aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/ThreadPlanStepInRange.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-462/+429
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2015-12-15Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr ↵Eugene Zelenko1-19/+11
warnings in some files in source/Target/. Simplify smart pointers checks in conditions. Other minor fixes. llvm-svn: 255598
2015-07-24Improve C++ function name handling and step-in avoid regerxp handlingTamas Berghammer1-1/+1
If the function is a template then the return type is part of the function name. This CL fixes the parsing of these function names in the case when the return type contains ':'. The name of free functions in C++ don't have context part. Fix the logic geting the function name without arguments out from a full function name to handle this case. Change the handling of step-in-avoid-regexp to match the value against the function name without it's arguments and return value. This is required because the default regex ("^std::") would match any template function returning an std object. Fifferential revision: http://reviews.llvm.org/D11461 llvm-svn: 243099
2015-07-23Most thread plans don't handle eStopReasonInstrumentation stop reasons,Jim Ingham1-18/+12
but that wasn't added to the list of reasons they don't explain. That would mean we keep stepping after hitting the AsanDie breakpoint rather than stopping when the Asan event occurred. <rdar://problem/21925479> llvm-svn: 243035
2015-05-15Fix virtual step handling in ThreadPlanStepInRangeTamas Berghammer1-0/+1
Differential revision: http://reviews.llvm.org/D9773 llvm-svn: 237435
2015-03-18Move lldb-log.cpp to core/Logging.cppZachary Turner1-2/+0
So that we don't have to update every single #include in the entire codebase to #include this new header (which used to get included by lldb-private-log.h, we automatically #include "Logging.h" from within "Log.h". llvm-svn: 232653
2014-10-15Remove unneeded local var initialization.Jason Molenda1-1/+0
clang static analyzer fixit. llvm-svn: 219770
2014-09-29This checkin is the first step in making the lldb thread stepping mechanism ↵Jim Ingham1-7/+22
more accessible from the user level. It adds the ability to invent new stepping modes implemented by python classes, and to view the current thread plan stack and to some extent alter it. I haven't gotten to documentation or tests yet. But this should not cause any behavior changes if you don't use it, so its safe to check it in now and work on it incrementally. llvm-svn: 218642
2014-08-08Don't duplicate the logic of the ↵Jim Ingham1-12/+4
ThreadPlanShouldStopHere::DefaultShouldStopHereCallback in the ThreadPlanStepInRange's implementation, just call it... llvm-svn: 215178
2014-08-06When stepping, handle the case where the step leaves us withJim Ingham1-2/+3
the same parent frame, but different current frame - e.g. when you step past a tail call exit from a function. Apply the same "avoid-no-debug" rules to this case as for a "step-in". <rdar://problem/16189225> llvm-svn: 214946
2014-03-13This commit reworks how the thread plan's ShouldStopHere mechanism works, so ↵Jim Ingham1-43/+78
that it is useful not only for customizing "step-in" behavior (e.g. step-in doesn't step into code with no debug info), but also the behavior of step-in/step-out and step-over when they step out of the frame they started in. I also added as a proof of concept of this reworking a mode for stepping where stepping out of a frame into a frame with no debug information will continue stepping out till it arrives at a frame that does have debug information. This is useful when you are debugging callback based code where the callbacks are separated from the code that initiated them by some library glue you don't care about, among other things. llvm-svn: 203747
2014-01-23Don't need to figure out the frame's module if we don't have any librariesJim Ingham1-10/+14
in the step-avoid-libraries list. llvm-svn: 199944
2014-01-23Add a "step-avoid-libraries" setting to complement the "step-avoid-regexp" ↵Jim Ingham1-4/+27
setting. llvm-svn: 199943
2013-11-25Fix issue from r166732 found by Andrew KaylorEd Maste1-2/+2
From Jim Ingham's email: It does look like ThreadPlanStepInRange test is some kind of thinko. In practice, in this case it is probably safe to run only one thread when doing the "step through" since that generally involved running from a shared library stub to its target. That could deadlock if the dynamic loader has to fix up the symbol, and another thread is in the middle of doing that. But that doesn't seem to be very common, or at least the code is clearly wrong but I haven't had any reports of this causing deadlocks... llvm-svn: 195657
2013-11-04Roll back the changes I made in r193907 which created a new FrameJason Molenda1-3/+3
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
2013-11-02Add a new base class, Frame. It is a pure virtual function whichJason Molenda1-3/+3
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
2013-07-18This commit does two things. One, it converts the return value of the ↵Jim Ingham1-18/+32
QueueThreadPlanXXX plan providers from a "ThreadPlan *" to a "lldb::ThreadPlanSP". That was needed to fix a bug where the ThreadPlanStepInRange wasn't checking with its sub-plans to make sure they succeed before trying to proceed further. If the sub-plan failed and as a result didn't make any progress, you could end up retrying the same failing algorithm in an infinite loop. <rdar://problem/14043602> llvm-svn: 186618
2013-06-04If ThreadPlanCallFunction hasn't set its notion of the "real stop info" yet, ↵Jim Ingham1-1/+1
just return the current PrivateStopInfo. Also renamed a few more places where we were using StopReason in functions that were returning StopInfo's. <rdar://problem/14042692> llvm-svn: 183177
2013-05-14Fix inline stepping test case on Linux because ↵Daniel Malea1-0/+6
Thread::ThreadStoppedForAReason ignored virtual steps. - add IsVirtualStep() virtual function to ThreadPlan, and implement it for ThreadPlanStepInRange - make GetPrivateStopReason query the current thread plan for a virtual stop to decide if the current stop reason needs to be preserved - remove extra check for an existing process in GetPrivateStopReason llvm-svn: 181795
2013-05-08Figure out the reply to "PlanExplainsStop" once when we stop and then use ↵Jim Ingham1-29/+40
the cached value. This fixes problems, for instance, with the StepRange plans, where they know that they explained the stop because they were at their "run to here" breakpoint, then deleted that breakpoint, so when they got asked again, doh! I had done this for a couple of plans in an ad hoc fashion, this just formalizes it. Also add a "ResumeRequested" in Process so that the code in the completion handlers can tell the ShouldStop logic they want to resume rather than just directly resuming. That allows us to handle resuming in a more controlled fashion. Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when the target was immediately restarted. --This line, and those below , will be ignored-- M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py M include/lldb/Target/ThreadList.h M include/lldb/Target/ThreadPlanStepOut.h M include/lldb/Target/Thread.h M include/lldb/Target/ThreadPlanBase.h M include/lldb/Target/ThreadPlanStepThrough.h M include/lldb/Target/ThreadPlanStepInstruction.h M include/lldb/Target/ThreadPlanStepInRange.h M include/lldb/Target/ThreadPlanStepOverBreakpoint.h M include/lldb/Target/ThreadPlanStepUntil.h M include/lldb/Target/StopInfo.h M include/lldb/Target/Process.h M include/lldb/Target/ThreadPlanRunToAddress.h M include/lldb/Target/ThreadPlan.h M include/lldb/Target/ThreadPlanCallFunction.h M include/lldb/Target/ThreadPlanStepOverRange.h M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp M source/Target/StopInfo.cpp M source/Target/Process.cpp M source/Target/ThreadPlanRunToAddress.cpp M source/Target/ThreadPlan.cpp M source/Target/ThreadPlanCallFunction.cpp M source/Target/ThreadPlanStepOverRange.cpp M source/Target/ThreadList.cpp M source/Target/ThreadPlanStepOut.cpp M source/Target/Thread.cpp M source/Target/ThreadPlanBase.cpp M source/Target/ThreadPlanStepThrough.cpp M source/Target/ThreadPlanStepInstruction.cpp M source/Target/ThreadPlanStepInRange.cpp M source/Target/ThreadPlanStepOverBreakpoint.cpp M source/Target/ThreadPlanStepUntil.cpp M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme llvm-svn: 181381
2013-04-03<rdar://problem/13384801>Greg Clayton1-2/+5
Make lldb_private::RegularExpression thread safe everywhere. This was done by removing the m_matches array from the lldb_private::RegularExpression class and putting it into the new lldb_private::RegularExpression::Match class. When executing a regular expression you now have the option to create a lldb_private::RegularExpression::Match object and pass a pointer in if you want to get parenthesized matching. If you don't want any matching, you pass in NULL. The lldb_private::RegularExpression::Match object is initialized with the number of matches you desire. Any matching strings are now extracted from the lldb_private::RegularExpression::Match objects. This makes the regular expression objects thread safe and as a result many more regex objects were turned into static objects that end up using a local lldb_private::RegularExpression::Match object when executing. llvm-svn: 178702
2013-03-27<rdar://problem/13521159>Greg Clayton1-5/+5
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
2013-03-14Log the match substring as well in the case where we match the step-avoid ↵Jim Ingham1-4/+12
regexp. llvm-svn: 177119
2013-03-14Add some logging to track cases where “step-in” steps out due to the ↵Jim Ingham1-4/+21
avoid-regexp and the step-in target. llvm-svn: 177117
2013-02-09Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction ↵Jim Ingham1-1/+1
interoperate to fix problems where hitting auto-continue signals while running a thread plan would cause us to lose control of the debug session. <rdar://problem/12993641> llvm-svn: 174793
2012-12-20Adding eStopReasonThreadExiting and fixing the handling of this state on Linux.Andrew Kaylor1-0/+1
llvm-svn: 170800
2012-12-12Fixed a few bugs in the "step in" thread plan logic.Jim Ingham1-7/+55
Added a "step-in-target" flag to "thread step-in" so if you have something like: Process 28464 stopped * thread #1: tid = 0x1c03, function: main , stop reason = breakpoint 1.1 frame #0: 0x0000000100000e08 a.out`main at main.c:62 61 -> 62 int A6 = complex (a(4), b(5), c(6)); // Stop here to step targetting b and hitting breakpoint. 63 and you want to get into "complex" skipping a, b and c, you can do: (lldb) step -t complex Process 28464 stopped * thread #1: tid = 0x1c03, function: complex , stop reason = step in frame #0: 0x0000000100000d0d a.out`complex at main.c:44 41 42 int complex (int first, int second, int third) 43 { -> 44 return first + second + third; // Step in targetting complex should stop here 45 } 46 47 int main (int argc, char const *argv[]) llvm-svn: 170008
2012-12-05<rdar://problem/12649160>Greg Clayton1-0/+1
Added the ability to debug through your process exec'ing itself to the same architecture. llvm-svn: 169340
2012-10-25Found a couple more places where we need to run all threads when stepping.Jim Ingham1-6/+9
llvm-svn: 166732
2012-09-07Ensure that the ShouldStopHere plans get called even when doing "virtual" steps.Jim Ingham1-95/+112
llvm-svn: 163366
2012-09-01Initial check-in of "fancy" inlined stepping. Doesn't do anything useful ↵Jim Ingham1-5/+29
unless you switch LLDB_FANCY_INLINED_STEPPING to true. With that on, basic inlined stepping works, including step-over of inlined functions. But for some as yet mysterious reason i386 debugging gets an assert and dies immediately. So for now its off. llvm-svn: 163044
2012-08-22Reimplemented the code that backed the "settings" in lldb. There were many ↵Greg Clayton1-3/+1
issues with the previous implementation: - no setting auto completion - very manual and error prone way of getting/setting variables - tons of code duplication - useless instance names for processes, threads Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing". llvm-svn: 162366
2012-07-13Make the setting for "target.process.thread.step-avoid-regexp" work for ↵Greg Clayton1-5/+4
inlined functions, not just concrete top level functions. llvm-svn: 160151
2012-05-10If the ObjC Step Through Trampoline plan causes a target crash, properly ↵Jim Ingham1-2/+2
propagate the error back to the controlling plans so that they don't lose control. Also change "ThreadPlanStepThrough" to take the return StackID for its backstop breakpoint as an argument to the constructor rather than having it try to figure it out itself, since it might get it wrong whereas the caller always knows where it is coming from. rdar://problem/11402287 llvm-svn: 156529
2012-05-01Fix reporting of stop reasons when the StepOver & StepIn plans stop because ↵Jim Ingham1-0/+38
of a crash or breakpoint. Added the ability for a plan to say it is done but doesn't want to be the reason for the stop. llvm-svn: 155927
2012-03-09First stage of implementing step by "run to next branch". Doesn't work yet, ↵Jim Ingham1-36/+12
is turned off. <rdar://problem/10975912> llvm-svn: 152376
2012-03-07<rdar://problem/10997402>Greg Clayton1-1/+1
This fix really needed to happen as a previous fix I had submitted for calculating symbol sizes made many symbols appear to have zero size since the function that was calculating the symbol size was calling another function that would cause the calculation to happen again. This resulted in some symbols having zero size when they shouldn't. This could then cause infinite stack traces and many other side affects. llvm-svn: 152244
2012-03-01Convert the thread plans over from using the stack count to do their logic ↵Jim Ingham1-4/+6
to using StackID's. This should be more efficient. llvm-svn: 151780
2012-02-21Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton1-1/+1
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
2012-02-18The second part in thread hardening the internals of LLDB where we makeGreg Clayton1-2/+2
the lldb_private::StackFrame objects hold onto a weak pointer to the thread object. The lldb_private::StackFrame objects the the most volatile objects we have as when we are doing single stepping, frames can often get lost or thrown away, only to be re-created as another object that still refers to the same frame. We have another bug tracking that. But we need to be able to have frames no longer be able to get the thread when they are not part of a thread anymore, and this is the first step (this fix makes that possible but doesn't implement it yet). Also changed lldb_private::ExecutionContextScope to return shared pointers to all objects in the execution context to further thread harden the internals. llvm-svn: 150871
2011-12-03Make the ThreadPlanStepThrough set a backstop breakpoint on the return ↵Jim Ingham1-0/+34
address from the function it is being asked to step through, so that even if we get the trampoline target wrong (for instance) we will still not lose control. The other fix here is to tighten up the handling of the case where the current plan doesn't explain the stop, but a plan above us does. In that case, if the plan that does explain the stop says it is done, we need to clean up the plans below it and continue on with our processing. llvm-svn: 145740
2011-10-15Make the step range plans capable of supporting multiple ranges. Also make ↵Jim Ingham1-1/+1
their constructors public, there isn't any good reason why you shouldn't be able to make these plans. llvm-svn: 142026
2011-02-15Made lldb_private::ArchSpec contain much more than just an architecture. ItGreg Clayton1-1/+3
now, in addition to cpu type/subtype and architecture flavor, contains: - byte order (big endian, little endian) - address size in bytes - llvm::Triple for true target triple support and for more powerful plug-in selection. llvm-svn: 125602
2011-01-21Added support for stepping out of a frame. If you have 10 stack frames, and you Greg Clayton1-2/+6
select frame #3, you can then do a step out and be able to go directly to the frame above frame #3! Added StepOverUntil and StepOutOfFrame to the SBThread API to allow more powerful stepping. llvm-svn: 123970
2010-11-06Modified all logging calls to hand out shared pointers to make sure weGreg Clayton1-2/+2
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
2010-11-05Handle stepping through ObjC vtable trampoline code.Jim Ingham1-18/+33
llvm-svn: 118270
2010-10-29Add the ability to disable individual log categories, ratherCaroline Tice1-0/+1
than just the entire log channel. Add checks, where appropriate, to make sure a log channel/category has not been disabled before attempting to write to it. llvm-svn: 117715
2010-10-27Updated the lldb_private::Flags class to have better method names and madeGreg Clayton1-1/+1
all of the calls inlined in the header file for better performance. Fixed the summary for C string types (array of chars (with any combo if modifiers), and pointers to chars) work in all cases. Fixed an issue where a forward declaration to a clang type could cause itself to resolve itself more than once if, during the resolving of the type itself it caused something to try and resolve itself again. We now remove the clang type from the forward declaration map in the DWARF parser when we start to resolve it and avoid this additional call. This should stop any duplicate members from appearing and throwing all the alignment of structs, unions and classes. llvm-svn: 117437
2010-09-16Step past prologues when we step into functions.Jim Ingham1-3/+42
llvm-svn: 114055
2010-09-15Adding a bit more logging.Jim Ingham1-0/+6
llvm-svn: 113907