Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Use full paths for "info sources"
@ 2004-09-19 22:57 Daniel Jacobowitz
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2004-09-19 22:57 UTC (permalink / raw)
  To: gdb-patches

This patch changes the output of "info sources" to use the new *_to_fullname
functions.  This means that we consistently output full paths, instead of
outputting basenames, relative paths, or dubious full paths, depending on
how the file was compiled.  It also cuts down on some duplication, since we
now print a unique list of real pathnames.  I tried to write a testcase for
this, but couldn't manage to.

Jim approved this patch on gdb@.  Tested on i386-pc-linux-gnu with no
regressions, and checked in.

-- 
Daniel Jacobowitz

2004-09-19  Daniel Jacobowitz  <dan@debian.org>

	* symtab.c (output_source_filename): Mark first argument as const.
	(sources_info): Use symtab_to_fullname and psymtab_to_fullname
	for "info sources" output.

Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.136
diff -u -p -r1.136 symtab.c
--- gdb/symtab.c	11 Sep 2004 10:24:51 -0000	1.136
+++ gdb/symtab.c	14 Sep 2004 23:35:12 -0000
@@ -69,7 +69,7 @@ static void variables_info (char *, int)
 
 static void sources_info (char *, int);
 
-static void output_source_filename (char *, int *);
+static void output_source_filename (const char *, int *);
 
 static int find_line_common (struct linetable *, int, int *);
 
@@ -2622,7 +2622,7 @@ filename_seen (const char *file, int add
    NAME is the name to print and *FIRST is nonzero if this is the first
    name printed.  Set *FIRST to zero.  */
 static void
-output_source_filename (char *name, int *first)
+output_source_filename (const char *name, int *first)
 {
   /* Since a single source file can result in several partial symbol
      tables, we need to avoid printing it more than once.  Note: if
@@ -2671,7 +2671,8 @@ sources_info (char *ignore, int from_tty
   first = 1;
   ALL_SYMTABS (objfile, s)
   {
-    output_source_filename (s->filename, &first);
+    const char *fullname = symtab_to_fullname (s);
+    output_source_filename (fullname ? fullname : s->filename, &first);
   }
   printf_filtered ("\n\n");
 
@@ -2682,7 +2683,8 @@ sources_info (char *ignore, int from_tty
   {
     if (!ps->readin)
       {
-	output_source_filename (ps->filename, &first);
+	const char *fullname = psymtab_to_fullname (ps);
+	output_source_filename (fullname ? fullname : ps->filename, &first);
       }
   }
   printf_filtered ("\n");


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [commit] Use full paths for "info sources"
@ 2004-09-21 14:22 David Lecomber
  2004-09-21 15:30 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: David Lecomber @ 2004-09-21 14:22 UTC (permalink / raw)
  To: patches, dan

Alas this fix doesn't seem to fix it for me..


[david@delmo FOO]$ ls
a.out  foo
[david@delmo FOO]$ ~/bin/gdb a.out
GNU gdb 20040920
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".
                                                                                                                                                                   
(gdb) info sources
Source files for which symbols have been read
in:                                                                                                                  
Source files for which symbols will be read in on
demand:                                                                                                                                                                   main.c, /home/david/FOO/foo/main.c
(gdb)



in contrast,


GNU gdb Red Hat Linux (6.0post-0.20040223.19rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
                                                                                                                                                                   
(gdb) info sources
Source files for which symbols have been read in:
                                                                                                                                                                   Source files for which symbols will be read in on demand:

foo/main.c
(gdb)
                                                                                                                                                              
                     

Cheers
d.                                                                                                                                              




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

end of thread, other threads:[~2004-10-16 23:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-19 22:57 [commit] Use full paths for "info sources" Daniel Jacobowitz
2004-09-21 14:22 David Lecomber
2004-09-21 15:30 ` Daniel Jacobowitz
2004-09-24 21:16   ` Joel Brobecker
2004-10-13 23:12     ` David Lecomber
2004-10-13 23:24       ` Joel Brobecker
2004-10-14  0:08         ` David Lecomber
2004-10-16 23:56           ` Joel Brobecker

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