summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/UnwindAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix handling of the arm IT instruction in the unwinderTamas Berghammer2016-02-101-38/+70
| | | | | | | | | | | | | | | | | | | | | | | | | The IT instruction can specify condition code for up to 4 consecutive instruction and it is used quite often by clang in epilogues causing an issue when trying to unwind from locations covered by the IT instruction and for locatins inmediately after the IT instruction. Changes made to fix it: * Introduce the concept of conditional instruction block what is a list of consecutive instructions with the same condition. We update the unwind information during the conditional instruction block and when we reach the end of it (first instruction with a differemt condition) then we restore the unwind information we had before the condition. * Fix a bug in the ARM instruction emulator where neither PC nor the ITSTATE was advanced when we reached an instruction what we can't decode. After the change we have no regression on android-arm running the regular test suit and TestStandardUnwind also passes when running it with clang as the compiler (previously it failed on an IT instruction). Differential revision: http://reviews.llvm.org/D16814 llvm-svn: 260368
* Remove autoconf support from source directories.Eugene Zelenko2016-01-282-28/+0
| | | | | | Differential revision: http://reviews.llvm.org/D16662 llvm-svn: 259098
* Add support for the LEAVE x86 instruction to AssemblyParse_x86.Jason Molenda2016-01-081-7/+38
| | | | llvm-svn: 257209
* Fix Clang-tidy modernize-use-override warnings in some files in ↵Eugene Zelenko2015-10-212-76/+75
| | | | | | | | source/Plugins; other minor fixes. Differential Revision: http://reviews.llvm.org/D13951 llvm-svn: 250925
* Silence some -Wunused-but-set-variable with gcc 5.2.0Saleem Abdulrasool2015-10-181-10/+2
| | | | | | Cleanup some unused variables. NFC. llvm-svn: 250661
* [cmake] Remove LLVM_NO_RTTI.Bruce Mitchener2015-09-032-4/+0
| | | | | | | | | | | | | | Summary: This doesn't exist in other LLVM projects any longer and doesn't do anything. Reviewers: chaoren, labath Subscribers: emaste, tberghammer, lldb-commits, danalbert Differential Revision: http://reviews.llvm.org/D12586 llvm-svn: 246749
* Fix assertion failure caused by r245546Tamas Berghammer2015-08-211-9/+24
| | | | | | | | Change the way EmulateInstruction::eContextPopRegisterOffStack handled in UnwindAssemblyInstEmulation::WriteRegister to accomodate for additional cases when eContextPopRegisterOffStack (pop PC/FLAGS). llvm-svn: 245690
* Improve instruction emulation based stack unwindingTamas Berghammer2015-08-201-2/+11
| | | | | | | | | | | On ARM there is no difference petween a pop and a load instruction so a register can be loaded multiple times during the function. Add check to threat the load as a restore only if it do the restore from the same location where the register was saved. Differential revision: http://reviews.llvm.org/D11947 llvm-svn: 245546
* Improve conditional opcode handling in emulation based unwindingTamas Berghammer2015-07-171-8/+12
| | | | | | | | | | Don't chane the CFI information when a conditional instruction is emulated (eg.: popeq {r0, pc}) because the CFI for the next instruction should be the same as the CFI for the current instruction. Differential revision: http://reviews.llvm.org/D11258 llvm-svn: 242519
* [Makefiles] Align library names with CMake buildKeno Fischer2015-07-141-3/+3
| | | | | | | | | | | | Summary: This aligns the library names used by the Makefile build to be the same as those create by the CMake build to make switching between the two easier. The only major difficulty was lldbHost which was one library in the CMake system and several in the Makefile system. Most of the other changes are trivial renames. Reviewers: labath Subscribers: emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11154 llvm-svn: 242196
* Ignore "push/pop {sp}" in emulation based unwindingTamas Berghammer2015-06-301-3/+8
| | | | | | | | | | | These instructions confusing the unwind code because in case of a push it assumes that the original valu of a register is pushed to the stack what is not neccessarily true in case of SP. The same is true for the pop (in the opposite way). Differential revision: http://reviews.llvm.org/D10806 llvm-svn: 241051
* Add branch emulation to aarch64 instruction emulatorTamas Berghammer2015-06-261-0/+10
| | | | | | | | | The emulation of the branches are required by the new stack unwinding logic to reinstantiate the prologue at the right place. Differential revision: http://reviews.llvm.org/D10702 llvm-svn: 240769
* Improve instruction emulation based stack unwinding on ARMTamas Berghammer2015-06-242-177/+59
| | | | | | | | | | | | | | | | | | | | | | | * Add and fix the emulation of several instruction. * Disable frame pointer usage on Android. * Specify return address register for the unwind plan instead of explict tracking the value of RA. * Replace prologue detection heuristics (unreliable in several cases) with a logic to follow the branch instructions and restore the CFI value based on them. The target address for a branch should have the same CFI as the source address (if they are in the same function). * Handle symbols in ELF files where the symbol size is not specified with calcualting their size based on the next symbol (already done in MachO files). * Fix architecture in FuncUnwinders with filling up the inforamtion missing from the object file with the architecture of the target. * Add code to read register wehn the value is set to "IsSame" as it meanse the value of a register in the parent frame is the same as the value in the current frame. Differential revision: http://reviews.llvm.org/D10447 llvm-svn: 240533
* Add support for 'leal' instruction to UnwindAssembly-x86Tamas Berghammer2015-03-251-1/+58
| | | | | | | | | | | Gcc for android use the leal instruction to substract from the stack pointer in the prologue of a function call. This patch add basic support for evaluating this instruction to support stack unwinding on android-x86. Differential revision: http://reviews.llvm.org/D8583 llvm-svn: 233178
* Initial Assembly profiler for mips64Bhushan D. Attarde2015-03-181-1/+29
| | | | | | | | | | | Summary: This is initial implementation of assembly profiler which only scans prologue/epilogue assembly instructions to create CFI instructions. Reviewers: clayborg, jasonmolenda Differential Revision: http://reviews.llvm.org/D7696 llvm-svn: 232619
* Don't #include ClangPersistentVariables.h from Process.hZachary Turner2015-03-031-0/+1
| | | | | | | Nothing from this header file was even being referenced in Process.h anyway, so it was a completely unnecessary include. llvm-svn: 231131
* Reduce header footprint of Target.hZachary Turner2015-03-031-0/+1
| | | | | | | | | | | | This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. llvm-svn: 231107
* UnwindPlan::Row refactor -- add support for CFA set by a DWARF expressionPavel Labath2015-02-232-42/+44
| | | | | | | | | | | | | | | | | | | Summary: This change refactors UnwindPlan::Row to be able to store the fact that the CFA is value is set by evaluating a dwarf expression (DW_CFA_def_cfa_expression). This is achieved by creating a new class CFAValue and moving all CFA setting/getting code there. Note that code using the new CFAValue::isDWARFExpression is not yet present and will be added in a follow-up patch. Therefore, this patch should not change the functionality in any way. Test Plan: Ran tests on Mac and Linux. No regressions detected. Reviewers: jasonmolenda, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7755 llvm-svn: 230210
* Change the default disassembly format again. First attempt atJason Molenda2015-02-131-1/+1
| | | | | | | | | | | | | | | | changing it was in r219544 - after living on that for a few months, I wanted to take another crack at this. The disassembly-format setting still exists and the old format can be user specified with a setting like ${current-pc-arrow}${addr-file-or-load}{ <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}: This patch was discussed in http://reviews.llvm.org/D7578 <rdar://problem/19726421> llvm-svn: 229186
* Fix the last two warnings I see on Linx building 'lldb': mismatchedChandler Carruth2015-02-131-2/+2
| | | | | | | | | | | | | signed and unsigned types in comparisons. For the text offset, use the addr_t type that is used elsewhere to get these kinds of offsets, and which it is being compared against. This seems to make things more consistent. For the other, the numbers are clearly small and uninteresting, so just cast them to the most boring 'int' type. llvm-svn: 229085
* Get rid of Debugger::FormatPrompt() and replace it with the new FormatEntity ↵Greg Clayton2015-02-041-2/+4
| | | | | | | | | | | | | | | | | | | class. Why? Debugger::FormatPrompt() would run through the format prompt every time and parse it and emit it piece by piece. It also did formatting differently depending on which key/value pair it was parsing. The new code improves on this with the following features: 1 - Allow format strings to be parsed into a FormatEntity::Entry which can contain multiple child FormatEntity::Entry objects. This FormatEntity::Entry is a parsed version of what was previously always done in Debugger::FormatPrompt() so it is more efficient to emit formatted strings using the new parsed FormatEntity::Entry. 2 - Allows errors in format strings to be shown immediately when setting the settings (frame-format, thread-format, disassembly-format 3 - Allows auto completion by implementing a new OptionValueFormatEntity and switching frame-format, thread-format, and disassembly-format settings over to using it. 4 - The FormatEntity::Entry for each of the frame-format, thread-format, disassembly-format settings only replaces the old one if the format parses correctly 5 - Combines all consecutive string values together for efficient output. This means all "${ansi.*}" keys and all desensitized characters like "\n" "\t" "\0721" "\x23" will get combined with their previous strings 6 - ${*.script:} (like "${var.script:mymodule.my_var_function}") have all been switched over to use ${script.*:} "${script.var:mymodule.my_var_function}") to make the format easier to parse as I don't believe anyone was using these format string power user features. 7 - All key values pairs are defined in simple C arrays of entries so it is much easier to add new entries. These changes pave the way for subsequent modifications where we can modify formats to do more (like control the width of value strings can do more and add more functionality more easily like string formatting to control the width, printf formats and more). llvm-svn: 228207
* Save & restore the array of which registers have already beenJason Molenda2015-01-131-2/+17
| | | | | | | | | saved/restored across a mid-function epilogue. We ignore repeated push/pops of a register so once we saw one 'pop %rbp', we'd ignore it the second time we saw it. <rdar://problem/19417410> llvm-svn: 225853
* Enhance the eh_frame unwind instruction augmenter so thatJason Molenda2015-01-131-6/+46
| | | | | | | | | it will do the right thing on x86 routines with a mid-function epilogue sequence (where the unwind rules need to be reinstalled after the epilogue has completed). <rdar://problem/19417410> llvm-svn: 225773
* Add an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite Jason Molenda2015-01-131-17/+36
| | | | | | | | | | | | | | | | which will verify if the eh_frame instructions include details about the prologue or not. Both clang and gcc include prologue instructions but there's no requirement for them to do so -- and I'm sure we'll have to interoperate with a compiler that doesn't generate prologue info at some point. I don't have any compilers that omit the prologue instructions so the testing was of the "makre sure augmented unwind info is still created". With an eh_frame without prologue, this code should reject the augmentation scheme altogether and we should fall back to using assembly instruction profiling. llvm-svn: 225771
* Change the x86 assembly instruction unwind parser toJason Molenda2015-01-131-170/+129
| | | | | | | | | | | | | | | step through the complete function looking for any epilogue instructions. If we find an epilogue sequence, re-instate the correct unwind instructions if there is more code past that epilogue -- this will correctly handle an x86 function with multiple epilogues in it. NB there is still a bug with the "eh_frame augmented" UnwindPlans and mid-function epilogues. Looking at that next. <rdar://problem/18863406> llvm-svn: 225770
* Hoist the RegisterNumber class out of RegisterContextLLDB and makeJason Molenda2015-01-101-3/+68
| | | | | | | | | | | | | | | it more generally available. Add checks to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite() so that it won't try to augment an UnwindPlan that already describes the function epilogue. Add a test case for backtracing out of _sigtramp on Darwin systems. This could probably be adapted to test the same thing on linux/bsd but the function names of sigtramp and kill are probably platform specific and I'm not sure what they should be. llvm-svn: 225578
* Have AssemblyParse_x86::get_non_call_site_unwind_plan trackJason Molenda2015-01-081-2/+13
| | | | | | | | | | | | | | | which registers have been spilled (saved to the stack) - and if we see that same register being saved to the stack again, don't record that, it's something specific to this stack frame. I found a code sequence for i386 where clang did a push %esi and then later in the function it did movl %esi, -0x7c(%ebp) and that second save of a scratch value overrode the original push location. <rdar://problem/19171178> llvm-svn: 225431
* Various unwinder work. Jason Molenda2014-12-211-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the changes are to the FuncUnwinders class -- as we've added more types of unwind information, the way this class was written was making it a mess to maintain. Instead of trying to keep one "non-call site" unwind plan and one "call site" unwind plan, track all the different types of unwind plans we can possibly retrieve for each function and have the call-site/non-call-site accessor methods retrieve those. Add a real "fast unwind plan" for x86_64 / i386 -- when doing an unwind through a function, this only has to read the first 4 bytes to tell if the function has a standard prologue sequence. If so, we can use the architecture default unwind plan to backtrace through this function. If we try to retrieve the save location for other registers later on, a real unwind plan will be used. This one is just for doing fast backtraces. Change the compact unwind plan importer to fill in the valid address range it is valid for. Compact unwind, in theory, may have multiple entries for a single function. The FuncUnwinders rewrite includes the start of supporting this correctly. In practice compact unwind encodings are used for the entire range of the function today -- in fact, sometimes the same encoding is used for multiple functions that have the same unwind rules. But I want to handle a single function that has multiple different compact unwind UnwindPlans eventually. llvm-svn: 224689
* The lldb unwinder can now use the unwind information from the compact-unwind Jason Molenda2014-12-081-0/+1
| | | | | | | | | | | | | | | | | | section for x86_64 and i386 targets on Darwin systems. Currently only the compact unwind encoding for normal frame-using functions is supported but it will be easy handle frameless functions when I have a bit more free time to test it. The LSDA and personality routines for functions are also retrieved correctly for functions from the compact unwind section. This new code is very fresh -- it passes the lldb testsuite and I've done by-hand inspection of many functions and am getting correct behavior for all of them. There may need to be some bug fixing over the next couple weeks as I exercise and test it further. But I think it's fine right now so I'm committing it. <rdar://problem/13220837> llvm-svn: 223625
* Fix some compiler warnings, one of which was a legit bug.Zachary Turner2014-11-101-2/+2
| | | | | | | | | | | | MSVC warns that not all control paths return a value when a switch doesn't have a default case handler. Changed explicit value checks to a default check. Also, it caught a case where bitwise AND was being used instead of logical AND. I'm not sure what this fixes, but presumably it is not covered by any kind of test case. llvm-svn: 221636
* Add recognition for another x86 epilogue sequence (ret followed byJason Molenda2014-11-041-0/+11
| | | | | | | | a nop). Fixes an instruction stepping problem when trying to step over the final instructions of an epilogue. <rdar://problem/18068877> llvm-svn: 221241
* Add a new disassembly-format specification so that the disassemblerJason Molenda2014-10-101-1/+2
| | | | | | | | | | | | | | | | | | | | | output style can be customized. Change the built-in default to be more similar to gdb's disassembly formatting. The disassembly-format for a gdb-like output is ${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>: The disassembly-format for the lldb style output is {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: The two backticks in the lldb style formatter triggers the sub-expression evaluation in CommandInterpreter::PreprocessCommand() so you can't use that one as-is ... changing to use ' characters instead of ` would work around that. <rdar://problem/9885398> llvm-svn: 219544
* Remove trailing whitespace from lines in UnwindAssembly-x86.cpp. No other ↵Jason Molenda2014-08-251-63/+63
| | | | | | changes. llvm-svn: 216420
* Clean up the coding conventions in UnwindAssembly-x86.cpp a little bit.Jason Molenda2014-08-251-38/+74
| | | | | | | | I wrote this originally as a part of an unwind library that was using a different coding convention and some of that old style remained after its integration into lldb. llvm-svn: 216419
* Have augment_unwind_plan_from_call_site update the UnwindPlan Jason Molenda2014-08-251-0/+15
| | | | | | | name/from-compiler settings to indicate that it was augmented by assembly profiling. llvm-svn: 216412
* On x86 & x86_64, try to use eh_frame for frame 0.Todd Fiala2014-08-254-11/+277
| | | | | | | | | | | | | We decided to use assmbly profiler instead of eh_frame for frame 0 because for compiler generated code, eh_frame is usually synchronous(a.k.a. only valid at call site); and we have no way to tell if it's asynchronous or not. But for x86 & x86_64 compiler generated code: 1. clang & GCC describes all prologue instructions in eh_frame; 2. mid-function stack pointer altering instructions can be easily detected. So we can grab eh_frame, and use assembly profiler to augment it into asynchronous unwind table. This change also benefits hand-written assembly; eh_frame for hand-written assembly is often asynchronous,so we have a much better chance to successfully unwind through them. Change by Tong Shen. llvm-svn: 216406
* Add code to AssemblyParse_x86::get_non_call_site_unwind_planJason Molenda2014-08-041-6/+24
| | | | | | | | to recognize an epilogue that ends with a jmp to objc_retainAutoreleaseReturnValue instead of a ret instruction. <rdar://problem/17889928> llvm-svn: 214783
* Fix an x86 assembler stack unwind calculation for non-volatile registers.Todd Fiala2014-07-251-1/+13
| | | | | | | | | | | | | | | | | | This change has the practical effect of fixing some backtrace scenarios that would fail with inferiors running on the Android Art host-side JVM under Linux x86_64 on Ubuntu 14.04. See this lldb-commits thread for more details: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140721/011988.html Change by Tong Shen. Reviewed by Jason Molenda. Tested: Ubuntu 14.04 x86_64, clang-3.5-built lldb. MacOSX 10.10 Preview 4, Xcode 6 Beta 4-built lldb. llvm-svn: 213914
* Replace uint32_t by lldb::RegisterKing in register context API.Jean-Daniel Dupas2014-07-021-1/+2
| | | | llvm-svn: 212172
* Fix typos.Bruce Mitchener2014-07-011-3/+3
| | | | llvm-svn: 212132
* sanitise sign comparisonsSaleem Abdulrasool2014-04-021-8/+14
| | | | | | | | This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390
* Convert to UNIX line endings.Joerg Sonnenberger2013-09-253-12/+12
| | | | llvm-svn: 191367
* Fix a bug where the x86 assembly instruction profiler would not correctly adjustJason Molenda2013-09-241-5/+14
| | | | | | | | the CFA instructions when it was profiling an -fomit-frame-pointer function and a "volatile" register was saved on the stack (e.g. an argument register). <rdar://problem/15036546> llvm-svn: 191267
* Disassembler::DisassembleRange() currently calls Target::ReadMemoryJason Molenda2013-09-121-1/+3
| | | | | | | | | | | | | with prefer_file_cache == false. This is what we want to do when the user is doing a disassemble command -- show the actual memory contents in case the memory has been corrupted or something -- but when we're profiling functions for stepping or unwinding (ThreadPlanStepRange::GetInstructionsForAddress, UnwindAssemblyInstEmulation::GetNonCallSiteUnwindP) we can read __TEXT instructions directly out of the file, if it exists. <rdar://problem/14397491> llvm-svn: 190638
* The DisassemblerLLVMC has a retain cycle - the InstructionLLVMC's contained ↵Jim Ingham2013-07-311-0/+3
| | | | | | | | | | | | in its instruction list have a shared pointer back to their DisassemblerLLVMC. This checkin force clears the InstructionList in all the places we use the DisassemblerSP to stop the leaking for now. I'll go back and fix this for real when I have time to do so. <rdar://problem/14581918> llvm-svn: 187473
* <rdar://problem/13854277>Greg Clayton2013-05-104-32/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-182-2/+2
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-182-2/+2
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* <rdar://problem/13521159>Greg Clayton2013-03-271-5/+5
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* Convert from the C-based LLVM Disassembler shim to the full MC Disassembler ↵Jim Ingham2013-03-021-0/+1
| | | | | | | | | | | | API's. Calculate "can branch" using the MC API's rather than our hand-rolled regex'es. As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att. <rdar://problem/11319574> <rdar://problem/9329275> llvm-svn: 176392
OpenPOWER on IntegriCloud