Is executing commands attached to breakpoints still a problem in MI ?

Maxim Grigoriev maxim@tensilica.com
Thu Apr 16 00:54:00 GMT 2009


Hello GDB community,

We used to have a problem, when commands attached to breakpoints
did not execute while running in MI mode. It looks like it's not fixed yet.

Am I correct ?

I built X86 FSF GDB and made an experiment :

 >>> cat t.c
#include <stdio.h>

int main()
{
  int i = 34;

  printf ("Hello, i =%d\n", i);
}

 >>> cat .gdbinit
break t.c:7
commands
echo I am here\n
continue
end

 >>> gcc --version -g t.c -o x86.exe
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)
. . . . . .

 >>> x86-fsf-gdb x86.exe
GNU gdb (GDB) 6.8.50.20090415-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
. . . . . .
Breakpoint 1 at 0x804839c: file t.c, line 7.
(gdb) run
Starting program: /home/maxim/W/BUGS/MI_DAVE/x86.exe

Breakpoint 1, main () at t.c:7
7         printf ("Hello, i =%d\n", i);
I am here
Hello, i =34

Program exited with code 015.
(gdb) q

 >>> cat MI_CMD
-interpreter-exec console echo
-gdb-show prompt
run
kill
-gdb-exit

 >>> x86-fsf-gdb x86.exe -i=mi2 <MI_CMD
~"GNU gdb (GDB) 6.8.50.20090415-cvs\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
. . . . . . . .
(gdb)
^done
(gdb)
^done,value="(gdb) "
(gdb)
&"run\n"
~"Starting program: /home/maxim/W/BUGS/MI_DAVE/x86.exe \n"
=thread-group-created,id="16396"
=thread-created,id="1",group-id="16396"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2",host-name="/lib/ld-linux.so.2",symbols-loaded="0"
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-name="/lib/libc.so.6",symbols-loaded="0"
~"\n"
~"Breakpoint 1, main () at t.c:7\n"
~"7\t  printf (\"Hello, i =%d\\n\", i);\n"
*stopped,frame={addr="0x0804839c",func="main",args=[],file="t.c",fullname="/home/maxim/W/BUGS/MI_DAVE/t.c",line="7"},thread-id="1",stopped-threads="all"
(gdb)
&"kill\n"
~"Kill the program being debugged? (y or n) [answered Y; input not from 
terminal]\n"
=thread-exited,id="1",group-id="16396"
=thread-group-exited,id="16396"
^done
(gdb)
^exit

Thanks,
-- Maxim




More information about the Gdb mailing list