This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/18742] New: In MI, breakpoint commands produce MI output instead of CLI


https://sourceware.org/bugzilla/show_bug.cgi?id=18742

            Bug ID: 18742
           Summary: In MI, breakpoint commands produce MI output instead
                    of CLI
           Product: gdb
           Version: 7.9
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: marc.khouzam at ericsson dot com
  Target Milestone: ---

Understandably, breakpoint commands can only be in CLI format.  This makes
sense to me as bp commands are something that the user creates, and therefore
are created in CLI format.

One would expect those CLI bp commands to always output in CLI format, but when
GDB is in MI mode, the output of bp commands is in MI format, which does not
make sense to a user.

I believe GDB should know it is running bp commands and therefore should force
them to be run in a CLI interpreter, even when the global interpreter is MI.

Below is cleaned up example of the problem:

> gdb.master -i mi testing/loopfirst
~"GNU gdb (GDB) 7.10.50.20150730-cvs\n"
(gdb) l
&"l\n"
~"1\t#include <unistd.h>\n"
~"2\t#include <stdio.h>\n"
~"3\t\n"
~"4\tint j = 0;\n"
~"5\t\n"
~"6\tint main() {\n"
~"7\t    int max = 900;\n"
~"8\t    for (int i=0;i<max;i++) {\n"
~"9\t        printf(\"i is %d\\n\",i);\n"
~"10\t        sleep(1);\n"
~"11\t    }\n"
~"12\t    return 0;\n"
~"13\t}\n"
^done
(gdb) 
-break-insert 10
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000400570",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10",thread-groups=["i1"],times="0",original-location="/home/lmckhou/testing/loopfirst.cc:10"}
(gdb) 
-break-commands 1 "i b"
^done
(gdb)i b
&"i b\n"
~"Num     Type           Disp Enb Address            What\n"
~"1       breakpoint     keep y   0x0000000000400570 in main() at
loopfirst.cc:10\n"
~"        i b\n"
^done
(gdb)
run
&"run\n"
~"Starting program: /home/lmckhou/testing/loopfirst \n"
=thread-group-started,id="i1",pid="7764"
=thread-created,id="1",group-id="i1"
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
^running
*running,thread-id="all"
(gdb) 
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000400570",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10",thread-groups=["i1"],times="1",script={"i
b"},original-location="/home/lmckhou/testing/loopfirst.cc:10"}
~"\nBreakpoint "
~"1, main () at loopfirst.cc:10\n"
~"10\t        sleep(1);\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000400570",func="main",args=[],file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10"},thread-id="1",stopped-threads="all",core="3"
(gdb) 

========> Notice no CLI printout for 'i b' when the bp is hit

========> I then simply press <enter> and below I get the output 
========> of 'i b' but in MI format!

&"\n"
^done,BreakpointTable={nr_rows="1",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="0x0000000000400570",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10",thread-groups=["i1"],times="1",script={"i
b"},original-location="/home/lmckhou/testing/loopfirst.cc:10"}]}
(gdb) 

======> Interestingly if I force the bp command to use a CLI interpreter
======> by wrapping it in "interpreter-exec console", things work

(gdb) 
-break-commands 1 "interpreter-exec console \"i b\""
^done
(gdb) 
i b
&"i b\n"
~"Num     Type           Disp Enb Address            What\n"
~"1       breakpoint     keep y   0x0000000000400570 in main() at
loopfirst.cc:10\n"
~"        interpreter-exec console \"i b\"\n"
^done
(gdb) 
c
&"c\n"
~"Continuing.\n"
^running
*running,thread-id="all"
(gdb) 
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000400570",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10",thread-groups=["i1"],times="2",script={"interpreter-exec
console \"i b\""},original-location="/home/lmckhou/testing/loopfirst.cc:10"}
~"\nBreakpoint "
~"1, main () at loopfirst.cc:10\n"
~"10\t        sleep(1);\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000400570",func="main",args=[],file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="10"},thread-id="1",stopped-threads="all",core="3"
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000000000400570 in main() at loopfirst.cc:10
        breakpoint already hit 2 times
        interpreter-exec console "i b"
~"(gdb) "
(gdb) 

======> Above we can see the CLI output of 'i b' when the bp is hit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]