* [PATCH] gdb: Display warning when source-highlight fails
@ 2020-06-02 3:54 Stephanos Ioannidis
2020-06-15 14:10 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Stephanos Ioannidis @ 2020-06-02 3:54 UTC (permalink / raw)
To: gdb-patches; +Cc: Stephanos Ioannidis
This patch adds the C++ exception handling for the source-highlight
library function calls.
Without this, the `highlighter->highlight (...)` call may silently
fail when the data directory for the source-highlight library cannot
be located.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
---
gdb/source-cache.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 965dc380b1..0561a26737 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -203,6 +203,11 @@ source_cache::ensure (struct symtab *s)
highlighter->highlight (input, output, lang_name, fullname);
contents = output.str ();
}
+ catch (const std::exception &exc)
+ {
+ warning ("source-highlight: %s\n",
+ exc.what());
+ }
catch (...)
{
/* Source Highlight will throw an exception if
--
2.26.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb: Display warning when source-highlight fails
2020-06-02 3:54 [PATCH] gdb: Display warning when source-highlight fails Stephanos Ioannidis
@ 2020-06-15 14:10 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2020-06-15 14:10 UTC (permalink / raw)
To: Stephanos Ioannidis; +Cc: gdb-patches
>>>>> "Stephanos" == Stephanos Ioannidis <root@stephanos.io> writes:
Thanks for the patch.
Stephanos> This patch adds the C++ exception handling for the source-highlight
Stephanos> library function calls.
Stephanos> Without this, the `highlighter->highlight (...)` call may silently
Stephanos> fail when the data directory for the source-highlight library cannot
Stephanos> be located.
I think it would be better to issue just a single warning per gdb session.
Stephanos> + catch (const std::exception &exc)
Stephanos> + {
Stephanos> + warning ("source-highlight: %s\n",
Stephanos> + exc.what());
Stephanos> + }
I think it would be fine to be a bit chattier here. Also, format
strings should normally be surrounded with _(...), so they are run
through gettext.
thanks
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-15 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 3:54 [PATCH] gdb: Display warning when source-highlight fails Stephanos Ioannidis
2020-06-15 14:10 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).