2005-01-14 Andrew Cagney <cagney@gnu.org>
* linespec.c (symtab_from_filename, decode_variable): Use throw_error instead of error_silent. * breakpoint.c (do_captured_parse_breakpoint): Change return type to void. (break_command_1): Use catch_exception and check the error return status. * exceptions.c (throw_error): New function. (throw_vsilent): Delete function. * exceptions.h (throw_error): Declare. (throw_vsilent): Delete declaration. * utils.c (error_silent): Delete function. * defs.h (error_silent): Delete declaration.
This commit is contained in:
parent
35695fd6e5
commit
05ff989b0b
7 changed files with 68 additions and 92 deletions
|
@ -1,5 +1,18 @@
|
||||||
2005-01-14 Andrew Cagney <cagney@gnu.org>
|
2005-01-14 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* linespec.c (symtab_from_filename, decode_variable): Use
|
||||||
|
throw_error instead of error_silent.
|
||||||
|
* breakpoint.c (do_captured_parse_breakpoint): Change return type
|
||||||
|
to void.
|
||||||
|
(break_command_1): Use catch_exception and check the error return
|
||||||
|
status.
|
||||||
|
* exceptions.c (throw_error): New function.
|
||||||
|
(throw_vsilent): Delete function.
|
||||||
|
* exceptions.h (throw_error): Declare.
|
||||||
|
(throw_vsilent): Delete declaration.
|
||||||
|
* utils.c (error_silent): Delete function.
|
||||||
|
* defs.h (error_silent): Delete declaration.
|
||||||
|
|
||||||
* mi/mi-main.c (mi_execute_command): Print the exception.
|
* mi/mi-main.c (mi_execute_command): Print the exception.
|
||||||
* cli/cli-interp.c (safe_execute_command): Print the exception.
|
* cli/cli-interp.c (safe_execute_command): Print the exception.
|
||||||
* exceptions.h (exception_print): Declare.
|
* exceptions.h (exception_print): Declare.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* Everything about breakpoints, for GDB.
|
/* Everything about breakpoints, for GDB.
|
||||||
|
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -118,8 +118,6 @@ static void condition_command (char *, int);
|
||||||
|
|
||||||
static int get_number_trailer (char **, int);
|
static int get_number_trailer (char **, int);
|
||||||
|
|
||||||
static int do_captured_parse_breakpoint (struct ui_out *, void *);
|
|
||||||
|
|
||||||
void set_breakpoint_count (int);
|
void set_breakpoint_count (int);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -5079,15 +5077,13 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
do_captured_parse_breakpoint (struct ui_out *ui, void *data)
|
do_captured_parse_breakpoint (struct ui_out *ui, void *data)
|
||||||
{
|
{
|
||||||
struct captured_parse_breakpoint_args *args = data;
|
struct captured_parse_breakpoint_args *args = data;
|
||||||
|
|
||||||
parse_breakpoint_sals (args->arg_p, args->sals_p, args->addr_string_p,
|
parse_breakpoint_sals (args->arg_p, args->sals_p, args->addr_string_p,
|
||||||
args->not_found_ptr);
|
args->not_found_ptr);
|
||||||
|
|
||||||
return GDB_RC_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set a breakpoint according to ARG (function, linenum or *address)
|
/* Set a breakpoint according to ARG (function, linenum or *address)
|
||||||
|
@ -5100,6 +5096,7 @@ do_captured_parse_breakpoint (struct ui_out *ui, void *data)
|
||||||
static int
|
static int
|
||||||
break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp)
|
break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp)
|
||||||
{
|
{
|
||||||
|
struct exception e;
|
||||||
int tempflag, hardwareflag;
|
int tempflag, hardwareflag;
|
||||||
struct symtabs_and_lines sals;
|
struct symtabs_and_lines sals;
|
||||||
struct expression **cond = 0;
|
struct expression **cond = 0;
|
||||||
|
@ -5112,7 +5109,7 @@ break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_b
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
struct cleanup *breakpoint_chain = NULL;
|
struct cleanup *breakpoint_chain = NULL;
|
||||||
struct captured_parse_breakpoint_args parse_args;
|
struct captured_parse_breakpoint_args parse_args;
|
||||||
int i, rc;
|
int i;
|
||||||
int pending = 0;
|
int pending = 0;
|
||||||
int thread = -1;
|
int thread = -1;
|
||||||
int ignore_count = 0;
|
int ignore_count = 0;
|
||||||
|
@ -5130,57 +5127,57 @@ break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_b
|
||||||
parse_args.addr_string_p = &addr_string;
|
parse_args.addr_string_p = &addr_string;
|
||||||
parse_args.not_found_ptr = ¬_found;
|
parse_args.not_found_ptr = ¬_found;
|
||||||
|
|
||||||
rc = catch_exceptions_with_msg (uiout, do_captured_parse_breakpoint,
|
e = catch_exception (uiout, do_captured_parse_breakpoint,
|
||||||
&parse_args, NULL, &err_msg,
|
&parse_args, RETURN_MASK_ALL);
|
||||||
RETURN_MASK_ALL);
|
|
||||||
|
|
||||||
/* If caller is interested in rc value from parse, set value. */
|
/* If caller is interested in rc value from parse, set value. */
|
||||||
|
switch (e.reason)
|
||||||
if (rc != GDB_RC_OK)
|
|
||||||
{
|
{
|
||||||
/* Check for file or function not found. */
|
case RETURN_QUIT:
|
||||||
if (not_found)
|
exception_print (gdb_stderr, NULL, e);
|
||||||
|
return e.reason;
|
||||||
|
case RETURN_ERROR:
|
||||||
|
switch (e.error)
|
||||||
{
|
{
|
||||||
/* If called to resolve pending breakpoint, just return error code. */
|
case NOT_FOUND_ERROR:
|
||||||
|
/* If called to resolve pending breakpoint, just return
|
||||||
|
error code. */
|
||||||
if (pending_bp)
|
if (pending_bp)
|
||||||
{
|
return e.reason;
|
||||||
xfree (err_msg);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_output_message (NULL, err_msg);
|
exception_print (gdb_stderr, NULL, e);
|
||||||
xfree (err_msg);
|
|
||||||
|
|
||||||
/* If pending breakpoint support is turned off, throw error. */
|
/* If pending breakpoint support is turned off, throw
|
||||||
|
error. */
|
||||||
|
|
||||||
if (pending_break_support == AUTO_BOOLEAN_FALSE)
|
if (pending_break_support == AUTO_BOOLEAN_FALSE)
|
||||||
throw_reason (RETURN_ERROR);
|
throw_reason (RETURN_ERROR);
|
||||||
|
|
||||||
/* If pending breakpoint support is auto query and the user selects
|
/* If pending breakpoint support is auto query and the user
|
||||||
no, then simply return the error code. */
|
selects no, then simply return the error code. */
|
||||||
if (pending_break_support == AUTO_BOOLEAN_AUTO &&
|
if (pending_break_support == AUTO_BOOLEAN_AUTO &&
|
||||||
!nquery ("Make breakpoint pending on future shared library load? "))
|
!nquery ("Make breakpoint pending on future shared library load? "))
|
||||||
return rc;
|
return e.reason;
|
||||||
|
|
||||||
/* At this point, either the user was queried about setting a
|
/* At this point, either the user was queried about setting
|
||||||
pending breakpoint and selected yes, or pending breakpoint
|
a pending breakpoint and selected yes, or pending
|
||||||
behavior is on and thus a pending breakpoint is defaulted
|
breakpoint behavior is on and thus a pending breakpoint
|
||||||
on behalf of the user. */
|
is defaulted on behalf of the user. */
|
||||||
copy_arg = xstrdup (addr_start);
|
copy_arg = xstrdup (addr_start);
|
||||||
addr_string = ©_arg;
|
addr_string = ©_arg;
|
||||||
sals.nelts = 1;
|
sals.nelts = 1;
|
||||||
sals.sals = &pending_sal;
|
sals.sals = &pending_sal;
|
||||||
pending_sal.pc = 0;
|
pending_sal.pc = 0;
|
||||||
pending = 1;
|
pending = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
exception_print (gdb_stderr, NULL, e);
|
||||||
|
return e.reason;
|
||||||
}
|
}
|
||||||
else
|
default:
|
||||||
{
|
if (!sals.nelts)
|
||||||
xfree (err_msg);
|
return GDB_RC_FAIL;
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!sals.nelts)
|
|
||||||
return GDB_RC_FAIL;
|
|
||||||
|
|
||||||
/* Create a chain of things that always need to be cleaned up. */
|
/* Create a chain of things that always need to be cleaned up. */
|
||||||
old_chain = make_cleanup (null_cleanup, 0);
|
old_chain = make_cleanup (null_cleanup, 0);
|
||||||
|
|
|
@ -891,8 +891,6 @@ extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN;
|
||||||
|
|
||||||
extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
|
extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
|
||||||
|
|
||||||
extern NORETURN void error_silent (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
|
|
||||||
|
|
||||||
extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
|
extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
|
||||||
|
|
||||||
/* Output arbitrary error message. */
|
/* Output arbitrary error message. */
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
|
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
|
||||||
Foundation, Inc.
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -401,15 +401,12 @@ throw_vfatal (const char *fmt, va_list ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void
|
NORETURN void
|
||||||
throw_vsilent (const char *fmt, va_list ap)
|
throw_error (enum errors error, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct exception e;
|
va_list args;
|
||||||
e.reason = RETURN_ERROR;
|
va_start (args, fmt);
|
||||||
e.error = GENERIC_ERROR;
|
print_and_throw (RETURN_ERROR, error, error_pre_print, fmt, args);
|
||||||
xfree (last_message);
|
va_end (args);
|
||||||
last_message = xstrvprintf (fmt, ap);
|
|
||||||
e.message = last_message;
|
|
||||||
throw_exception (e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call FUNC() with args FUNC_UIOUT and FUNC_ARGS, catching any
|
/* Call FUNC() with args FUNC_UIOUT and FUNC_ARGS, catching any
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
|
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
|
||||||
Foundation, Inc.
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ enum errors {
|
||||||
/* Any generic error, the corresponding text is in
|
/* Any generic error, the corresponding text is in
|
||||||
exception.message. */
|
exception.message. */
|
||||||
GENERIC_ERROR,
|
GENERIC_ERROR,
|
||||||
|
NOT_FOUND_ERROR,
|
||||||
/* Add more errors here. */
|
/* Add more errors here. */
|
||||||
NR_ERRORS
|
NR_ERRORS
|
||||||
};
|
};
|
||||||
|
@ -86,8 +87,8 @@ extern NORETURN void throw_reason (enum return_reason reason) ATTR_NORETURN;
|
||||||
extern NORETURN void throw_verror (enum errors, const char *fmt,
|
extern NORETURN void throw_verror (enum errors, const char *fmt,
|
||||||
va_list ap) ATTR_NORETURN;
|
va_list ap) ATTR_NORETURN;
|
||||||
extern NORETURN void throw_vfatal (const char *fmt, va_list ap) ATTR_NORETURN;
|
extern NORETURN void throw_vfatal (const char *fmt, va_list ap) ATTR_NORETURN;
|
||||||
extern NORETURN void throw_vsilent (const char *fmt, va_list ap) ATTR_NORETURN;
|
extern NORETURN void throw_error (enum errors error, const char *fmt,
|
||||||
|
...) ATTR_NORETURN ATTR_FORMAT (printf, 2, 3);
|
||||||
|
|
||||||
/* Call FUNC(UIOUT, FUNC_ARGS) but wrapped within an exception
|
/* Call FUNC(UIOUT, FUNC_ARGS) but wrapped within an exception
|
||||||
handler. If an exception (enum return_reason) is thrown using
|
handler. If an exception (enum return_reason) is thrown using
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Parser for linespec for the GNU debugger, GDB.
|
/* Parser for linespec for the GNU debugger, GDB.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
|
||||||
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
|
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "objc-lang.h"
|
#include "objc-lang.h"
|
||||||
#include "linespec.h"
|
#include "linespec.h"
|
||||||
|
#include "exceptions.h"
|
||||||
|
|
||||||
/* We share this one with symtab.c, but it is not exported widely. */
|
/* We share this one with symtab.c, but it is not exported widely. */
|
||||||
|
|
||||||
|
@ -1526,18 +1528,8 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
|
||||||
if (!have_full_symbols () && !have_partial_symbols ())
|
if (!have_full_symbols () && !have_partial_symbols ())
|
||||||
error ("No symbol table is loaded. Use the \"file\" command.");
|
error ("No symbol table is loaded. Use the \"file\" command.");
|
||||||
if (not_found_ptr)
|
if (not_found_ptr)
|
||||||
{
|
*not_found_ptr = 1;
|
||||||
*not_found_ptr = 1;
|
throw_error (NOT_FOUND_ERROR, "No source file named %s.", copy);
|
||||||
/* The caller has indicated that it wishes quiet notification of any
|
|
||||||
error where the function or file is not found. A call to
|
|
||||||
error_silent causes an error to occur, but it does not issue
|
|
||||||
the supplied message. The message can be manually output by
|
|
||||||
the caller, if desired. This is used, for example, when
|
|
||||||
attempting to set breakpoints for functions in shared libraries
|
|
||||||
that have not yet been loaded. */
|
|
||||||
error_silent ("No source file named %s.", copy);
|
|
||||||
}
|
|
||||||
error ("No source file named %s.", copy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard the file name from the arg. */
|
/* Discard the file name from the arg. */
|
||||||
|
@ -1748,19 +1740,8 @@ decode_variable (char *copy, int funfirstline, char ***canonical,
|
||||||
error ("No symbol table is loaded. Use the \"file\" command.");
|
error ("No symbol table is loaded. Use the \"file\" command.");
|
||||||
|
|
||||||
if (not_found_ptr)
|
if (not_found_ptr)
|
||||||
{
|
*not_found_ptr = 1;
|
||||||
*not_found_ptr = 1;
|
throw_error (NOT_FOUND_ERROR, "Function \"%s\" not defined.", copy);
|
||||||
/* The caller has indicated that it wishes quiet notification of any
|
|
||||||
error where the function or file is not found. A call to
|
|
||||||
error_silent causes an error to occur, but it does not issue
|
|
||||||
the supplied message. The message can be manually output by
|
|
||||||
the caller, if desired. This is used, for example, when
|
|
||||||
attempting to set breakpoints for functions in shared libraries
|
|
||||||
that have not yet been loaded. */
|
|
||||||
error_silent ("Function \"%s\" not defined.", copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
error ("Function \"%s\" not defined.", copy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
15
gdb/utils.c
15
gdb/utils.c
|
@ -1,8 +1,8 @@
|
||||||
/* General utility routines for GDB, the GNU debugger.
|
/* General utility routines for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
|
||||||
Foundation, Inc.
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -641,17 +641,6 @@ fatal (const char *string, ...)
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cause a silent error to occur. Any error message is recorded
|
|
||||||
though it is not issued. */
|
|
||||||
NORETURN void
|
|
||||||
error_silent (const char *string, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start (args, string);
|
|
||||||
throw_vsilent (string, args);
|
|
||||||
va_end (args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output an error message including any pre-print text to gdb_stderr. */
|
/* Output an error message including any pre-print text to gdb_stderr. */
|
||||||
void
|
void
|
||||||
error_output_message (char *pre_print, char *msg)
|
error_output_message (char *pre_print, char *msg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue