* breakpoint.c (update_watchpoint): Adjust and extend the description
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index 355552db5e0aa8c59b1c98abbfce89e4e7618496..6d6b91580e90cacd8e0af091a4d25149ec4b0ee0 100644 (file)
@@ -48,7 +48,7 @@
 #include "tui/tui.h"           /* For tui_active et.al.   */
 #endif
 
-#if defined(__MINGW32__)
+#if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
 # define USE_PRINTF_I64 1
 # define PRINTF_HAS_LONG_LONG
 #else
@@ -1012,21 +1012,65 @@ sym_info (char *arg, int from_tty)
        && sect_addr < obj_section_endaddr (osect)
        && (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);
+       mapped = section_is_mapped (osect) ? _("mapped") : _("unmapped");
+       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)
-         printf_filtered ("%s + %u in ",
-                          SYMBOL_PRINT_NAME (msymbol), offset);
+         xasprintf (&loc_string, "%s + %u", msym_name, offset);
        else
-         printf_filtered ("%s in ",
-                          SYMBOL_PRINT_NAME (msymbol));
-       if (pc_in_unmapped_range (addr, osect))
-         printf_filtered (_("load address range of "));
-       if (section_is_overlay (osect))
-         printf_filtered (_("%s overlay "),
-                          section_is_mapped (osect) ? "mapped" : "unmapped");
-       printf_filtered (_("section %s"), osect->the_bfd_section->name);
-       printf_filtered ("\n");
+         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 in load address range of "
+                                "%s overlay section %s of %s\n"),
+                              loc_string, mapped, sec_name, obj_name);
+           else
+             printf_filtered (_("%s in load address range of "
+                                "section %s of %s\n"),
+                              loc_string, sec_name, obj_name);
+         else
+           if (section_is_overlay (osect))
+             printf_filtered (_("%s in %s overlay section %s of %s\n"),
+                              loc_string, mapped, sec_name, obj_name);
+           else
+             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 in load address range of %s overlay "
+                                "section %s\n"),
+                              loc_string, mapped, sec_name);
+           else
+             printf_filtered (_("%s in load address range of section %s\n"),
+                              loc_string, sec_name);
+         else
+           if (section_is_overlay (osect))
+             printf_filtered (_("%s in %s overlay section %s\n"),
+                              loc_string, mapped, sec_name);
+           else
+             printf_filtered (_("%s in section %s\n"),
+                              loc_string, sec_name);
+
+       do_cleanups (old_chain);
       }
   }
   if (matches == 0)
@@ -1197,16 +1241,25 @@ address_info (char *exp, int from_tty)
        else
          {
            section = SYMBOL_OBJ_SECTION (msym);
-           printf_filtered (_("static storage at address "));
            load_addr = SYMBOL_VALUE_ADDRESS (msym);
-           fputs_filtered (paddress (load_addr), gdb_stdout);
-           if (section_is_overlay (section))
+
+           if (section
+               && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
+             printf_filtered (_("a thread-local variable at offset %s "
+                                "in the thread-local storage for `%s'"),
+                              paddr_nz (load_addr), section->objfile->name);
+           else
              {
-               load_addr = overlay_unmapped_address (load_addr, section);
-               printf_filtered (_(",\n -- loaded at "));
+               printf_filtered (_("static storage at address "));
                fputs_filtered (paddress (load_addr), gdb_stdout);
-               printf_filtered (_(" in overlay section %s"),
-                                section->the_bfd_section->name);
+               if (section_is_overlay (section))
+                 {
+                   load_addr = overlay_unmapped_address (load_addr, section);
+                   printf_filtered (_(",\n -- loaded at "));
+                   fputs_filtered (paddress (load_addr), gdb_stdout);
+                   printf_filtered (_(" in overlay section %s"),
+                                    section->the_bfd_section->name);
+                 }
              }
          }
       }
This page took 0.02455 seconds and 4 git commands to generate.