summaryrefslogtreecommitdiff
path: root/gdb/auto-load.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-03-31 13:32:20 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-04-04 17:50:41 -0400
commit962937b15dd570e44109f3c8196a392b788837ba (patch)
tree4a2172585a6a63cb779f5bd269ad3a5a3528e8f3 /gdb/auto-load.c
parentcb25fdbb76e41d9c02fe86009fc8a3ecf8737c9a (diff)
downloadbinutils-gdb-962937b15dd570e44109f3c8196a392b788837ba.tar.gz
gdb: make timestamped_file implement can_emit_style_escape
In our AMDGPU downstream port, we use styling in some logging output. We noticed it stopped working after the gdb_printf changes. Making timestamped_file implement can_emit_style_escape (returning the value of the stream it wraps) fixes it. To show that it works, modify some logging statements in auto-load.c to output style filenames. You can see it in action by setting "set debug auto-load 1" and running a program. We can incrementally add styling to other debug statements throughout GDB, as needed. Change-Id: I78a2fd1e078f80f2263251cf6bc53b3a9de9c17a
Diffstat (limited to 'gdb/auto-load.c')
-rw-r--r--gdb/auto-load.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 057104d97b0..b6056f5d60a 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -733,8 +733,8 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
gdb_file_up input = gdb_fopen_cloexec (filename.c_str (), "r");
debugfile = filename.c_str ();
- auto_load_debug_printf ("Attempted file \"%s\" %s.",
- debugfile,
+ auto_load_debug_printf ("Attempted file \"%ps\" %s.",
+ styled_string (file_name_style.style (), debugfile),
input != nullptr ? "exists" : "does not exist");
std::string debugfile_holder;
@@ -763,8 +763,9 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
input = gdb_fopen_cloexec (debugfile, "r");
- auto_load_debug_printf ("Attempted file \"%s\" %s.",
- debugfile,
+ auto_load_debug_printf ("Attempted file \"%ps\" %s.",
+ styled_string (file_name_style.style (),
+ debugfile),
(input != nullptr
? "exists"
: "does not exist"));