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