This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB command "info source"


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]