summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/UnwindAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding CMake build system to LLDB. Some known issues remain:Daniel Malea2013-02-213-0/+12
| | | | | | | | | | | | | | - 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
* Made LLDB compile with LLVM top-of-tree again.Sean Callanan2012-12-211-2/+0
| | | | | | | | | The results from Clang name lookups changed to be ArrayRefs, so I had to change the way we check for the presence of a result and the way we iterate across results. llvm-svn: 170927
* More Linux warnings fixes (remove default labels as needed):Daniel Malea2012-12-071-1/+0
| | | | | | | | - as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations Patch by Matt Kopec! llvm-svn: 169633
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-2/+2
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* 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 how the UnwindAssemblyInstEmulation class tracks the setup ofJason Molenda2012-10-232-16/+47
| | | | | | | | | | | | | the function's prologue instructions so we can re-instate that prologue if we hit an early return mid-function. Add some additional heuristics to differentiate between prologue and epilogue instruction sequences. This fixes the specific problem of correctly unwinding through a function which has an epilogue one instruction after the last prologue setup instruction has completed. <rdar://problem/12091139> llvm-svn: 166465
* Add code to UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssemblyJason Molenda2012-10-172-2/+51
| | | | | | | | | | | | | | to handle an addition class of early-return instructions we find in arm code: tail-call optimziation returns where we restore the register state from the function entry and jump directly (not branch & link) to another function -- when that other function returns, it will return to our caller. Previously this mid-function epilogue sequence was not being correctly detected. We would not re-instate the prologue setup instructions for the rest of the function so unwinds would break from that point until the end of the function. <rdar://problem/12502597> llvm-svn: 166081
* 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
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-181-2/+2
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* <rdar://problem/11757916>Greg Clayton2012-08-291-0/+1
| | | | | | | | | | | | Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
* When emulating instructions that read from memory,Jason Molenda2012-08-131-0/+1
| | | | | | | | | return 0x0 as the read value instead of uninitialized stack data so we get consistent behavior from the emulator. <rdar://problem/12058770> llvm-svn: 161795
* Change UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly so ↵Jason Molenda2012-07-172-8/+86
| | | | | | | | | | | | | | | | it records the state of the unwind instructions once the prologue has finished. If it hits an early return epilogue in the middle of the function, re-instate the prologue after that epilogue has completed so that we can still unwind for cases where the flow of control goes past that early-return. <rdar://problem/11775059> Move the UnwindPlan operator== definition into the .cpp file, expand the definition a bit. Add some casts to a SBCommandInterpreter::HandleCompletion() log statement so it builds without warning on 64- and 32-bit systems. llvm-svn: 160337
* Switch nearly all of the use of the UnwindPlan::Row's to go throughJason Molenda2012-07-143-51/+98
| | | | | | | | | | | | | | 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
* Revert the change I committed yesterday, it caused a regressionJason Molenda2012-07-131-14/+0
| | | | | | | with one armv7 unwind. I'll look at updating this or finding a different way of fixing it later tonight. llvm-svn: 160198
* When parsing the epilogue of a thumbv2 function, when we see theJason Molenda2012-07-121-0/+14
| | | | | | | | frame pointer overwritten with the caller's fp value, return to expressing the CFA in terms of the stack pointer. <rdar://problem/11855862> llvm-svn: 160150
* Simplify the CreateDefaultUnwindPlan methods for the x86 and arm unwindersJason Molenda2012-07-091-4/+4
| | | | | | | | | a bit -- we're creating the UnwindPlan here, we can set the register set to whatever is convenient for us, no need to handle different register sets. A handful of small comment fixes I noticed while reading through the code. llvm-svn: 159924
* 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
* <rdar://problem/11330621>Greg Clayton2012-05-101-2/+1
| | | | | | | | | | | | Fixed the DisassemblerLLVMC disassembler to parse more efficiently instead of parsing opcodes over and over. The InstructionLLVMC class now only reads the opcode in the InstructionLLVMC::Decode function. This can be done very efficiently for ARM and architectures that have fixed opcode sizes. For x64 it still calls the disassembler to get the byte size. Moved the lldb_private::Instruction::Dump(...) function up into the lldb_private::Instruction class and it now uses the function that gets the mnemonic, operandes and comments so that all disassembly is using the same code. Added StreamString::FillLastLineToColumn() to allow filling a line up to a column with a character (which is used by the lldb_private::Instruction::Dump(...) function). Modified the Opcode::GetData() fucntion to "do the right thing" for thumb instructions. llvm-svn: 156532
* Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton2012-02-214-28/+37
| | | | | | | | | | | | | | | | | 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
* Fix verbose logging of unwinders.Jason Molenda2011-09-291-6/+6
| | | | llvm-svn: 140817
* Converted the lldb_private::Process over to use the intrusiveGreg Clayton2011-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
* Tighten up the 'log enable lldb unwind' printing forJason Molenda2011-09-161-6/+6
| | | | | | | | the arm emulate instruction unwinder so you can leave it on by default and not be overwhelmed. Set verbose mode to get the full story on how the unwindplans were created. llvm-svn: 139897
* Add UnwindAssembly plugins to makefile buildPeter Collingbourne2011-05-192-0/+28
| | | | llvm-svn: 131650
* Added generic register numbers for simple ABI argument registers and definedGreg Clayton2011-05-151-2/+2
| | | | | | | | | | | | | | | | | the appropriate registers for arm and x86_64. The register names for the arguments that are the size of a pointer or less are all named "arg1", "arg2", etc. This allows you to read these registers by name: (lldb) register read arg1 arg2 arg3 ... You can also now specify you want to see alternate register names when executing the read register command: (lldb) register read --alternate (lldb) register read -A llvm-svn: 131376
* Added the ability to get the return value from a ThreadPlanCallFunctionGreg Clayton2011-05-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread plan. In order to get the return value, you can call: void ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp); This registers a shared pointer to a return value that will get filled in if everything goes well. After the thread plan is run the return value will be extracted for you. Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT. We currently have the standard JIT selected because we have some work to do to get the MCJIT fuctioning properly. Added the ability to call functions with 6 argument in the x86_64 ABI. Added the ability for GDBRemoteCommunicationClient to detect if the allocate and deallocate memory packets are supported and to not call allocate memory ("_M") or deallocate ("_m") if we find they aren't supported. Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...) to be able to deal with the allocate and deallocate memory packets not being supported. If they are not supported, ProcessGDBRemote will switch to calling "mmap" and "munmap" to allocate and deallocate memory instead using our trivial function call support. Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore the qHostInfo triple information if any was specified in the target. Currently if the target only specifies an architecture when creating the target: (lldb) target create --arch i386 a.out Then the vendor, os and environemnt will be adopted by the target. If the target was created with any triple that specifies more than the arch: (lldb) target create --arch i386-unknown-unknown a.out Then the target will maintain its triple and not adopt any new values. This can be used to help force bare board debugging where the dynamic loader for static files will get used and users can then use "target modules load ..." to set addressses for any files that are desired. Added back some convenience functions to the lldb_private::RegisterContext class for writing registers with unsigned values. Also made all RegisterContext constructors explicit to make sure we know when an integer is being converted to a RegisterValue. llvm-svn: 131370
* Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into theirGreg Clayton2011-05-112-104/+232
| | | | | | | | | | | | | | | respective ABI plugins as they were plug-ins that supplied ABI specfic info. Also hookep up the UnwindAssemblyInstEmulation so that it can generate the unwind plans for ARM. Changed the way ABI plug-ins are handed out when you get an instance from the plug-in manager. They used to return pointers that would be mananged individually by each client that requested them, but now they are handed out as shared pointers since there is no state in the ABI objects, they can be shared. llvm-svn: 131193
* While implementing unwind information using UnwindAssemblyInstEmulation I ranGreg Clayton2011-05-092-45/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into some cleanup I have been wanting to do when reading/writing registers. Previously all RegisterContext subclasses would need to implement: virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data); virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0); There is now a new class specifically designed to hold register values: lldb_private::RegisterValue The new register context calls that subclasses must implement are: virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0; virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0; The RegisterValue class must be big enough to handle any register value. The class contains an enumeration for the value type, and then a union for the data value. Any integer/float values are stored directly in an appropriate host integer/float. Anything bigger is stored in a byte buffer that has a length and byte order. The RegisterValue class also knows how to copy register value bytes into in a buffer with a specified byte order which can be used to write the register value down into memory, and this does the right thing when not all bytes from the register values are needed (getting a uint8 from a uint32 register value..). All RegiterContext and other sources have been switched over to using the new regiter value class. llvm-svn: 131096
* Added the start of the CFI row production using theGreg Clayton2011-04-292-15/+97
| | | | | | emulate instruction classes. llvm-svn: 130556
* Got the EmulateInstruction CFI code a lot closer to producing CFI data.Greg Clayton2011-04-262-46/+51
| | | | | | | | | | | | | Switch the EmulateInstruction to use the standard RegisterInfo structure that is defined in the lldb private types intead of passing the reg kind and reg num everywhere. EmulateInstruction subclasses also need to provide RegisterInfo structs given a reg kind and reg num. This eliminates the need for the GetRegisterName() virtual function and allows more complete information to be passed around in the read/write register callbacks. Subclasses should always provide RegiterInfo structs with the generic register info filled in as well as at least one kind of register number in the RegisterInfo.kinds[] array. llvm-svn: 130256
* Changed the emulate instruction function to take emulate options whichGreg Clayton2011-04-264-25/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-254-12/+12
| | | | 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-254-25/+215
| | | | llvm-svn: 130154
* Put plug-ins into the correct directories as they were incorrectly locatedGreg Clayton2011-04-252-0/+975
in a Utility directory. llvm-svn: 130135
OpenPOWER on IntegriCloud