Hi, OBF, see this post:
http://sourceware.org/ml/gdb-patches/2012-03/msg00823.html
I have some discussion with gdb developers, and after the line specification rewrite, the command break "filename:line" will not work anymore, can we use this command with out "quotes" like:
break "filename":line
or
break filename:line
I think it was easy to change in debugger plugin, right?
It this the only place I have to change? in file: gdb_commands.h
class GdbCmd_AddBreakpoint : public DebuggerCmd
{
DebuggerBreakpoint::Pointer m_BP;
public:
/** @param bp The breakpoint to set. */
GdbCmd_AddBreakpoint(DebuggerDriver* driver, DebuggerBreakpoint::Pointer bp)
: DebuggerCmd(driver),
m_BP(bp)
{
// gdb doesn't allow setting the bp number.
// instead, we must read it back in ParseOutput()...
m_BP->index = -1;
if (m_BP->enabled)
{
if (m_BP->type == DebuggerBreakpoint::bptCode)//m_BP->func.IsEmpty())
{
wxString out = m_BP->filename;
// we add one to line, because scintilla uses 0-based line numbers, while gdb uses 1-based
if (!m_BP->temporary)
m_Cmd << _T("break ");
else
m_Cmd << _T("tbreak ");
m_Cmd << _T('"') << out << _T(":") << wxString::Format(_T("%d"), m_BP->line) << _T('"');
Does "filename":line not make a lot more sense anyway, even now? That's assuming the current version supports that, of course.
If the present version supports this variant, I don't see why we should not use it. A line number should not contain anything that needs quoting, only a filename might. Insofar, only quoting the filename is a kind of sensible approach.
The gdb developer Keith strongly suggest that the line number should not be quoted.
This feature "filename":line does not exist in the current gdb CVS or 7.4 branch, but I guess they still need some test. (Currently, the new line specification has already pass all the gdb build-in tests)
Change our debugger branch code is quite simple. For the
Here is the patch:
Index: E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h
===================================================================
--- E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h (revision 7909)
+++ E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h (working copy)
@@ -131,7 +131,7 @@
// Breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reBreakpoint(_T("Breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
// Breakpoint 1 ("/home/jens/codeblocks-build/codeblocks-1.0svn/src/plugins/debuggergdb/gdb_commands.h:125) pending.
-static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\(\\\"(.+):([0-9]+)\\)[ \t]pending\\."));
+static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\((.+):([0-9]+)\\)[ \t]pending\\."));
// Hardware assisted breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reHWBreakpoint(_T("Hardware assisted breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
// Hardware watchpoint 1: expr
@@ -448,7 +448,7 @@
m_Cmd << _T("break ");
else
m_Cmd << _T("tbreak ");
- m_Cmd << _T('"') << out << _T(":") << wxString::Format(_T("%d"), m_BP->line) << _T('"');
+ m_Cmd << out << _T(":") << wxString::Format(_T("%d"), m_BP->line);
}
else if (m_BP->type == DebuggerBreakpoint::bptData)
{
This patch works under both the official gdb or the gdb-line-spec-branch.
For
It should also be quite easy to implement. :)
To my point: I think mostly quote is not needed. (I exclude the case that file name does not contain spaces :), I'm not sure gdb support this)
The quote was added because some people have their projects inside paths containing "code::blocks" and this is regarded as method/function specification.
Ok, thanks, here is the new test from command line(under c::b debugger plugin)
[debug]> break "E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain1.cpp":29
[debug]No source file named E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain1.cpp.
[debug]Breakpoint 6 ("E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain1.cpp":29) pending.
[debug]>>>>>>cb_gdb:
No source file named E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain1.cpp.
Breakpoint 6 ("E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain1.cpp":29) pending.
> break "E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp":35
[debug]> break "E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp":35
[debug]Breakpoint 7 at 0x684c1814: file E:\code\cb\test_code\DebugDLLTest\TestDLL\dllmain.cpp, line 35.
[debug]>>>>>>cb_gdb:
Breakpoint 7 at 0x684c1814: file E:\code\cb\test_code\DebugDLLTest\TestDLL\dllmain.cpp, line 35.
So, I'm now trying to adjust the reg. :)
So, I'm now trying to adjust the reg. :)
Good luck...
Thanks, Done. Here is the new regular expression and patch:
Index: E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h
===================================================================
--- E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h (revision 7909)
+++ E:/code/cb/cb_debugger_branch/src/plugins/debuggergdb/gdb_commands.h (working copy)
@@ -131,7 +131,7 @@
// Breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reBreakpoint(_T("Breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
// Breakpoint 1 ("/home/jens/codeblocks-build/codeblocks-1.0svn/src/plugins/debuggergdb/gdb_commands.h:125) pending.
-static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\(\\\"(.+):([0-9]+)\\)[ \t]pending\\."));
+static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\(\\\"(.+)\\\":([0-9]+)\\)[ \t]pending\\."));
// Hardware assisted breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reHWBreakpoint(_T("Hardware assisted breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
// Hardware watchpoint 1: expr
@@ -448,7 +448,7 @@
m_Cmd << _T("break ");
else
m_Cmd << _T("tbreak ");
- m_Cmd << _T('"') << out << _T(":") << wxString::Format(_T("%d"), m_BP->line) << _T('"');
+ m_Cmd << _T('"') << out << _T("\":") << wxString::Format(_T("%d"), m_BP->line);
}
else if (m_BP->type == DebuggerBreakpoint::bptData)
{
Please add a line which demonstrates what kind of lines matches the new regex, because I'm not really sure.
Here is what gdb7.4-gdb6.8 returned:
[debug]> break "E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/token.cpp:64"
[debug]No source file named E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/token.cpp.
[debug]Breakpoint 2 ("E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/token.cpp:64) pending.
Here is gdb cvs(7.5) returned:
[debug]> break "E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp:29"
[debug]No source file named E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp.
[debug]Breakpoint 4 ("E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp:29") pending.
You see, the gdb cvs has a quote before right-parenthesis, but gdb7.4-gdb6.8 does not.
Also your patch doesn't change the setting of breakpoints, why?
I don't think the old gdb( 7.4-6.8 ) will works under command like
So, I don't change the bp command send from c::b.
p.s. I guess you wanted to use preserve instead of deserve?
Thanks, It should be "preserve". (My English is not quite good :))
I'm not really sure about the number of \ in this. This is a copy paste from the second line in the regex testbed plugin.
The thing I want in there is (\"?), so it is clear that the " is optional.
I did further test, and I can confirm that
can be replaced by , everything works OK.
This is because is not a special character in regular expression.
I will commit the patch below if there is no objections in a few days.
Index: E:/code/cb/cb_trunk/src/plugins/debuggergdb/gdb_commands.h
===================================================================
--- E:/code/cb/cb_trunk/src/plugins/debuggergdb/gdb_commands.h (revision 7925)
+++ E:/code/cb/cb_trunk/src/plugins/debuggergdb/gdb_commands.h (working copy)
@@ -130,8 +130,11 @@
static wxRegEx reBT4(_T("#([0-9]+)[ \\t]+(.+)[ \\t]in[ \\t](.+)")); // case #11
// Breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reBreakpoint(_T("Breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
+// GDB7.4 and before will return:
// Breakpoint 1 ("/home/jens/codeblocks-build/codeblocks-1.0svn/src/plugins/debuggergdb/gdb_commands.h:125) pending.
-static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\(\\\"(.+):([0-9]+)\\)[ \t]pending\\."));
+// GDB7.5 and later will return:
+// Breakpoint 4 ("E:/code/cb/test_code/DebugDLLTest/TestDLL/dllmain.cpp:29") pending.
+static wxRegEx rePendingBreakpoint(_T("Breakpoint ([0-9]+)[ \t]\\(\"(.+):([0-9]+)(\"?)\\)[ \t]pending\\."));
// Hardware assisted breakpoint 1 at 0x4013d6: file main.cpp, line 8.
static wxRegEx reHWBreakpoint(_T("Hardware assisted breakpoint ([0-9]+) at (0x[0-9A-Fa-f]+)"));
// Hardware watchpoint 1: expr