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