]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Style locations when setting a breakpoint
authorTom Tromey <tom@tromey.com>
Thu, 6 Sep 2018 05:32:16 +0000 (23:32 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 28 Dec 2018 19:49:50 +0000 (12:49 -0700)
say_where does not use ui-out, so function and file names printed by
it were not styled.  This patch changes say_where to use the low-level
style code directly.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* breakpoint.c (say_where): Style file name.

gdb/testsuite/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* gdb.base/style.exp: Add test for breakpoint setting.

gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/style.exp

index 6a6a535a4aa876ab577c339227bd5fda8242b829..f9a8f092296374bea3671871b2035ee8bf8cd3d5 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
+       * breakpoint.c (say_where): Style file name.
+
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
        * ui-out.h (enum class ui_out_style_kind) <VARIABLE>: New global.
index 53763e0254cf5be16a5ed8ae213c22998fc8d9dd..b99b0fb27c929bb6e05453721364595c5552cac4 100644 (file)
@@ -68,6 +68,7 @@
 #include "format.h"
 #include "thread-fsm.h"
 #include "tid-parse.h"
+#include "cli/cli-style.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -12195,9 +12196,14 @@ say_where (struct breakpoint *b)
          /* If there is a single location, we can print the location
             more nicely.  */
          if (b->loc->next == NULL)
-           printf_filtered (": file %s, line %d.",
-                            symtab_to_filename_for_display (b->loc->symtab),
-                            b->loc->line_number);
+           {
+             puts_filtered (": file ");
+             fputs_styled (symtab_to_filename_for_display (b->loc->symtab),
+                           file_name_style.style (),
+                           gdb_stdout);
+             printf_filtered (", line %d.",
+                              b->loc->line_number);
+           }
          else
            /* This is not ideal, but each location may have a
               different file name, and this at least reflects the
index d27272d841c2544360d19aabfd6ff1cbd1913f18..de21939317262f4b774615348d52122339988e08 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
+       * gdb.base/style.exp: Add test for breakpoint setting.
+
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
        * gdb.base/style.exp: Add test for variable names.
index df66e999435c1a4e413594ecefe5866d929d4028..f5d3fc2938d3958533e0526b346207c54252e93f 100644 (file)
@@ -33,10 +33,13 @@ save_vars { env(TERM) } {
     gdb_test_no_output "set style enabled on"
 
     set main_expr "\033\\\[33mmain\033\\\[m"
-    set file_expr "\033\\\[32m.*style\\.c\033\\\[m:\[0-9\]"
+    set base_file_expr "\033\\\[32m.*style\\.c\033\\\[m"
+    set file_expr "$base_file_expr:\[0-9\]"
     set arg_expr "\033\\\[36marg.\033\\\[m"
 
     gdb_test "frame" \
        "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
     gdb_test "info breakpoints" "$main_expr at $file_expr.*"
+
+    gdb_test "break main" "file $base_file_expr.*"
 }