예제 #1
0
lldb::BreakpointLocationSP
Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent(
    const lldb::EventSP &event_sp, uint32_t bp_loc_idx) {
  lldb::BreakpointLocationSP bp_loc_sp;

  const BreakpointEventData *data = GetEventDataFromEvent(event_sp.get());
  if (data) {
    bp_loc_sp = data->m_locations.GetByIndex(bp_loc_idx);
  }

  return bp_loc_sp;
}
예제 #2
0
    bool
    HandleProcessStateChangedEvent (const lldb::EventSP &event_sp,
                                             lldb_private::Stream *stream)
    {
        lldb::ProcessSP process_sp = lldb_private::Process::ProcessEventData::GetProcessFromEvent(event_sp.get());

        if (!process_sp)
            return false;

        lldb::StateType event_state = lldb_private::Process::ProcessEventData::GetStateFromEvent (event_sp.get());
        if (event_state == lldb::eStateInvalid)
            return false;

        switch (event_state)
        {
            default:
            case lldb::eStateInvalid:
            case lldb::eStateUnloaded:
            case lldb::eStateAttaching:
            case lldb::eStateLaunching:
            case lldb::eStateStepping:
            case lldb::eStateDetached:
            case lldb::eStateConnected:
            case lldb::eStateRunning:
            case lldb::eStateExited:
            {
                bool pop = false;
                return lldb_private::Process::HandleProcessStateChangedEvent(event_sp, stream, pop);
            }
            case lldb::eStateStopped:
            case lldb::eStateCrashed:
            case lldb::eStateSuspended:
                // Make sure the program hasn't been auto-restarted:
                if (lldb_private::Process::ProcessEventData::GetRestartedFromEvent (event_sp.get()))
                {
                    // Don't print anything if we were silently restarted
                }
                else
                {
                    UpdateSelectedThread(process_sp);
                    // Drop the ThreadList mutex by here, since GetThreadStatus below might have to run code,
                    // e.g. for Data formatters, and if we hold the ThreadList mutex, then the process is going to
                    // have a hard time restarting the process.
                    if (stream)
                    {
                        lldb_private::Debugger &debugger = process_sp->GetTarget().GetDebugger();
                        // This is not a hard assert, just not something we handle here,
                        // so better to assert if something unexpected comes up and would otherwise be silent
                        assert(debugger.GetTargetList().GetSelectedTarget().get() == &process_sp->GetTarget());

                        /*const bool only_threads_with_stop_reason = true;
                        const uint32_t start_frame = 0;
                        const uint32_t num_frames = 1;
                        const uint32_t num_frames_with_source = 1;*/
                        process_sp->GetStatus(*stream);
                        PrintProcessThreadStatus(stream,process_sp);
                    }

                }
                break;
        }

        return true;
    }