Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sources.redhat.com
Subject: [commit] Use full paths for "info sources"
Date: Sun, 19 Sep 2004 22:57:00 -0000	[thread overview]
Message-ID: <20040919225730.GA8021@nevyn.them.org> (raw)

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");


             reply	other threads:[~2004-09-19 22:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-19 22:57 Daniel Jacobowitz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040919225730.GA8021@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox