Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to show the file being executed?
@ 2010-02-20 12:26 Stefano Sabatini
  2010-02-20 12:37 ` Alfred M. Szmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Stefano Sabatini @ 2010-02-20 12:26 UTC (permalink / raw)
  To: gdb Mailing List

Hi all,

I'm running gdb 7.0 and first of all let me thank you, it's simply
*AWESOME*, reversible debugging and scripting are some features we
always dreamt for, and now they're finally available to all the free
world, thanks!!

I have a small problem, I need to show the name of the file debugged
in a gdb script, and info target looks overkill as it shows too much
information.

(gdb) show version
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) info target
Symbols from "/home/stefano/src/PROGRAM".
Unix child process:
	Using the running image of child Thread 0xb5f33b70 (LWP 8998).
	While running this, GDB does not access memory from...
Local exec file:
	`/home/stefano/src/PROGRAM', file type elf32-i386.
	Entry point: 0x804bc70
	0x08048134 - 0x08048147 is .interp
	0x08048148 - 0x08048168 is .note.ABI-tag
	0x08048168 - 0x0804818c is .note.gnu.build-id
        [...]

There is some way to show *only* this information?, otherwise I suggest
to implement a show file command.

Regards.


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

* Re: How to show the file being executed?
  2010-02-20 12:26 How to show the file being executed? Stefano Sabatini
@ 2010-02-20 12:37 ` Alfred M. Szmidt
  2010-02-20 14:06   ` Stefano Sabatini
  0 siblings, 1 reply; 11+ messages in thread
From: Alfred M. Szmidt @ 2010-02-20 12:37 UTC (permalink / raw)
  To: Stefano Sabatini; +Cc: gdb

   (gdb) info target
   Symbols from "/home/stefano/src/PROGRAM".
   Unix child process:
	   Using the running image of child Thread 0xb5f33b70 (LWP 8998).
	   While running this, GDB does not access memory from...
   Local exec file:
	   `/home/stefano/src/PROGRAM', file type elf32-i386.
	   Entry point: 0x804bc70
	   0x08048134 - 0x08048147 is .interp
	   0x08048148 - 0x08048168 is .note.ABI-tag
	   0x08048168 - 0x0804818c is .note.gnu.build-id
	   [...]

   There is some way to show *only* this information?, otherwise I suggest
   to implement a show file command.

You can use readelf to get most of that information.


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

* Re: How to show the file being executed?
  2010-02-20 12:37 ` Alfred M. Szmidt
@ 2010-02-20 14:06   ` Stefano Sabatini
  2010-02-23 19:25     ` Alfred M. Szmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Stefano Sabatini @ 2010-02-20 14:06 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: gdb

On Saturday 2010-02-20 07:37:22 -0500, Alfred M. Szmidt wrote:
>    (gdb) info target
>    Symbols from "/home/stefano/src/PROGRAM".
>    Unix child process:
> 	   Using the running image of child Thread 0xb5f33b70 (LWP 8998).
> 	   While running this, GDB does not access memory from...
>    Local exec file:
> 	   `/home/stefano/src/PROGRAM', file type elf32-i386.
> 	   Entry point: 0x804bc70
> 	   0x08048134 - 0x08048147 is .interp
> 	   0x08048148 - 0x08048168 is .note.ABI-tag
> 	   0x08048168 - 0x0804818c is .note.gnu.build-id
> 	   [...]
> 
>    There is some way to show *only* this information?, otherwise I suggest
>    to implement a show file command.
> 
> You can use readelf to get most of that information.

I want to show *only* the local exec file as specified by the "file"
command, and within a gdb script, currently the only way I see is to
use info target.

Regards.


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

* Re: How to show the file being executed?
  2010-02-20 14:06   ` Stefano Sabatini
@ 2010-02-23 19:25     ` Alfred M. Szmidt
  2010-02-23 19:35       ` Pedro Alves
  0 siblings, 1 reply; 11+ messages in thread
From: Alfred M. Szmidt @ 2010-02-23 19:25 UTC (permalink / raw)
  To: Stefano Sabatini; +Cc: gdb

   I want to show *only* the local exec file as specified by the "file"
   command, and within a gdb script, currently the only way I see is to
   use info target.

You can probobly use the `shell' command, and set that somehow.


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

* Re: How to show the file being executed?
  2010-02-23 19:25     ` Alfred M. Szmidt
@ 2010-02-23 19:35       ` Pedro Alves
  2010-02-23 20:51         ` Pedro Alves
  2010-02-24 16:54         ` Alfred M. Szmidt
  0 siblings, 2 replies; 11+ messages in thread
From: Pedro Alves @ 2010-02-23 19:35 UTC (permalink / raw)
  To: gdb, ams; +Cc: Stefano Sabatini, gdb

Starting with gdb 7.1, "info inferiors" shows you the executable of
each inferior.

(top-gdb) info inferiors
  Num  Description       Executable
* 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb

-- 
Pedro Alves


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

* Re: How to show the file being executed?
  2010-02-23 19:35       ` Pedro Alves
@ 2010-02-23 20:51         ` Pedro Alves
  2010-02-24 16:54         ` Alfred M. Szmidt
  1 sibling, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2010-02-23 20:51 UTC (permalink / raw)
  To: gdb, ams; +Cc: Stefano Sabatini, gdb

Starting with gdb 7.1, "info inferiors" shows you the executable of
each inferior.

(top-gdb) info inferiors
  Num  Description       Executable
* 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb

-- 
Pedro Alves


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

