From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26655 invoked by alias); 27 Aug 2003 15:42:53 -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 26644 invoked from network); 27 Aug 2003 15:42:52 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 27 Aug 2003 15:42:52 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id AA712CAF5; Wed, 27 Aug 2003 08:42:51 -0700 (PDT) To: Andrew Cagney Cc: Randolph Chung , gdb-patches@sources.redhat.com Subject: Re: [patch/minor] fix compile warning in linux-proc.c References: <20030821051149.GB21328@tausq.org> <3F4C32C3.7020504@redhat.com> From: David Carlton Date: Wed, 27 Aug 2003 15:42:00 -0000 In-Reply-To: <3F4C32C3.7020504@redhat.com> (Andrew Cagney's message of "Wed, 27 Aug 2003 00:25:39 -0400") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-08/txt/msg00473.txt.bz2 On Wed, 27 Aug 2003 00:25:39 -0400, Andrew Cagney said: > David, feel free to check it in. A comment mentioning that this > should use a generic (and not yet existing) local_address_string() > method would be useful. Done; here's what I've committed. Tested on i686-pc-linux-gnu, DWARF-2, GCC 3.2; no regressions. David Carlton carlton@kealia.com 2003-08-27 David Carlton From Randolph Chung : * linux-proc.c (linux_info_proc_cmd): rework the code so that it compiles with -Wformat-nonliteral -Werror. Index: linux-proc.c =================================================================== RCS file: /cvs/src/src/gdb/linux-proc.c,v retrieving revision 1.17 diff -u -p -r1.17 linux-proc.c --- linux-proc.c 24 Aug 2003 13:34:01 -0000 1.17 +++ linux-proc.c 27 Aug 2003 15:32:58 -0000 @@ -404,35 +404,52 @@ linux_info_proc_cmd (char *args, int fro { long long addr, endaddr, size, offset, inode; char permissions[8], device[8], filename[MAXPATHLEN]; - char *header_fmt_string, *data_fmt_string; + printf_filtered ("Mapped address spaces:\n\n"); if (TARGET_ADDR_BIT == 32) { - header_fmt_string = "\t%10s %10s %10s %10s %7s\n"; - data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n"; - } + printf_filtered ("\t%10s %10s %10s %10s %7s\n", + "Start Addr", + " End Addr", + " Size", " Offset", "objfile"); + } else - { - header_fmt_string = " %18s %18s %10s %10s %7s\n"; - data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n"; - } - - printf_filtered ("Mapped address spaces:\n\n"); - printf_filtered (header_fmt_string, + { + printf_filtered (" %18s %18s %10s %10s %7s\n", "Start Addr", " End Addr", " Size", " Offset", "objfile"); + } while (read_mapping (procfile, &addr, &endaddr, &permissions[0], &offset, &device[0], &inode, &filename[0])) { size = endaddr - addr; - printf_filtered (data_fmt_string, (unsigned long) addr, /* FIXME: pr_addr */ + + /* FIXME: carlton/2003-08-27: Maybe the printf_filtered + calls here (and possibly above) should be abstracted + out into their own functions? Andrew suggests using + a generic local_address_string instead to print out + the addresses; that makes sense to me, too. */ + + if (TARGET_ADDR_BIT == 32) + { + printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n", + (unsigned long) addr, /* FIXME: pr_addr */ (unsigned long) endaddr, (int) size, (unsigned int) offset, filename[0] ? filename : ""); - + } + else + { + printf_filtered (" %#18lx %#18lx %#10x %#10x %7s\n", + (unsigned long) addr, /* FIXME: pr_addr */ + (unsigned long) endaddr, + (int) size, + (unsigned int) offset, + filename[0] ? filename : ""); + } } fclose (procfile);