summaryrefslogtreecommitdiff
path: root/gdb/exceptions.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-01-16 21:20:06 +0000
committerAndrew Cagney <cagney@redhat.com>2005-01-16 21:20:06 +0000
commit80dfa7e61a021cbed533f7f1263c6e54d290aa22 (patch)
tree8f55dae9b8efc8e0d68699d3c9d5e41f40eac559 /gdb/exceptions.c
parentd938bcea6b78ed30832307500ad5b078ecb035e8 (diff)
downloadgdb-80dfa7e61a021cbed533f7f1263c6e54d290aa22.tar.gz
2005-01-16 Andrew Cagney <cagney@gnu.org>
* cli/cli-script.c: Include "exceptions.h". (struct wrapped_read_command_file_args): Define. (wrapped_read_command_file): New function. (script_from_file): Replace direct call to read_command_file by one wrapped by an exception handler. * exceptions.c (throw_it): Free the old message after creating the new. * Makefile.in: Update dependencies. Index: testsuite/ChangeLog 2005-01-16 Andrew Cagney <cagney@gnu.org> * gdb.base/source.exp: Delete KFAIL gdb/1846, simplify.
Diffstat (limited to 'gdb/exceptions.c')
-rw-r--r--gdb/exceptions.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index d95c58aa3c8..e640b5fb70a 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -360,10 +360,13 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt,
va_list ap)
{
struct exception e;
+ char *new_message;
- /* Save the message. */
+ /* Save the message. Create the new message before deleting the
+ old, the new message may include the old message text. */
+ new_message = xstrvprintf (fmt, ap);
xfree (last_message);
- last_message = xstrvprintf (fmt, ap);
+ last_message = new_message;
/* Create the exception. */
e.reason = reason;