From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Rethrow exception properly.
Date: Sun, 27 Jan 2008 02:19:00 -0000 [thread overview]
Message-ID: <200801262257.36197.vladimir@codesourcery.com> (raw)
Nick has reported that my recent changes regressed MI
error messages, and now we get:
(gdb)
-break-insert sqrt
&"Function \"sqrt\" not defined.\n"
^error,msg="unknown error"
(gdb)
The problem is in rather old code in break_command_really --
when we can't parse breakpoint location, and pending breakpoints
are off, we rethrow the exception using the deprecated_throw_reason.
Unfortunately, that strips the message from the exception,
so MI code gets rather useless exception.
Such rethrowing is just wrong -- if we fully delegate handling of
the error to our caller, we should just throw the original exception.
The attached patch switches to using throw_exception and gets us
back to sane MI error message. OK?
- Volodya
[gdb]
Properly rethrow exception. This fixes errors
about non-existent functions for -break-insert.
* breakpoint.c (break_command_really): Use throw_exception
for rethrowing. If rethrowing, don't print the exception.
[gdb/testsuite]
* gdb.mi/mi-break.exp (test_error): New.
Call it.
---
gdb/breakpoint.c | 6 +++---
gdb/testsuite/gdb.mi/mi-break.exp | 10 ++++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9551bd5..d5de3e7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5280,13 +5280,13 @@ break_command_really (char *arg, char *cond_string, int thread,
{
case NOT_FOUND_ERROR:
- exception_print (gdb_stderr, e);
-
/* If pending breakpoint support is turned off, throw
error. */
if (pending_break_support == AUTO_BOOLEAN_FALSE)
- deprecated_throw_reason (RETURN_ERROR);
+ throw_exception (e);
+
+ exception_print (gdb_stderr, e);
/* If pending breakpoint support is auto query and the user
selects no, then simply return the error code. */
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index af438b9..ca59348 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -175,10 +175,20 @@ proc test_ignore_count {} {
}
}
+proc test_error {} {
+ global mi_gdb_prompt
+
+ mi_gdb_test "-break-insert function_that_does_not_exit" \
+ ".*\\^error,msg=\"Function \\\\\"function_that_does_not_exit\\\\\" not defined.\"" \
+ "breakpoint at nonexistent function"
+}
+
test_tbreak_creation_and_listing
test_rbreak_creation_and_listing
test_ignore_count
+test_error
+
mi_gdb_exit
return 0
--
1.5.3.5
next reply other threads:[~2008-01-26 19:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-27 2:19 Vladimir Prus [this message]
2008-01-27 7:53 ` Nick Roberts
2008-01-27 14:15 ` Vladimir Prus
2008-01-31 22:21 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200801262257.36197.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox