aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/ThreadPlanStepRange.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-444/+374
*** 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
2016-06-07Now that there are no cycles that cause leaks in the ↵Greg Clayton1-10/+0
disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue. <rdar://problem/26684190> llvm-svn: 272071
2016-05-11Keep original source path and mapped path in LineEntryTed Woodward1-1/+1
Summary: The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped. Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct. Tests run on Ubuntu 12.04 show no regression. Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D20135 llvm-svn: 269250
2015-12-15Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr ↵Eugene Zelenko1-31/+12
warnings in some files in source/Target/. Simplify smart pointers checks in conditions. Other minor fixes. llvm-svn: 255598
2015-12-15When constructing an address range to "step" or "next" through,Jason Molenda1-2/+2
find the largest address range (possibly combining multiple LineEntry's for this line number) that is contiguous. This allows lldb's fast-step stepping algorithm to potentially run for a longer address range than if we have to stop at every LineEntry indicating a subexpression in the source line. http://reviews.llvm.org/D15407 <rdar://problem/23270882> llvm-svn: 255590
2015-11-13Fix commit 252963 to work around a bug on some platforms where they don't Jim Ingham1-3/+13
correctly handle stepping over one breakpoint directly onto another breakpoint. This isn't fixing that bug, but rather just changing 252963 to not use breakpoints if it is only stepping one instruction. llvm-svn: 253008
2015-11-13Revert "Another little stepping optimization: if any of the source step ↵Ying Chen1-9/+2
commands are running through a range " - Revert because this commit introduce several failures in lldb test suite - http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/8391 - This reverts commit 78943bb678c2893703ee4e8b41969372740c8a6f. llvm-svn: 252980
2015-11-12Another little stepping optimization: if any of the source step commands are ↵Jim Ingham1-2/+9
running through a range of addresses, and the range has no branches, instead of running to the last instruction and single-stepping over that, run to the first instruction after the end of the range. If there are no branches in the current range, then the bytes right after it have to be in the current function, and have to be instructions not data in code, so this is safe. And it cuts down one extra stepi per source range step. Incidentally, this also works around a bug in the llvm Intel assembler where it treats the "rep" prefix as a separate instruction from the repeated instruction. If that were at the end of a line range, then we would put a trap in place of the repeated instruction, which is undefined behavior. Current processors just ignore the repetition in this case, which changes program behavior. Since there would never be a line range break after the rep prefix, always doing the range stepping to the beginning of the new range avoids this problem. <rdar://problem/23461686> llvm-svn: 252963
2015-07-16Fix compiler warning in ThreadPlanStepRangePavel Labath1-1/+1
llvm-svn: 242403
2015-07-14Small fix to ThreadPlanStepRange::DumpRanges to loggingJason Molenda1-1/+1
output when stepping through multiple ranges. llvm-svn: 242243
2015-06-25Resubmitting 240466 after fixing the linux test suite failures.Greg Clayton1-2/+2
A few extras were fixed - Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. - Since some places want to access the address as a reference, I added a few new functions to symbol: Address &Symbol::GetAddressRef(); const Address &Symbol::GetAddressRef() const; Linux test suite passes just fine now. <rdar://problem/21494354> llvm-svn: 240702
2015-05-11Add Hexagon packet support to ThreadPlanStepRangeTed Woodward1-1/+2
Summary: Hexagon is a VLIW processor. It can execute multiple instructions at once, called a packet. Breakpoints need to be alone in a packet. This patch will make sure that temporary breakpoints used for stepping are set at the start of a packet, which will put the breakpoint in a packet by itself. Patch by Deepak Panickal of CodePlay and Ted Woodward of Qualcomm. Reviewers: deepak2427, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9437 llvm-svn: 237047
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-09-29This checkin is the first step in making the lldb thread stepping mechanism ↵Jim Ingham1-3/+5
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-11Fetching the parent frame may fail, handle that case. Patch from Tong Shen.Jim Ingham1-2/+7
llvm-svn: 215411
2014-08-06When stepping, handle the case where the step leaves us withJim Ingham1-1/+9
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-03Fix Windows build using portable types for formatting the log outputsDeepak Panickal1-2/+2
llvm-svn: 202723
2013-11-04Roll back the changes I made in r193907 which created a new FrameJason Molenda1-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
2013-11-02Add a new base class, Frame. It is a pure virtual function whichJason Molenda1-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
2013-10-11<rdar://problem/13635174>Greg Clayton1-1/+1
Added a way to set hardware breakpoints from the "breakpoint set" command with the new "--hardware" option. Hardware breakpoints are not a request, they currently are a requirement. So when breakpoints are specified as hardware breakpoints, they might fail to be set when they are able to be resolved and should be used sparingly. This is currently hooked up for GDB remote debugging. Linux and FreeBSD should quickly enable this feature if possible, or return an error for any breakpoints that are hardware breakpoint sites in the "virtual Error Process::EnableBreakpointSite (BreakpointSite *bp_site);" function. llvm-svn: 192491
2013-09-27DWARF says line number 0 is a valid line number - used to indicate a source ↵Jim Ingham1-0/+19
line that should not have breakpoints set on it inserted into code that does have a valid line number. So allow that line number, and the ThreadPlanStepRange should just continue stepping over 0 line ranges as if they had the same line number as whatever we were previously stepping through. llvm-svn: 191477
2013-09-12Disassembler::DisassembleRange() currently calls Target::ReadMemoryJason Molenda1-1/+3
with prefer_file_cache == false. This is what we want to do when the user is doing a disassemble command -- show the actual memory contents in case the memory has been corrupted or something -- but when we're profiling functions for stepping or unwinding (ThreadPlanStepRange::GetInstructionsForAddress, UnwindAssemblyInstEmulation::GetNonCallSiteUnwindP) we can read __TEXT instructions directly out of the file, if it exists. <rdar://problem/14397491> llvm-svn: 190638
2013-08-01Re-enable fast stepping for arm targets. The issue being workedJason Molenda1-5/+1
around was fixed in llvm commit r186846. <rdar://problem/14489274> llvm-svn: 187620
2013-07-31The DisassemblerLLVMC has a retain cycle - the InstructionLLVMC's contained ↵Jim Ingham1-0/+13
in its instruction list have a shared pointer back to their DisassemblerLLVMC. This checkin force clears the InstructionList in all the places we use the DisassemblerSP to stop the leaking for now. I'll go back and fix this for real when I have time to do so. <rdar://problem/14581918> llvm-svn: 187473
2013-07-19Turn off fast stepping for ARM till the MC's MayAffectControlFlow gets more ↵Jim Ingham1-1/+5
accurate. rdar://problem/14488761 llvm-svn: 186646
2013-03-27<rdar://problem/13521159>Greg Clayton1-7/+7
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-13Add a target setting (target.use-fast-stepping) to control using the "run to ↵Jim Ingham1-0/+1
next branch" stepping algorithm. llvm-svn: 176958
2013-03-13The step by running from branch to branch pretty much works with this ↵Jim Ingham1-7/+61
checkin (at least for x86_64) but is still turned off, it needs more qualification. If you want to play with it, change the initialization of m_use_fast_step to true. llvm-svn: 176923
2013-03-02Convert from the C-based LLVM Disassembler shim to the full MC Disassembler ↵Jim Ingham1-1/+4
API's. Calculate "can branch" using the MC API's rather than our hand-rolled regex'es. As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att. <rdar://problem/11319574> <rdar://problem/9329275> llvm-svn: 176392
2013-01-26Add "target.process.stop-on-shared-library-events" setting, and make it work.Jim Ingham1-2/+7
Add the ability to give breakpoints a "kind" string, and have the StopInfoBreakpoint print that in the brief description if set. Also print the kind - if set - in the breakpoint listing. Give kinds to a bunch of the internal breakpoints. We were deleting the Mac OS X dynamic loader breakpoint as though the id we had stored away was a breakpoint site ID, but in fact it was a breakpoint id, so we never actually deleted it. Fixed that. llvm-svn: 173555
2012-11-29Resolve printf formatting warnings on Linux:Daniel Malea1-1/+1
- use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
2012-09-10Shortcut ThreadPlanStepRange::MischiefManaged - if we have pushed new plans ↵Jim Ingham1-6/+20
and they are not done, then we aren't done either. <rdar://problem/12259124> llvm-svn: 163572
2012-05-03Clean up the usage of "MasterPlan" status in ThreadPlans. Only ↵Jim Ingham1-0/+27
user-initiated plans should be MasterPlans that want to stay on the plan stack. So make all plans NOT MasterPlans by default and then have the SB API's and the CommandObjectThread step commands set this explicitly. Also added a "clean up" phase to the Thread::ShouldStop so that if plans get stranded on the stack, we can remove them. This is done by adding an IsPlanStale method to the thread plans, and if the plan can know that it is no longer relevant, it returns true, and the plan and its sub-plans will get discarded. llvm-svn: 156101
2012-05-01Fix reporting of stop reasons when the StepOver & StepIn plans stop because ↵Jim Ingham1-36/+0
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-04-20Make sure the "synchronous breakpoint callbacks" get called before the ↵Jim Ingham1-0/+3
thread plan logic gets invoked, and if they ask to continue that should short-circuit the thread plans for that thread. Also add a bit more explanation for how this machinery is supposed to work. Also pass eExecutionPolicyOnlyWhenNeeded, not eExecutionPolicyAlways when evaluating the expression for breakpoint conditions. llvm-svn: 155236
2012-03-09First stage of implementing step by "run to next branch". Doesn't work yet, ↵Jim Ingham1-1/+156
is turned off. <rdar://problem/10975912> llvm-svn: 152376
2012-03-07<rdar://problem/10997402>Greg Clayton1-2/+3
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-50/+20
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-8/+8
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
2011-12-03Make the ThreadPlanStepThrough set a backstop breakpoint on the return ↵Jim Ingham1-24/+0
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-6/+45
their constructors public, there isn't any good reason why you shouldn't be able to make these plans. llvm-svn: 142026
2011-09-23If stepping takes us from the line range we were stepping through into the ↵Jim Ingham1-9/+33
MIDDLE of another line, then continue till we get to the real beginning of a line. This is mostly to work around debug information bugs. llvm-svn: 140416
2011-02-08Formatting.Jim Ingham1-1/+6
llvm-svn: 125076
2011-01-18Fixed incorrect logging printf (patch from Stephen Wilson).Greg Clayton1-1/+1
llvm-svn: 123780
2010-11-11Add ThreadPlanTracer class to allow instruction step tracing of execution.Jim Ingham1-1/+1
Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean. llvm-svn: 118824
2010-11-06Modified all logging calls to hand out shared pointers to make sure weGreg Clayton1-5/+5
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-10-20Don't cache the public stop reason, since it can change as plan completion ↵Jim Ingham1-3/+3
gets processed. That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version. Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do. llvm-svn: 116892
2010-09-16Step past prologues when we step into functions.Jim Ingham1-0/+4
llvm-svn: 114055
2010-09-14Moved the section load list up into the target so we can use the targetGreg Clayton1-6/+4
to symbolicate things without the need for a valid process subclass. llvm-svn: 113895
2010-09-03Fixed the StackFrame to correctly resolve the StackID's SymbolContextScope.Greg Clayton1-4/+6
Added extra logging for stepping. Fixed an issue where cached stack frame data could be lost between runs when the thread plans read a stack frame. llvm-svn: 112973