summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Modified all logging calls to hand out shared pointers to make sure weGreg Clayton2010-11-061-6/+6
| | | | | | | | | | | don't crash if we disable logging when some code already has a copy of the logger. Prior to this fix, logs were handed out as pointers and if they were held onto while a log got disabled, then it could cause a crash. Now all logs are handed out as shared pointers so this problem shouldn't happen anymore. We are also using our new shared pointers that put the shared pointer count and the object into the same allocation for a tad better performance. llvm-svn: 118319
* Built the native unwinder with all the warnings c++-4.2 could muster;Jason Molenda2010-11-041-2/+3
| | | | | | | | | fixed them. Added DISALLOW_COPY_AND_ASSIGN to classes that should not be bitwise copied. Added default initializers for member variables that weren't being initialized in the ctor. Fixed a few shadowed local variable mistakes. llvm-svn: 118240
* Handle the case where no eh_frame section is present.Jason Molenda2010-11-041-27/+40
| | | | | | | | | | | | | RegisterContextLLDB holds a reference to the SymbolContext in the vector of Cursors that UnwindLLDB maintains. Switch UnwindLLDB to hold a vector of shared pointers of Cursors so this reference doesn't become invalid. Correctly falling back from the "fast" UnwindPlan to the "full" UnwindPlan when additional registers need to be retrieved. llvm-svn: 118218
* Add an unwind log Printf to note when an eh_frame section isJason Molenda2010-10-261-146/+205
| | | | | | | | | | | | | | | | | loaded/parsed. Should add timers to this eventually. Delay getting a full UnwindPlan if it's possible to unwind with just a fast UnwindPlan. This keeps us from reading the eh_frame section unless we hit something built -fomit-frame pointer or we hit a frame with no symbol (read: no start address) available. It doesn't look like it is correctly falling back to using the full UnwindPlan to provide additional registers that the fast UnwindPlan doesn't supply; e.g. go to the middle of a stack and ask for r12 and it will show you the value of r12 in frame 0. That's a bug for tomorrow. llvm-svn: 117361
* Don't indent log lines by frame # spaces if the frame # exceeds 100 - the ↵Jason Molenda2010-10-261-29/+42
| | | | | | | | | | | | indentation gets to be a problem if you have a unbounded stack walk. Fix the CFA sanity checks. Add one to the arch default UnwindPlan run which was giving one extra stack frame on the main thread. Fix a couple of logging lines that had their argument order incorrect. llvm-svn: 117350
* Get a disassembler based on the correct architecture for assemblyJason Molenda2010-10-261-49/+68
| | | | | | | | | | | | prologue profiling. Change the log print statements to elide the thread number, make some of them only print when IsLogVerbose(). Add a couple of sanity checks for impossible CFA values so backtraces don't go too far off into the weeds. llvm-svn: 117343
* Check in the native lldb unwinder. Jason Molenda2010-10-251-0/+986
Not yet enabled as the default unwinder but there are no known backtrace problems with the code at this point. Added 'log enable lldb unwind' to help diagnose backtrace problems; this output needs a little refining but it's a good first step. eh_frame information is currently read unconditionally - the code is structured to allow this to be delayed until it's actually needed. There is a performance hit when you have to parse the eh_frame information for any largeish executable/library so it's necessary to avoid if possible. It's confusing having both the UnwindPlan::RegisterLocation struct and the RegisterConextLLDB::RegisterLocation struct, I need to rename one of them. The writing of registers isn't done in the RegisterConextLLDB subclass yet; neither is the running of complex DWARF expressions from eh_frame (e.g. used for _sigtramp on Mac OS X). llvm-svn: 117256
OpenPOWER on IntegriCloud