summaryrefslogtreecommitdiff
path: root/gdb/debuginfod-support.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-03-09 17:26:37 -0700
committerTom Tromey <tom@tromey.com>2022-03-31 18:01:38 -0600
commit8839e3f3b0d1af5d93ba1d4f667ce33936bb7db2 (patch)
tree3415fb5146ff047711b8fad2c594443a7c52bcb6 /gdb/debuginfod-support.c
parentd7abb2c4bd748e5fc54f3e2585fe295fb60300f0 (diff)
downloadbinutils-gdb-8839e3f3b0d1af5d93ba1d4f667ce33936bb7db2.tar.gz
Style URLs in GDB output
I noticed that GDB will display URLs in a few spots. This changes them to be styled. Originally I thought I'd introduce a new "url" style, but there aren't many places to use this, so I just reused filename styling instead. This patch also changes the debuginfod URL list to be printed one URL per line. I think this is probably a bit easier to read.
Diffstat (limited to 'gdb/debuginfod-support.c')
-rw-r--r--gdb/debuginfod-support.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index b3a49bfeccf..22944ce50bb 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -181,10 +181,27 @@ debuginfod_is_enabled ()
if (debuginfod_enabled == debuginfod_ask)
{
- int resp = nquery (_("\nThis GDB supports auto-downloading debuginfo " \
- "from the following URLs:\n%s\nEnable debuginfod " \
- "for this session? "),
- urls);
+ gdb_printf (_("\nThis GDB supports auto-downloading debuginfo " \
+ "from the following URLs:\n"));
+
+ gdb::string_view url_view (urls);
+ while (true)
+ {
+ url_view = url_view.substr (url_view.find_first_not_of (' '));
+ if (url_view.empty ())
+ break;
+ size_t off = url_view.find_first_of (' ');
+ gdb_printf
+ (_(" <%ps>\n"),
+ styled_string (file_name_style.style (),
+ gdb::to_string (url_view.substr (0,
+ off)).c_str ()));
+ if (off == gdb::string_view::npos)
+ break;
+ url_view = url_view.substr (off);
+ }
+
+ int resp = nquery (_("Enable debuginfod for this session? "));
if (!resp)
{
gdb_printf (_("Debuginfod has been disabled.\nTo make this " \