Exemplo n.º 1
0
void SBThread::StepOver(lldb::RunMode stop_other_threads) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));

  std::unique_lock<std::recursive_mutex> lock;
  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);

  if (log)
    log->Printf("SBThread(%p)::StepOver (stop_other_threads='%s')",
                static_cast<void *>(exe_ctx.GetThreadPtr()),
                Thread::RunModeAsCString(stop_other_threads));

  if (exe_ctx.HasThreadScope()) {
    Thread *thread = exe_ctx.GetThreadPtr();
    bool abort_other_plans = false;
    StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));

    ThreadPlanSP new_plan_sp;
    if (frame_sp) {
      if (frame_sp->HasDebugInformation()) {
        const LazyBool avoid_no_debug = eLazyBoolCalculate;
        SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
        new_plan_sp = thread->QueueThreadPlanForStepOverRange(
            abort_other_plans, sc.line_entry, sc, stop_other_threads,
            avoid_no_debug);
      } else {
        new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
            true, abort_other_plans, stop_other_threads);
      }
    }

    // This returns an error, we should use it!
    ResumeNewPlan(exe_ctx, new_plan_sp.get());
  }
}
Exemplo n.º 2
0
void SBThread::StepInto(const char *target_name, uint32_t end_line,
                        SBError &error, lldb::RunMode stop_other_threads) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));

  std::unique_lock<std::recursive_mutex> lock;
  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);

  if (log)
    log->Printf(
        "SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
        static_cast<void *>(exe_ctx.GetThreadPtr()),
        target_name ? target_name : "<NULL>",
        Thread::RunModeAsCString(stop_other_threads));

  if (exe_ctx.HasThreadScope()) {
    bool abort_other_plans = false;

    Thread *thread = exe_ctx.GetThreadPtr();
    StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));
    ThreadPlanSP new_plan_sp;

    if (frame_sp && frame_sp->HasDebugInformation()) {
      SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
      AddressRange range;
      if (end_line == LLDB_INVALID_LINE_NUMBER)
        range = sc.line_entry.range;
      else {
        if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref()))
          return;
      }

      const LazyBool step_out_avoids_code_without_debug_info =
          eLazyBoolCalculate;
      const LazyBool step_in_avoids_code_without_debug_info =
          eLazyBoolCalculate;
      new_plan_sp = thread->QueueThreadPlanForStepInRange(
          abort_other_plans, range, sc, target_name, stop_other_threads,
          step_in_avoids_code_without_debug_info,
          step_out_avoids_code_without_debug_info);
    } else {
      new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
          false, abort_other_plans, stop_other_threads);
    }

    error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
  }
}
Exemplo n.º 3
0
void
SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

    Mutex::Locker api_locker;
    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);

    if (log)
        log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
                     exe_ctx.GetThreadPtr(),
                     target_name? target_name: "<NULL>",
                     Thread::RunModeAsCString (stop_other_threads));
    
    if (exe_ctx.HasThreadScope())
    {
        bool abort_other_plans = false;

        Thread *thread = exe_ctx.GetThreadPtr();
        StackFrameSP frame_sp(thread->GetStackFrameAtIndex (0));
        ThreadPlanSP new_plan_sp;

        if (frame_sp && frame_sp->HasDebugInformation ())
        {
            bool avoid_code_without_debug_info = true;
            SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
            new_plan_sp = thread->QueueThreadPlanForStepInRange (abort_other_plans,
                                                              sc.line_entry.range,
                                                              sc,
                                                              target_name,
                                                              stop_other_threads,
                                                              avoid_code_without_debug_info);
        }
        else
        {
            new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (false,
                                                                        abort_other_plans, 
                                                                        stop_other_threads);
        }
        
        // This returns an error, we should use it!
        ResumeNewPlan (exe_ctx, new_plan_sp.get());
    }
}
Exemplo n.º 4
0
void SBThread::StepInstruction(bool step_over) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));

  std::unique_lock<std::recursive_mutex> lock;
  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);

  if (log)
    log->Printf("SBThread(%p)::StepInstruction (step_over=%i)",
                static_cast<void *>(exe_ctx.GetThreadPtr()), step_over);

  if (exe_ctx.HasThreadScope()) {
    Thread *thread = exe_ctx.GetThreadPtr();
    ThreadPlanSP new_plan_sp(
        thread->QueueThreadPlanForStepSingleInstruction(step_over, true, true));

    // This returns an error, we should use it!
    ResumeNewPlan(exe_ctx, new_plan_sp.get());
  }
}