public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* MI: full file name
@ 2005-11-21 14:44 Vladimir Prus
  2005-11-21 14:46 ` Bob Rossi
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Prus @ 2005-11-21 14:44 UTC (permalink / raw)
  To: gdb


Hi,
I'm using gdb 6.3 and it seems like in MI mode, there's no way to get full
name of a source file on stop. Consider this session:

   $ gdb a.out -fullname
   ....
   (gdb) set annotate 1
   (gdb) interpreter mi "-exec-run"
   ^running
   (gdb)
   Hi
   *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",
    frame={addr="0x08048470",func="main",args=[],file="a.cpp",line="7"}
   (gdb)
   (gdb) r
   The program being debugged has been started already.
   Start it from the beginning? (y or n) y
   Starting program: /tmp/a.out
   Hi

   Breakpoint 1, main () at a.cpp:7
   б▒б▒/tmp/a.cpp:7:54:beg:0x8048470

As you see, in console mode, full name of the file is printed. In MI mode, I
see just "a.cpp". 

1. Can I get full file name in MI output somehow?
2. If not, any chance this will be fixed?

Thanks,
Volodya



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-21 14:44 MI: full file name Vladimir Prus
@ 2005-11-21 14:46 ` Bob Rossi
  2005-11-21 14:53   ` Vladimir Prus
  2005-11-23 13:53   ` MI: full file name Vladimir Prus
  0 siblings, 2 replies; 12+ messages in thread
From: Bob Rossi @ 2005-11-21 14:46 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

> 1. Can I get full file name in MI output somehow?

-file-list-exec-source-file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-21 14:46 ` Bob Rossi
@ 2005-11-21 14:53   ` Vladimir Prus
  2005-11-21 14:55     ` Bob Rossi
  2005-11-23 13:53   ` MI: full file name Vladimir Prus
  1 sibling, 1 reply; 12+ messages in thread
From: Vladimir Prus @ 2005-11-21 14:53 UTC (permalink / raw)
  To: Bob Rossi; +Cc: gdb

On Monday 21 November 2005 17:45, Bob Rossi wrote:
> > 1. Can I get full file name in MI output somehow?
>
> -file-list-exec-source-file

Thanks. 

Is there any reason why I need separate MI command? Can't "*stopped" packet 
include full file name as well?

- Volodya

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-21 14:53   ` Vladimir Prus
@ 2005-11-21 14:55     ` Bob Rossi
  2005-11-21 15:07       ` Daniel Jacobowitz
  0 siblings, 1 reply; 12+ messages in thread
From: Bob Rossi @ 2005-11-21 14:55 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

On Mon, Nov 21, 2005 at 05:53:06PM +0300, Vladimir Prus wrote:
> On Monday 21 November 2005 17:45, Bob Rossi wrote:
> > > 1. Can I get full file name in MI output somehow?
> >
> > -file-list-exec-source-file
> 
> Thanks. 
> 
> Is there any reason why I need separate MI command? Can't "*stopped" packet 
> include full file name as well?

I believe this is in the works. Actually, this might already work with
mi2 or latest CVS. Maybe someone else knows better. I've been very busy,
and haven't had time to keep up.

Bob Rossi

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-21 14:55     ` Bob Rossi
@ 2005-11-21 15:07       ` Daniel Jacobowitz
  2005-11-22  8:01         ` Anon CVS (Was: MI: full file name) Vladimir Prus
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-11-21 15:07 UTC (permalink / raw)
  To: Vladimir Prus, gdb

On Mon, Nov 21, 2005 at 09:54:53AM -0500, Bob Rossi wrote:
> On Mon, Nov 21, 2005 at 05:53:06PM +0300, Vladimir Prus wrote:
> > On Monday 21 November 2005 17:45, Bob Rossi wrote:
> > > > 1. Can I get full file name in MI output somehow?
> > >
> > > -file-list-exec-source-file
> > 
> > Thanks. 
> > 
> > Is there any reason why I need separate MI command? Can't "*stopped" packet 
> > include full file name as well?
> 
> I believe this is in the works. Actually, this might already work with
> mi2 or latest CVS. Maybe someone else knows better. I've been very busy,
> and haven't had time to keep up.

Looks like it's been done in 6.4:

drow@caradoc:~% gdb -i=mi ~/nevyn-home/debugging/printf 
~"GNU gdb 6.3.90_20051119-debian\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you are\n"
~"welcome to change it and/or distribute copies of it under certain conditions.\n"
~"Type \"show copying\" to see the conditions.\n"
~"There is absolutely no warranty for GDB.  Type \"show warranty\" for details.\n"
~"This GDB was configured as \"x86_64-linux-gnu\"..."
~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n"
~"\n"
(gdb) 
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x08048394",func="main",file="debugging/printf.c",line="6",times="0"}
(gdb) 
-exec-run
^running
(gdb) 
&"warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4\n"
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048394",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffc4b4"}],file="debugging/printf.c",line="6"}
(gdb) 

