aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-05 23:32:16 -0600
committerTom Tromey <tom@tromey.com>2018-12-28 12:49:50 -0700
commit0bb296cb5f3a81b4b5e702208aad911d3b727f8b (patch)
tree534b69220272b8b0a8cc06c7eb4f4d6098cb8bca /gdb
parent80ae204359b707f2914132ed353d3cecbdb58b23 (diff)
downloadgdb-0bb296cb5f3a81b4b5e702208aad911d3b727f8b.zip
gdb-0bb296cb5f3a81b4b5e702208aad911d3b727f8b.tar.gz
gdb-0bb296cb5f3a81b4b5e702208aad911d3b727f8b.tar.bz2
Style locations when setting a breakpoint
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/breakpoint.c12
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/style.exp5
4 files changed, 21 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6a6a535..f9a8f09 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
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.
* stack.c (print_frame_arg): Style name.
* printcmd.c (print_variable_and_value): Style variable name.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 53763e0..b99b0fb 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d27272d..de21939 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
2018-12-28 Tom Tromey <tom@tromey.com>
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index df66e99..f5d3fc2 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -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.*"
}