summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/UnwindAssembly/x86
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* 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-252-11/+264
| | | | | | | | | | | | | 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
* 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-251-5/+5
| | | | 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
* <rdar://problem/13854277>Greg Clayton2013-05-102-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <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
* Adding CMake build system to LLDB. Some known issues remain:Daniel Malea2013-02-211-0/+5
| | | | | | | | | | | | | | - generate-vers.pl has to be called by cmake to generate the version number - parallel builds not yet supported; dependency on clang must be explicitly specified Tested on Linux. - Building on Mac will require code-signing logic to be implemented. - Building on Windows will require OS-detection logic and some selective directory inclusion Thanks to Carlo Kok (who originally prepared these CMakefiles for Windows) and Ben Langmuir who ported them to Linux! llvm-svn: 175795
* Add a new capability to RegisterContextLLDB: To recognize when theJason Molenda2012-10-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Full UnwindPlan is trying to do an impossible unwind; in that case invalidate the Full UnwindPlan and replace it with the architecture default unwind plan. This is a scenario that happens occasionally with arm unwinds in particular; the instruction analysis based full unwindplan can mis-parse the functions and the stack walk stops prematurely. Now we can do a simpleminded frame-chain walk to find the caller frame and continue the unwind. It's not ideal but given the complicated nature of analyzing the arm functions, and the lack of eh_frame information on iOS, it is a distinct improvement and fixes some long-standing problems with the unwinder on that platform. This is fixing <rdar://problem/12091421>. I may re-use this invalidate feature in the future if I can identify other cases where the full unwindplan's unwind information is clearly incorrect. This checkin also includes some cleanup for the volatile register definition in the arm ABI plugin for <rdar://problem/10652166> although work remains to be done for that bug. llvm-svn: 166757
* Change the scratch buffer for x86 assembly instructions in AssemblyParse_x86 ↵Jason Molenda2012-10-111-13/+5
| | | | | | | | from malloc'ed heap to an llvm SmallVector. llvm-svn: 165703
* Move the scratch buffer allocation for x86 instructions from being allocated ↵Jason Molenda2012-10-101-7/+9
| | | | | | | | | each instruction, to once in the AssemblyParse_x86 ctor. an instruction llvm-svn: 165662
* Free the opcode_data malloc'ed memory instead of leaking it - thanks for ↵Jason Molenda2012-10-101-1/+2
| | | | | | catching that, Chris. llvm-svn: 165597
* Change the x86 unwinder from using edis as its disassemblerJason Molenda2012-10-102-67/+46
| | | | | | | | API (to get the length of x86 instructions) to using the LLVM-MC disassembler. <rdar://problem/12411000> llvm-svn: 165587
* Switch nearly all of the use of the UnwindPlan::Row's to go throughJason Molenda2012-07-141-40/+77
| | | | | | | | | | | | | | a shared pointer to ease some memory management issues with a patch I'm working on. The main complication with using SPs for these objects is that most methods that build up an UnwindPlan will construct a Row to a given instruction point in a function, then add additional regsaves in the next instruction point to that row and push it again. A little care is needed to not mutate the previous instruction point's Row once these are switched to being held behing shared pointers. llvm-svn: 160214
* Add support for function with stack frame checks added by the compiler;Jason Molenda2012-05-251-28/+57
| | | | | | | | | | | | | | | | | | | | these functions will end in the sequence mov %rbp, %rsp ret call __stack_chk_fail instead of the usual mov, ret. The x86 assembly profiler only looked for functions ending in 'ret' and added the Unwind row describing how to set the CFA based on that -- the addition of the call insn (which is jumped to earlier in the function body) threw off that inspection. Resolves the need to "step" twice to get out of these functions when doing source-level stepping. <rdar://problem/11469705> llvm-svn: 157454
* Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton2012-02-212-23/+34
| | | | | | | | | | | | | | | | | objects for the backlink to the lldb_private::Process. The issues we were running into before was someone was holding onto a shared pointer to a lldb_private::Thread for too long, and the lldb_private::Process parent object would get destroyed and the lldb_private::Thread had a "Process &m_process" member which would just treat whatever memory that used to be a Process as a valid Process. This was mostly happening for lldb_private::StackFrame objects that had a member like "Thread &m_thread". So this completes the internal strong/weak changes. Documented the ExecutionContext and ExecutionContextRef classes so that our LLDB developers can understand when and where to use ExecutionContext and ExecutionContextRef objects. llvm-svn: 151009
* Patch from Daniel Dunbar for future-proof against ↵Johnny Chen2011-11-291-0/+11
| | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=145331. llvm-svn: 145345
* Add UnwindAssembly plugins to makefile buildPeter Collingbourne2011-05-191-0/+14
| | | | llvm-svn: 131650
* Changed the emulate instruction function to take emulate options whichGreg Clayton2011-04-262-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are defined as enumerations. Current bits include: eEmulateInstructionOptionAutoAdvancePC eEmulateInstructionOptionIgnoreConditions Modified the EmulateInstruction class to have a few more pure virtuals that can help clients understand how many instructions the emulator can handle: virtual bool SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0; Where instruction types are defined as: //------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { eInstructionTypeAny, // Support for any instructions at all (at least one) eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer eInstructionTypeAll // All instructions of any kind } InstructionType; This allows use to tell what an emulator can do and also allows us to request these abilities when we are finding the plug-in interface. Added the ability for an EmulateInstruction class to get the register names for any registers that are part of the emulation. This helps with being able to dump and log effectively. The UnwindAssembly class now stores the architecture it was created with in case it is needed later in the unwinding process. Added a function that can tell us DWARF register names for ARM that goes along with the source/Utility/ARM_DWARF_Registers.h file: source/Utility/ARM_DWARF_Registers.c Took some of plug-ins out of the lldb_private namespace. llvm-svn: 130189
* Renamed UnwindAssemblyProfiler to UnwindAssembly along with its source files.Greg Clayton2011-04-252-6/+6
| | | | llvm-svn: 130156
* Even more renaming.Greg Clayton2011-04-252-6/+6
| | | | llvm-svn: 130155
* More moving things around for the unwind plan and assembly unwind plug-ins.Greg Clayton2011-04-252-0/+975
llvm-svn: 130154
OpenPOWER on IntegriCloud