And then again with appropriate "dir" so GDB can find the file:

-exec-run
^running
(gdb) 
&"warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4\n"
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048394",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffc974"}],file="debugging/printf.c",fullname="/home/drow/mnt/nevyn/home/drow/debugging/printf.c",line="6"}
(gdb) 

I didn't try 6.3.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Anon CVS (Was: MI: full file name)
  2005-11-21 15:07       ` Daniel Jacobowitz
@ 2005-11-22  8:01         ` Vladimir Prus
  2005-11-22 12:10           ` Bob Rossi
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Prus @ 2005-11-22  8:01 UTC (permalink / raw)
  To: gdb

Daniel Jacobowitz wrote:

> On Mon, Nov 21, 2005 at 09:54:53AM -0500, Bob Rossi wrote:
>> On Mon, Nov 21, 2005 at 05:53:06PM +0300, Vladimir Prus wrote:
>> > On Monday 21 November 2005 17:45, Bob Rossi wrote:
>> > > > 1. Can I get full file name in MI output somehow?
>> > >
>> > > -file-list-exec-source-file
>> > 
>> > Thanks.
>> > 
>> > Is there any reason why I need separate MI command? Can't "*stopped"
>> > packet include full file name as well?
>> 
>> I believe this is in the works. Actually, this might already work with
>> mi2 or latest CVS. Maybe someone else knows better. I've been very busy,
>> and haven't had time to keep up.
> 
> Looks like it's been done in 6.4:

Indeed, just tried in 6.4 snapshot, and it works. Thanks.

BTW, it's pretty hard to get CVS version of gdb. 

On, http://www.gnu.org/software/gdb/current/, under "Read-only CVS", I read:

   A weekly snapshot (gdb+dejagnu-CVS-YYYYMMDD.tar.bz2) of the sources
   checked out using CVS is available for download from the current snapshot
   directory. ..... Once you have downloaded and unpacked this snapshot, you
   can cd to the src directory and use the command: 

      cvs update

But the snapshot directory does not have any file following that pattern.
There's only "gdb+dejagnu.tar.bz2", that does not have "CVS" directories.

Later:

   Alternativly, you can check out a copy of the CVS repository directly
   using the command: 

   cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu

That works, but then configure dies with:

   configure: error: cannot find install-sh or install.sh in
   `cd .;pwd`/.. ./`cd .;pwd`/..

The only working solution is to download "gdb-weekly-CVS-YYYYYMMDD.tar.bz2".
Maybe the page should be fixed?

- Volodya


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anon CVS (Was: MI: full file name)
  2005-11-22  8:01         ` Anon CVS (Was: MI: full file name) Vladimir Prus
@ 2005-11-22 12:10           ` Bob Rossi
  2005-11-22 12:19             ` Vladimir Prus
  0 siblings, 1 reply; 12+ messages in thread
From: Bob Rossi @ 2005-11-22 12:10 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

> Later:
> 
>    Alternativly, you can check out a copy of the CVS repository directly
>    using the command: 
> 
>    cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu
> 
> That works, but then configure dies with:
> 
>    configure: error: cannot find install-sh or install.sh in
>    `cd .;pwd`/.. ./`cd .;pwd`/..

This is exclusivly how I get GDB and configure it. I'm not sure why this
wouldn't work for you. I do:

  cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu
  mkdir builddir 
  cd builddir 
  ../src/conifugure
  make

This should probably also work for you. The only difference is, I don't
use anoncvs.

Bob Rossi

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anon CVS (Was: MI: full file name)
  2005-11-22 12:10           ` Bob Rossi
@ 2005-11-22 12:19             ` Vladimir Prus
  2005-11-22 12:47               ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Prus @ 2005-11-22 12:19 UTC (permalink / raw)
  To: gdb

On Tuesday 22 November 2005 15:09, Bob Rossi wrote:
> > Later:
> >
> >    Alternativly, you can check out a copy of the CVS repository directly
> >    using the command:
> >
> >    cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu
> >
> > That works, but then configure dies with:
> >
> >    configure: error: cannot find install-sh or install.sh in
> >    `cd .;pwd`/.. ./`cd .;pwd`/..
>
> This is exclusivly how I get GDB and configure it. I'm not sure why this
> wouldn't work for you. I do:
>
>   cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu
>   mkdir builddir
>   cd builddir
>   ../src/conifugure
>   make
>
> This should probably also work for you. The only difference is, I don't
> use anoncvs.

It turns out, things got broken if "-d gdb-cvs" option is also used:

   cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -d gdb-cvs
      gdb+dejagnu

