|
From: Eran I. <no...@so...> - 2013-12-14 16:15:02
|
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 d1f188f23ede39b900f9f2a495d53802f5070b19 (commit)
from a3dcbfbbb5ac37da07bea26c12362ea42e063546 (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/d1f188f23ede39b900f9f2a495d53802f5070b19
commit d1f188f23ede39b900f9f2a495d53802f5070b19
Author: eran <era...@gm...>
Date: Sat Dec 14 18:14:35 2013 +0200
Make disabled breakpoints working properly
diff --git a/Debugger/dbgcmd.cpp b/Debugger/dbgcmd.cpp
index d600ab5..d9e882b 100644
--- a/Debugger/dbgcmd.cpp
+++ b/Debugger/dbgcmd.cpp
@@ -545,8 +545,8 @@ bool DbgCmdHandlerBp::ProcessOutput(const wxString &line)
// so the breakpoint ID will come in form of
// ^done,bkpt={number="2"....
// ^done,wpt={number="2"
- static wxRegEx reBreak (wxT("done,bkpt={number=\"([0-9]+)\""));
- static wxRegEx reWatch (wxT("done,wpt={number=\"([0-9]+)\""));
+ static wxRegEx reBreak(wxT("done,bkpt={number=\"([0-9]+)\""));
+ static wxRegEx reWatch(wxT("done,wpt={number=\"([0-9]+)\""));
wxString number;
long breakpointId(wxNOT_FOUND);
@@ -568,7 +568,7 @@ bool DbgCmdHandlerBp::ProcessOutput(const wxString &line)
m_observer->UpdateBpAdded(m_bp.internal_id, breakpointId);
if (breakpointId == wxNOT_FOUND) {
- return true; // If the bp wasn't matched, the most likely reason is that bp creation failed. So don't say it worked
+ return true; // If the bp wasn't matched, the most likely reason is that bp creation failed. So don't say it worked
}
wxString msg;
@@ -610,11 +610,11 @@ bool DbgCmdHandlerBp::ProcessOutput(const wxString &line)
msg << m_bp.lineno;
}
}
-
+
m_observer->UpdateAddLine(msg);
return true;
}
-
+
bool DbgCmdHandlerLocals::ProcessOutput(const wxString &line)
{
LocalVariables locals;
diff --git a/Debugger/dbgcmd.h b/Debugger/dbgcmd.h
index 4353d13..e46166c 100644
--- a/Debugger/dbgcmd.h
+++ b/Debugger/dbgcmd.h
@@ -184,15 +184,16 @@ class DbgCmdHandlerBp : public DbgCmdHandler
std::vector< BreakpointInfo > *m_bplist;
int m_bpType; // BP_type_break by default
DbgGdb* m_debugger;
-
+
public:
DbgCmdHandlerBp(IDebuggerObserver *observer, DbgGdb *debugger, BreakpointInfo bp, std::vector< BreakpointInfo > *bplist, int bptype = BP_type_break)
: DbgCmdHandler(observer)
, m_bp(bp)
, m_bplist(bplist)
, m_bpType(bptype)
- , m_debugger(debugger) {}
-
+ , m_debugger(debugger)
+ {}
+
virtual ~DbgCmdHandlerBp() {}
virtual bool ProcessOutput(const wxString &line);
virtual bool WantsErrors() const {
diff --git a/Debugger/debuggergdb.cpp b/Debugger/debuggergdb.cpp
index 673408a..65eb7cf 100644
--- a/Debugger/debuggergdb.cpp
+++ b/Debugger/debuggergdb.cpp
@@ -380,7 +380,13 @@ bool DbgGdb::Break( const BreakpointInfo& bp )
default:
// Should be standard breakpts. But if someone tries to make an ignored temp bp
// it won't have the BP_type_tempbreak type, so check again here
- command = ( bp.is_temp ? breakinsertcmd + wxT("-t ") : breakinsertcmd );
+ command << breakinsertcmd;
+ if ( bp.is_temp ) {
+ command << " -t ";
+ }
+ if ( !bp.is_enabled ) {
+ command << " -d ";
+ }
break;
}
@@ -424,7 +430,8 @@ bool DbgGdb::Break( const BreakpointInfo& bp )
gdbCommand << command << condition << ignoreCounnt << breakWhere;
// execute it
- return WriteCommand( gdbCommand, new DbgCmdHandlerBp( m_observer, this, bp, &m_bpList, bp.bp_type ) );
+ DbgCmdHandlerBp* dbgCommandHandler = new DbgCmdHandlerBp( m_observer, this, bp, &m_bpList, bp.bp_type );
+ return WriteCommand( gdbCommand, dbgCommandHandler);
}
bool DbgGdb::SetIgnoreLevel( const int bid, const int ignorecount )
diff --git a/Interfaces/debugger.h b/Interfaces/debugger.h
index 908dc8b..f4eada0 100644
--- a/Interfaces/debugger.h
+++ b/Interfaces/debugger.h
@@ -163,6 +163,17 @@ typedef std::vector<DisassembleEntry> DisassembleEntryVec_t;
class BreakpointInfo: public SerializedObject
{
public:
+ class PredicateByFileAndLine {
+ wxString m_filename;
+ int m_line;
+ public:
+ PredicateByFileAndLine(const wxString &file, int line) : m_filename(file), m_line(line) {}
+ bool operator()(const BreakpointInfo& bp) const {
+ return m_filename == bp.file && m_line == bp.lineno;
+ }
+ };
+
+public:
// Where the bp is: file/lineno, function name (e.g. main()) or the memory location
wxString file;
int lineno;
@@ -211,17 +222,18 @@ public:
}
}
- BreakpointInfo() : lineno(-1), regex(false), debugger_id(-1), bp_type(BP_type_break),
+ BreakpointInfo() : lineno(-1), regex(false), internal_id(wxNOT_FOUND), debugger_id(wxNOT_FOUND), bp_type(BP_type_break),
ignore_number(0), is_enabled(true), is_temp(false), watchpoint_type(WP_watch), origin(BO_Other) {}
-// BreakpointInfo(const BreakpointInfo& BI ) {
-// *this = BI;
-// }
-
bool IsConditional() {
return ! conditions.IsEmpty();
}
-
+
+ int GetId() const {
+ int best_id = (this->debugger_id == -1 ? this->internal_id : this->debugger_id );
+ return best_id;
+ }
+
void Create(wxString filename, int line, int int_id, int ext_id = -1) {
wxFileName fn(filename);
fn.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_LONG);
@@ -261,7 +273,11 @@ public:
&& (ignore_number == BI.ignore_number) && (conditions == BI.conditions) && (commandlist == BI.commandlist) && (is_temp == BI.is_temp)
&& (bp_type==BP_type_watchpt ? (watchpoint_type == BI.watchpoint_type) : true) && (!function_name.IsEmpty() ? (regex == BI.regex) : true));
}
-
+
+ bool IsNull() const {
+ return internal_id == wxNOT_FOUND && debugger_id == wxNOT_FOUND;
+ }
+
protected:
// SerializedObject interface
virtual void Serialize(Archive& arch) {
diff --git a/LiteEditor/LiteEditor.project b/LiteEditor/LiteEditor.project
index f9f9b4c..d367c68 100644
--- a/LiteEditor/LiteEditor.project
+++ b/LiteEditor/LiteEditor.project
@@ -1325,7 +1325,7 @@ resources.cpp: resources.xrc
<Library Value="liblibclang.dll"/>
</Linker>
<ResourceCompiler Options="$(shell wx-config --rcflags)" Required="yes"/>
- <General OutputFile="$(IntermediateDirectory)/codelite-dbg.exe" IntermediateDirectory="./Debug" Command="./codelite-dbg.exe" CommandArguments="-b ." UseSeparateDebugArgs="yes" DebugArguments="-b . --no-plugins" WorkingDirectory="../Runtime " PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
+ <General OutputFile="$(IntermediateDirectory)/codelite-dbg.exe" IntermediateDirectory="./Debug" Command="./codelite-dbg.exe" CommandArguments="-b . --no-plugins" UseSeparateDebugArgs="yes" DebugArguments="-b . --no-plugins" WorkingDirectory="../Runtime " PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="Default" DbgSetName="">
<![CDATA[PATH=../sdk/clang/lib;$(WXWIN)\lib\gcc_dll;$(PATH)]]>
</Environment>
diff --git a/LiteEditor/breakpointsmgr.cpp b/LiteEditor/breakpointsmgr.cpp
index 8bb5bc8..a4d94e2 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("")*/, const bool is_temp/*=false*/)
+bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions/*=wxT("")*/, const bool is_temp, bool is_disabled)
{
BreakpointInfo bp;
bp.Create(file, lineno, GetNextID());
@@ -50,7 +50,9 @@ bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, c
if (is_temp) {
bp.bp_type = BP_type_tempbreak;
bp.is_temp = true;
- }
+
+ }
+ bp.is_enabled = !is_disabled;
bp.conditions = conditions;
return AddBreakpoint(bp);
}
@@ -78,22 +80,13 @@ bool BreakptMgr::AddBreakpoint(const BreakpointInfo &bp)
BreakpointInfo newBreakpoint(bp);
SetBestBPType(newBreakpoint);
-
- bool alreadyExist(false);
- for(size_t i=0; i<m_bps.size(); i++) {
- if(newBreakpoint == m_bps.at(i)) {
- // this breakpoint already exist
- alreadyExist = true;
- break;
- }
- }
-
- // Add this breakpoint to the list only if it does not already exist
- // in the breakpoint list
- if( !alreadyExist ) {
- m_bps.push_back(newBreakpoint);
+
+ BreakpointInfoVec_t::const_iterator iter = std::find(m_bps.begin(), m_bps.end(), newBreakpoint);
+ if ( iter == m_bps.end() ) {
+ // new breakpoint
+ m_bps.push_back( newBreakpoint );
}
-
+
DeleteAllBreakpointMarkers();
RefreshBreakpointMarkers();
return true;
@@ -136,40 +129,30 @@ void BreakptMgr::GetBreakpoints(std::vector<BreakpointInfo> &li)
}
// Get all known breakpoints for this line/file
-unsigned int BreakptMgr::GetBreakpoints(std::vector<BreakpointInfo>& li, const wxString &fileName, const int lineno)
+BreakpointInfo& BreakptMgr::GetBreakpoint(const wxString &fileName, const int lineno)
{
- li.clear();
wxFileName fn(fileName);
fn.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_LONG);
- std::vector<BreakpointInfo>::iterator iter = m_bps.begin();
- for (; iter != m_bps.end(); iter++) {
- BreakpointInfo b = *iter;
- if ( (b.lineno == lineno) && (b.file == fn.GetFullPath()) ) {
- li.push_back(b);
- }
+ BreakpointInfoVec_t::iterator iter = std::find_if(m_bps.begin(), m_bps.end(), BreakpointInfo::PredicateByFileAndLine(fn.GetFullPath(), lineno));
+ if ( iter == m_bps.end() ) {
+ static BreakpointInfo empty;
+ return empty;
}
- return li.size();
+ return *iter;
}
-// Try to find a breakpoint on this line/file to match the data
-// Returns whether >0 was found, with matches stored in the vector
-bool BreakptMgr::GetMatchingBreakpoints(std::vector<BreakpointInfo>& li, const wxString &fileName, const int lineno, enum BreakpointType bp_type)
+const BreakpointInfo& BreakptMgr::GetBreakpoint(const wxString &fileName, const int lineno) const
{
- std::vector<BreakpointInfo> allonline; // Start by finding all on the line
- if ( ! GetBreakpoints(allonline, fileName, lineno) ) {
- return false;
- }
+ wxFileName fn(fileName);
+ fn.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_LONG);
- li.clear();
- std::vector<BreakpointInfo>::iterator iter = allonline.begin();
- for (; iter != allonline.end(); ++iter) { // Now add the matching ones to li
- BreakpointInfo b = *iter;
- if (b.bp_type == bp_type) {
- li.push_back(b);
- }
+ BreakpointInfoVec_t::const_iterator iter = std::find_if(m_bps.begin(), m_bps.end(), BreakpointInfo::PredicateByFileAndLine(fn.GetFullPath(), lineno));
+ if ( iter == m_bps.end() ) {
+ static BreakpointInfo empty;
+ return empty;
}
- return ! li.empty();
+ return *iter;
}
wxString BreakptMgr::GetTooltip(const wxString& fileName, const int lineno)
@@ -178,51 +161,49 @@ wxString BreakptMgr::GetTooltip(const wxString& fileName, const int lineno)
return wxEmptyString;
}
- std::vector<BreakpointInfo> li;
- GetBreakpoints(li, fileName, lineno);
+ const BreakpointInfo &bp = GetBreakpoint(fileName, lineno);
+ if ( bp.IsNull() ) {
+ return wxEmptyString;
+ }
wxString tooltip;
- std::vector<BreakpointInfo>::iterator iter = li.begin();
- for (; iter != li.end(); ++iter) {
-
- if (! tooltip.IsEmpty()) {
- tooltip << wxT("<hr>");
- }
-
- int id = (iter->debugger_id > 0 ? iter->debugger_id : iter->internal_id - FIRST_INTERNAL_ID);
- tooltip << _("<b>Breakpoint: ") << id << _("</b>\n");
-
- bool isSimple = true;
- if (iter->is_temp) {
- tooltip << _("Temporary \n");
- isSimple = false;
- }
-
- if (! iter->is_enabled) {
- tooltip << _(" (disabled)\n");
- isSimple = false;
- }
-
- if (iter->ignore_number > 0) {
- tooltip << wxString::Format(_("Ignore-count = %u\n"), iter->ignore_number);
- isSimple = false;
- }
+ if (! tooltip.IsEmpty()) {
+ tooltip << wxT("<hr>");
+ }
+
+ int id = (bp.debugger_id > 0 ? bp.debugger_id : bp.internal_id - FIRST_INTERNAL_ID);
+ tooltip << _("<b>Breakpoint: ") << id << _("</b>\n");
+
+ bool isSimple = true;
+ if (bp.is_temp) {
+ tooltip << _("Temporary \n");
+ isSimple = false;
+ }
+
+ if (! bp.is_enabled) {
+ tooltip << _(" (disabled)\n");
+ isSimple = false;
+ }
+
+ if (bp.ignore_number > 0) {
+ tooltip << wxString::Format(_("Ignore-count = %u\n"), bp.ignore_number);
+ isSimple = false;
+ }
- if (! iter->conditions.IsEmpty()) {
- tooltip << wxString::Format(_("Condition:\n<code>%s</code>\n"), iter->conditions.c_str());
- isSimple = false;
- }
+ if (! bp.conditions.IsEmpty()) {
+ tooltip << wxString::Format(_("Condition:\n<code>%s</code>\n"), bp.conditions.c_str());
+ isSimple = false;
+ }
- if (! iter->commandlist.IsEmpty()) {
- tooltip << wxString::Format(_("Commands:\n<code>%s</code>\n"), iter->commandlist.c_str());
- isSimple = false;
- }
-
- if ( isSimple ) {
- tooltip << _("Normal breakpoint\n");
- }
+ if (! bp.commandlist.IsEmpty()) {
+ tooltip << wxString::Format(_("Commands:\n<code>%s</code>\n"), bp.commandlist.c_str());
+ isSimple = false;
}
+ if ( isSimple ) {
+ tooltip << _("Normal breakpoint\n");
+ }
+
tooltip.Trim().Trim(false);
return tooltip;
}
@@ -364,22 +345,6 @@ void BreakptMgr::DebuggerStopped()
DoRemoveDuplicateBreakpoints();
}
-// Since a bp can't be created disabled, disable any here once the debugger is started
-void BreakptMgr::DisableAnyDisabledBreakpoints()
-{
- IDebugger* dbgr = DebuggerMgr::Get().GetActiveDebugger();
- if (!(dbgr && dbgr->IsRunning())) {
- return;
- }
-
- for (size_t i=0; i<m_bps.size(); i++) {
- BreakpointInfo& bp = m_bps.at(i);
- if (bp.is_enabled == false) {
- dbgr->SetEnabledState(bp.debugger_id, false);
- }
- }
-}
-
bool BreakptMgr::DelBreakpoint(const int id)
{
int index = FindBreakpointById(id, m_bps);
@@ -417,20 +382,16 @@ bool BreakptMgr::DelBreakpoint(const int id)
int BreakptMgr::DelBreakpointByLineno(const wxString& file, const int lineno)
{
- std::vector<BreakpointInfo> allOnLine; // Start by finding all on the line
- if ( ! GetBreakpoints(allOnLine, file, lineno) ) {
- return BP_type_none;
+ const BreakpointInfo& bp = GetBreakpoint(file, lineno);
+ if ( bp.IsNull() ) {
+ return false;
}
- for(size_t i=0; i<allOnLine.size(); i++) {
- BreakpointInfo bp = allOnLine[i];
- int bpId = (bp.debugger_id == -1 ? bp.internal_id : bp.debugger_id );
-
- if(bpId == wxID_CANCEL || bpId == BP_type_none)
- continue;
+ int bpId = bp.GetId();
+ if(bpId == wxID_CANCEL || bpId == BP_type_none)
+ return false;
- DelBreakpoint(bpId);
- }
+ DelBreakpoint(bpId);
return true;
}
@@ -524,32 +485,6 @@ void BreakptMgr::SetAllBreakpointsEnabledState(bool enabled)
}
}
-// Toggle a breakpoint's enabled state
-bool BreakptMgr::ToggleEnabledStateByLineno(const wxString& file, const int lineno)
-{
- wxString msg(_("Select the breakpoint that you want to alter"));
- int bid = GetDesiredBreakpointIfMultiple(file, lineno, msg);
- if (bid == wxID_CANCEL || bid == BP_type_none) {
- return false;
- }
-
- int index = FindBreakpointById(bid, m_bps);
-
- // sanity
- if (index < 0 || index >= (int)m_bps.size()) {
- wxLogMessage(wxT("ToggleEnabledStateByLineno(): Insane index"));
- return false;
- }
-
- if (! SetBPEnabledState(bid, !m_bps.at(index).is_enabled)) {
- return false;
- }
-
- m_bps.at(index).is_enabled = ! m_bps.at(index).is_enabled;
- RefreshBreakpointMarkers();
- return true;
-}
-
// The debugger labels each breakpoint with an id and passes it here via Manager::UpdateBpAdded.
// By storing it as BreakpointInfo::debugger_id, we can be certain that this bp refers to the gdb breakpoint
void BreakptMgr::SetBreakpointDebuggerID(const int internal_id, const int debugger_id)
@@ -594,45 +529,40 @@ void BreakptMgr::SetBreakpointDebuggerID(const int internal_id, const int debugg
// Set a breakpoint's ignore count
bool BreakptMgr::IgnoreByLineno(const wxString& file, const int lineno)
{
- wxString msg(_("Select the breakpoint to have its ignore-count changed"));
- int bid = GetDesiredBreakpointIfMultiple(file, lineno, msg);
- if (bid == wxID_CANCEL || bid == BP_type_none) {
- return false;
- }
-
- int index = FindBreakpointById(bid, m_bps);
-
- // sanity
- if (index < 0 || index >= (int)m_bps.size()) {
- wxLogMessage(wxT("IgnoreByLineno(): Insane index"));
+ BreakpointInfo &bp = GetBreakpoint(file, lineno);
+ if ( bp.IsNull() ) {
return false;
}
-
- BreakpointInfo bp = m_bps.at(index);
+
if (bp.bp_type == BP_type_invalid) {
return false;
}
- long newvalue = wxGetNumberFromUser( _("Please enter the new ignore-count"), wxT(""), _("Set ignore-count"), bp.ignore_number, 0, 1000000);
+ long newvalue = ::wxGetNumberFromUser( _("Please enter the new ignore-count"), wxT(""), _("Set ignore-count"), bp.ignore_number, 0, 1000000);
if ((newvalue == -1) || (newvalue == (long)bp.ignore_number)) {
return false;
}
- if (! SetBPIgnoreCount(bid, newvalue)) {
+ if (! SetBPIgnoreCount(bp.GetId(), newvalue)) {
return false;
}
- m_bps.at(index).ignore_number = newvalue;
+ bp.ignore_number = newvalue;
... 510 lines suppressed ...
hooks/post-receive
--
codelite
|