Browse Source

Fixes to remote debugging

merge-requests/365/head
Ole Christian Eidheim 10 years ago
parent
commit
1638f8044b
  1. 22
      src/debug_clang.cc

22
src/debug_clang.cc

@ -101,8 +101,26 @@ void Debug::Clang::start(const std::string &command, const boost::filesystem::pa
}
lldb::SBError error;
if(!plugin.empty() && plugin!="host")
process = std::unique_ptr<lldb::SBProcess>(new lldb::SBProcess(target.ConnectRemote(*listener, url.c_str(), plugin.c_str(), error)));
if(!plugin.empty() && plugin!="host") {
process = std::unique_ptr<lldb::SBProcess>(new lldb::SBProcess(target.ConnectRemote(*listener, url.c_str(), "gdb-remote", error)));
if(error.Fail()) {
Terminal::get().async_print(std::string("Error (debug): ")+error.GetCString()+'\n', true);
if(callback)
callback(-1);
return;
}
lldb::SBEvent event;
while(true) {
if(listener->GetNextEvent(event)) {
if((event.GetType() & lldb::SBProcess::eBroadcastBitStateChanged)>0) {
auto state=process->GetStateFromEvent(event);
if(state==lldb::StateType::eStateConnected)
break;
}
}
}
process->RemoteLaunch(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, lldb::eLaunchFlagNone, false, error);
}
else
process = std::unique_ptr<lldb::SBProcess>(new lldb::SBProcess(target.Launch(*listener, argv, const_cast<const char**>(environ), nullptr, nullptr, nullptr, path.string().c_str(), lldb::eLaunchFlagNone, false, error)));
if(error.Fail()) {

Loading…
Cancel
Save