blob: 8bb36bd732405d4aaa80cb23a115a5816f94466d [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- SBBreakpointLocation.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/API/SBBreakpointLocation.h"
11#include "lldb/API/SBDefines.h"
12#include "lldb/API/SBDebugger.h"
13
14#include "lldb/lldb-types.h"
15#include "lldb/lldb-defines.h"
16#include "lldb/Breakpoint/BreakpointLocation.h"
17#include "lldb/Core/Stream.h"
18#include "lldb/Core/StreamFile.h"
19
20using namespace lldb;
21using namespace lldb_private;
22
23
24
25//class SBBreakpointLocation
26
27SBBreakpointLocation::SBBreakpointLocation ()
28{
29}
30
31SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
32 m_break_loc_sp (break_loc_sp)
33{
34}
35
36SBBreakpointLocation::~SBBreakpointLocation ()
37{
38}
39
40bool
41SBBreakpointLocation::IsValid() const
42{
43 return m_break_loc_sp.get() != NULL;
44}
45
46addr_t
47SBBreakpointLocation::GetLoadAddress ()
48{
49 addr_t ret_addr = LLDB_INVALID_ADDRESS;
50
51 if (m_break_loc_sp)
52 {
53 ret_addr = m_break_loc_sp->GetLoadAddress();
54 }
55
56 return ret_addr;
57}
58
59void
60SBBreakpointLocation::SetEnabled (bool enabled)
61{
62 if (m_break_loc_sp)
63 {
64 m_break_loc_sp->SetEnabled (enabled);
65 }
66}
67
68bool
69SBBreakpointLocation::IsEnabled ()
70{
71 if (m_break_loc_sp)
72 return m_break_loc_sp->IsEnabled();
73 else
74 return false;
75}
76
77int32_t
78SBBreakpointLocation::GetIgnoreCount ()
79{
80 if (m_break_loc_sp)
81 return m_break_loc_sp->GetIgnoreCount();
82 else
83 return 0;
84}
85
86void
87SBBreakpointLocation::SetIgnoreCount (int32_t n)
88{
89 if (m_break_loc_sp)
90 m_break_loc_sp->SetIgnoreCount (n);
91}
92
93void
94SBBreakpointLocation::SetThreadID (tid_t thread_id)
95{
96 if (m_break_loc_sp)
97 m_break_loc_sp->SetThreadID (thread_id);
98}
99
100tid_t
101SBBreakpointLocation::GetThreadID ()
102{
103 tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
104 if (m_break_loc_sp)
105 sb_thread_id = m_break_loc_sp->GetThreadID();
106
107 return sb_thread_id;
108}
109
110bool
111SBBreakpointLocation::IsResolved ()
112{
113 if (m_break_loc_sp)
114 return m_break_loc_sp->IsResolved();
115 else
116 return false;
117}
118
119void
120SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_sp)
121{
122 if (m_break_loc_sp)
123 {
124 // Uninstall the callbacks?
125 }
126 m_break_loc_sp = break_loc_sp;
127}
128
129void
130SBBreakpointLocation::GetDescription (FILE *f, const char *description_level)
131{
132 if (f == NULL)
133 return;
134
135 if (m_break_loc_sp)
136 {
137 DescriptionLevel level;
138 if (strcmp (description_level, "brief") == 0)
139 level = eDescriptionLevelBrief;
140 else if (strcmp (description_level, "full") == 0)
141 level = eDescriptionLevelFull;
142 else if (strcmp (description_level, "verbose") == 0)
143 level = eDescriptionLevelVerbose;
144 else
145 level = eDescriptionLevelBrief;
146
147 StreamFile str (f);
148
149 m_break_loc_sp->GetDescription (&str, level);
150 str.EOL();
151 }
152}
153
154SBBreakpoint
155SBBreakpointLocation::GetBreakpoint ()
156{
157 SBBreakpoint sb_bp;
158 if (m_break_loc_sp)
159 *sb_bp = m_break_loc_sp->GetBreakpoint ().GetSP();
160 return sb_bp;
161}
162