From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22147 invoked by alias); 19 Sep 2004 22:57:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22138 invoked from network); 19 Sep 2004 22:57:31 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 19 Sep 2004 22:57:31 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1C9Acd-00028x-23 for ; Sun, 19 Sep 2004 18:57:31 -0400 Date: Sun, 19 Sep 2004 22:57:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: [commit] Use full paths for "info sources" Message-ID: <20040919225730.GA8021@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-09/txt/msg00306.txt.bz2 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 * 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");