Remove gdb_print_host_address
[binutils-gdb.git] / gdb / symmisc.c
index e38ceb6bda12e944e0ea8ca5665e21e2e7df4b7f..b5e3ef7acaab4c9ea36cc9afcc40118f9aeaa842 100644 (file)
@@ -37,6 +37,7 @@
 #include "gdbcmd.h"
 #include "source.h"
 #include "readline/tilde.h"
+#include <cli/cli-style.h>
 
 /* Prototypes for local functions */
 
@@ -112,11 +113,9 @@ static void
 dump_objfile (struct objfile *objfile)
 {
   printf_filtered ("\nObject file %s:  ", objfile_name (objfile));
-  printf_filtered ("Objfile at ");
-  gdb_print_host_address (objfile, gdb_stdout);
-  printf_filtered (", bfd at ");
-  gdb_print_host_address (objfile->obfd, gdb_stdout);
-  printf_filtered (", %d minsyms\n\n",
+  printf_filtered ("Objfile at %s, bfd at %s, %d minsyms\n\n",
+                  host_address_to_string (objfile),
+                  host_address_to_string (objfile->obfd),
                   objfile->per_bfd->minimal_symbol_count);
 
   objfile->dump ();
@@ -128,9 +127,9 @@ dump_objfile (struct objfile *objfile)
        {
          for (symtab *symtab : compunit_filetabs (cu))
            {
-             printf_filtered ("%s at ",
-                              symtab_to_filename_for_display (symtab));
-             gdb_print_host_address (symtab, gdb_stdout);
+             printf_filtered ("%s at %s",
+                              symtab_to_filename_for_display (symtab),
+                              host_address_to_string (symtab));
              if (SYMTAB_OBJFILE (symtab) != objfile)
                printf_filtered (", NOT ON CHAIN!");
              printf_filtered ("\n");
@@ -252,10 +251,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
   if (SYMTAB_DIRNAME (symtab) != NULL)
     fprintf_filtered (outfile, "Compilation directory is %s\n",
                      SYMTAB_DIRNAME (symtab));
-  fprintf_filtered (outfile, "Read from object file %s (",
-                   objfile_name (objfile));
-  gdb_print_host_address (objfile, outfile);
-  fprintf_filtered (outfile, ")\n");
+  fprintf_filtered (outfile, "Read from object file %s (%s)\n",
+                   objfile_name (objfile),
+                   host_address_to_string (objfile));
   fprintf_filtered (outfile, "Language: %s\n",
                    language_str (symtab->language));
 
@@ -285,14 +283,12 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
        {
          b = BLOCKVECTOR_BLOCK (bv, i);
          depth = block_depth (b) * 2;
-         print_spaces (depth, outfile);
-         fprintf_filtered (outfile, "block #%03d, object at ", i);
-         gdb_print_host_address (b, outfile);
+         fprintf_filtered (outfile, "%*sblock #%03d, object at %s",
+                           depth, "", i,
+                           host_address_to_string (b));
          if (BLOCK_SUPERBLOCK (b))
-           {
-             fprintf_filtered (outfile, " under ");
-             gdb_print_host_address (BLOCK_SUPERBLOCK (b), outfile);
-           }
+           fprintf_filtered (outfile, " under %s",
+                             host_address_to_string (BLOCK_SUPERBLOCK (b)));
          /* drow/2002-07-10: We could save the total symbols count
             even if we're using a hashtable, but nothing else but this message
             wants it.  */
@@ -509,7 +505,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
   else
     section = NULL;
 
-  print_spaces (depth, outfile);
+  print_spaces_filtered (depth, outfile);
   if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN)
     {
       fprintf_filtered (outfile, "label %s at ", symbol->print_name ());
@@ -632,16 +628,11 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
          break;
 
        case LOC_BLOCK:
-         fprintf_filtered (outfile, "block object ");
-         gdb_print_host_address (SYMBOL_BLOCK_VALUE (symbol), outfile);
-         fprintf_filtered (outfile, ", ");
-         fputs_filtered (paddress (gdbarch,
-                                   BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))),
-                         outfile);
-         fprintf_filtered (outfile, "..");
-         fputs_filtered (paddress (gdbarch,
-                                   BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))),
-                         outfile);
+         fprintf_filtered
+           (outfile, "block object %s, %s..%s",
+            host_address_to_string (SYMBOL_BLOCK_VALUE (symbol)),
+            paddress (gdbarch, BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))),
+            paddress (gdbarch, BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))));
          if (section)
            fprintf_filtered (outfile, " section %s",
                              bfd_section_name (section->the_bfd_section));
@@ -966,13 +957,16 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
   struct objfile *objfile;
 
   objfile = symtab->compunit_symtab->objfile;
-  printf_filtered (_("objfile: %s ((struct objfile *) %s)\n"),
-                  objfile_name (objfile),
+  printf_filtered (_("objfile: %ps ((struct objfile *) %s)\n"),
+                  styled_string (file_name_style.style (),
+                                 objfile_name (objfile)),
                   host_address_to_string (objfile));
-  printf_filtered (_("compunit_symtab: ((struct compunit_symtab *) %s)\n"),
+  printf_filtered (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
+                  symtab->compunit_symtab->name,
                   host_address_to_string (symtab->compunit_symtab));
-  printf_filtered (_("symtab: %s ((struct symtab *) %s)\n"),
-                  symtab_to_fullname (symtab),
+  printf_filtered (_("symtab: %ps ((struct symtab *) %s)\n"),
+                  styled_string (file_name_style.style (),
+                                 symtab_to_fullname (symtab)),
                   host_address_to_string (symtab));
   linetable = SYMTAB_LINETABLE (symtab);
   printf_filtered (_("linetable: ((struct linetable *) %s):\n"),
@@ -1036,7 +1030,10 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
 
                if (regexp == NULL
                    || re_exec (symtab_to_filename_for_display (symtab)))
-                 maintenance_print_one_line_table (symtab, NULL);
+                 {
+                   maintenance_print_one_line_table (symtab, NULL);
+                   printf_filtered ("\n");
+                 }
              }
          }
       }