summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-9/+9
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Change RegisterContextLLDB's unwind logging to report which stack frameJason Molenda2012-11-161-4/+12
| | | | | | | finally was able to restore a register, instead of just reporting the frames that couldn't supply the reg. llvm-svn: 168139
* A change in how we search for saved register values unintentionallyJason Molenda2012-11-161-19/+19
| | | | | | | | | allowed volatile registers to be returned up the stack. That leads to unexpected/incorrect values provided to the user and we need to avoid that. <rdar://problem/12714247> llvm-svn: 168123
* Add a new capability to RegisterContextLLDB: To recognize when theJason Molenda2012-10-261-319/+293
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a new ABI plugin method which specifies whether the architectureJason Molenda2012-10-161-1/+1
| | | | | | | | | | | | | | | must push something on the stack for a function call or not. In x86, the stack pointer is decremented when the caller's pc is saved on the stack. In arm, the stack pointer and frame pointer don't necessarily have to change for a function call, although most functions need to use some stack space during their execution. Use this information in the RegisterContextLLDB to detect invalid unwind scenarios more accurately. <rdar://problem/12348574> llvm-svn: 166005
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-1/+1
| | | | llvm-svn: 165808
* <rdar://problem/11757916>Greg Clayton2012-08-291-1/+3
| | | | | | | | | | | | 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
* Some eh_frame unwind instructions will define a return address register;Jason Molenda2012-08-181-11/+32
| | | | | | | | | | | | | | | when you want to find the caller's saved pc, you look up the return address register and use that. On arm, for instance, this would be the contents of the link register (lr). If the eh_frame CIE defines an RA, record that fact in the UnwindPlan. When we're finding a saved register, if it's the pc, lok for the location of the return address register instead. <rdar://problem/12062310> llvm-svn: 162167
* Fixed a potential crash where we attempt to readSean Callanan2012-08-101-0/+4
| | | | | | | | an invalid register. <rdar://problem/12065366> llvm-svn: 161679
* Removed explicit NULL checks for shared pointersSean Callanan2012-08-091-1/+1
| | | | | | | | | and instead made us use implicit casts to bool. This generated a warning in C++11. <rdar://problem/11930775> llvm-svn: 161559
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-171-4/+4
| | | | llvm-svn: 160338
* Switch nearly all of the use of the UnwindPlan::Row's to go throughJason Molenda2012-07-141-11/+11
| | | | | | | | | | | | | | 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
* Remove the sanity checks from RegisterContextLLDB::InitializeZerothFrameJason Molenda2012-03-011-13/+0
| | | | | | | | | which require a valid CFA address to create a stack frame. On connecting to just-starting-up hardware we may have a stack pointer/frame pointer of 0 but we should still create a stack frame so other code in lldb can retrieve register values via a stackframe. llvm-svn: 151796
* Fix a recursion that could happen when creating the first frame inJason Molenda2012-02-291-13/+45
| | | | | | | | | | | | | an unwind because RegisterContextLLDB::InitializeZerothFrame() would create a minimal stack frame to fetch the pc value of the current instruction. This proved fragile when another section of code was trying to create the first stack frame and UnwindLLDB called RegisterContextLLDB which tried to create its minimal stack frame. Instead, get the live RegisterContext, retrieve the pc value from the registers, and create an Address object from that. llvm-svn: 151714
* Patch from Filipe Cabecinhas fixing a typo in the "lldb unwind" log output.Jim Ingham2012-02-241-1/+1
| | | | llvm-svn: 151370
* <rdar://problem/10103468>Greg Clayton2012-02-241-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | I started work on being able to add symbol files after a debug session had started with a new "target symfile add" command and quickly ran into problems with stale Address objects in breakpoint locations that had lldb_private::Section pointers into modules that had been removed or replaced. This also let to grabbing stale modules from those sections. So I needed to thread harded the Address, Section and related objects. To do this I modified the ModuleChild class to now require a ModuleSP on initialization so that a weak reference can created. I also changed all places that were handing out "Section *" to have them hand out SectionSP. All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild so all of the find plug-in, static creation function and constructors now require ModuleSP references instead of Module *. Address objects now have weak references to their sections which can safely go stale when a module gets destructed. This checkin doesn't complete the "target symfile add" command, but it does get us a lot clioser to being able to do such things without a high risk of crashing or memory corruption. llvm-svn: 151336
* Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton2012-02-211-20/+26
| | | | | | | | | | | | | | | | | 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
* Switching back to using std::tr1::shared_ptr. We originally switched awayGreg Clayton2012-01-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell. Once the RTTI issue wasn't an issue, we were looking for a way to properly track weak pointers to objects to solve some of the threading issues we have been running into which naturally led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared pointer from just a pointer, which is also easily solved using the std::tr1::enable_shared_from_this class. The main reason for this move back is so we can start properly having weak references to objects. Currently a lldb_private::Thread class has a refrence to its parent lldb_private::Process. This doesn't work well when we now hand out a SBThread object that contains a shared pointer to a lldb_private::Thread as this SBThread can be held onto by external clients and if they end up using one of these objects we can easily crash. So the next task is to start adopting std::tr1::weak_ptr where ever it makes sense which we can do with lldb_private::Debugger, lldb_private::Target, lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and many more objects now that they are no longer using intrusive ref counted pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive pointers). llvm-svn: 149207
* Don't call lldb_private::Process::GetLoadAddressPermissions to sanity check ↵Jim Ingham2012-01-101-28/+34
| | | | | | | | | the unwind addresses when you already know that the address is contained in a bona fide function. This can be a slow call. llvm-svn: 147829
* <rdar://problem/10645694> Greg Clayton2012-01-081-2/+58
| | | | | | | | | | | | | | | | | | | | Fixed an ARM backtracing issue where if the previous frame was a thumb function and it was a tail call so that the current frame returned to an address that would fall into the next function, we would use the next function as the basis for how we unwound the previous frame's registers and of course get things wrong. We now fix the PC code address using the current ABI plug-in, and the ARM ABI plug-in has been modified to correctly fix the code address. So when we do the symbol context lookup, instead of taking an address like 0x1001 and decrementing 1, and looking up the symbol context for a frame, we now correctly fix 0x1001 to 0x1000, then decrement that by 1 to get the correct symbol context. I added a bunch more logging to "log enable lldb uwnind" to help us in the future. We now log the PC, FP and SP (if they are available), and we also dump the "active_row" that we find for unwinding a frame. llvm-svn: 147747
* When we're unwinding out of frame 0 and we end up with a bogus frameJason Molenda2011-12-161-8/+55
| | | | | | | | | | | | | | | | | | | | | | | | 1 -- an address pointing off into non-executable memory -- don't abort the unwind. We'll use the ABI's default UnwindPlan to try to get out of frame 1 and on many platforms with a standard frame chain stack layout we can get back on track and get a valid frame 2. This preserves the lldb behavior to-date; the change last week to require the memory region to be executable broke it. I'd like to mark this frame specially when displayed to the user; I tried to override the places where the frame's pc value is returned to change it to a sentinel value (e.g. LLDB_INVALID_ADDRESS) but couldn't get that to work cleanly so I backed that part out for now. When this happens we'll often miss one of the user's actual frames, the one that's of most interest to the user, so I'd like to make this visually distinctive. Note that a frame in non-executable memory region is only allowed for frame 1. After that we should be solid on the unwind and any pc address in non-executable memory indicates a failure and we should stop unwinding. llvm-svn: 146723
* On Mac OS X the Objective-C runtime (libobjc) has many criticalJason Molenda2011-12-141-2/+24
| | | | | | | | | | | | | | | | | | | | | dispatch functions that are implemented in hand-written assembly. There is also hand-written eh_frame instructions for unwinding from these functions. Normally we don't use eh_frame instructions for the currently executing function, prefering the assembly instruction profiling method. But in these hand-written dispatch functions, the profiling is doomed and we should use the eh_frame instructions. Unfortunately there's no easy way to flag/extend the eh_frame/debug_frame sections to annotate if the unwind instructions are accurate at all addresses ("asynchronous") or if they are only accurate at locations that can throw an exception ("synchronous" and the normal case for gcc/clang generated eh_frame/debug_frame CFI). <rdar://problem/10508134> llvm-svn: 146551
* Add two new memory region based checks to the Unwinder:Jason Molenda2011-12-131-0/+20
| | | | | | | | | | | | | | | | | Check that the pc value for frames up the stack is in a mapped+executable region of memory. Check that the stack pointer for frames up the stack is in a mapped+readable region of memory. If the unwinder ever makes a mistake walking the stack, these checks will help to keep it from going too far into the weeds. These aren't fixing any bugs that I know of, but they add extra robustness to a complicated task. llvm-svn: 146478
* When unwinding from the first frame, try to ask the remote debugserverJason Molenda2011-12-131-9/+16
| | | | | | | | | | | | | | if this is a mapped/executable region of memory. If it isn't, we've jumped through a bad pointer and we know how to unwind the stack correctly based on the ABI. Previously I had 0x0 special cased but if you jumped to 0x2 on x86_64 one frame would be skipped because the unwinder would try using the x86_64 ArchDefaultUnwindPlan which relied on the rbp. Fixes <rdar://problem/10508291> llvm-svn: 146477
* Restructure the relationship between UnwindLLDB and theJason Molenda2011-11-011-55/+61
| | | | | | | | | | | | | | | | | | RegisterContextLLDBs it contains. Previously RegisterContextLLDB objects had a pointer to their "next" frame down the stack. e.g. stack starts at frame 0; frame 3 has a pointer to frame 2. This is used to retreive callee saved register values. When debugging an inferior that has blown out its own stack, however, this could result in lldb blowing out its own stack while recursing down to retrieve register values. RegisterContextLLDB no longer has a pointer to its next frame; it has a reference to the UnwindLLDB which contains it. When it needs to retrieve a reg value, it asks the UnwindLLDB for that reg value and UnwindLLDB iterates through the frames until it finds a location. llvm-svn: 143423
* Add code to RegisterContextLLDB::InitializeNonZerothFrame to detect a ↵Jason Molenda2011-10-181-0/+39
| | | | | | | | | multiple stack frames with the same CFA (or an alternating sequence between two CFA values) to catch a handful of unwind cases where lldb will inf loop trying to unwind a stack. llvm-svn: 142331
* Fix verbose logging of unwinders.Jason Molenda2011-09-291-10/+10
| | | | llvm-svn: 140817
* Tighten up the 'log enable lldb unwind' printing forJason Molenda2011-09-161-4/+4
| | | | | | | | 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
* Have the FuncUnwinder object request & provide an architecture-definedJason Molenda2011-09-151-1/+13
| | | | | | | | | | | | | | | | | | | | | UnwindPlan for unwinding from the first instruction of an otherwise unknown function call (GetUnwindPlanArchitectureDefaultAtFunctionEntry()). Update RegisterContextLLDB::GetFullUnwindPlanForFrame() to detect the case of a frame 0 at address 0x0 which indicates that we jumped through a NULL function pointer. Use the ABI's FunctionEntryUnwindPlan to find the caller frame. These changes make it so lldb can identify the calling frame correctly in code like int main () { void (*f)(void) = 0; f(); } llvm-svn: 139760
* Added the ability for DWARF locations to use the ABI plug-ins to resolveGreg Clayton2011-09-021-1/+1
| | | | | | | | register names when dumping variable locations and location lists. Also did some cleanup where "int" types were being used for "lldb::RegisterKind" values. llvm-svn: 138988
* Improved the packet throughput when debugging with GDB remote by over 3x onGreg Clayton2011-06-171-13/+27
| | | | | | | | | | | | | darwin (not sure about other platforms). Modified the communication and connection classes to not require the BytesAvailable function. Now the "Read(...)" function has a timeout in microseconds. Fixed a lot of assertions that were firing off in certain cases and replaced them with error output and code that can deal with the assertion case. llvm-svn: 133224
* Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into theirGreg Clayton2011-05-111-21/+27
| | | | | | | | | | | | | | | 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-091-134/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Put plug-ins into the correct directories as they were incorrectly locatedGreg Clayton2011-04-251-11/+12
| | | | | | in a Utility directory. llvm-svn: 130135
* Fixed the SymbolContext::DumpStopContext() to correctly indent and dumpGreg Clayton2011-04-231-3/+3
| | | | | | | | | | | | | | | | | inline contexts when the deepest most block is not inlined. Added source path remappings to the lldb_private::Target class that allow it to remap paths found in debug info so we can find source files that are elsewhere on the current system. Fixed disassembly by function name to disassemble inline functions that are inside other functions much better and to show enough context before the disassembly output so you can tell where things came from. Added the ability to get more than one address range from a SymbolContext class for the case where a block or function has discontiguous address ranges. llvm-svn: 130044
* Order of initialization lists.Stephen Wilson2011-04-111-11/+11
| | | | | | | | This patch fixes all of the warnings due to unordered initialization lists. Patch by Marco Minutoli. llvm-svn: 129290
* Remove an assertion that was causing a crash.Greg Clayton2011-02-221-2/+12
| | | | llvm-svn: 126235
* All UnwindPlan objects are now passed around as shared pointers.Greg Clayton2011-02-151-156/+130
| | | | | | | | | | | | | ArchDefaultUnwindPlan plug-in interfaces are now cached per architecture instead of being leaked for every frame. Split the ArchDefaultUnwindPlan_x86 into ArchDefaultUnwindPlan_x86_64 and ArchDefaultUnwindPlan_i386 interfaces. There were sporadic crashes that were due to something leaking or being destroyed when doing stack crawls. This patch should clear up these issues. llvm-svn: 125541
* Endian patch from Kirk Beitz that allows better cross platform building.Greg Clayton2011-02-011-5/+5
| | | | llvm-svn: 124643
* Enabled extra warnings and fixed a bunch of small issues.Greg Clayton2011-01-251-1/+1
| | | | llvm-svn: 124250
* Avoid infinite loops in stack backtraces and renamed:Greg Clayton2011-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | bool RegisterContextLLDB::GetPC (addr_t& pc); to: bool RegisterContextLLDB::ReadPC (addr_t& pc); To avoid confusion with the GetPC() function that is part of the lldb_private::RegisterContext: uint64_t RegisterContext::GetPC (uint64_t fail_value); Bad things could happen if the two got intermixed and the wrong one got called. Fixed inifinite loop detection by watching for two frames where the RegisterContextLLDB::CursorSP contains the same start_pc and cfa. llvm-svn: 123673
* Put more smarts into the RegisterContext base class. Now the base class hasGreg Clayton2011-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a method: void RegisterContext::InvalidateIfNeeded (bool force); Each time this function is called, when "force" is false, it will only call the pure virtual "virtual void RegisterContext::InvalideAllRegisters()" if the register context's stop ID doesn't match that of the process. When the stop ID doesn't match, or "force" is true, the base class will clear its cached registers and the RegisterContext will update its stop ID to match that of the process. This helps make it easier to correctly flush the register context (possibly from multiple locations depending on when and where new registers are availabe) without inadvertently clearing the register cache when it doesn't need to be. Modified the ProcessGDBRemote plug-in to be much more efficient when it comes to: - caching the expedited registers in the stop reply packets (we were ignoring these before and it was causing us to read at least three registers every time we stopped that were already supplied in the stop reply packet). - When a thread has no stop reason, don't keep asking for the thread stopped info. Prior to this fix we would continually send a qThreadStopInfo packet over and over when any thread stop info was requested. We now note the stop ID that the stop info was requested for and avoid multiple requests. Cleaned up some of the expression code to not look for ClangExpressionVariable objects up by name since they are now shared pointers and we can just look for the exact pointer match and avoid possible errors. Fixed an bug in the ValueObject code that would cause children to not be displayed. llvm-svn: 123127
* Made FuncUnwinders threadsafe.Greg Clayton2011-01-081-5/+8
| | | | | | Other small cleanups as well. llvm-svn: 123088
* Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener.Greg Clayton2011-01-081-1/+1
| | | | | | Thanks Bruce! llvm-svn: 123083
* Fixed issues with RegisterContext classes and the subclasses. There wasGreg Clayton2011-01-061-61/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | an issue with the way the UnwindLLDB was handing out RegisterContexts: it was making shared pointers to register contexts and then handing out just the pointers (which would get put into shared pointers in the thread and stack frame classes) and cause double free issues. MallocScribble helped to find these issues after I did some other cleanup. To help avoid any RegisterContext issue in the future, all code that deals with them now returns shared pointers to the register contexts so we don't end up with multiple deletions. Also now that the RegisterContext class doesn't require a stack frame, we patched a memory leak where a StackFrame object was being created and leaked. Made the RegisterContext class not have a pointer to a StackFrame object as one register context class can be used for N inlined stack frames so there is not a 1 - 1 mapping. Updates the ExecutionContextScope part of the RegisterContext class to never return a stack frame to indicate this when it is asked to recreate the execution context. Now register contexts point to the concrete frame using a concrete frame index. Concrete frames are all of the frames that are actually formed on the stack of a thread. These concrete frames can be turned into one or more user visible frames due to inlining. Each inlined stack frame has the exact same register context (shared via shared pointers) as any parent inlined stack frames all the way up to the concrete frame itself. So now the stack frames and the register contexts should behave much better. llvm-svn: 122976
* RegisterContextLLDB.cpp (InitializeNonZerothFrame): If we get aJason Molenda2010-12-221-0/+6
| | | | | | | | | | | 0 mid-stack, stop backtracing. SectionLoadList.cpp (ResolveLoadAddress): Don't assert on an out-of-range address, just return an invalid Address object. The unwinder may be passing in invalid addresses on the final stack frame and the assert is a problem. llvm-svn: 122386
* Change the DWARFExpression::Evaluate methods to take an optionalJason Molenda2010-11-201-1/+43
| | | | | | | | | | | | | | RegisterContext* - normally this is retrieved from the ExecutionContext's StackFrame but when we need to evaluate an expression while creating the stack frame list this can be a little tricky. Add DW_OP_deref_size, needed for the _sigtramp FDE expression. Add support for processing DWARF expressions in RegisterContextLLDB. Update callers to DWARFExpression::Evaluate. llvm-svn: 119885
* I'm not thrilled with how I structured this but RegisterContextLLDBJason Molenda2010-11-121-11/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | needs to use the current pc and current offset in two ways: To determine which function we are currently executing, and the decide how much of that function has executed so far. For the former use, we need to back up the saved pc value by one byte if we're going to use the correct function's unwind information -- we may be executing a CALL instruction at the end of a function and the following instruction belongs to a new function, or we may be looking at unwind information which only covers the call instruction and not the subsequent instruction. But when we're talking about deciding which row of an UnwindPlan to execute, we want to use the actual byte offset in the function, not the byte offset - 1. Right now RegisterContextLLDB is tracking both the "real" offset and an "offset minus one" and different parts of the class have to know which one to use and they need to be updated/set in tandem. I want to revisit this at some point. The second change made in looking up eh_frame information; it was formerly done by looking for the start address of the function we are currently executing. But it is possible to have unwind information for a function which only covers a small section of the function's address range. In which case looking up by the start pc value may not find the eh_frame FDE. The hand-written _sigtramp() unwind info on Mac OS X, which covers exactly one instruction in the middle of the function, happens to trigger both of these issues. I still need to get the UnwindPlan runner to handle arbitrary dwarf expressions in the FDE but there's a good chance it will be easy to reuse the DWARFExpression class to do this. llvm-svn: 118882
* Implement RegisterContext::WriteRegisterBytes in RegisterContextLLDB.Jason Molenda2010-11-091-7/+83
| | | | | | | | | | | I only did a tiny bit of testing; in the one case I tried changing the contents of a radar in the middle of a stack and it was still current in the live register context so it filtered down to frame 0 and was handed over to the live register set RegisterContext. I need to test a case where a register is saved on the stack in memory before I check this one off. llvm-svn: 118486
* Fix thinko in UnwindTable.cpp where it wouldn't provde a Jason Molenda2010-11-091-3/+8
| | | | | | | | | | FuncUnwinders object if the eh_frame section was missing from an objfile. Worked fine on x86_64 but on i386 where eh_frame is unusual, that resulted in the arch default UnwindPlan being used all the time instead of picking up an assembly profile based unwindplan. llvm-svn: 118467
OpenPOWER on IntegriCloud