aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/printcmd.c48
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/sepsymtab.exp2
4 files changed, 40 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 62b98fe..89f352d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-20 Doug Evans <dje@google.com>
+
+ * printcmd.c (sym_info): Don't print the offset if it's zero.
+
2008-11-20 Pedro Alves <pedro@codesourcery.com>
* infrun.c (resume): If following a fork, reread the current
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index fec81d9..81638fb 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1013,6 +1013,8 @@ sym_info (char *arg, int from_tty)
&& (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, osect)))
{
const char *obj_name, *mapped, *sec_name, *msym_name;
+ char *loc_string;
+ struct cleanup *old_chain;
matches = 1;
offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
@@ -1020,43 +1022,55 @@ sym_info (char *arg, int from_tty)
sec_name = osect->the_bfd_section->name;
msym_name = SYMBOL_PRINT_NAME (msymbol);
+ /* Don't print the offset if it is zero.
+ We assume there's no need to handle i18n of "sym + offset". */
+ if (offset)
+ xasprintf (&loc_string, "%s + %u", msym_name, offset);
+ else
+ xasprintf (&loc_string, "%s", msym_name);
+
+ /* Use a cleanup to free loc_string in case the user quits
+ a pagination request inside printf_filtered. */
+ old_chain = make_cleanup (xfree, loc_string);
+
gdb_assert (osect->objfile && osect->objfile->name);
obj_name = osect->objfile->name;
if (MULTI_OBJFILE_P ())
if (pc_in_unmapped_range (addr, osect))
if (section_is_overlay (osect))
- printf_filtered (_("%s + %u in load address range of "
+ printf_filtered (_("%s in load address range of "
"%s overlay section %s of %s\n"),
- msym_name, offset,
- mapped, sec_name, obj_name);
+ loc_string, mapped, sec_name, obj_name);
else
- printf_filtered (_("%s + %u in load address range of "
+ printf_filtered (_("%s in load address range of "
"section %s of %s\n"),
- msym_name, offset, sec_name, obj_name);
+ loc_string, sec_name, obj_name);
else
if (section_is_overlay (osect))
- printf_filtered (_("%s + %u in %s overlay section %s of %s\n"),
- msym_name, offset, mapped, sec_name, obj_name);
+ printf_filtered (_("%s in %s overlay section %s of %s\n"),
+ loc_string, mapped, sec_name, obj_name);
else
- printf_filtered (_("%s + %u in section %s of %s\n"),
- msym_name, offset, sec_name, obj_name);
+ printf_filtered (_("%s in section %s of %s\n"),
+ loc_string, sec_name, obj_name);
else
if (pc_in_unmapped_range (addr, osect))
if (section_is_overlay (osect))
- printf_filtered (_("%s + %u in load address range of %s overlay "
+ printf_filtered (_("%s in load address range of %s overlay "
"section %s\n"),
- msym_name, offset, mapped, sec_name);
+ loc_string, mapped, sec_name);
else
- printf_filtered (_("%s + %u in load address range of section %s\n"),
- msym_name, offset, sec_name);
+ printf_filtered (_("%s in load address range of section %s\n"),
+ loc_string, sec_name);
else
if (section_is_overlay (osect))
- printf_filtered (_("%s + %u in %s overlay section %s\n"),
- msym_name, offset, mapped, sec_name);
+ printf_filtered (_("%s in %s overlay section %s\n"),
+ loc_string, mapped, sec_name);
else
- printf_filtered (_("%s + %u in section %s\n"),
- msym_name, offset, sec_name);
+ printf_filtered (_("%s in section %s\n"),
+ loc_string, sec_name);
+
+ do_cleanups (old_chain);
}
}
if (matches == 0)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a737872..b08bcd1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-20 Doug Evans <dje@google.com>
+
+ * gdb.base/sepsymtab.exp: Update, old "info sym" format restored.
+
2008-11-18 Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.arch/ppc-dfp.exp: New file.
diff --git a/gdb/testsuite/gdb.base/sepsymtab.exp b/gdb/testsuite/gdb.base/sepsymtab.exp
index 3192701..ce0ea7d 100644
--- a/gdb/testsuite/gdb.base/sepsymtab.exp
+++ b/gdb/testsuite/gdb.base/sepsymtab.exp
@@ -45,7 +45,7 @@ gdb_load ${binfile}
set command "info sym main"
set command_regex [string_to_regexp $command]
gdb_test_multiple "$command" "$command" {
- -re "^${command_regex}\[\r\n\]+main \\+ 0 in section \[^\r\n\]+\[\r\n\]+$gdb_prompt \$" {
+ -re "^${command_regex}\[\r\n\]+main in section \[^\r\n\]+\[\r\n\]+$gdb_prompt \$" {
pass "$command"
}
}