This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
mi/2554: -break-list can produce non MI compliant output
- From: dodji at redhat dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 13 Nov 2008 12:39:55 -0000
- Subject: mi/2554: -break-list can produce non MI compliant output
- Reply-to: dodji at redhat dot com
>Number: 2554
>Category: mi
>Synopsis: -break-list can produce non MI compliant output
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 13 12:48:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: dodji@redhat.com
>Release: 6.8
>Organization:
>Environment:
GNU/Linux
>Description:
Suppose I am using gdb --interpreter=mi2 to debug a program with a .gdbinit that contains:
b info_command
commands
silent
return
end
Then I set a breakpoint in main, doing "-break-insert main".
When I do "-break-list", I get an MI output record that I believe is not MI compliant:
~=~
^done,BreakpointTable={nr_rows="3",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",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="0x000000000044f7d0",func="internal_error",file="utils.c",fullname="/home/dodji/devel/git/archer.git/gdb/utils.c",line="964",times="0"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x000000000048ec10",func="info_command",file=".././gdb/cli/cli-cmds.c",fullname="/home/dodji/devel/git/archer.git/gdb/cli/cli-cmds.c",line="198",times="0",script={"silent","return"}},bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000446ec0",func="main",file="gdb.c",fullname="/home/dodji/devel/git/archer.git/gdb/gdb.c",line="26",times="1"}]}
(gdb)
~=~
The part that is not MI compliant here is the result:
script={"silent", "return"}
I believe that is not a valid MI RESULT production, as defined by the grammar at http://sourceware.org/gdb/current/onlinedocs/gdb_26.html#SEC264.
A RESULT has the form:
VARIABLE "=" VALUE
where VALUE is either a CONST, a LIST, or a TUPLE.
In our case, the VALUE is {"silent", "return"}. This looks like a TUPLE because it starts with a '{', but alas it's not a TUPLE because a TUPLE should have the form:
"{}" | "{" RESULT ( "," RESULT )* "}"
where, again, RESULT has the form: VARIABLE "=" VALUE.
So, I think we should have script = ["silent", "return"] instead, where ["silent", "return"] is a LIST, not a TUPLE.
That would be at least compliant with the MI grammar, and save clients from twistint their MI parsers to make those understand non MI compliant constructs.
>From a quick first glance, it seems to appear that the function print_one_breakpoint_location() reads at some point:
script_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "script");
That could suggests the deliberate generation of a tuple here, where I believe it should be a LIST generation instead. Maybe that could be a starting point of investigation.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: