Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SBThread.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 | |
Daniel Malea | d891f9b | 2012-12-05 00:20:57 +0000 | [diff] [blame] | 10 | #include "lldb/lldb-python.h" |
| 11 | |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 12 | #include "lldb/API/SBThread.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 13 | |
| 14 | #include "lldb/API/SBSymbolContext.h" |
| 15 | #include "lldb/API/SBFileSpec.h" |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 16 | #include "lldb/API/SBStream.h" |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 17 | #include "lldb/Breakpoint/BreakpointLocation.h" |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 18 | #include "lldb/Core/Debugger.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 19 | #include "lldb/Core/Stream.h" |
| 20 | #include "lldb/Core/StreamFile.h" |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 21 | #include "lldb/Interpreter/CommandInterpreter.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 22 | #include "lldb/Target/Thread.h" |
| 23 | #include "lldb/Target/Process.h" |
| 24 | #include "lldb/Symbol/SymbolContext.h" |
| 25 | #include "lldb/Symbol/CompileUnit.h" |
Greg Clayton | 643ee73 | 2010-08-04 01:40:35 +0000 | [diff] [blame] | 26 | #include "lldb/Target/StopInfo.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 27 | #include "lldb/Target/Target.h" |
| 28 | #include "lldb/Target/ThreadPlan.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 29 | #include "lldb/Target/ThreadPlanStepInstruction.h" |
| 30 | #include "lldb/Target/ThreadPlanStepOut.h" |
| 31 | #include "lldb/Target/ThreadPlanStepRange.h" |
| 32 | #include "lldb/Target/ThreadPlanStepInRange.h" |
| 33 | |
| 34 | |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 35 | #include "lldb/API/SBAddress.h" |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 36 | #include "lldb/API/SBDebugger.h" |
Jim Ingham | 94a5d0d | 2012-10-10 18:32:14 +0000 | [diff] [blame] | 37 | #include "lldb/API/SBEvent.h" |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 38 | #include "lldb/API/SBFrame.h" |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 39 | #include "lldb/API/SBProcess.h" |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 40 | #include "lldb/API/SBValue.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 41 | |
| 42 | using namespace lldb; |
| 43 | using namespace lldb_private; |
| 44 | |
Jim Ingham | 94a5d0d | 2012-10-10 18:32:14 +0000 | [diff] [blame] | 45 | const char * |
| 46 | SBThread::GetBroadcasterClassName () |
| 47 | { |
| 48 | return Thread::GetStaticBroadcasterClass().AsCString(); |
| 49 | } |
| 50 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 51 | //---------------------------------------------------------------------- |
| 52 | // Constructors |
| 53 | //---------------------------------------------------------------------- |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 54 | SBThread::SBThread () : |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 55 | m_opaque_sp (new ExecutionContextRef()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 56 | { |
| 57 | } |
| 58 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 59 | SBThread::SBThread (const ThreadSP& lldb_object_sp) : |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 60 | m_opaque_sp (new ExecutionContextRef(lldb_object_sp)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 61 | { |
| 62 | } |
| 63 | |
Greg Clayton | 1b28441 | 2010-10-30 18:26:59 +0000 | [diff] [blame] | 64 | SBThread::SBThread (const SBThread &rhs) : |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 65 | m_opaque_sp (new ExecutionContextRef(*rhs.m_opaque_sp)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 66 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 67 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | //---------------------------------------------------------------------- |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 71 | // Assignment operator |
| 72 | //---------------------------------------------------------------------- |
| 73 | |
| 74 | const lldb::SBThread & |
| 75 | SBThread::operator = (const SBThread &rhs) |
| 76 | { |
| 77 | if (this != &rhs) |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 78 | *m_opaque_sp = *rhs.m_opaque_sp; |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 79 | return *this; |
| 80 | } |
| 81 | |
| 82 | //---------------------------------------------------------------------- |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 83 | // Destructor |
| 84 | //---------------------------------------------------------------------- |
| 85 | SBThread::~SBThread() |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | bool |
| 90 | SBThread::IsValid() const |
| 91 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 92 | return m_opaque_sp->GetThreadSP().get() != NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Greg Clayton | 43490d1 | 2010-07-30 20:12:55 +0000 | [diff] [blame] | 95 | void |
| 96 | SBThread::Clear () |
| 97 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 98 | m_opaque_sp->Clear(); |
Greg Clayton | 43490d1 | 2010-07-30 20:12:55 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 102 | StopReason |
| 103 | SBThread::GetStopReason() |
| 104 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 105 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 106 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 107 | StopReason reason = eStopReasonInvalid; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 108 | Mutex::Locker api_locker; |
| 109 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 110 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 111 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 112 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 113 | Process::StopLocker stop_locker; |
| 114 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 115 | { |
Greg Clayton | 3acaa92 | 2012-09-25 02:40:06 +0000 | [diff] [blame] | 116 | return exe_ctx.GetThreadPtr()->GetStopReason(); |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 117 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 118 | else |
| 119 | { |
| 120 | if (log) |
| 121 | log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr()); |
| 122 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 123 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 124 | |
| 125 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 126 | log->Printf ("SBThread(%p)::GetStopReason () => %s", exe_ctx.GetThreadPtr(), |
Caroline Tice | 61ba7ec | 2010-10-26 23:49:36 +0000 | [diff] [blame] | 127 | Thread::StopReasonAsCString (reason)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 128 | |
| 129 | return reason; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | size_t |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 133 | SBThread::GetStopReasonDataCount () |
| 134 | { |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 135 | Mutex::Locker api_locker; |
| 136 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 137 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 138 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 139 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 140 | Process::StopLocker stop_locker; |
| 141 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 142 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 143 | StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo (); |
| 144 | if (stop_info_sp) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 145 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 146 | StopReason reason = stop_info_sp->GetStopReason(); |
| 147 | switch (reason) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 148 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 149 | case eStopReasonInvalid: |
| 150 | case eStopReasonNone: |
| 151 | case eStopReasonTrace: |
Greg Clayton | 0bce9a2 | 2012-12-05 00:16:59 +0000 | [diff] [blame] | 152 | case eStopReasonExec: |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 153 | case eStopReasonPlanComplete: |
| 154 | // There is no data for these stop reasons. |
| 155 | return 0; |
| 156 | |
| 157 | case eStopReasonBreakpoint: |
| 158 | { |
| 159 | break_id_t site_id = stop_info_sp->GetValue(); |
| 160 | lldb::BreakpointSiteSP bp_site_sp (exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID (site_id)); |
| 161 | if (bp_site_sp) |
| 162 | return bp_site_sp->GetNumberOfOwners () * 2; |
| 163 | else |
| 164 | return 0; // Breakpoint must have cleared itself... |
| 165 | } |
| 166 | break; |
| 167 | |
| 168 | case eStopReasonWatchpoint: |
| 169 | return 1; |
| 170 | |
| 171 | case eStopReasonSignal: |
| 172 | return 1; |
| 173 | |
| 174 | case eStopReasonException: |
| 175 | return 1; |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 176 | } |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 177 | } |
| 178 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 179 | else |
| 180 | { |
| 181 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 182 | if (log) |
| 183 | log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr()); |
| 184 | } |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 185 | } |
| 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | uint64_t |
| 190 | SBThread::GetStopReasonDataAtIndex (uint32_t idx) |
| 191 | { |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 192 | Mutex::Locker api_locker; |
| 193 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 194 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 195 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 196 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 197 | Process::StopLocker stop_locker; |
| 198 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 199 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 200 | Thread *thread = exe_ctx.GetThreadPtr(); |
| 201 | StopInfoSP stop_info_sp = thread->GetStopInfo (); |
| 202 | if (stop_info_sp) |
| 203 | { |
| 204 | StopReason reason = stop_info_sp->GetStopReason(); |
| 205 | switch (reason) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 206 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 207 | case eStopReasonInvalid: |
| 208 | case eStopReasonNone: |
| 209 | case eStopReasonTrace: |
Greg Clayton | 0bce9a2 | 2012-12-05 00:16:59 +0000 | [diff] [blame] | 210 | case eStopReasonExec: |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 211 | case eStopReasonPlanComplete: |
| 212 | // There is no data for these stop reasons. |
| 213 | return 0; |
| 214 | |
| 215 | case eStopReasonBreakpoint: |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 216 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 217 | break_id_t site_id = stop_info_sp->GetValue(); |
| 218 | lldb::BreakpointSiteSP bp_site_sp (exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID (site_id)); |
| 219 | if (bp_site_sp) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 220 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 221 | uint32_t bp_index = idx / 2; |
| 222 | BreakpointLocationSP bp_loc_sp (bp_site_sp->GetOwnerAtIndex (bp_index)); |
| 223 | if (bp_loc_sp) |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 224 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 225 | if (bp_index & 1) |
| 226 | { |
| 227 | // Odd idx, return the breakpoint location ID |
| 228 | return bp_loc_sp->GetID(); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | // Even idx, return the breakpoint ID |
| 233 | return bp_loc_sp->GetBreakpoint().GetID(); |
| 234 | } |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 235 | } |
| 236 | } |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 237 | return LLDB_INVALID_BREAK_ID; |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 238 | } |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 239 | break; |
| 240 | |
| 241 | case eStopReasonWatchpoint: |
| 242 | return stop_info_sp->GetValue(); |
| 243 | |
| 244 | case eStopReasonSignal: |
| 245 | return stop_info_sp->GetValue(); |
| 246 | |
| 247 | case eStopReasonException: |
| 248 | return stop_info_sp->GetValue(); |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 249 | } |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 250 | } |
| 251 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 252 | else |
| 253 | { |
| 254 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 255 | if (log) |
| 256 | log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr()); |
| 257 | } |
Greg Clayton | 640dc6b | 2010-11-18 18:52:36 +0000 | [diff] [blame] | 258 | } |
| 259 | return 0; |
| 260 | } |
| 261 | |
| 262 | size_t |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 263 | SBThread::GetStopDescription (char *dst, size_t dst_len) |
| 264 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 265 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 266 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 267 | Mutex::Locker api_locker; |
| 268 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 269 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 270 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 271 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 272 | Process::StopLocker stop_locker; |
| 273 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 274 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 275 | |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 276 | StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo (); |
| 277 | if (stop_info_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 278 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 279 | const char *stop_desc = stop_info_sp->GetDescription(); |
| 280 | if (stop_desc) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 281 | { |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 282 | if (log) |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 283 | log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 284 | exe_ctx.GetThreadPtr(), stop_desc); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 285 | if (dst) |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 286 | return ::snprintf (dst, dst_len, "%s", stop_desc); |
| 287 | else |
| 288 | { |
| 289 | // NULL dst passed in, return the length needed to contain the description |
| 290 | return ::strlen (stop_desc) + 1; // Include the NULL byte for size |
| 291 | } |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | size_t stop_desc_len = 0; |
| 296 | switch (stop_info_sp->GetStopReason()) |
| 297 | { |
| 298 | case eStopReasonTrace: |
| 299 | case eStopReasonPlanComplete: |
| 300 | { |
| 301 | static char trace_desc[] = "step"; |
| 302 | stop_desc = trace_desc; |
| 303 | stop_desc_len = sizeof(trace_desc); // Include the NULL byte for size |
| 304 | } |
| 305 | break; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 306 | |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 307 | case eStopReasonBreakpoint: |
| 308 | { |
| 309 | static char bp_desc[] = "breakpoint hit"; |
| 310 | stop_desc = bp_desc; |
| 311 | stop_desc_len = sizeof(bp_desc); // Include the NULL byte for size |
| 312 | } |
| 313 | break; |
| 314 | |
| 315 | case eStopReasonWatchpoint: |
| 316 | { |
| 317 | static char wp_desc[] = "watchpoint hit"; |
| 318 | stop_desc = wp_desc; |
| 319 | stop_desc_len = sizeof(wp_desc); // Include the NULL byte for size |
| 320 | } |
| 321 | break; |
| 322 | |
| 323 | case eStopReasonSignal: |
| 324 | { |
| 325 | stop_desc = exe_ctx.GetProcessPtr()->GetUnixSignals ().GetSignalAsCString (stop_info_sp->GetValue()); |
| 326 | if (stop_desc == NULL || stop_desc[0] == '\0') |
| 327 | { |
| 328 | static char signal_desc[] = "signal"; |
| 329 | stop_desc = signal_desc; |
| 330 | stop_desc_len = sizeof(signal_desc); // Include the NULL byte for size |
| 331 | } |
| 332 | } |
| 333 | break; |
| 334 | |
| 335 | case eStopReasonException: |
| 336 | { |
| 337 | char exc_desc[] = "exception"; |
| 338 | stop_desc = exc_desc; |
| 339 | stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size |
| 340 | } |
| 341 | break; |
| 342 | |
Greg Clayton | 0bce9a2 | 2012-12-05 00:16:59 +0000 | [diff] [blame] | 343 | case eStopReasonExec: |
| 344 | { |
| 345 | char exc_desc[] = "exec"; |
| 346 | stop_desc = exc_desc; |
| 347 | stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size |
| 348 | } |
| 349 | break; |
| 350 | |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 351 | default: |
| 352 | break; |
| 353 | } |
| 354 | |
| 355 | if (stop_desc && stop_desc[0]) |
| 356 | { |
| 357 | if (log) |
| 358 | log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", |
| 359 | exe_ctx.GetThreadPtr(), stop_desc); |
| 360 | |
| 361 | if (dst) |
| 362 | return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte |
| 363 | |
| 364 | if (stop_desc_len == 0) |
| 365 | stop_desc_len = ::strlen (stop_desc) + 1; // Include the NULL byte |
| 366 | |
| 367 | return stop_desc_len; |
| 368 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 369 | } |
| 370 | } |
| 371 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 372 | else |
| 373 | { |
| 374 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 375 | if (log) |
| 376 | log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr()); |
| 377 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 378 | } |
| 379 | if (dst) |
| 380 | *dst = 0; |
| 381 | return 0; |
| 382 | } |
| 383 | |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 384 | SBValue |
| 385 | SBThread::GetStopReturnValue () |
| 386 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 387 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 388 | ValueObjectSP return_valobj_sp; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 389 | Mutex::Locker api_locker; |
| 390 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 391 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 392 | if (exe_ctx.HasThreadScope()) |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 393 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 394 | Process::StopLocker stop_locker; |
| 395 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 396 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 397 | StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo (); |
| 398 | if (stop_info_sp) |
| 399 | { |
| 400 | return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp); |
| 401 | } |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 402 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 403 | else |
| 404 | { |
| 405 | if (log) |
| 406 | log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr()); |
| 407 | } |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 408 | } |
| 409 | |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 410 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 411 | log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(), |
Jim Ingham | 1586d97 | 2011-12-17 01:35:57 +0000 | [diff] [blame] | 412 | return_valobj_sp.get() |
| 413 | ? return_valobj_sp->GetValueAsCString() |
| 414 | : "<no return value>"); |
| 415 | |
| 416 | return SBValue (return_valobj_sp); |
| 417 | } |
| 418 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 419 | void |
| 420 | SBThread::SetThread (const ThreadSP& lldb_object_sp) |
| 421 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 422 | m_opaque_sp->SetThreadSP (lldb_object_sp); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | |
| 426 | lldb::tid_t |
| 427 | SBThread::GetThreadID () const |
| 428 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 429 | ThreadSP thread_sp(m_opaque_sp->GetThreadSP()); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 430 | if (thread_sp) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 431 | return thread_sp->GetID(); |
| 432 | return LLDB_INVALID_THREAD_ID; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | uint32_t |
| 436 | SBThread::GetIndexID () const |
| 437 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 438 | ThreadSP thread_sp(m_opaque_sp->GetThreadSP()); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 439 | if (thread_sp) |
| 440 | return thread_sp->GetIndexID(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 441 | return LLDB_INVALID_INDEX32; |
| 442 | } |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 443 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 444 | const char * |
| 445 | SBThread::GetName () const |
| 446 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 447 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 448 | const char *name = NULL; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 449 | Mutex::Locker api_locker; |
| 450 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 451 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 452 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 453 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 454 | Process::StopLocker stop_locker; |
| 455 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 456 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 457 | name = exe_ctx.GetThreadPtr()->GetName(); |
| 458 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 459 | else |
| 460 | { |
| 461 | if (log) |
| 462 | log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr()); |
| 463 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 464 | } |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 465 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 466 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 467 | log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL"); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 468 | |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 469 | return name; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | const char * |
| 473 | SBThread::GetQueueName () const |
| 474 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 475 | const char *name = NULL; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 476 | Mutex::Locker api_locker; |
| 477 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 478 | |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 479 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 480 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 481 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 482 | Process::StopLocker stop_locker; |
| 483 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 484 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 485 | name = exe_ctx.GetThreadPtr()->GetQueueName(); |
| 486 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 487 | else |
| 488 | { |
| 489 | if (log) |
| 490 | log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr()); |
| 491 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 492 | } |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 493 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 494 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 495 | log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL"); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 496 | |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 497 | return name; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 498 | } |
| 499 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 500 | SBError |
| 501 | SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan) |
| 502 | { |
| 503 | SBError sb_error; |
| 504 | |
| 505 | Process *process = exe_ctx.GetProcessPtr(); |
| 506 | if (!process) |
| 507 | { |
| 508 | sb_error.SetErrorString("No process in SBThread::ResumeNewPlan"); |
| 509 | return sb_error; |
| 510 | } |
| 511 | |
| 512 | Thread *thread = exe_ctx.GetThreadPtr(); |
| 513 | if (!thread) |
| 514 | { |
| 515 | sb_error.SetErrorString("No thread in SBThread::ResumeNewPlan"); |
| 516 | return sb_error; |
| 517 | } |
| 518 | |
| 519 | // User level plans should be Master Plans so they can be interrupted, other plans executed, and |
| 520 | // then a "continue" will resume the plan. |
| 521 | if (new_plan != NULL) |
| 522 | { |
| 523 | new_plan->SetIsMasterPlan(true); |
| 524 | new_plan->SetOkayToDiscard(false); |
| 525 | } |
| 526 | |
| 527 | // Why do we need to set the current thread by ID here??? |
| 528 | process->GetThreadList().SetSelectedThreadByID (thread->GetID()); |
| 529 | sb_error.ref() = process->Resume(); |
| 530 | |
| 531 | if (sb_error.Success()) |
| 532 | { |
| 533 | // If we are doing synchronous mode, then wait for the |
| 534 | // process to stop yet again! |
| 535 | if (process->GetTarget().GetDebugger().GetAsyncExecution () == false) |
| 536 | process->WaitForProcessToStop (NULL); |
| 537 | } |
| 538 | |
| 539 | return sb_error; |
| 540 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 541 | |
| 542 | void |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 543 | SBThread::StepOver (lldb::RunMode stop_other_threads) |
| 544 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 545 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 546 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 547 | Mutex::Locker api_locker; |
| 548 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 549 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 550 | |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 551 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 552 | log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", exe_ctx.GetThreadPtr(), |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 553 | Thread::RunModeAsCString (stop_other_threads)); |
| 554 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 555 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 556 | { |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 557 | Thread *thread = exe_ctx.GetThreadPtr(); |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 558 | bool abort_other_plans = false; |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 559 | StackFrameSP frame_sp(thread->GetStackFrameAtIndex (0)); |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 560 | ThreadPlan *new_plan = NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 561 | |
| 562 | if (frame_sp) |
| 563 | { |
| 564 | if (frame_sp->HasDebugInformation ()) |
| 565 | { |
| 566 | SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 567 | new_plan = thread->QueueThreadPlanForStepRange (abort_other_plans, |
| 568 | eStepTypeOver, |
| 569 | sc.line_entry.range, |
| 570 | sc, |
| 571 | stop_other_threads, |
| 572 | false); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 573 | |
| 574 | } |
| 575 | else |
| 576 | { |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 577 | new_plan = thread->QueueThreadPlanForStepSingleInstruction (true, |
| 578 | abort_other_plans, |
| 579 | stop_other_threads); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 580 | } |
| 581 | } |
| 582 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 583 | // This returns an error, we should use it! |
| 584 | ResumeNewPlan (exe_ctx, new_plan); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 585 | } |
| 586 | } |
| 587 | |
| 588 | void |
| 589 | SBThread::StepInto (lldb::RunMode stop_other_threads) |
| 590 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 591 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 592 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 593 | Mutex::Locker api_locker; |
| 594 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 595 | |
| 596 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 597 | log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", exe_ctx.GetThreadPtr(), |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 598 | Thread::RunModeAsCString (stop_other_threads)); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 599 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 600 | { |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 601 | bool abort_other_plans = false; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 602 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 603 | Thread *thread = exe_ctx.GetThreadPtr(); |
| 604 | StackFrameSP frame_sp(thread->GetStackFrameAtIndex (0)); |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 605 | ThreadPlan *new_plan = NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 606 | |
| 607 | if (frame_sp && frame_sp->HasDebugInformation ()) |
| 608 | { |
Greg Clayton | 8f5fd6b | 2010-06-12 18:59:55 +0000 | [diff] [blame] | 609 | bool avoid_code_without_debug_info = true; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 610 | SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 611 | new_plan = thread->QueueThreadPlanForStepRange (abort_other_plans, |
| 612 | eStepTypeInto, |
| 613 | sc.line_entry.range, |
| 614 | sc, |
| 615 | stop_other_threads, |
| 616 | avoid_code_without_debug_info); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 617 | } |
| 618 | else |
| 619 | { |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 620 | new_plan = thread->QueueThreadPlanForStepSingleInstruction (false, |
| 621 | abort_other_plans, |
| 622 | stop_other_threads); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 623 | } |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 624 | |
| 625 | // This returns an error, we should use it! |
| 626 | ResumeNewPlan (exe_ctx, new_plan); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 627 | } |
| 628 | } |
| 629 | |
| 630 | void |
| 631 | SBThread::StepOut () |
| 632 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 633 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 634 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 635 | Mutex::Locker api_locker; |
| 636 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 637 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 638 | |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 639 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 640 | log->Printf ("SBThread(%p)::StepOut ()", exe_ctx.GetThreadPtr()); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 641 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 642 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 643 | { |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 644 | bool abort_other_plans = false; |
Jim Ingham | be0cde9 | 2012-09-14 21:07:14 +0000 | [diff] [blame] | 645 | bool stop_other_threads = false; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 646 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 647 | Thread *thread = exe_ctx.GetThreadPtr(); |
| 648 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 649 | ThreadPlan *new_plan = thread->QueueThreadPlanForStepOut (abort_other_plans, |
| 650 | NULL, |
| 651 | false, |
| 652 | stop_other_threads, |
| 653 | eVoteYes, |
| 654 | eVoteNoOpinion, |
| 655 | 0); |
| 656 | |
| 657 | // This returns an error, we should use it! |
| 658 | ResumeNewPlan (exe_ctx, new_plan); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 659 | } |
| 660 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 661 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 662 | void |
| 663 | SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame) |
| 664 | { |
| 665 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 666 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 667 | Mutex::Locker api_locker; |
| 668 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 669 | |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 670 | StackFrameSP frame_sp (sb_frame.GetFrameSP()); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 671 | if (log) |
| 672 | { |
| 673 | SBStream frame_desc_strm; |
| 674 | sb_frame.GetDescription (frame_desc_strm); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 675 | log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData()); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 676 | } |
| 677 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 678 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 679 | { |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 680 | bool abort_other_plans = false; |
Jim Ingham | be0cde9 | 2012-09-14 21:07:14 +0000 | [diff] [blame] | 681 | bool stop_other_threads = false; |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 682 | Thread *thread = exe_ctx.GetThreadPtr(); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 683 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 684 | ThreadPlan *new_plan = thread->QueueThreadPlanForStepOut (abort_other_plans, |
| 685 | NULL, |
| 686 | false, |
| 687 | stop_other_threads, |
| 688 | eVoteYes, |
| 689 | eVoteNoOpinion, |
| 690 | frame_sp->GetFrameIndex()); |
| 691 | |
| 692 | // This returns an error, we should use it! |
| 693 | ResumeNewPlan (exe_ctx, new_plan); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 694 | } |
| 695 | } |
| 696 | |
| 697 | void |
| 698 | SBThread::StepInstruction (bool step_over) |
| 699 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 700 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 701 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 702 | Mutex::Locker api_locker; |
| 703 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 704 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 705 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 706 | |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 707 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 708 | log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", exe_ctx.GetThreadPtr(), step_over); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 709 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 710 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 711 | { |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 712 | Thread *thread = exe_ctx.GetThreadPtr(); |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 713 | ThreadPlan *new_plan = thread->QueueThreadPlanForStepSingleInstruction (step_over, true, true); |
| 714 | |
| 715 | // This returns an error, we should use it! |
| 716 | ResumeNewPlan (exe_ctx, new_plan); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 717 | } |
| 718 | } |
| 719 | |
| 720 | void |
| 721 | SBThread::RunToAddress (lldb::addr_t addr) |
| 722 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 723 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 724 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 725 | Mutex::Locker api_locker; |
| 726 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 727 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 728 | |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 729 | if (log) |
Daniel Malea | 5f35a4b | 2012-11-29 21:49:15 +0000 | [diff] [blame] | 730 | log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr); |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 731 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 732 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 733 | { |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 734 | bool abort_other_plans = false; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 735 | bool stop_other_threads = true; |
| 736 | |
Greg Clayton | 3508c38 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 737 | Address target_addr (addr); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 738 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 739 | Thread *thread = exe_ctx.GetThreadPtr(); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 740 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 741 | ThreadPlan *new_plan = thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads); |
| 742 | |
| 743 | // This returns an error, we should use it! |
| 744 | ResumeNewPlan (exe_ctx, new_plan); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 745 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 746 | } |
| 747 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 748 | SBError |
| 749 | SBThread::StepOverUntil (lldb::SBFrame &sb_frame, |
| 750 | lldb::SBFileSpec &sb_file_spec, |
| 751 | uint32_t line) |
| 752 | { |
| 753 | SBError sb_error; |
| 754 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 755 | char path[PATH_MAX]; |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 756 | |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 757 | Mutex::Locker api_locker; |
| 758 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 759 | |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 760 | StackFrameSP frame_sp (sb_frame.GetFrameSP()); |
| 761 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 762 | if (log) |
| 763 | { |
| 764 | SBStream frame_desc_strm; |
| 765 | sb_frame.GetDescription (frame_desc_strm); |
| 766 | sb_file_spec->GetPath (path, sizeof(path)); |
| 767 | log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)", |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 768 | exe_ctx.GetThreadPtr(), |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 769 | frame_sp.get(), |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 770 | frame_desc_strm.GetData(), |
| 771 | path, line); |
| 772 | } |
Greg Clayton | 90c5214 | 2012-01-30 02:53:15 +0000 | [diff] [blame] | 773 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 774 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 775 | { |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 776 | Target *target = exe_ctx.GetTargetPtr(); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 777 | Thread *thread = exe_ctx.GetThreadPtr(); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 778 | |
| 779 | if (line == 0) |
| 780 | { |
| 781 | sb_error.SetErrorString("invalid line argument"); |
| 782 | return sb_error; |
| 783 | } |
| 784 | |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 785 | if (!frame_sp) |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 786 | { |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 787 | frame_sp = thread->GetSelectedFrame (); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 788 | if (!frame_sp) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 789 | frame_sp = thread->GetStackFrameAtIndex (0); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | SymbolContext frame_sc; |
| 793 | if (!frame_sp) |
| 794 | { |
| 795 | sb_error.SetErrorString("no valid frames in thread to step"); |
| 796 | return sb_error; |
| 797 | } |
| 798 | |
| 799 | // If we have a frame, get its line |
| 800 | frame_sc = frame_sp->GetSymbolContext (eSymbolContextCompUnit | |
| 801 | eSymbolContextFunction | |
| 802 | eSymbolContextLineEntry | |
| 803 | eSymbolContextSymbol ); |
| 804 | |
| 805 | if (frame_sc.comp_unit == NULL) |
| 806 | { |
| 807 | sb_error.SetErrorStringWithFormat("frame %u doesn't have debug information", frame_sp->GetFrameIndex()); |
| 808 | return sb_error; |
| 809 | } |
| 810 | |
| 811 | FileSpec step_file_spec; |
| 812 | if (sb_file_spec.IsValid()) |
| 813 | { |
| 814 | // The file spec passed in was valid, so use it |
| 815 | step_file_spec = sb_file_spec.ref(); |
| 816 | } |
| 817 | else |
| 818 | { |
| 819 | if (frame_sc.line_entry.IsValid()) |
| 820 | step_file_spec = frame_sc.line_entry.file; |
| 821 | else |
| 822 | { |
| 823 | sb_error.SetErrorString("invalid file argument or no file for frame"); |
| 824 | return sb_error; |
| 825 | } |
| 826 | } |
| 827 | |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 828 | // Grab the current function, then we will make sure the "until" address is |
| 829 | // within the function. We discard addresses that are out of the current |
| 830 | // function, and then if there are no addresses remaining, give an appropriate |
| 831 | // error message. |
| 832 | |
| 833 | bool all_in_function = true; |
| 834 | AddressRange fun_range = frame_sc.function->GetAddressRange(); |
| 835 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 836 | std::vector<addr_t> step_over_until_addrs; |
Jim Ingham | d82bc6d | 2012-05-11 23:47:32 +0000 | [diff] [blame] | 837 | const bool abort_other_plans = false; |
Jim Ingham | 52124e7 | 2012-09-14 18:57:14 +0000 | [diff] [blame] | 838 | const bool stop_other_threads = false; |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 839 | const bool check_inlines = true; |
| 840 | const bool exact = false; |
| 841 | |
| 842 | SymbolContextList sc_list; |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 843 | const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext (step_file_spec, |
| 844 | line, |
| 845 | check_inlines, |
| 846 | exact, |
| 847 | eSymbolContextLineEntry, |
| 848 | sc_list); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 849 | if (num_matches > 0) |
| 850 | { |
| 851 | SymbolContext sc; |
| 852 | for (uint32_t i=0; i<num_matches; ++i) |
| 853 | { |
| 854 | if (sc_list.GetContextAtIndex(i, sc)) |
| 855 | { |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 856 | addr_t step_addr = sc.line_entry.range.GetBaseAddress().GetLoadAddress(target); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 857 | if (step_addr != LLDB_INVALID_ADDRESS) |
| 858 | { |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 859 | if (fun_range.ContainsLoadAddress(step_addr, target)) |
| 860 | step_over_until_addrs.push_back(step_addr); |
| 861 | else |
| 862 | all_in_function = false; |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 863 | } |
| 864 | } |
| 865 | } |
| 866 | } |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 867 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 868 | if (step_over_until_addrs.empty()) |
| 869 | { |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 870 | if (all_in_function) |
| 871 | { |
| 872 | step_file_spec.GetPath (path, sizeof(path)); |
Jason Molenda | 7e5fa7f | 2011-09-20 21:44:10 +0000 | [diff] [blame] | 873 | sb_error.SetErrorStringWithFormat("No line entries for %s:%u", path, line); |
Jim Ingham | b07c62a | 2011-05-08 00:56:32 +0000 | [diff] [blame] | 874 | } |
| 875 | else |
Greg Clayton | 9c23673 | 2011-10-26 00:56:27 +0000 | [diff] [blame] | 876 | sb_error.SetErrorString ("step until target not in current function"); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 877 | } |
| 878 | else |
| 879 | { |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 880 | ThreadPlan *new_plan = thread->QueueThreadPlanForStepUntil (abort_other_plans, |
| 881 | &step_over_until_addrs[0], |
| 882 | step_over_until_addrs.size(), |
| 883 | stop_other_threads, |
| 884 | frame_sp->GetFrameIndex()); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 885 | |
Jim Ingham | 88e3de2 | 2012-05-03 21:19:36 +0000 | [diff] [blame] | 886 | sb_error = ResumeNewPlan (exe_ctx, new_plan); |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 887 | } |
| 888 | } |
| 889 | else |
| 890 | { |
| 891 | sb_error.SetErrorString("this SBThread object is invalid"); |
| 892 | } |
| 893 | return sb_error; |
| 894 | } |
| 895 | |
Jim Ingham | a17a81a | 2012-09-12 00:40:39 +0000 | [diff] [blame] | 896 | SBError |
Jim Ingham | f59388a | 2012-09-14 02:14:15 +0000 | [diff] [blame] | 897 | SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value) |
Jim Ingham | a17a81a | 2012-09-12 00:40:39 +0000 | [diff] [blame] | 898 | { |
| 899 | SBError sb_error; |
| 900 | |
| 901 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 902 | |
| 903 | Mutex::Locker api_locker; |
| 904 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 905 | |
| 906 | |
| 907 | if (log) |
Jim Ingham | f59388a | 2012-09-14 02:14:15 +0000 | [diff] [blame] | 908 | log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID()); |
Jim Ingham | a17a81a | 2012-09-12 00:40:39 +0000 | [diff] [blame] | 909 | |
| 910 | if (exe_ctx.HasThreadScope()) |
| 911 | { |
| 912 | Thread *thread = exe_ctx.GetThreadPtr(); |
Jim Ingham | f59388a | 2012-09-14 02:14:15 +0000 | [diff] [blame] | 913 | sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP())); |
Jim Ingham | a17a81a | 2012-09-12 00:40:39 +0000 | [diff] [blame] | 914 | } |
| 915 | |
| 916 | return sb_error; |
| 917 | } |
| 918 | |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 919 | |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 920 | bool |
| 921 | SBThread::Suspend() |
| 922 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 923 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 924 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 925 | bool result = false; |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 926 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 927 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 928 | Process::StopLocker stop_locker; |
| 929 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 930 | { |
| 931 | exe_ctx.GetThreadPtr()->SetResumeState (eStateSuspended); |
| 932 | result = true; |
| 933 | } |
| 934 | else |
| 935 | { |
| 936 | if (log) |
| 937 | log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr()); |
| 938 | } |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 939 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 940 | if (log) |
| 941 | log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result); |
| 942 | return result; |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | bool |
| 946 | SBThread::Resume () |
| 947 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 948 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 949 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 950 | bool result = false; |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 951 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 952 | { |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 953 | Process::StopLocker stop_locker; |
| 954 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 955 | { |
| 956 | exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning); |
| 957 | result = true; |
| 958 | } |
| 959 | else |
| 960 | { |
| 961 | if (log) |
| 962 | log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr()); |
| 963 | } |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 964 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 965 | if (log) |
| 966 | log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result); |
| 967 | return result; |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 968 | } |
| 969 | |
| 970 | bool |
| 971 | SBThread::IsSuspended() |
| 972 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 973 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 974 | if (exe_ctx.HasThreadScope()) |
| 975 | return exe_ctx.GetThreadPtr()->GetResumeState () == eStateSuspended; |
Greg Clayton | 123db40 | 2011-01-12 02:25:42 +0000 | [diff] [blame] | 976 | return false; |
| 977 | } |
| 978 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 979 | SBProcess |
| 980 | SBThread::GetProcess () |
| 981 | { |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 982 | |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 983 | SBProcess sb_process; |
| 984 | ProcessSP process_sp; |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 985 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 986 | if (exe_ctx.HasThreadScope()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 987 | { |
| 988 | // Have to go up to the target so we can get a shared pointer to our process... |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 989 | sb_process.SetSP (exe_ctx.GetProcessSP()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 990 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 991 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 992 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 993 | if (log) |
| 994 | { |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 995 | SBStream frame_desc_strm; |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 996 | sb_process.GetDescription (frame_desc_strm); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 997 | log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", exe_ctx.GetThreadPtr(), |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 998 | process_sp.get(), frame_desc_strm.GetData()); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 1001 | return sb_process; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | uint32_t |
| 1005 | SBThread::GetNumFrames () |
| 1006 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 1007 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1008 | |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1009 | uint32_t num_frames = 0; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 1010 | Mutex::Locker api_locker; |
| 1011 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 1012 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1013 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1014 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1015 | Process::StopLocker stop_locker; |
| 1016 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 1017 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1018 | num_frames = exe_ctx.GetThreadPtr()->GetStackFrameCount(); |
| 1019 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 1020 | else |
| 1021 | { |
| 1022 | if (log) |
| 1023 | log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr()); |
| 1024 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1025 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1026 | |
| 1027 | if (log) |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1028 | log->Printf ("SBThread(%p)::GetNumFrames () => %u", exe_ctx.GetThreadPtr(), num_frames); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1029 | |
| 1030 | return num_frames; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1031 | } |
| 1032 | |
| 1033 | SBFrame |
| 1034 | SBThread::GetFrameAtIndex (uint32_t idx) |
| 1035 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 1036 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1037 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1038 | SBFrame sb_frame; |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 1039 | StackFrameSP frame_sp; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 1040 | Mutex::Locker api_locker; |
| 1041 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 1042 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1043 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1044 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1045 | Process::StopLocker stop_locker; |
| 1046 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 1047 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1048 | frame_sp = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex (idx); |
| 1049 | sb_frame.SetFrameSP (frame_sp); |
| 1050 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 1051 | else |
| 1052 | { |
| 1053 | if (log) |
| 1054 | log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr()); |
| 1055 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1056 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1057 | |
| 1058 | if (log) |
| 1059 | { |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 1060 | SBStream frame_desc_strm; |
| 1061 | sb_frame.GetDescription (frame_desc_strm); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 1062 | log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1063 | exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData()); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1064 | } |
| 1065 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1066 | return sb_frame; |
| 1067 | } |
| 1068 | |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1069 | lldb::SBFrame |
| 1070 | SBThread::GetSelectedFrame () |
| 1071 | { |
| 1072 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 1073 | |
| 1074 | SBFrame sb_frame; |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 1075 | StackFrameSP frame_sp; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 1076 | Mutex::Locker api_locker; |
| 1077 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 1078 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1079 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1080 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1081 | Process::StopLocker stop_locker; |
| 1082 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
| 1083 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1084 | frame_sp = exe_ctx.GetThreadPtr()->GetSelectedFrame (); |
| 1085 | sb_frame.SetFrameSP (frame_sp); |
| 1086 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 1087 | else |
| 1088 | { |
| 1089 | if (log) |
| 1090 | log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr()); |
| 1091 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 1092 | } |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1093 | |
| 1094 | if (log) |
| 1095 | { |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 1096 | SBStream frame_desc_strm; |
| 1097 | sb_frame.GetDescription (frame_desc_strm); |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1098 | log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s", |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1099 | exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData()); |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1100 | } |
| 1101 | |
| 1102 | return sb_frame; |
| 1103 | } |
| 1104 | |
| 1105 | lldb::SBFrame |
| 1106 | SBThread::SetSelectedFrame (uint32_t idx) |
| 1107 | { |
| 1108 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 1109 | |
| 1110 | SBFrame sb_frame; |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 1111 | StackFrameSP frame_sp; |
Jim Ingham | d0bdddf | 2012-08-22 21:34:33 +0000 | [diff] [blame] | 1112 | Mutex::Locker api_locker; |
| 1113 | ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); |
| 1114 | |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1115 | if (exe_ctx.HasThreadScope()) |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1116 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1117 | Process::StopLocker stop_locker; |
| 1118 | if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1119 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1120 | Thread *thread = exe_ctx.GetThreadPtr(); |
| 1121 | frame_sp = thread->GetStackFrameAtIndex (idx); |
| 1122 | if (frame_sp) |
| 1123 | { |
| 1124 | thread->SetSelectedFrame (frame_sp.get()); |
| 1125 | sb_frame.SetFrameSP (frame_sp); |
| 1126 | } |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1127 | } |
Greg Clayton | 9f3c98e | 2012-04-06 02:17:47 +0000 | [diff] [blame] | 1128 | else |
| 1129 | { |
| 1130 | if (log) |
| 1131 | log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr()); |
| 1132 | } |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | if (log) |
| 1136 | { |
Greg Clayton | 1ebdcc7 | 2011-01-21 06:11:58 +0000 | [diff] [blame] | 1137 | SBStream frame_desc_strm; |
| 1138 | sb_frame.GetDescription (frame_desc_strm); |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1139 | log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s", |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1140 | exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData()); |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1141 | } |
| 1142 | return sb_frame; |
| 1143 | } |
| 1144 | |
Jim Ingham | 94a5d0d | 2012-10-10 18:32:14 +0000 | [diff] [blame] | 1145 | bool |
| 1146 | SBThread::EventIsThreadEvent (const SBEvent &event) |
| 1147 | { |
| 1148 | return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL; |
| 1149 | } |
| 1150 | |
| 1151 | SBFrame |
| 1152 | SBThread::GetStackFrameFromEvent (const SBEvent &event) |
| 1153 | { |
| 1154 | return Thread::ThreadEventData::GetStackFrameFromEvent (event.get()); |
| 1155 | |
| 1156 | } |
| 1157 | |
| 1158 | SBThread |
| 1159 | SBThread::GetThreadFromEvent (const SBEvent &event) |
| 1160 | { |
| 1161 | return Thread::ThreadEventData::GetThreadFromEvent (event.get()); |
| 1162 | } |
Greg Clayton | c5157ec | 2010-12-17 02:26:24 +0000 | [diff] [blame] | 1163 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1164 | bool |
| 1165 | SBThread::operator == (const SBThread &rhs) const |
| 1166 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1167 | return m_opaque_sp->GetThreadSP().get() == rhs.m_opaque_sp->GetThreadSP().get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | bool |
| 1171 | SBThread::operator != (const SBThread &rhs) const |
| 1172 | { |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1173 | return m_opaque_sp->GetThreadSP().get() != rhs.m_opaque_sp->GetThreadSP().get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1174 | } |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 1175 | |
| 1176 | bool |
Jim Ingham | 94a5d0d | 2012-10-10 18:32:14 +0000 | [diff] [blame] | 1177 | SBThread::GetStatus (SBStream &status) const |
| 1178 | { |
| 1179 | Stream &strm = status.ref(); |
| 1180 | |
| 1181 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
| 1182 | if (exe_ctx.HasThreadScope()) |
| 1183 | { |
| 1184 | exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1); |
| 1185 | } |
| 1186 | else |
| 1187 | strm.PutCString ("No status"); |
| 1188 | |
| 1189 | return true; |
| 1190 | } |
| 1191 | |
| 1192 | bool |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1193 | SBThread::GetDescription (SBStream &description) const |
| 1194 | { |
Greg Clayton | 96154be | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 1195 | Stream &strm = description.ref(); |
| 1196 | |
Greg Clayton | a894fe7 | 2012-04-05 16:12:35 +0000 | [diff] [blame] | 1197 | ExecutionContext exe_ctx (m_opaque_sp.get()); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame] | 1198 | if (exe_ctx.HasThreadScope()) |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1199 | { |
Daniel Malea | 5f35a4b | 2012-11-29 21:49:15 +0000 | [diff] [blame] | 1200 | strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID()); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1201 | } |
| 1202 | else |
Greg Clayton | 96154be | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 1203 | strm.PutCString ("No value"); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 1204 | |
| 1205 | return true; |
| 1206 | } |