summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadPlanStepOverRange.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
committerAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
commit05097246f352eca76207c9ebb08656c88bdf751a (patch)
treebfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Target/ThreadPlanStepOverRange.cpp
parentadd59c052dd6768fd54431e6a3bf045e7f25cb59 (diff)
downloadbcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz
bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
Diffstat (limited to 'lldb/source/Target/ThreadPlanStepOverRange.cpp')
-rw-r--r--lldb/source/Target/ThreadPlanStepOverRange.cpp107
1 files changed, 43 insertions, 64 deletions
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index d5778fb5e8d..b88d25b707e 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -32,8 +32,7 @@ uint32_t ThreadPlanStepOverRange::s_default_flag_values = 0;
//----------------------------------------------------------------------
// ThreadPlanStepOverRange: Step through a stack range, either stepping over or
-// into
-// based on the value of \a type.
+// into based on the value of \a type.
//----------------------------------------------------------------------
ThreadPlanStepOverRange::ThreadPlanStepOverRange(
@@ -91,21 +90,17 @@ void ThreadPlanStepOverRange::SetupAvoidNoDebug(
else
GetFlags().Clear(ThreadPlanShouldStopHere::eStepOutAvoidNoDebug);
// Step Over plans should always avoid no-debug on step in. Seems like you
- // shouldn't
- // have to say this, but a tail call looks more like a step in that a step
- // out, so
- // we want to catch this case.
+ // shouldn't have to say this, but a tail call looks more like a step in that
+ // a step out, so we want to catch this case.
GetFlags().Set(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
}
bool ThreadPlanStepOverRange::IsEquivalentContext(
const SymbolContext &context) {
- // Match as much as is specified in the m_addr_context:
- // This is a fairly loose sanity check. Note, sometimes the target doesn't
- // get filled
- // in so I left out the target check. And sometimes the module comes in as
- // the .o file from the
- // inlined range, so I left that out too...
+ // Match as much as is specified in the m_addr_context: This is a fairly
+ // loose sanity check. Note, sometimes the target doesn't get filled in so I
+ // left out the target check. And sometimes the module comes in as the .o
+ // file from the inlined range, so I left that out too...
if (m_addr_context.comp_unit) {
if (m_addr_context.comp_unit != context.comp_unit)
return false;
@@ -113,8 +108,8 @@ bool ThreadPlanStepOverRange::IsEquivalentContext(
if (m_addr_context.function != context.function)
return false;
// It is okay to return to a different block of a straight function, we
- // only have to
- // be more careful if returning from one inlined block to another.
+ // only have to be more careful if returning from one inlined block to
+ // another.
if (m_addr_context.block->GetInlinedFunctionInfo() == nullptr &&
context.block->GetInlinedFunctionInfo() == nullptr)
return true;
@@ -140,8 +135,8 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
}
// If we're out of the range but in the same frame or in our caller's frame
- // then we should stop.
- // When stepping out we only stop others if we are forcing running one thread.
+ // then we should stop. When stepping out we only stop others if we are
+ // forcing running one thread.
bool stop_others = (m_stop_others == lldb::eOnlyThisThread);
ThreadPlanSP new_plan_sp;
FrameComparison frame_order = CompareCurrentFrameToStartFrame();
@@ -152,11 +147,9 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
// A caveat to this is if we think the frame is older but we're actually in
// a trampoline.
// I'm going to make the assumption that you wouldn't RETURN to a
- // trampoline. So if we are
- // in a trampoline we think the frame is older because the trampoline
- // confused the backtracer.
- // As below, we step through first, and then try to figure out how to get
- // back out again.
+ // trampoline. So if we are in a trampoline we think the frame is older
+ // because the trampoline confused the backtracer. As below, we step
+ // through first, and then try to figure out how to get back out again.
new_plan_sp =
m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others);
@@ -166,8 +159,7 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
"Thought I stepped out, but in fact arrived at a trampoline.");
} else if (frame_order == eFrameCompareYounger) {
// Make sure we really are in a new frame. Do that by unwinding and seeing
- // if the
- // start function really is our start function...
+ // if the start function really is our start function...
for (uint32_t i = 1;; ++i) {
StackFrameSP older_frame_sp = m_thread.GetStackFrameAtIndex(i);
if (!older_frame_sp) {
@@ -200,28 +192,23 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
if (!InSymbol()) {
// This one is a little tricky. Sometimes we may be in a stub or
- // something similar,
- // in which case we need to get out of there. But if we are in a stub
- // then it's
- // likely going to be hard to get out from here. It is probably easiest
- // to step into the
- // stub, and then it will be straight-forward to step out.
+ // something similar, in which case we need to get out of there. But if
+ // we are in a stub then it's likely going to be hard to get out from
+ // here. It is probably easiest to step into the stub, and then it will
+ // be straight-forward to step out.
new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false,
stop_others);
} else {
- // The current clang (at least through 424) doesn't always get the address
- // range for the
- // DW_TAG_inlined_subroutines right, so that when you leave the inlined
- // range the line table says
- // you are still in the source file of the inlining function. This is
- // bad, because now you are missing
- // the stack frame for the function containing the inlining, and if you
- // sensibly do "finish" to get
- // out of this function you will instead exit the containing function.
- // To work around this, we check whether we are still in the source file
- // we started in, and if not assume
- // it is an error, and push a plan to get us out of this line and back to
- // the containing file.
+ // The current clang (at least through 424) doesn't always get the
+ // address range for the DW_TAG_inlined_subroutines right, so that when
+ // you leave the inlined range the line table says you are still in the
+ // source file of the inlining function. This is bad, because now you
+ // are missing the stack frame for the function containing the inlining,
+ // and if you sensibly do "finish" to get out of this function you will
+ // instead exit the containing function. To work around this, we check
+ // whether we are still in the source file we started in, and if not
+ // assume it is an error, and push a plan to get us out of this line and
+ // back to the containing file.
if (m_addr_context.line_entry.IsValid()) {
SymbolContext sc;
@@ -244,14 +231,11 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
bool step_past_remaining_inline = false;
if (entry_idx > 0) {
// We require the previous line entry and the current line
- // entry come
- // from the same file.
- // The other requirement is that the previous line table entry
- // be part of an
- // inlined block, we don't want to step past cases where
- // people have inlined
- // some code fragment by using #include <source-fragment.c>
- // directly.
+ // entry come from the same file. The other requirement is
+ // that the previous line table entry be part of an inlined
+ // block, we don't want to step past cases where people have
+ // inlined some code fragment by using #include <source-
+ // fragment.c> directly.
LineEntry prev_line_entry;
if (line_table->GetLineEntryAtIndex(entry_idx - 1,
prev_line_entry) &&
@@ -338,8 +322,7 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
if (!new_plan_sp) {
// For efficiencies sake, we know we're done here so we don't have to do
- // this
- // calculation again in MischiefManaged.
+ // this calculation again in MischiefManaged.
SetPlanComplete();
return true;
} else
@@ -347,16 +330,12 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
}
bool ThreadPlanStepOverRange::DoPlanExplainsStop(Event *event_ptr) {
- // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan
- // above us)
- // handle the stop. That way the user can see the stop, step around, and then
- // when they
- // are done, continue and have their step complete. The exception is if we've
- // hit our
- // "run to next branch" breakpoint.
- // Note, unlike the step in range plan, we don't mark ourselves complete if we
- // hit an
- // unexplained breakpoint/crash.
+ // For crashes, breakpoint hits, signals, etc, let the base plan (or some
+ // plan above us) handle the stop. That way the user can see the stop, step
+ // around, and then when they are done, continue and have their step
+ // complete. The exception is if we've hit our "run to next branch"
+ // breakpoint. Note, unlike the step in range plan, we don't mark ourselves
+ // complete if we hit an unexplained breakpoint/crash.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
StopInfoSP stop_info_sp = GetPrivateStopInfo();
@@ -387,8 +366,8 @@ bool ThreadPlanStepOverRange::DoWillResume(lldb::StateType resume_state,
m_first_resume = false;
if (resume_state == eStateStepping && current_plan) {
// See if we are about to step over an inlined call in the middle of the
- // inlined stack, if so figure
- // out its extents and reset our range to step over that.
+ // inlined stack, if so figure out its extents and reset our range to
+ // step over that.
bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth();
if (in_inlined_stack) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
OpenPOWER on IntegriCloud