* GDB command "info source"
@ 2006-03-28 22:21 Nick Roberts
2006-03-29 1:23 ` Bob Rossi
0 siblings, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2006-03-28 22:21 UTC (permalink / raw)
To: gdb
Starting GNU gdb 6.4.50.20060325-cvs, I get the following:
nickrob/24 src/gdb/gdb -q myprog
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) help info source
Information about the current source file.
(gdb) info source
No current source file.
(gdb) b 10
Breakpoint 1 at 0x8048498: file myprog.c, line 10.
So GDB seems to assume myprog.c is current, but doesn't share that information
with the user until now...
(gdb) info source
Current source file is myprog.c
Compilation directory is /home/nickrob
Source language is c.
Compiled with DWARF 2 debugging format.
Includes preprocessor macro info.
In contrast using MI, GDB does yield this information immediately:
nickrob/25 src/gdb/gdb -q -i=mi myprog
~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n"
(gdb)
-file-list-exec-source-file
^done,line="58",file="myprog.c",fullname="/home/nickrob/myprog.c"
(gdb)
Shouldn't "info source" do the same?
About -file-list-exec-source-file the manual says:
There's no GDB command which directly corresponds to this one.
but apart from this difference, they seem pretty similar. Also
-file-list-exec-source-files could be likened to "info sources".
WDYT?
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GDB command "info source"
2006-03-28 22:21 GDB command "info source" Nick Roberts
@ 2006-03-29 1:23 ` Bob Rossi
2006-03-29 4:21 ` Nick Roberts
0 siblings, 1 reply; 4+ messages in thread
From: Bob Rossi @ 2006-03-29 1:23 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb
On Wed, Mar 29, 2006 at 09:59:35AM +1200, Nick Roberts wrote:
>
> Starting GNU gdb 6.4.50.20060325-cvs, I get the following:
>
> nickrob/24 src/gdb/gdb -q myprog
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
>
> (gdb) help info source
> Information about the current source file.
>
> (gdb) info source
> No current source file.
>
> (gdb) b 10
> Breakpoint 1 at 0x8048498: file myprog.c, line 10.
>
> So GDB seems to assume myprog.c is current, but doesn't share that information
> with the user until now...
>
> (gdb) info source
> Current source file is myprog.c
> Compilation directory is /home/nickrob
> Source language is c.
> Compiled with DWARF 2 debugging format.
> Includes preprocessor macro info.
>
>
> In contrast using MI, GDB does yield this information immediately:
>
> nickrob/25 src/gdb/gdb -q -i=mi myprog
> ~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n"
> (gdb)
> -file-list-exec-source-file
> ^done,line="58",file="myprog.c",fullname="/home/nickrob/myprog.c"
> (gdb)
Yes, that's because of this line
mi-cmd-file.c:72 set_default_source_symtab_and_line();
It's a special case for finding the default file. When using annotate 2,
I do 'info line' followed by 'info source'.
> Shouldn't "info source" do the same?
>
> About -file-list-exec-source-file the manual says:
>
> There's no GDB command which directly corresponds to this one.
>
> but apart from this difference, they seem pretty similar. Also
> -file-list-exec-source-files could be likened to "info sources".
>
> WDYT?
They are similar but not the same. So I don't know.
Bob Rossi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GDB command "info source"
2006-03-29 1:23 ` Bob Rossi
@ 2006-03-29 4:21 ` Nick Roberts
2006-03-29 4:35 ` Bob Rossi
0 siblings, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2006-03-29 4:21 UTC (permalink / raw)
To: Bob Rossi; +Cc: gdb
> > In contrast using MI, GDB does yield this information immediately:
> >
> > nickrob/25 src/gdb/gdb -q -i=mi myprog
> > ~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n"
> > (gdb)
> > -file-list-exec-source-file
> > ^done,line="58",file="myprog.c",fullname="/home/nickrob/myprog.c"
> > (gdb)
>
> Yes, that's because of this line
> mi-cmd-file.c:72 set_default_source_symtab_and_line();
>
> It's a special case for finding the default file. When using annotate 2,
> I do 'info line' followed by 'info source'.
That doesn't seem to work for me:
nickrob/47 src/gdb/gdb -q myprog
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) info line
No line number information available.
(gdb) info source
No current source file.
I do "list main" but that doesn't work for languages lik Ada.
> > Shouldn't "info source" do the same?
> >
> > About -file-list-exec-source-file the manual says:
> >
> > There's no GDB command which directly corresponds to this one.
> >
> > but apart from this difference, they seem pretty similar. Also
> > -file-list-exec-source-files could be likened to "info sources".
> >
> > WDYT?
>
> They are similar but not the same. So I don't know.
The same could be said for -stack-list-frames and backtrace,
-stack-list-locals and "info locals" etc.
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GDB command "info source"
2006-03-29 4:21 ` Nick Roberts
@ 2006-03-29 4:35 ` Bob Rossi
0 siblings, 0 replies; 4+ messages in thread
From: Bob Rossi @ 2006-03-29 4:35 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb
On Wed, Mar 29, 2006 at 11:55:19AM +1200, Nick Roberts wrote:
> > > In contrast using MI, GDB does yield this information immediately:
> > >
> > > nickrob/25 src/gdb/gdb -q -i=mi myprog
> > > ~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n"
> > > (gdb)
> > > -file-list-exec-source-file
> > > ^done,line="58",file="myprog.c",fullname="/home/nickrob/myprog.c"
> > > (gdb)
> >
> > Yes, that's because of this line
> > mi-cmd-file.c:72 set_default_source_symtab_and_line();
> >
> > It's a special case for finding the default file. When using annotate 2,
> > I do 'info line' followed by 'info source'.
>
> That doesn't seem to work for me:
>
> nickrob/47 src/gdb/gdb -q myprog
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
> (gdb) info line
> No line number information available.
> (gdb) info source
> No current source file.
>
> I do "list main" but that doesn't work for languages lik Ada.
Oops, I'm very sorry. I simply do 'list'. That works for C/C++ and kind
of works for ADA. By that I mean, it takes you to the 'main' function
instead of the function that ADA starts off at. You should look at what
GVD does, since it figures out what the starting ADA function is and it
uses annotate=1.
> > > Shouldn't "info source" do the same?
> > >
> > > About -file-list-exec-source-file the manual says:
> > >
> > > There's no GDB command which directly corresponds to this one.
> > >
> > > but apart from this difference, they seem pretty similar. Also
> > > -file-list-exec-source-files could be likened to "info sources".
> > >
> > > WDYT?
> >
> > They are similar but not the same. So I don't know.
>
> The same could be said for -stack-list-frames and backtrace,
> -stack-list-locals and "info locals" etc.
OK, if that's the case, then yes, I agree with you.
Bob Rossi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-29 1:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-28 22:21 GDB command "info source" Nick Roberts
2006-03-29 1:23 ` Bob Rossi
2006-03-29 4:21 ` Nick Roberts
2006-03-29 4:35 ` Bob Rossi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox