aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-09-16 00:58:09 +0000
committerJim Ingham <jingham@apple.com>2010-09-16 00:58:09 +0000
commit7ce490c6b5670448b6ee95254d054e8fcf34441f (patch)
treee96bef27d3fcce669f42e56bff1261d77ebe8b1e /lldb/source/Target
parent0909e5f4dfc41cc85c9eecf3db133c746a6d1be2 (diff)
downloadllvm-7ce490c6b5670448b6ee95254d054e8fcf34441f.tar.gz
llvm-7ce490c6b5670448b6ee95254d054e8fcf34441f.tar.bz2
llvm-7ce490c6b5670448b6ee95254d054e8fcf34441f.zip
Step past prologues when we step into functions.
llvm-svn: 114055
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp45
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp4
2 files changed, 46 insertions, 3 deletions
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index c6b9fb63bffa..74e059fe642b 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -18,6 +18,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/Symbol.h"
+#include "lldb/Symbol/Function.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
@@ -43,10 +44,10 @@ ThreadPlanStepInRange::ThreadPlanStepInRange
lldb::RunMode stop_others
) :
ThreadPlanStepRange (ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others),
- ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL)
+ ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL),
+ m_step_past_prologue (true)
{
SetFlagsToDefault ();
- // SetAvoidRegexp("^std\\:\\:.*");
}
ThreadPlanStepInRange::~ThreadPlanStepInRange ()
@@ -125,8 +126,46 @@ ThreadPlanStepInRange::ShouldStop (Event *event_ptr)
if (!new_plan && FrameIsYounger())
new_plan = InvokeShouldStopHereCallback();
- if (new_plan == NULL)
+ // If we've stepped in and we are going to stop here, check to see if we were asked to
+ // run past the prologue, and if so do that.
+
+ if (new_plan == NULL && FrameIsYounger() && m_step_past_prologue)
{
+ lldb::StackFrameSP curr_frame = m_thread.GetStackFrameAtIndex(0);
+ if (curr_frame)
+ {
+ size_t bytes_to_skip = 0;
+ lldb::addr_t curr_addr = m_thread.GetRegisterContext()->GetPC();
+ Address func_start_address;
+
+ SymbolContext sc = curr_frame->GetSymbolContext (eSymbolContextFunction | eSymbolContextSymbol);
+
+ if (sc.function)
+ {
+ func_start_address = sc.function->GetAddressRange().GetBaseAddress();
+ if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget()))
+ bytes_to_skip = sc.function->GetPrologueByteSize();
+ }
+ else if (sc.symbol)
+ {
+ func_start_address = sc.symbol->GetValue();
+ if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget()))
+ bytes_to_skip = sc.symbol->GetPrologueByteSize();
+ }
+
+ if (bytes_to_skip != 0)
+ {
+ func_start_address.Slide (bytes_to_skip);
+ if (log)
+ log->Printf ("Pushing past prologue ");
+
+ new_plan = m_thread.QueueThreadPlanForRunToAddress(false, func_start_address,true);
+ }
+ }
+ }
+
+ if (new_plan == NULL)
+ {
m_no_more_plans = true;
SetPlanComplete();
return true;
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index 353848279896..afc9773170af 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -159,6 +159,10 @@ bool
ThreadPlanStepRange::FrameIsYounger ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+
+ // FIXME: Might be better to do this by storing the FrameID we started in and seeing if that is still above
+ // us on the stack. Counting the whole stack could be expensive.
+
uint32_t current_depth = m_thread.GetStackFrameCount();
if (current_depth == m_stack_depth)
{