This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add fullname field for MI -break-info command
Bob Rossi wrote:
> On Tue, Jan 24, 2006 at 07:32:15PM +0300, Vladimir Prus wrote:
>>
>> Hello!
>>
>> The attached patch adds the "fullname" field to the output of MI
>> -break-info command.
>
> The patch seems good to me at first glance. However, you should also
> update the testsuite, and send in the patch for that as well.
>
> Also, don't forget about the documentation.
Revised patch attached. I did verify that it causes no regressions for MI
tests.
Note, however, that I could not verify that it does not cause any
regressions globally, because something seems wrong with my configuration
or the test system. Sporadically, I get errors like this:
Running ../.././gdb/testsuite/gdb.base/code-expr.exp ...
gdb compile failed, spawn failed
WARNING: Testcase compile failed, so all tests in this file will
automatically fail.
WARNING: remote_expect statement without a default case?!
ERROR: couldn't
load /space/p2/ghost/build/gdb/gdb/testsuite/gdb.base/cvexpr
into /space/p2/ghost/build/gdb/gdb/testsuite/../../gdb/gdb (end of file).
FAIL: gdb.base/code-expr.exp: set print address off
Or messages like:
gdb compile failed, gcc: fork: Resource temporarily unavailable
When running specific tests, the errors don't reproduce. Sometimes the
errors disappear by themself. So, it looks like testsystem needs more
resources (pids?) than is allowed by rlimit or something like that.
- Volodya
? testsuite/gdb.mi/A.diff
? testsuite/gdb.mi/B.diff
? testsuite/gdb.mi/Makefile
? testsuite/gdb.mi/basics
? testsuite/gdb.mi/gdb.log
? testsuite/gdb.mi/gdb.sum
? testsuite/gdb.mi/gdb669-pthreads
? testsuite/gdb.mi/gdb701
? testsuite/gdb.mi/gdb792
? testsuite/gdb.mi/mi-console
? testsuite/gdb.mi/mi-pthreads
? testsuite/gdb.mi/mi-read-memory
? testsuite/gdb.mi/mi-stack
? testsuite/gdb.mi/mi-syn-frame
? testsuite/gdb.mi/mi-var-child
? testsuite/gdb.mi/mi2-pthreads
? testsuite/gdb.mi/testrun.log
? testsuite/gdb.mi/testrun.sum
? testsuite/gdb.mi/until
? testsuite/gdb.mi/var-cmd
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.220
diff -u -r1.220 breakpoint.c
--- breakpoint.c 16 Jan 2006 12:55:18 -0000 1.220
+++ breakpoint.c 28 Jan 2006 13:05:38 -0000
@@ -3506,6 +3506,22 @@
}
ui_out_field_string (uiout, "file", b->source_file);
ui_out_text (uiout, ":");
+
+ if (ui_out_is_mi_like_p (uiout))
+ {
+ if (b->loc->loc_type == bp_loc_software_breakpoint
+ || b->loc->loc_type == bp_loc_hardware_breakpoint)
+ {
+ struct symtab_and_line sal = find_pc_line (b->loc->address, 0);
+ char* fullname = symtab_to_fullname (sal.symtab);
+
+ if (fullname)
+ {
+ ui_out_field_string (uiout, "fullname", fullname);
+ }
+ }
+ }
+
ui_out_field_int (uiout, "line", b->line_number);
}
else if (b->pending)
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.309
diff -u -r1.309 gdb.texinfo
--- doc/gdb.texinfo 23 Jan 2006 16:28:37 -0000 1.309
+++ doc/gdb.texinfo 28 Jan 2006 13:05:40 -0000
@@ -17588,7 +17588,7 @@
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
+addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c"line="5",times="0",
ignore="3"@}]@}
(@value{GDBP})
@end smallexample
@@ -17636,7 +17636,7 @@
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
+addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",line="5",cond="1",
times="0",ignore="3"@}]@}
(@value{GDBP})
@end smallexample
@@ -17708,7 +17708,7 @@
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",line="5",times="0"@}]@}
(@value{GDBP})
@end smallexample
@@ -17743,7 +17743,7 @@
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",line="5",times="0"@}]@}
(@value{GDBP})
@end smallexample
@@ -17849,9 +17849,9 @@
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
+addr="0x0001072c", func="main",file="recursive2.c",fullname="/home/foo/recursive2.c,"line="4",times="0"@},
bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
-addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
+addr="0x00010774",func="foo",file="recursive2.c",fullname="/home/foo/recursive2.c",line="11",times="0"@}]@}
(@value{GDBP})
-break-insert -r foo.*
~int foo(int, int);
@@ -17911,7 +17911,7 @@
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
+addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",line="13",times="0"@}]@}
(@value{GDBP})
@end smallexample
@@ -18021,7 +18021,7 @@
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",times="1"@},
bkpt=@{number="2",type="watchpoint",disp="keep",
enabled="y",addr="",what="C",times="0"@}]@}
(@value{GDBP})
@@ -18043,7 +18043,7 @@
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
bkpt=@{number="2",type="watchpoint",disp="keep",
enabled="y",addr="",what="C",times="-5"@}]@}
(@value{GDBP})
@@ -18065,7 +18065,7 @@
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
(@value{GDBP})
@end smallexample
Index: testsuite/gdb.mi/mi-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-break.exp,v
retrieving revision 1.7
diff -u -r1.7 mi-break.exp
--- testsuite/gdb.mi/mi-break.exp 13 Aug 2004 16:21:29 -0000 1.7
+++ testsuite/gdb.mi/mi-break.exp 28 Jan 2006 13:05:40 -0000
@@ -56,6 +56,8 @@
set line_main_head [gdb_get_line_number "main ("]
set line_main_body [expr $line_main_head + 2]
+set fullname "fullname=\"${fullname_syntax}${srcfile}\""
+
proc test_tbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
@@ -65,6 +67,7 @@
global line_callee2_head line_callee2_body
global line_callee1_head line_callee1_body
global line_main_head line_main_body
+ global fullname
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -75,25 +78,27 @@
# -break-insert -t srcfile:$line_callee4_head
# -break-list
+
+
mi_gdb_test "222-break-insert -t main" \
- "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
+ "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}" \
"break-insert -t operation"
mi_gdb_test "333-break-insert -t basics.c:callee2" \
- "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
+ "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:callee2"
mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
- "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",${fullname},line=\"$line_callee3_head\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:\$line_callee3_body"
# Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",${fullname},line=\"$line_callee4_head\",times=\"0\"\}" \
"insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "666-break-list" \
- "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
+ "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
Index: testsuite/gdb.mi/mi2-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-break.exp,v
retrieving revision 1.3
diff -u -r1.3 mi2-break.exp
--- testsuite/gdb.mi/mi2-break.exp 13 Aug 2004 16:21:29 -0000 1.3
+++ testsuite/gdb.mi/mi2-break.exp 28 Jan 2006 13:05:40 -0000
@@ -56,6 +56,8 @@
set line_main_head [gdb_get_line_number "main ("]
set line_main_body [expr $line_main_head + 2]
+set fullname "fullname=\"${fullname_syntax}${srcfile}\""
+
proc test_tbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
@@ -65,6 +67,7 @@
global line_callee2_head line_callee2_body
global line_callee1_head line_callee1_body
global line_main_head line_main_body
+ global fullname
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -76,24 +79,24 @@
# -break-list
mi_gdb_test "222-break-insert -t main" \
- "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
+ "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}" \
"break-insert -t operation"
mi_gdb_test "333-break-insert -t basics.c:callee2" \
- "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
+ "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:callee2"
mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
- "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",${fullname},line=\"$line_callee3_head\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:\$line_callee3_body"
# Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
- "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",${fullname},line=\"$line_callee4_head\",times=\"0\"\}" \
"insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "666-break-list" \
- "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
+ "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
@@ -110,6 +113,7 @@
global line_callee2_head line_callee2_body
global line_callee1_head line_callee1_body
global line_main_head line_main_body
+ global fullname
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -122,27 +126,27 @@
setup_xfail "*-*-*"
mi_gdb_test "122-break-insert -r main" \
- "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
+ "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_main_body\"\}" \
"break-insert -r operation"
setup_xfail "*-*-*"
mi_gdb_test "133-break-insert -r callee2" \
- "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\}" \
+ "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\}" \
"insert breakpoint with regexp callee2"
setup_xfail "*-*-*"
mi_gdb_test "144-break-insert -r callee" \
- "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
+ "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \
"insert breakpoint with regexp callee"
setup_xfail "*-*-*"
mi_gdb_test "155-break-insert -r \.\*llee" \
- "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
+ "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \
"insert breakpoint with regexp .*llee"
setup_xfail "*-*-*"
mi_gdb_test "166-break-list" \
- "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
+ "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete" \