From: Nick Roberts <nickrob@snap.net.nz>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com, Ulrich.Weigand@de.ibm.com
Subject: Re: [PATCH] PR mi/2086 -break-insert missing error diagnostic
Date: Sun, 19 Nov 2006 04:39:00 -0000 [thread overview]
Message-ID: <20061119043442.53649BE447@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20061117211556.GA13961@nevyn.them.org>
> > OK, how about just using the hack in mi_cmd_thread_select for
> > mi_cmd_break_insert for the moment.
>
> This is just nasty. I believe I pointed you at Ulrich's analysis of
> this problem upthread:
>
> http://sources.redhat.com/ml/gdb/2006-10/msg00021.html
>
> It seems pretty clear to me that the patch which switched things to
> return the result of catch_exceptions_with_msg was wrong. The
> functions are defined to return an enum gdb_rc. Can't we make
> them do that again? Simple, obviously correct.
Well we need to propagate the error message back to
captured_mi_execute_command. The best I can do is create a new function
catch_errors_with_msg (gdb_breakpoint used catch_errors previously). We can
also change mi_cmd_thread_list_ids accordingly. Also do_captured_breakpoint,
do_captured_breakpoint_query, do_captured_thread_select and
do_captured_list_thread_ids should really be type enum gdb_rc.
--
Nick http://www.inet.net.nz/~nickrob**
*** exceptions.h 22 Sep 2006 10:00:57 +1200 1.19
--- exceptions.h 19 Nov 2006 17:09:58 +1300
***************
*** 227,236 ****
indication of the exact exception that it caught - quit_flag might
help.
! This function is superseeded by catch_exceptions(). */
typedef int (catch_errors_ftype) (void *);
extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
/* Template to catch_errors() that wraps calls to command
functions. */
--- 227,238 ----
indication of the exact exception that it caught - quit_flag might
help.
! This function is superseded by catch_exceptions(). */
typedef int (catch_errors_ftype) (void *);
extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
+ extern int catch_errors_with_msg (catch_errors_ftype *, void *, char *,
+ char **, return_mask);
/* Template to catch_errors() that wraps calls to command
functions. */
*** exceptions.c 04 Feb 2006 10:50:25 +1300 1.24
--- exceptions.c 19 Nov 2006 17:00:36 +1300
***************
*** 508,513 ****
--- 508,520 ----
catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
return_mask mask)
{
+ return catch_errors_with_msg (func, func_args, errstring, NULL, mask);
+ }
+
+ int
+ catch_errors_with_msg (catch_errors_ftype *func, void *func_args, char *errstring,
+ char **gdberrmsg, return_mask mask)
+ {
volatile int val = 0;
volatile struct gdb_exception exception;
TRY_CATCH (exception, mask)
***************
*** 516,522 ****
}
print_any_exception (gdb_stderr, errstring, exception);
if (exception.reason != 0)
! return 0;
return val;
}
--- 523,541 ----
}
print_any_exception (gdb_stderr, errstring, exception);
if (exception.reason != 0)
! {
! /* If caller wants a copy of the low-level error message, make
! one. This is used in the case of a silent error whereby the
! caller may optionally want to issue the message. */
! if (gdberrmsg != NULL)
! {
! if (exception.message != NULL)
! *gdberrmsg = xstrdup (exception.message);
! else
! *gdberrmsg = NULL;
! }
! return 0;
! }
return val;
}
*** breakpoint.c 23 Oct 2006 08:48:48 +1300 1.231
--- breakpoint.c 19 Nov 2006 17:19:52 +1300
***************
*** 3615,3621 ****
};
static int
! do_captured_breakpoint_query (struct ui_out *uiout, void *data)
{
struct captured_breakpoint_query_args *args = data;
struct breakpoint *b;
--- 3615,3621 ----
};
static int
! do_captured_breakpoint_query (void *data)
{
struct captured_breakpoint_query_args *args = data;
struct breakpoint *b;
***************
*** 3632,3645 ****
}
enum gdb_rc
! gdb_breakpoint_query (struct ui_out *uiout, int bnum, char **error_message)
{
struct captured_breakpoint_query_args args;
args.bnum = bnum;
/* For the moment we don't trust print_one_breakpoint() to not throw
an error. */
! return catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args,
! error_message, RETURN_MASK_ALL);
}
/* Return non-zero if B is user settable (breakpoints, watchpoints,
--- 3632,3645 ----
}
enum gdb_rc
! gdb_breakpoint_query (int bnum, char **error_message)
{
struct captured_breakpoint_query_args args;
args.bnum = bnum;
/* For the moment we don't trust print_one_breakpoint() to not throw
an error. */
! return catch_errors_with_msg (do_captured_breakpoint_query, &args, NULL,
! error_message, RETURN_MASK_ALL);
}
/* Return non-zero if B is user settable (breakpoints, watchpoints,
***************
*** 5373,5379 ****
};
static int
! do_captured_breakpoint (struct ui_out *uiout, void *data)
{
struct captured_breakpoint_args *args = data;
struct symtabs_and_lines sals;
--- 5373,5379 ----
};
static int
! do_captured_breakpoint (void *data)
{
struct captured_breakpoint_args *args = data;
struct symtabs_and_lines sals;
***************
*** 5481,5488 ****
args.tempflag = tempflag;
args.thread = thread;
args.ignore_count = ignore_count;
! return catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args,
! error_message, RETURN_MASK_ALL);
}
--- 5481,5488 ----
args.tempflag = tempflag;
args.thread = thread;
args.ignore_count = ignore_count;
! return catch_errors_with_msg (do_captured_breakpoint, &args,
! NULL, error_message, RETURN_MASK_ALL);
}
*** mi-cmd-break.c 24 Dec 2005 07:57:46 +1300 1.13
--- mi-cmd-break.c 19 Nov 2006 17:31:58 +1300
***************
*** 39,45 ****
static void
breakpoint_notify (int b)
{
! gdb_breakpoint_query (uiout, b, NULL);
}
--- 39,45 ----
static void
breakpoint_notify (int b)
{
! gdb_breakpoint_query (b, NULL);
}
*** mi-main.c 18 Nov 2006 19:13:33 +1300 1.86
--- mi-main.c 19 Nov 2006 14:17:16 +1300
***************
*** 234,244 ****
else
rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
! /* RC is enum gdb_rc if it is successful (>=0)
! enum return_reason if not (<0). */
! if ((int) rc < 0 && (enum return_reason) rc == RETURN_ERROR)
! return MI_CMD_ERROR;
! else if ((int) rc >= 0 && rc == GDB_RC_FAIL)
return MI_CMD_ERROR;
else
return MI_CMD_DONE;
--- 234,240 ----
else
rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
! if (rc == GDB_RC_FAIL)
return MI_CMD_ERROR;
else
return MI_CMD_DONE;
prev parent reply other threads:[~2006-11-19 4:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 21:10 Nick Roberts
2006-10-17 21:31 ` Daniel Jacobowitz
2006-10-17 21:51 ` Nick Roberts
2006-10-17 21:57 ` Daniel Jacobowitz
2006-10-17 22:10 ` Nick Roberts
2006-10-17 23:47 ` Nick Roberts
2006-10-18 15:31 ` Daniel Jacobowitz
2006-10-18 15:55 ` Nick Roberts
2006-11-17 21:16 ` Daniel Jacobowitz
2006-11-19 4:39 ` Nick Roberts [this message]
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=20061119043442.53649BE447@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=drow@false.org \
--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