From 4104d9e1aa25af8fbcf20e192691d4bba77b218e Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 3 Jan 2016 11:19:38 +0100 Subject: [PATCH] Now selects the thread in which a debug process stops --- src/debug.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/debug.cc b/src/debug.cc index 858850f..f706e32 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -117,6 +117,16 @@ void Debug::start(const std::string &command, const boost::filesystem::path &pat auto state=process->GetStateFromEvent(event); this->state=state; + if(state==lldb::StateType::eStateStopped) { + for(uint32_t c=0;cGetNumThreads();c++) { + auto thread=process->GetThreadAtIndex(c); + if(thread.GetStopReason()>=2) { + process->SetSelectedThreadByIndexID(thread.GetIndexID()); + break; + } + } + } + //Update debug status lldb::SBStream stream; event.GetDescription(stream); @@ -128,7 +138,8 @@ void Debug::start(const std::string &command, const boost::filesystem::path &pat if(state==lldb::StateType::eStateStopped) { char buffer[100]; auto n=process->GetSelectedThread().GetStopDescription(buffer, 100); - status+=" ("+std::string(buffer, n)+")"; + if(n>0) + status+=" ("+std::string(buffer, n<=100?n:100)+")"; } status_callback(status); }