summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix to solve Bug 23139 & Bug 23560Abhishek Aggarwal2015-11-131-1/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - Reason of both bugs: 1. For the very first frame, Unwinder doesn't check the validity of Full UnwindPlan before creating StackFrame from it: When 'process launch' command is run after setting a breakpoint in inferior, the Unwinder runs and saves only Frame 0 (the frame in which breakpoint was set) in thread's StackFrameList i.e. m_curr_frames_sp. However, it doesn't check the validity of the Full UnwindPlan for this frame by unwinding 2 more frames further. 2. Unwinder doesn't update the CFA value of Cursor when Full UnwindPlan fails and FallBack UnwindPlan succeeds in providing valid CFA values for frames: Sometimes during unwinding of stack frames, the Full UnwindPlan inside the RegisterContextLLDB object may fail to provide valid CFA values for these frames. Then the Fallback UnwindPlan is used to unwind the frames. If the Fallback UnwindPlan succeeds, then it provides a valid new CFA value. The RegisterContextLLDB::m_cfa field of Cursor object is updated during the Fallback UnwindPlan execution. However, UnwindLLDB misses the implementation to update the 'cfa' field of this Cursor with this valid new CFA value. - This patch fixes both these issues. - Remove XFAIL in test files corresponding to these 2 Bugs Change-Id: I932ea407545ceee2d628f946ecc61a4806d4cc86 Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com> Reviewers: jingham, lldb-commits, jasonmolenda Subscribers: lldb-commits, ovyalov, tberghammer Differential Revision: http://reviews.llvm.org/D14226 llvm-svn: 253026
* Improve UnwindLLDB with better detection for unwinding failuresTamas Berghammer2015-07-061-70/+106
| | | | | | | | | | | | | | | | | | | Previously we accepted a frame as correct result if the PC pointed into an executable section of code. The isse with that approac is that if we calculated PC correctly but messed up the value of CFA then unwinding from the next fram will most likely fail. With this change I modify the logic with keeping the requirement for PC to point to an executable section and also check that we can continue the unwind from the frame we calculated. If continuing from the frame calculated with the primary unwind plan isn't working then fall back to the fallback plan with the hope for a better frame (if the fallback plan won't help then we acceot the frame from the primary plan). Differential revision: http://reviews.llvm.org/D10932 llvm-svn: 241434
* 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
* Add a new 'eRegisterInLiveRegisterContext' RegisterLocation to trackJason Molenda2014-12-091-0/+8
| | | | | | | | | | | | | | a register value that is live in the stack frame 0 register context. Fixes a problem where retrieving a register value on stack frame #n would involved O(n!) stack frame checks. This could be very slow on a deep stack when retrieving register values that had not been modified/saved by any of the stack frames. Not common, but annoying when it was hit. <rdar://problem/19010211> llvm-svn: 223843
* When a RegisterContext produces an invalid CFA address, changeJason Molenda2014-11-221-8/+25
| | | | | | | | | | | | | | | | | UnwindLLDB::AddOneMoreFrame to try the fallback unwind plan on that same stack frame before it tries the fallback unwind plan on the "next" or callee frame. In RegisterContextLLDB::TryFallbackUnwindPlan, when we're trying the fallback unwind plan to see if it is valid, make sure we change all of the object ivars that might be used in the process of fetching the CFA & caller's saved pc value and restore those if we decide not to use the fallback unwindplan. <rdar://problem/19035079> llvm-svn: 222601
* A pretty big overhaul of the TryFallbackUnwindPlan method inJason Molenda2014-11-131-2/+3
| | | | | | | | | | | | RegisterContextLLDB. I have core files of half a dozen tricky unwind situations on x86/arm and they're all working pretty much correctly at this point, but we'll need to keep an eye out for unwinder regressions for a little while; it's tricky to get these heuristics completely correct in all unwind situations. <rdar://problem/18937193> llvm-svn: 221866
* Back out r221229 -- instead of trying to identify the end of the unwind,Jason Molenda2014-11-041-2/+1
| | | | | | | | | | | | | | | | | let's let lldb try the arch default unwind every time but not destructively -- it doesn't permanently replace the main unwind method for that function from now on. This fix is for <rdar://problem/18683658>. I tested it against Ryan Brown's go program test case and also a collection of core files of tricky unwind scenarios <rdar://problem/15664282> <rdar://problem/15835846> <rdar://problem/15982682> <rdar://problem/16099440> <rdar://problem/17364005> <rdar://problem/18556719> that I've fixed over the last 6-9 months. llvm-svn: 221238
* After we've completed a full backtrace, we'll have one frame whichJason Molenda2014-11-041-1/+2
| | | | | | | | | | | | | | | | is "invalid" -- it is past the end of the stack trace. Add a new method IsCompletedStackWalk() so we can tell if an invalid stack frame is from a complete backtrace or if it might be worth re-trying the last unwind with a different method. This fixes the unwinder problems Ryan Brown was having with go programs. The unwinder can (under the right circumstances) still destructively replace unwind plans permanently - I'll work on that in a different patch. <rdar://problem/18683658> llvm-svn: 221229
* sanitise sign comparisonsSaleem Abdulrasool2014-04-021-1/+1
| | | | | | | | 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
* Add a new idea of a "fallback" UnwindPlan to the RegisterContextLLDBJason Molenda2014-02-211-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | class. If we try to unwind a stack frame to find a caller stack frame, and we fail to get a valid-looking frame, AND if the UnwindPlan we used is an assembly-inspection based UnwindPlan, then we should throw away the assembly-inspection UnwindPlan and try unwinding with the architectural default UnwindPlan. This code path won't be taken if eh_frame unwind instructions are available - lldb will always prefer those once it's off the zeroth frame. The problem I'm trying to fix here is the class of unwind failures that happen when we have hand-written assembly on the stack, with no eh_frame, and lldb's assembly parser fails to understand the assembly. People usually write their hand-written assembly to follow the frame-pointer-preserving conventions of the platform so the architectural default UnwindPlan will often work. We won't have the spill location for most of the non-volatile registers if we fall back to this, but it's better than stopping the unwind prematurely. This is a bit of a tricky change that I believe is correct, but if we get unwinds that go of into the weeds / unwind bogus frames at the end of the stack, I'll need to revisit it. <rdar://problem/16099440> llvm-svn: 201839
* Add a new target setting, trap-handler-names, where a user canJason Molenda2014-02-141-1/+14
| | | | | | | | | | | | specify a list of functions which should be treated as trap handlers. This will be primarily useful to people working in non-user-level process debugging - kernels and other standalone environments. For most people, the trap handler functions provided by the Platform plugin will be sufficient. <rdar://problem/15835846>, <rdar://problem/15982682> llvm-svn: 201386
* The Platform base class now maintains a list of trap handlersJason Molenda2014-02-131-1/+1
| | | | | | | | | | | | | | | | aka asynchronous signal handlers, which subclasses should fill in as appropriate. For most Unix user process environments, the one entry in this list is _sigtramp. For bare-board and kernel environments, there will be different sets of trap handlers. The unwinder needs to know when a frame is a trap handler because the rules it enforces for the frame "above" the trap handler is different from most middle-of-the-stack frames. <rdar://problem/15835846> llvm-svn: 201300
* Don't enforce ABI stack alignment rules on the sigtramp frame --Jason Molenda2014-01-031-4/+10
| | | | | | | | | | its stack frame is a constructed, fake thing that may not conform correctly to these rules. This fixes a problem where lldb couldn't backtrace past an asynchronous signal handler (_sigtramp) frame on a stack on Mac OS X. <rdar://problem/15035673> llvm-svn: 198450
* Partially revert a patch from Ashok Thirumurthi in r191430.Jason Molenda2013-12-201-0/+25
| | | | | | | | | | | The original code was not completely correct, but a form of this check is necessary to avoid an infinite recursion on some unwind cases where a function unwinds to itself with the same CFA. Ashok thought the recursion would be caught in RegisterContextLLDB but this one isn't - we still need it here. <rdar://problem/15664282> llvm-svn: 197761
* Roll back the changes I made in r193907 which created a new FrameJason Molenda2013-11-041-1/+1
| | | | | | | | | | pure virtual base class and made StackFrame a subclass of that. As I started to build on top of that arrangement today, I found that it wasn't working out like I intended. Instead I'll try sticking with the single StackFrame class -- there's too much code duplication to make a more complicated class hierarchy sensible I think. llvm-svn: 193983
* Add a new base class, Frame. It is a pure virtual function whichJason Molenda2013-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
* Fix the partial backtrace in a recursive inferior compiled with ↵Ashok Thirumurthi2013-09-261-15/+1
| | | | | | | | | | | | -fomit-frame-pointer. - Removes the block in UnwindLLDB::AddOneMoreFrame that tests for a bad stack setup, since it is neither correct (tests the FP GPR), complete (doesn't consider multi-frame cycles), nor reachable (the construction of RegisterContextLLDB will fail in the case where either of the two (why just two?) previous frames have the same canonical frame address as the frame that we propose adding to the stack). llvm-svn: 191430
* Change UnwindLLDB::SearchForSavedLocationForRegister so that it will allow forJason Molenda2013-06-051-2/+2
| | | | | | | | | | the link register save location being in the link register - in which case we should iterate down the stack, not recursively try to find the lr in the current frame over and over. <rdar://problem/13932954> llvm-svn: 183282
* Add a hard limit to how many frames lldb will unwind in a singleJason Molenda2013-05-031-0/+16
| | | | | | | | | | | | thread before UnwindLLDB::AddOneMoreFrame calls it quits. We have a couple of reports of unending backtraces in the field and we haven't been able to collect any information about what kind of backtrace is causing this. We've found on Mac OS X that it's tricky to get more than around 200k stack frames before a process exceeds its stack space so we're starting with a hard limit of 300,000 frames. <rdar://problem/13383069> llvm-svn: 180995
* <rdar://problem/13521159>Greg Clayton2013-03-271-1/+1
| | | | | | | | 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
* <rdar://problem/12350715>Jason Molenda2013-01-191-0/+13
| | | | | | | | | | | | | | | | Modify UnwindLLDB::SearchForSavedLocationForRegister so if the register save locations for a register mid-stack is in another register (or in the same register, indicating the reg wasn't modified in this frame), don't return that as a found location. Keep iterating down the array of frames until a concrete location/value for the register is found, or until we get to frame 0 where the reg value can be used as-is. If lldb was trying to backtrace a program that blew out its stack via recursion and the unwind instructions had some kind of this-reg-is-saved-in-that-reg instruction, lldb would revert to doing a recursive search for a concrete value and blow out its own stack. llvm-svn: 172887
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-1/+1
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* A change in how we search for saved register values unintentionallyJason Molenda2012-11-161-2/+8
| | | | | | | | | 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-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-1/+1
| | | | llvm-svn: 165808
* Make the StackFrameList::GetFrameAtIndex only fetch as many stack frames as ↵Jim Ingham2012-02-291-14/+29
| | | | | | | | | needed to get the frame requested. <rdar://problem/10943135> llvm-svn: 151705
* <rdar://problem/10103468>Greg Clayton2012-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+6
| | | | | | | | | | | | | | | | | 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-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Restructure the relationship between UnwindLLDB and theJason Molenda2011-11-011-5/+30
| | | | | | | | | | | | | | | | | | 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
* Lock the Unwinder before accessing it.Jim Ingham2011-10-211-3/+3
| | | | llvm-svn: 142632
* Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constantsPeter Collingbourne2011-06-181-3/+3
| | | | | | Fixes the Linux build. llvm-svn: 133370
* Added some comments.Greg Clayton2011-05-251-0/+2
| | | | llvm-svn: 132066
* ABI plug-ins must implement the following pure virtual functions:Greg Clayton2011-05-241-27/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual bool ABI::StackUsesFrames () = 0; Should return true if your ABI uses frames when doing stack backtraces. This means a frame pointer is used that points to the previous stack frame in some way or another. virtual bool ABI::CallFrameAddressIsValid (lldb::addr_t cfa) = 0; Should take a look at a call frame address (CFA) which is just the stack pointer value upon entry to a function. ABIs usually impose alignment restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed. This function should return true if "cfa" is valid call frame address for the ABI, and false otherwise. This is used by the generic stack frame unwinding code to help determine when a stack ends. virtual bool ABI::CodeAddressIsValid (lldb::addr_t pc) = 0; Validates a possible PC value and returns true if an opcode can be at "pc". Some ABIs or architectures have fixed width instructions and must be aligned to a 2 or 4 byte boundary. "pc" can be an opcode or a callable address which means the load address might be decorated with extra bits (such as bit zero to indicate a thumb function call for ARM targets), so take this into account when returning true or false. The address should also be validated to ensure it is a valid address for the address size of the inferior process. 32 bit targets should make sure the address is less than UINT32_MAX. Modified UnwindLLDB to use the new ABI functions to help it properly terminate stacks. Modified the mach-o function that extracts dependent files to not resolve the path as the paths inside a binary might not match those on the current host system. llvm-svn: 132021
* Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into theirGreg Clayton2011-05-111-1/+0
| | | | | | | | | | | | | | | 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
* Put plug-ins into the correct directories as they were incorrectly locatedGreg Clayton2011-04-251-6/+6
| | | | | | in a Utility directory. llvm-svn: 130135
* All UnwindPlan objects are now passed around as shared pointers.Greg Clayton2011-02-151-5/+9
| | | | | | | | | | | | | 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
* Avoid infinite loops in stack backtraces and renamed:Greg Clayton2011-01-171-2/+11
| | | | | | | | | | | | | | | | | | | | | | 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-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed an issue with the UnwindLLDB code where if there were inlined stackGreg Clayton2011-01-081-1/+1
| | | | | | | | | | frames, UnwindLLDB could create the incorrect RegisterContext for a given stack frame because it was using the frame index (not the concrete frame index). This was causing crashes when doing backtraces through the SBFrame::GetFP() because a NULL register context was being returned for the deepest stack frame. llvm-svn: 123052
* Added memory caching to lldb_private::Process. All lldb_private::ProcessGreg Clayton2011-01-071-1/+15
| | | | | | | | | | | | | | | | | | subclasses will automatically be able to take advantage of caching. The cache line size is set to 512 by default. This greatly speeds up stack backtraces on MacOSX when using the ProcessGDBRemote process plug-in since only about 6300 packets per second can be sent. Initial speedups show: Prior to caching: 10,000 stack frames took 5.2 seconds After caching: 10,000 stack frames in 240 ms! About a 20x speedup! llvm-svn: 122996
* Fixed issues with RegisterContext classes and the subclasses. There wasGreg Clayton2011-01-061-33/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor UnwindLLDB so it doesn't populate the entire stack unlessJason Molenda2010-11-091-79/+108
| | | | | | | | | | | | | the frame count is requested or each frame is individually requested. In practice this doesn't seem to help anything because we have functions like StackFrameList::GetNumFrames() which is going to request each frame anyway. And classes like ThreadPlanStepRange and ThreadPlanStepOverRange get the stack depth in their ctor forcing a full stack walk. But at least UnwindLLDB will delay doing a full walk if it can. llvm-svn: 118477
* Modified all logging calls to hand out shared pointers to make sure weGreg Clayton2010-11-061-1/+1
| | | | | | | | | | | 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-8/+8
| | | | | | | | | 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-17/+17
| | | | | | | | | | | | | 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
* Don't indent log lines by frame # spaces if the frame # exceeds 100 - the ↵Jason Molenda2010-10-261-4/+4
| | | | | | | | | | | | 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-6/+16
| | | | | | | | | | | | 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/+141
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