blob: 632cfe68c31e8dd79fb3bfd0bfe2ffbae0c66966 [file] [log] [blame]
Jim Ingham745ac7a2010-11-11 19:26:09 +00001//===-- ThreadPlan.cpp ------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/Target/ThreadPlan.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16#include "lldb/Core/Debugger.h"
17#include "lldb/Core/Log.h"
18#include "lldb/Core/State.h"
19#include "lldb/Target/RegisterContext.h"
20#include "lldb/Target/Thread.h"
21#include "lldb/Target/Process.h"
22#include "lldb/Target/Target.h"
23
24using namespace lldb;
25using namespace lldb_private;
26
27ThreadPlanTracer::ThreadPlanTracer (Thread &thread, lldb::StreamSP &stream_sp) :
28 m_single_step(true),
29 m_enabled (false),
30 m_thread (thread),
31 m_stream_sp (stream_sp)
32{
33}
34
35ThreadPlanTracer::ThreadPlanTracer (Thread &thread) :
36 m_single_step(true),
37 m_enabled (false),
38 m_thread (thread),
39 m_stream_sp ()
40{
41}
42
43Stream *
44ThreadPlanTracer::GetLogStream ()
45{
46
47 if (m_stream_sp.get())
48 return m_stream_sp.get();
49 else
50 return &(m_thread.GetProcess().GetTarget().GetDebugger().GetOutputStream());
51}
52
53void
54ThreadPlanTracer::Log()
55{
56 SymbolContext sc;
57 bool show_frame_index = false;
58 bool show_fullpaths = false;
59
60 m_thread.GetStackFrameAtIndex(0)->Dump (GetLogStream(), show_frame_index, show_fullpaths);
61 GetLogStream()->Printf("\n");
62}
63
64bool
65ThreadPlanTracer::TracerExplainsStop ()
66{
67 if (m_enabled && m_single_step)
68 {
69 lldb::StopInfoSP stop_info = m_thread.GetStopInfo();
70 if (stop_info->GetStopReason() == eStopReasonTrace)
71 return true;
72 else
73 return false;
74 }
75 else
76 return false;
77}