* [MI] -exec-return or CLI 'return' do not trigger MI events
@ 2010-02-11 19:50 Marc Khouzam
2010-02-12 10:29 ` Vladimir Prus
0 siblings, 1 reply; 5+ messages in thread
From: Marc Khouzam @ 2010-02-11 19:50 UTC (permalink / raw)
To: 'gdb@sourceware.org'
Hi,
I just noticed that GDB 7.0.1 does not issue MI events
*running and *stopped for the CLI 'return' command.
This is the relevant output, while the whole (small)
session is after.
(gdb) -exec-return
^done,frame={level="0",addr="0x08048412",func="foo",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="6"}
(gdb) return
&"return\n"
~"#0 main () at a.cc:9\n"
~"9\t return 0;\n"
^done
Do you want me to write a bug?
Thanks
Marc
~"GNU gdb (GDB) 7.0.1\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>...\n"
~"Reading symbols from /local/lmckhou/testing/a.out..."
~"done.\n"
(gdb)
l
&"l\n"
~"1\tvoid foo1() {\n"
~"2\t return;\n"
~"3\t}\n"
~"4\tvoid foo() {\n"
~"5\t foo1();\n"
~"6\t}\n"
~"7\tint main() {\n"
~"8\t foo();\n"
~"9\t return 0;\n"
~"10\t}\n"
^done
(gdb)
start
&"start\n"
~"Temporary breakpoint 1 at 0x8048422: file a.cc, line 8.\n"
~"Starting program: /local/lmckhou/testing/a.out \n"
=thread-group-created,id="2173"
=thread-created,id="1",group-id="2173"
^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="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libstdc++.so.6",host-name="/usr/lib/libstdc++.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-name="/lib/libm.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1",host-name="/lib/libgcc_s.so.1",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"
~"Temporary breakpoint 1, main () at a.cc:8\n"
~"8\t foo();\n"
*stopped,frame={addr="0x08048422",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="8"},thread-id="1",stopped-threads="all"
(gdb)
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"foo () at a.cc:5\n"
~"5\t foo1();\n"
*stopped,frame={addr="0x0804840d",func="foo",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="5"},thread-id="1",stopped-threads="all"
(gdb)
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"foo1 () at a.cc:3\n"
~"3\t}\n"
*stopped,frame={addr="0x08048407",func="foo1",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="3"},thread-id="1",stopped-threads="all"
(gdb)
-exec-return
^done,frame={level="0",addr="0x08048412",func="foo",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="6"}
(gdb)
return
&"return\n"
~"#0 main () at a.cc:9\n"
~"9\t return 0;\n"
^done
(gdb)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [MI] -exec-return or CLI 'return' do not trigger MI events
2010-02-11 19:50 [MI] -exec-return or CLI 'return' do not trigger MI events Marc Khouzam
@ 2010-02-12 10:29 ` Vladimir Prus
2010-02-12 10:54 ` Joel Brobecker
2010-02-12 15:33 ` Marc Khouzam
0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Prus @ 2010-02-12 10:29 UTC (permalink / raw)
To: gdb
Marc Khouzam wrote:
> Hi,
>
> I just noticed that GDB 7.0.1 does not issue MI events
> *running and *stopped for the CLI 'return' command.
> This is the relevant output, while the whole (small)
> session is after.
>
> (gdb) -exec-return
>
^done,frame={level="0",addr="0x08048412",func="foo",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="6"}
> (gdb) return
> &"return\n"
> ~"#0 main () at a.cc:9\n"
> ~"9\t return 0;\n"
> ^done
>
> Do you want me to write a bug?
For all I can tell, the 'return' command does not actually resume the target.
It just pops the stack.
- Volodya
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [MI] -exec-return or CLI 'return' do not trigger MI events
2010-02-12 10:29 ` Vladimir Prus
@ 2010-02-12 10:54 ` Joel Brobecker
2010-02-12 15:33 ` Marc Khouzam
1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2010-02-12 10:54 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb
> For all I can tell, the 'return' command does not actually resume the
> target. It just pops the stack.
I got caught by this tiny but important detail as well. But if you look
at the GDB User's manual, it's very explicit about it. Among many things,
it says:
The return command does not resume execution; it leaves the program
stopped in the state that would exist if the function had just returned.
In contrast, the finish command (see Continuing and Stepping) resumes
execution until the selected stack frame returns naturally.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [MI] -exec-return or CLI 'return' do not trigger MI events
2010-02-12 10:29 ` Vladimir Prus
2010-02-12 10:54 ` Joel Brobecker
@ 2010-02-12 15:33 ` Marc Khouzam
2010-02-12 15:37 ` Vladimir Prus
1 sibling, 1 reply; 5+ messages in thread
From: Marc Khouzam @ 2010-02-12 15:33 UTC (permalink / raw)
To: 'Vladimir Prus', 'gdb@sources.redhat.com'
> -----Original Message-----
> From: gdb-owner@sourceware.org
> [mailto:gdb-owner@sourceware.org] On Behalf Of Vladimir Prus
> Sent: Friday, February 12, 2010 5:28 AM
> To: gdb@sources.redhat.com
> Subject: Re: [MI] -exec-return or CLI 'return' do not trigger
> MI events
>
> Marc Khouzam wrote:
>
> > Hi,
> >
> > I just noticed that GDB 7.0.1 does not issue MI events
> > *running and *stopped for the CLI 'return' command.
> > This is the relevant output, while the whole (small)
> > session is after.
> >
> > (gdb) -exec-return
> >
> ^done,frame={level="0",addr="0x08048412",func="foo",args=[],fi
> le="a.cc",fullname="/local/lmckhou/testing/a.cc",line="6"}
> > (gdb) return
> > &"return\n"
> > ~"#0 main () at a.cc:9\n"
> > ~"9\t return 0;\n"
> > ^done
> >
> > Do you want me to write a bug?
>
> For all I can tell, the 'return' command does not actually
> resume the target.
> It just pops the stack.
Ok, but how does the frontend know the stack has been poped
and the editor should show a new line?
When we use GDB 7.0 we only listen for MI events to update the
frontend data.
I'll have to fix this for '-exec-return' anyway to support
GDB 7.0, but with respect to GDB itself, aren't we missing
some MI event then?
Thanks
Marc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [MI] -exec-return or CLI 'return' do not trigger MI events
2010-02-12 15:33 ` Marc Khouzam
@ 2010-02-12 15:37 ` Vladimir Prus
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Prus @ 2010-02-12 15:37 UTC (permalink / raw)
To: Marc Khouzam; +Cc: 'gdb@sources.redhat.com'
On Friday 12 February 2010 18:33:28 Marc Khouzam wrote:
> > -----Original Message-----
> > From: gdb-owner@sourceware.org
> > [mailto:gdb-owner@sourceware.org] On Behalf Of Vladimir Prus
> > Sent: Friday, February 12, 2010 5:28 AM
> > To: gdb@sources.redhat.com
> > Subject: Re: [MI] -exec-return or CLI 'return' do not trigger
> > MI events
> >
> > Marc Khouzam wrote:
> >
> > > Hi,
> > >
> > > I just noticed that GDB 7.0.1 does not issue MI events
> > > *running and *stopped for the CLI 'return' command.
> > > This is the relevant output, while the whole (small)
> > > session is after.
> > >
> > > (gdb) -exec-return
> > >
> > ^done,frame={level="0",addr="0x08048412",func="foo",args=[],fi
> > le="a.cc",fullname="/local/lmckhou/testing/a.cc",line="6"}
> > > (gdb) return
> > > &"return\n"
> > > ~"#0 main () at a.cc:9\n"
> > > ~"9\t return 0;\n"
> > > ^done
> > >
> > > Do you want me to write a bug?
> >
> > For all I can tell, the 'return' command does not actually
> > resume the target.
> > It just pops the stack.
>
> Ok, but how does the frontend know the stack has been poped
> and the editor should show a new line?
I think it has to special-case the '-exec-return' command. Note that
the new stack is reported as the result.
> When we use GDB 7.0 we only listen for MI events to update the
> frontend data.
>
> I'll have to fix this for '-exec-return' anyway to support
> GDB 7.0, but with respect to GDB itself, aren't we missing
> some MI event then?
I don't know any other command like that, so special-casing
-exec-return is just as good as a new notification -- that
frontend has to specially support just as well.
- Volodya
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-12 15:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-11 19:50 [MI] -exec-return or CLI 'return' do not trigger MI events Marc Khouzam
2010-02-12 10:29 ` Vladimir Prus
2010-02-12 10:54 ` Joel Brobecker
2010-02-12 15:33 ` Marc Khouzam
2010-02-12 15:37 ` Vladimir Prus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox