[RFC,6/8] Style print_address_symbolic

Message ID 20180906211303.11029-7-tom@tromey.com
State New
Headers show
Series
  • add terminal styling to gdb
Related show

Commit Message

Tom Tromey Sept. 6, 2018, 9:13 p.m.
print_address_symbolic does not use ui-out, so it did not style
function names.  This patch changes it to use the low-level style code
directly.
---
 gdb/printcmd.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
2.13.6

Patch

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index c63d567e487..18721de425f 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -49,6 +49,7 @@ 
 #include "format.h"
 #include "source.h"
 #include "common/byte-vector.h"
+#include "cli/cli-style.h"
 
 /* Last specified output format.  */
 
@@ -534,7 +535,9 @@  print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
     fputs_filtered ("<*", stream);
   else
     fputs_filtered ("<", stream);
+  set_output_style (stream, function_name_style.style ());
   fputs_filtered (name.c_str (), stream);
+  set_output_style (stream, ui_file_style ());
   if (offset != 0)
     fprintf_filtered (stream, "+%u", (unsigned int) offset);
 
@@ -542,10 +545,12 @@  print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
      line # of this addr, if we have it; else line # of the nearest symbol.  */
   if (print_symbol_filename && !filename.empty ())
     {
+      fputs_filtered (line == -1 ? " in " : " at ", stream);
+      set_output_style (stream, file_name_style.style ());
+      fputs_filtered (filename.c_str (), stream);
+      set_output_style (stream, ui_file_style ());
       if (line != -1)
-	fprintf_filtered (stream, " at %s:%d", filename.c_str (), line);
-      else
-	fprintf_filtered (stream, " in %s", filename.c_str ());
+	fprintf_filtered (stream, ":%d", line);
     }
   if (unmapped)
     fputs_filtered ("*>", stream);