* Re: How to show the file being executed?
  2010-02-24 16:54         ` Alfred M. Szmidt
@ 2010-02-24 16:46           ` Alfred M. Szmidt
  2010-02-24 17:01           ` Pedro Alves
  1 sibling, 0 replies; 11+ messages in thread
From: Alfred M. Szmidt @ 2010-02-24 16:46 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, stefano.sabatini-lala, gdb

   Starting with gdb 7.1, "info inferiors" shows you the executable of
   each inferior.

   (top-gdb) info inferiors
     Num  Description       Executable
   * 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb

The original poster wanted the information from `file' as I understood
it.


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

* Re: How to show the file being executed?
  2010-02-23 19:35       ` Pedro Alves
  2010-02-23 20:51         ` Pedro Alves
@ 2010-02-24 16:54         ` Alfred M. Szmidt
  2010-02-24 16:46           ` Alfred M. Szmidt
  2010-02-24 17:01           ` Pedro Alves
  1 sibling, 2 replies; 11+ messages in thread
From: Alfred M. Szmidt @ 2010-02-24 16:54 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, stefano.sabatini-lala, gdb

   Starting with gdb 7.1, "info inferiors" shows you the executable of
   each inferior.

   (top-gdb) info inferiors
     Num  Description       Executable
   * 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb

The original poster wanted the information from `file' as I understood
it.


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

* Re: How to show the file being executed?
  2010-02-24 16:54         ` Alfred M. Szmidt
  2010-02-24 16:46           ` Alfred M. Szmidt
@ 2010-02-24 17:01           ` Pedro Alves
  2010-02-24 17:26             ` Pedro Alves
  2010-02-25 15:28             ` Alfred M. Szmidt
  1 sibling, 2 replies; 11+ messages in thread
From: Pedro Alves @ 2010-02-24 17:01 UTC (permalink / raw)
  To: ams; +Cc: gdb, stefano.sabatini-lala

On Wednesday 24 February 2010 16:41:38, Alfred M. Szmidt wrote:
>    (top-gdb) info inferiors
>      Num  Description       Executable
>    * 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb
> 
> The original poster wanted the information from `file' as I understood
> it.

`file FOO' is actually just short hand for:

  `exec-file FOO' + `symbol-file FOO'.

`info inferiors' shows you the FOO from `exec-file FOO'.

-- 
Pedro Alves


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

* Re: How to show the file being executed?
  2010-02-24 17:01           ` Pedro Alves
@ 2010-02-24 17:26             ` Pedro Alves
  2010-02-25 15:28             ` Alfred M. Szmidt
  1 sibling, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2010-02-24 17:26 UTC (permalink / raw)
  To: gdb; +Cc: ams, stefano.sabatini-lala

On Wednesday 24 February 2010 16:46:42, Pedro Alves wrote:
> On Wednesday 24 February 2010 16:41:38, Alfred M. Szmidt wrote:
> >    (top-gdb) info inferiors
> >      Num  Description       Executable
> >    * 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb
> > 
> > The original poster wanted the information from `file' as I understood
> > it.

Oh, maybe you're thinking that `info inferiors' wouldn't 
work for this until the program was running.  That was true
on 7.0, no longer on 7.1:

 $./gdb
 :
 (gdb) info inferiors
   Num  Description       Executable
 * 1    <null>

 (gdb) file ./gdb
 Reading symbols from /home/pedro/gdb/baseline/build/gdb/gdb...done.

 (gdb) info inferiors
   Num  Description       Executable
 * 1    <null>            /home/pedro/gdb/baseline/build/gdb/gdb

 (gdb) start
 :
 Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe168) at ../../src/gdb/gdb.c:28
 28        memset (&args, 0, sizeof args);

 (gdb) info inferiors
   Num  Description       Executable
 * 1    process 26761     /home/pedro/gdb/baseline/build/gdb/gdb

-- 
Pedro Alves


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

* Re: How to show the file being executed?
  2010-02-24 17:01           ` Pedro Alves
  2010-02-24 17:26             ` Pedro Alves
@ 2010-02-25 15:28             ` Alfred M. Szmidt
  1 sibling, 0 replies; 11+ messages in thread
From: Alfred M. Szmidt @ 2010-02-25 15:28 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, stefano.sabatini-lala


   On Wednesday 24 February 2010 16:41:38, Alfred M. Szmidt wrote:
   >    (top-gdb) info inferiors
   >      Num  Description       Executable
   >    * 1    process 25218     /home/pedro/gdb/baseline/build/gdb/gdb
   > 
   > The original poster wanted the information from `file' as I understood
   > it.

   `file FOO' is actually just short hand for:

     `exec-file FOO' + `symbol-file FOO'.

   `info inferiors' shows you the FOO from `exec-file FOO'.

We are on different wave lengths, when I wrote `file' I meant the
command line program, not the GDB command.  Which `info file' has
similar information too at the start.


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

end of thread, other threads:[~2010-02-24 17:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-20 12:26 How to show the file being executed? Stefano Sabatini
2010-02-20 12:37 ` Alfred M. Szmidt
2010-02-20 14:06   ` Stefano Sabatini
2010-02-23 19:25     ` Alfred M. Szmidt
2010-02-23 19:35       ` Pedro Alves
2010-02-23 20:51         ` Pedro Alves
2010-02-24 16:54         ` Alfred M. Szmidt
2010-02-24 16:46           ` Alfred M. Szmidt
2010-02-24 17:01           ` Pedro Alves
2010-02-24 17:26             ` Pedro Alves
2010-02-25 15:28             ` Alfred M. Szmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox