From: Eran I. <no...@so...> - 2013-10-19 05:08:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "codelite". The branch, master has been updated via 5e97b0e5da3eb3743f3892559ca2daa4394d7dd4 (commit) from e2c61c38c2a5ef92889a88471a81040e54eba7b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceforge.net/p/codelite/codelitegit/ci/5e97b0e5da3eb3743f3892559ca2daa4394d7dd4 commit 5e97b0e5da3eb3743f3892559ca2daa4394d7dd4 Author: eran <era...@gm...> Date: Sat Oct 19 08:07:53 2013 +0300 Reverted disable breakpoints code which completly broke debugging under MSW. The following commits have been reverted: 297c8fe, 9084817, c40fe44, 0beeebf diff --git a/Debugger/debuggergdb.cpp b/Debugger/debuggergdb.cpp index 8827d7a..673408a 100644 --- a/Debugger/debuggergdb.cpp +++ b/Debugger/debuggergdb.cpp @@ -1290,6 +1290,9 @@ void DbgGdb::GetDebugeePID(const wxString& line) wxString msg; msg << wxT( ">> Debuggee process ID: " ) << m_debuggeePid; m_observer->UpdateAddLine( msg ); + + // Now there's a known pid, the debugger can be interrupted to let any to-be-disabled bps be disabled. So... + m_observer->DebuggerPidValid(); } } } diff --git a/Debugger/debuggergdb.h b/Debugger/debuggergdb.h index 5d33c85..1f91118 100644 --- a/Debugger/debuggergdb.h +++ b/Debugger/debuggergdb.h @@ -100,10 +100,6 @@ public: return m_break_at_main; } void GetDebugeePID(const wxString& line); - - bool HasValidDebugeePid() { - return m_debuggeePid > 0; - } void SetGoingDown(bool goingDown) { this->m_goingDown = goingDown; diff --git a/Interfaces/debugger.h b/Interfaces/debugger.h index 2d77840..908dc8b 100644 --- a/Interfaces/debugger.h +++ b/Interfaces/debugger.h @@ -640,11 +640,7 @@ public: * \brief return true of the debugger is currently running * \return true on success, false otherwise */ - virtual bool IsRunning() = 0; /** - * \brief return true if the debuggee pid is now known - * \return true if the debuggee pid > 0, false otherwise - */ - virtual bool HasValidDebugeePid() = 0; + virtual bool IsRunning() = 0; /** * \brief step to next line * \return true on success, false otherwise diff --git a/Interfaces/debuggerobserver.h b/Interfaces/debuggerobserver.h index 0a2c199..72c128f 100644 --- a/Interfaces/debuggerobserver.h +++ b/Interfaces/debuggerobserver.h @@ -78,7 +78,8 @@ enum DebuggerUpdateReason { DBG_UR_VAROBJUPDATE, // An update to variable object DBG_UR_FRAMEDEPTH, // Frame information DBG_UR_VARIABLEOBJUPDATEERR, // Variable object update error - DBG_UR_FUNCTIONFINISHED // Function execution finished, there might be a return value to display in the Locals view + DBG_UR_FUNCTIONFINISHED, // Function execution finished, there might be a return value to display in the Locals view + DBG_UR_DEBUGGER_PID_VALID // The debugger's pid is now known, so it's possible e.g. to interrupt it. Used for disabling bps }; enum UserReason { @@ -293,6 +294,15 @@ public: } /** + * @brief Tell the manager that the debugger is now interruptable + */ + void DebuggerPidValid() { + DebuggerEventData e; + e.m_updateReason = DBG_UR_DEBUGGER_PID_VALID; + DebuggerUpdate( e ); + } + + /** * @brief Tells the breakpoints-manager which breakpoint was just hit * @param The breakpoint's ID */ diff --git a/LiteEditor/breakpointsmgr.cpp b/LiteEditor/breakpointsmgr.cpp index 4683fed..8bb5bc8 100644 --- a/LiteEditor/breakpointsmgr.cpp +++ b/LiteEditor/breakpointsmgr.cpp @@ -42,7 +42,7 @@ bool BreakptMgr::AddBreakpointByAddress(const wxString& address) return AddBreakpoint(bp); } -bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions/*=wxT("")*/, bool is_temp/*=false*/, bool is_disabled/*=false*/) +bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions/*=wxT("")*/, const bool is_temp/*=false*/) { BreakpointInfo bp; bp.Create(file, lineno, GetNextID()); @@ -51,7 +51,6 @@ bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, c bp.bp_type = BP_type_tempbreak; bp.is_temp = true; } - bp.is_enabled = !is_disabled; bp.conditions = conditions; return AddBreakpoint(bp); } @@ -116,6 +115,10 @@ void BreakptMgr::AddBreakpoint() } if (AddBreakpoint(dlg.b)) { + IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger(); + if ((!dlg.b.is_enabled) && dbgr && dbgr->IsRunning()) { + SetBPEnabledState(dlg.b.debugger_id, dlg.b.is_enabled); + } wxString msg; if (dlg.b.bp_type == BP_type_watchpt) { msg = _("Watchpoint successfully added"); @@ -369,26 +372,12 @@ void BreakptMgr::DisableAnyDisabledBreakpoints() return; } - bool contIsNeeded = PauseDebuggerIfNeeded(); - for (size_t i=0; i<m_bps.size(); i++) { BreakpointInfo& bp = m_bps.at(i); if (bp.is_enabled == false) { - if (dbgr->SetEnabledState(bp.debugger_id, false)) { - ManagerST::Get()->UpdateAddLine(wxString::Format(_("Successfully disabled breakpoint %i"), bp.debugger_id)); - } else { - ManagerST::Get()->UpdateAddLine(wxString::Format(_("Failed to disable breakpoint %i"), bp.debugger_id)); - } - + dbgr->SetEnabledState(bp.debugger_id, false); } } - - if (contIsNeeded) { - dbgr->Continue(); - } - - // We only want to do this once, not every time the debugger restarts, so Unbind the event - wxTheApp->Unbind(wxEVT_DEBUG_EDITOR_LOST_CONTROL, wxCommandEventHandler(clMainFrame::OnDisableAnyDisabledBreakpoints), clMainFrame::Get()); } bool BreakptMgr::DelBreakpoint(const int id) @@ -503,39 +492,31 @@ void BreakptMgr::DelAllBreakpoints() void BreakptMgr::SetAllBreakpointsEnabledState(bool enabled) { - unsigned int successes = 0; - bool debuggerIsRunning = false; - bool contIsNeeded = false; - + // UpdateUI should prevent this from being called unless the debugger is running, but check anyway IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger(); if (dbgr && dbgr->IsRunning()) { - debuggerIsRunning = true; - contIsNeeded = PauseDebuggerIfNeeded(); - } + unsigned int successes = 0; + bool contIsNeeded = PauseDebuggerIfNeeded(); - for (size_t i=0; i<m_bps.size(); ++i) { - BreakpointInfo &bp = m_bps.at(i); - if (((bp.debugger_id != -1) || !debuggerIsRunning) // Sanity check for when the debugger's running - && (bp.is_enabled != enabled)) { // No point setting it to the current status - if (debuggerIsRunning) { + for (size_t i=0; i<m_bps.size(); ++i) { + BreakpointInfo &bp = m_bps.at(i); + if ((bp.debugger_id != -1) // Sanity + && (bp.is_enabled != enabled)) { // No point setting it to the current status if (dbgr->SetEnabledState(bp.debugger_id, enabled)) { bp.is_enabled = enabled; ++successes; } - } else { - bp.is_enabled = enabled; - ++successes; } } - } - if (debuggerIsRunning && contIsNeeded) { - dbgr->Continue(); - } + if (contIsNeeded) { + dbgr->Continue(); + } - if (successes) { - RefreshBreakpointMarkers(); - clMainFrame::Get()->GetDebuggerPane()->GetBreakpointView()->Initialize(); + if (successes) { + RefreshBreakpointMarkers(); + clMainFrame::Get()->GetDebuggerPane()->GetBreakpointView()->Initialize(); + } wxString msg = wxString::Format(wxT("%u "), successes); msg << (enabled ? _("breakpoints enabled") : _("breakpoints disabled")); @@ -602,17 +583,6 @@ void BreakptMgr::SetBreakpointDebuggerID(const int internal_id, const int debugg if (index != wxNOT_FOUND) { m_pendingBreakpointsList.erase(m_pendingBreakpointsList.begin()+index); } - // If the bp needs disabling, do so providing it's safe i.e. the debuggee pid is known (this happens after the first Poke() is processed) - if (!iter->is_enabled) { - IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger(); - if (dbgr && dbgr->IsRunning() && dbgr->HasValidDebugeePid()) { - if (SetBPEnabledState(debugger_id, false)) { - ManagerST::Get()->UpdateAddLine(wxString::Format(_("Successfully disabled breakpoint %i"), debugger_id)); - } else { - ManagerST::Get()->UpdateAddLine(wxString::Format(_("Failed to disable breakpoint %i"), debugger_id)); - } - } - } // update the UI as well clMainFrame::Get()->GetDebuggerPane()->GetBreakpointView()->Initialize(); return; @@ -1065,6 +1035,12 @@ void BreakptMgr::SetBreakpoints(const std::vector<BreakpointInfo>& bps) bool BreakptMgr::AreThereEnabledBreakpoints(bool enabled /*= true*/) { + IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger(); + if (!(dbgr && dbgr->IsRunning())) { + // No point playing with bp enablement when the debugger's not running + return false; + } + for (size_t i=0; i<m_bps.size(); ++i) { BreakpointInfo &bp = m_bps.at(i); if (bp.is_enabled == enabled) { diff --git a/LiteEditor/breakpointsmgr.h b/LiteEditor/breakpointsmgr.h index 5bd3299..7e038bb 100644 --- a/LiteEditor/breakpointsmgr.h +++ b/LiteEditor/breakpointsmgr.h @@ -174,9 +174,9 @@ public: /** * Add a breakpoint to the current debugger at the given line-number/file - * Depending on the parameters, a temporary/ignored/conditional/disabled/commandlist bp can be created + * Depending on the parameters, a temporary/ignored/conditional/commandlist bp can be created */ - bool AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions = wxT(""), bool is_temp = false, bool is_disabled = false); + bool AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions = wxT(""), const bool is_temp = false); /** * Add a breakpoint using the 'Properties' dialog diff --git a/LiteEditor/cl_editor.cpp b/LiteEditor/cl_editor.cpp index f17e74a..cc843a0 100644 --- a/LiteEditor/cl_editor.cpp +++ b/LiteEditor/cl_editor.cpp @@ -2949,9 +2949,12 @@ void LEditor::AddBreakpoint(int lineno /*= -1*/,const wxString& conditions/*=wxT } ManagerST::Get()->GetBreakpointsMgr()->SetExpectingControl(true); - if (!ManagerST::Get()->GetBreakpointsMgr()->AddBreakpointByLineno(GetFileName().GetFullPath(), lineno, conditions, is_temp, is_disabled)) { + if (!ManagerST::Get()->GetBreakpointsMgr()->AddBreakpointByLineno(GetFileName().GetFullPath(), lineno, conditions, is_temp)) { wxMessageBox(_("Failed to insert breakpoint")); } else { + if (is_disabled) { + ToggleBreakpointEnablement(); + } clMainFrame::Get()->GetDebuggerPane()->GetBreakpointView()->Initialize(); wxString message( _("Breakpoint successfully added") ), prefix; if (is_temp) { diff --git a/LiteEditor/frame.cpp b/LiteEditor/frame.cpp index 420eee4..f0f2548 100644 --- a/LiteEditor/frame.cpp +++ b/LiteEditor/frame.cpp @@ -3267,13 +3267,6 @@ void clMainFrame::OnDebuggerSettings(wxCommandEvent &e) dlg->Destroy(); } - -void clMainFrame::OnDisableAnyDisabledBreakpoints(wxCommandEvent &e) -{ - wxUnusedVar(e); - ManagerST::Get()->GetBreakpointsMgr()->DisableAnyDisabledBreakpoints(); -} - void clMainFrame::OnIdle(wxIdleEvent &e) { e.Skip(); diff --git a/LiteEditor/frame.h b/LiteEditor/frame.h index 4c5cb61..e413095 100644 --- a/LiteEditor/frame.h +++ b/LiteEditor/frame.h @@ -131,13 +131,11 @@ public: DockablePaneMenuManager *GetDockablePaneMenuManager() { return m_DPmenuMgr; } -//--------------------- debugger--------------------------------- +//--------------------- debuger--------------------------------- /** * @brief launch TTY */ wxString StartTTY(const wxString &title); - - void OnDisableAnyDisabledBreakpoints(wxCommandEvent& e); //--------------------------------------------------------------- diff --git a/LiteEditor/manager.cpp b/LiteEditor/manager.cpp index dcba422..75a3659 100644 --- a/LiteEditor/manager.cpp +++ b/LiteEditor/manager.cpp @@ -2301,6 +2301,9 @@ void Manager::DbgStart ( long attachPid ) // wont need to read from the XML each time perform 'next' step clMainFrame::Get()->GetDebuggerPane()->GetLocalsTable()->Initialize(); + // gdb can't cope with creating a BP already disabled, so disable any now + GetBreakpointsMgr()->DisableAnyDisabledBreakpoints(); + // let the active editor get the focus LEditor *editor = clMainFrame::Get()->GetMainBook()->GetActiveEditor(); if ( editor ) { @@ -2311,10 +2314,6 @@ void Manager::DbgStart ( long attachPid ) DebugMessage ( output ); DebugMessage ( _( "Debug session started successfully!\n" ) ); - // We need to tell the debugger to disable any disabled breakpoints, but not until it's running properly (too soon and it can't be successfully interrupted) - // So Bind the wxEVT_DEBUG_EDITOR_LOST_CONTROL event that will be sent by UpdateLostControl(). It'll be Unbound in the handler. - wxTheApp->Bind(wxEVT_DEBUG_EDITOR_LOST_CONTROL, wxCommandEventHandler(clMainFrame::OnDisableAnyDisabledBreakpoints), clMainFrame::Get()); - if ( dbgr->GetIsRemoteDebugging() ) { // debugging remote target @@ -3172,6 +3171,10 @@ void Manager::DebuggerUpdate(const DebuggerEventData& event) GetBreakpointsMgr()->ReconcileBreakpoints( event.m_bpInfoList ); break; + case DBG_UR_DEBUGGER_PID_VALID: + GetBreakpointsMgr()->DisableAnyDisabledBreakpoints(); + break; + case DBG_UR_BP_HIT: GetBreakpointsMgr()->BreakpointHit( event.m_bpDebuggerId ); break; ----------------------------------------------------------------------- Summary of changes: Debugger/debuggergdb.cpp | 3 ++ Debugger/debuggergdb.h | 4 -- Interfaces/debugger.h | 6 +--- Interfaces/debuggerobserver.h | 12 ++++++- LiteEditor/breakpointsmgr.cpp | 76 ++++++++++++++--------------------------- LiteEditor/breakpointsmgr.h | 4 +- LiteEditor/cl_editor.cpp | 5 ++- LiteEditor/frame.cpp | 7 ---- LiteEditor/frame.h | 4 +-- LiteEditor/manager.cpp | 11 ++++-- 10 files changed, 55 insertions(+), 77 deletions(-) hooks/post-receive -- codelite |