diff options
author | David Carlton <carlton@bactrian.org> | 2003-08-27 15:41:41 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-08-27 15:41:41 +0000 |
commit | ba058b661774f984d1ac3d6563a323e098ff92b6 (patch) | |
tree | 550fe6fd7f82607732f5654dc03cc6f7e847d3da /gdb | |
parent | d539b3aa78c59cc1cf7adace42150a5dec88932e (diff) | |
download | gdb-ba058b661774f984d1ac3d6563a323e098ff92b6.zip gdb-ba058b661774f984d1ac3d6563a323e098ff92b6.tar.gz gdb-ba058b661774f984d1ac3d6563a323e098ff92b6.tar.bz2 |
2003-08-27 David Carlton <carlton@kealia.com>
From Randolph Chung <tausq@debian.org>:
* linux-proc.c (linux_info_proc_cmd): rework the code so that it
compiles with -Wformat-nonliteral -Werror.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/linux-proc.c | 43 |
2 files changed, 36 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cdf7581..98ac736 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-08-27 David Carlton <carlton@kealia.com> + + From Randolph Chung <tausq@debian.org>: + * linux-proc.c (linux_info_proc_cmd): rework the code so that it + compiles with -Wformat-nonliteral -Werror. + 2003-08-26 Jim Blandy <jimb@redhat.com> * solib-svr4.c (bfd_lookup_symbol): New SECT_FLAGS argument. diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index 245052f..6d9be05 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -404,35 +404,52 @@ linux_info_proc_cmd (char *args, int from_tty) { 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); |