Strange, I always thought that "-d" just changed the name of the directory and 
has no effect on anything. And I've added it because "src" does not look like 
a good name for directory. Maybe this issue should be explicitly mentioned.


- Volodya

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anon CVS (Was: MI: full file name)
  2005-11-22 12:19             ` Vladimir Prus
@ 2005-11-22 12:47               ` Andreas Schwab
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2005-11-22 12:47 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

Vladimir Prus <ghost@cs.msu.su> writes:

> It turns out, things got broken if "-d gdb-cvs" option is also used:
>
>    cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -d gdb-cvs
>       gdb+dejagnu

"-d" does not play nice with cvs modules (at least the way they are used
in the src repository).  Much better to check out without "-d" and rename
afterwards.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-21 14:46 ` Bob Rossi
  2005-11-21 14:53   ` Vladimir Prus
@ 2005-11-23 13:53   ` Vladimir Prus
  2005-11-23 14:53     ` Daniel Jacobowitz
       [not found]     ` <7f89a3ea0512221820u4512e691x59d20442123d3086@mail.gmail.com>
  1 sibling, 2 replies; 12+ messages in thread
From: Vladimir Prus @ 2005-11-23 13:53 UTC (permalink / raw)
  To: gdb

Bob Rossi wrote:

>> 1. Can I get full file name in MI output somehow?
> 
> -file-list-exec-source-file

For the record, this is buggy in 6.3:

(gdb) interpreter mi -exec-step 
^running
(gdb) 
*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x08048e3e",func="interpret_bytecode",args=[{name="data",value="0x8052180"}
{name="size",value="1776"}],file="interpreter/autogen/gen/interpreter.c",line="325"}
(gdb) 
(gdb) backtrace 
#0  interpret_bytecode (data=0x8052180, size=1776) at
interpreter/autogen/gen/interpreter.c:325
#1  0x0804c2ca in main (ac=2, av=0xbffff594) at
interpreter/target/x86/startup.c:48
(gdb) interpreter mi -file-list-exec-source-file 
^done,line="48",file="interpreter/target/x86/startup.c",fullname="/home/ghost/Work/Module/module_testing/interpreter/target/x86/startup.c"
(gdb) 

The file/line in output from -file-list-exec-source-file correspond to frame
#1, not frame #0, as expected.

Works fine in HEAD, though. Changing the order of "backtrace" and
"interpreter mi -file-list-exec-source-file" seems to fix the problem, too.

- Volodya





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
  2005-11-23 13:53   ` MI: full file name Vladimir Prus
@ 2005-11-23 14:53     ` Daniel Jacobowitz
       [not found]     ` <7f89a3ea0512221820u4512e691x59d20442123d3086@mail.gmail.com>
  1 sibling, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-11-23 14:53 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

On Wed, Nov 23, 2005 at 12:29:08PM +0300, Vladimir Prus wrote:
> The file/line in output from -file-list-exec-source-file correspond to frame
> #1, not frame #0, as expected.

That has nothing to do with -file-list-exec-source-file; it's a known
bug in GDB 6.3's backtrace command.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: MI: full file name
       [not found]     ` <7f89a3ea0512221820u4512e691x59d20442123d3086@mail.gmail.com>
@ 2005-12-23  7:09       ` Vladimir Prus
  0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Prus @ 2005-12-23  7:09 UTC (permalink / raw)
  To: Midnight Xiong; +Cc: gdb

On Friday 23 December 2005 05:20, Midnight Xiong wrote:
> Could you please point more details about this buggy?(backtrace and then
> -file-list-exec-source-file)
> I only can use GDB 6.3 but 6.4, and have to resolve it in GDB 6.3.
> Thanks.

It's simple: if you do

   backtrace
  -file-list-exec-source-file

then the second command will print the file corresponding to the last frame 
printed by 'backtrace'. The workaround I use is to reverse the order of the 
commands.

- Volodya

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-12-23  7:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-21 14:44 MI: full file name Vladimir Prus
2005-11-21 14:46 ` Bob Rossi
2005-11-21 14:53   ` Vladimir Prus
2005-11-21 14:55     ` Bob Rossi
2005-11-21 15:07       ` Daniel Jacobowitz
2005-11-22  8:01         ` Anon CVS (Was: MI: full file name) Vladimir Prus
2005-11-22 12:10           ` Bob Rossi
2005-11-22 12:19             ` Vladimir Prus
2005-11-22 12:47               ` Andreas Schwab
2005-11-23 13:53   ` MI: full file name Vladimir Prus
2005-11-23 14:53     ` Daniel Jacobowitz
     [not found]     ` <7f89a3ea0512221820u4512e691x59d20442123d3086@mail.gmail.com>
2005-12-23  7:09       ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).