diff --git a/LLDBDebugger/LLDBCallStack.cpp b/LLDBDebugger/LLDBCallStack.cpp index e0f398b1fb..3be9496039 100644 --- a/LLDBDebugger/LLDBCallStack.cpp +++ b/LLDBDebugger/LLDBCallStack.cpp @@ -2,6 +2,7 @@ #include "LLDBProtocol/LLDBEvent.h" #include "LLDBProtocol/LLDBConnector.h" #include +#include "macros.h" LLDBCallStackPane::LLDBCallStackPane(wxWindow* parent, LLDBConnector* connector) : LLDBCallStackBase(parent) @@ -40,3 +41,11 @@ void LLDBCallStackPane::OnRunning(LLDBEvent& event) event.Skip(); m_dvListCtrlBacktrace->DeleteAllItems(); } + +void LLDBCallStackPane::OnItemActivated(wxDataViewEvent& event) +{ + // Activate the selected frame + CHECK_ITEM_RET(event.GetItem()); + int rowNum = m_dvListCtrlBacktrace->ItemToRow( event.GetItem() ); + m_connector->SelectFrame( rowNum ); +} diff --git a/LLDBDebugger/LLDBCallStack.h b/LLDBDebugger/LLDBCallStack.h index 15def21876..4cb80d8dc1 100644 --- a/LLDBDebugger/LLDBCallStack.h +++ b/LLDBDebugger/LLDBCallStack.h @@ -10,6 +10,7 @@ class LLDBCallStackPane : public LLDBCallStackBase { LLDBConnector* m_connector; protected: + virtual void OnItemActivated(wxDataViewEvent& event); void OnBacktrace(LLDBEvent &event); void OnRunning(LLDBEvent &event); diff --git a/LLDBDebugger/LLDBProtocol/LLDBCommand.cpp b/LLDBDebugger/LLDBProtocol/LLDBCommand.cpp index 908d1a5139..2ae8690140 100644 --- a/LLDBDebugger/LLDBProtocol/LLDBCommand.cpp +++ b/LLDBDebugger/LLDBProtocol/LLDBCommand.cpp @@ -20,6 +20,7 @@ void LLDBCommand::FromJSON(const JSONElement& json) m_interruptReason = json.namedObject("m_interruptReason").toInt(kInterruptReasonNone); m_lldbId = json.namedObject("m_lldbId").toInt(wxNOT_FOUND); m_env = json.namedObject("m_env").toStringMap(); + m_frameId = json.namedObject("m_frameId").toInt(wxNOT_FOUND); JSONElement arr = json.namedObject("m_breakpoints"); for(int i=0; im_frameId = frameId; + } + int GetFrameId() const { + return m_frameId; + } void SetEnv(const JSONElement::wxStringMap_t& env) { this->m_env = env; } diff --git a/LLDBDebugger/LLDBProtocol/LLDBConnector.cpp b/LLDBDebugger/LLDBProtocol/LLDBConnector.cpp index 9da2cbc868..d0b344d33c 100644 --- a/LLDBDebugger/LLDBProtocol/LLDBConnector.cpp +++ b/LLDBDebugger/LLDBProtocol/LLDBConnector.cpp @@ -467,6 +467,16 @@ wxString LLDBConnector::GetDebugServerPath() const return path; } +void LLDBConnector::SelectFrame(int frameID) +{ + if ( IsCanInteract() ) { + LLDBCommand command; + command.SetCommandType( kCommandSelectFrame ); + command.SetFrameId( frameID ); + SendCommand( command ); + } +} + void LLDBTerminalCallback::OnProcessOutput(const wxString& str) { diff --git a/LLDBDebugger/LLDBProtocol/LLDBConnector.h b/LLDBDebugger/LLDBProtocol/LLDBConnector.h index 593bfe4d39..b5dbe545f2 100644 --- a/LLDBDebugger/LLDBProtocol/LLDBConnector.h +++ b/LLDBDebugger/LLDBProtocol/LLDBConnector.h @@ -230,6 +230,11 @@ class LLDBConnector : public wxEvtHandler * @param reason */ void Interrupt(eInterruptReason reason); + + /** + * @brief select a given frame + */ + void SelectFrame(int frameID); }; #endif // LLDBCONNECTOR_H diff --git a/LLDBDebugger/LLDBProtocol/LLDBEnums.h b/LLDBDebugger/LLDBProtocol/LLDBEnums.h index 493b2373e1..7d8d965eaa 100644 --- a/LLDBDebugger/LLDBProtocol/LLDBEnums.h +++ b/LLDBDebugger/LLDBProtocol/LLDBEnums.h @@ -41,6 +41,7 @@ enum eCommandType { kCommandInterrupt, kCommandGetLocals, kCommandExpandVariable, + kCommandSelectFrame, }; enum eLLDBOptions { diff --git a/LLDBDebugger/LLDBProtocol/LLDBSettings.cpp b/LLDBDebugger/LLDBProtocol/LLDBSettings.cpp index 525ec8ac8f..5f6ce1374e 100644 --- a/LLDBDebugger/LLDBProtocol/LLDBSettings.cpp +++ b/LLDBDebugger/LLDBProtocol/LLDBSettings.cpp @@ -10,7 +10,7 @@ static const wxString s_DefaultTypes = LLDBSettings::LLDBSettings() : m_arrItems(50) - , m_flags(0) + , m_flags(kLLDBOptionRaiseCodeLite) , m_stackFrames(100) { m_types = s_DefaultTypes; diff --git a/LLDBDebugger/UI.cpp b/LLDBDebugger/UI.cpp index f7211b6632..79b75f33e1 100644 --- a/LLDBDebugger/UI.cpp +++ b/LLDBDebugger/UI.cpp @@ -40,10 +40,15 @@ LLDBCallStackBase::LLDBCallStackBase(wxWindow* parent, wxWindowID id, const wxPo GetSizer()->Fit(this); } Centre(wxBOTH); + // Connect events + m_dvListCtrlBacktrace->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(LLDBCallStackBase::OnItemActivated), NULL, this); + } LLDBCallStackBase::~LLDBCallStackBase() { + m_dvListCtrlBacktrace->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(LLDBCallStackBase::OnItemActivated), NULL, this); + } LLDBBreakpointsPaneBase::LLDBBreakpointsPaneBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) diff --git a/LLDBDebugger/UI.h b/LLDBDebugger/UI.h index 329f950266..684d53cf8b 100644 --- a/LLDBDebugger/UI.h +++ b/LLDBDebugger/UI.h @@ -37,6 +37,7 @@ class LLDBCallStackBase : public wxPanel wxDataViewListCtrl* m_dvListCtrlBacktrace; protected: + virtual void OnItemActivated(wxDataViewEvent& event) { event.Skip(); } public: LLDBCallStackBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(500,300), long style = wxTAB_TRAVERSAL); diff --git a/LLDBDebugger/UI.wxcp b/LLDBDebugger/UI.wxcp index dbfea3083c..e91526cb0b 100644 --- a/LLDBDebugger/UI.wxcp +++ b/LLDBDebugger/UI.wxcp @@ -186,7 +186,14 @@ "m_label": "Style:", "m_value": "" }], - "m_events": [], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED", + "m_eventClass": "wxDataViewEvent", + "m_eventHandler": "wxDataViewEventHandler", + "m_functionNameAndSignature": "OnItemActivated(wxDataViewEvent& event)", + "m_description": "Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.\nThis event is triggered by double clicking an item or pressing some special key (usually \"Enter\") when it is focused", + "m_noBody": false + }], "m_children": [{ "m_type": 4472, "proportion": 0, diff --git a/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.cpp b/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.cpp index 976b75a612..0c7b2e2d31 100644 --- a/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.cpp +++ b/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.cpp @@ -639,4 +639,14 @@ void CodeLiteLLDBApp::MainLoop() } } +void CodeLiteLLDBApp::SelectFrame(const LLDBCommand& command) +{ + wxPrintf("codelite-lldb: selecting frame %d\n", command.GetFrameId()); + if ( CanInteract() ) { + m_target.GetProcess().GetSelectedThread().SetSelectedFrame( command.GetFrameId() ); + m_interruptReason = kInterruptReasonNone; + NotifyStopped(); + } +} + #endif diff --git a/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.h b/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.h index da43b63528..c3fae40d77 100644 --- a/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.h +++ b/LLDBDebugger/codelite-lldb/CodeLiteLLDBApp.h @@ -103,6 +103,7 @@ class CodeLiteLLDBApp void Interrupt(const LLDBCommand& command); void LocalVariables(const LLDBCommand& command); void ExpandVariable(const LLDBCommand& command); + void SelectFrame(const LLDBCommand& command); }; DECLARE_APP(CodeLiteLLDBApp) diff --git a/LLDBDebugger/codelite-lldb/LLDBNetworkServerThread.cpp b/LLDBDebugger/codelite-lldb/LLDBNetworkServerThread.cpp index 395474573e..aa824565c1 100644 --- a/LLDBDebugger/codelite-lldb/LLDBNetworkServerThread.cpp +++ b/LLDBDebugger/codelite-lldb/LLDBNetworkServerThread.cpp @@ -90,6 +90,10 @@ void* LLDBNetworkServerThread::Entry() case kCommandExpandVariable: m_app->CallAfter( &CodeLiteLLDBApp::ExpandVariable, command); break; + + case kCommandSelectFrame: + m_app->CallAfter( &CodeLiteLLDBApp::SelectFrame, command ); + break; default: break; diff --git a/LLDBDebugger/lldbdebugger-plugin.cpp b/LLDBDebugger/lldbdebugger-plugin.cpp index 3840cafa82..6e6416e278 100644 --- a/LLDBDebugger/lldbdebugger-plugin.cpp +++ b/LLDBDebugger/lldbdebugger-plugin.cpp @@ -341,9 +341,9 @@ void LLDBDebuggerPlugin::OnLLDBStarted(LLDBEvent& event) // instruct the debugger to 'Run' #ifdef __WXMSW__ - wxFileName fnTerminalOutout( wxFileName::GetTempDir(), "codelite-terminal.txt" ); + wxFileName fnTerminalOutout( wxFileName::GetTempDir(), "codelite-terminal.txt" ); #else - wxFileName fnTerminalOutout( "/tmp/codelite-terminal.txt" ); + wxFileName fnTerminalOutout( "/tmp/codelite-terminal.txt" ); #endif CL_DEBUG("Searching for terminal info file: %s", fnTerminalOutout.GetFullPath()); @@ -366,7 +366,7 @@ void LLDBDebuggerPlugin::OnLLDBStarted(LLDBEvent& event) DoCleanup(); return; } - + JSONRoot root( fnTerminalOutout ); wxString tty = root.toElement().namedObject("tty").toString(); m_terminalPID = root.toElement().namedObject("ProcessID").toInt(wxNOT_FOUND); @@ -376,6 +376,11 @@ void LLDBDebuggerPlugin::OnLLDBStarted(LLDBEvent& event) CL_DEBUG("CODELITE>> LLDB started"); wxCommandEvent e2(wxEVT_DEBUG_STARTED); EventNotifier::Get()->AddPendingEvent( e2 ); + + { + wxLogNull noLog; + ::wxRemoveFile( fnTerminalOutout.GetFullPath() ); + } } void LLDBDebuggerPlugin::OnLLDBStopped(LLDBEvent& event) @@ -426,6 +431,7 @@ void LLDBDebuggerPlugin::OnLLDBStopped(LLDBEvent& event) CL_DEBUG("Deleting all pending deletion breakpoints"); m_connector.DeleteBreakpoints(); m_connector.Continue(); + } } diff --git a/LiteEditor.workspace b/LiteEditor.workspace index 3319e99541..db685b7c0d 100644 --- a/LiteEditor.workspace +++ b/LiteEditor.workspace @@ -120,7 +120,7 @@ - + @@ -157,7 +157,7 @@ - +