/* Everything about breakpoints, for GDB.
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.
This file is part of GDB.
#include "block.h"
#include "solist.h"
#include "observer.h"
+#include "exceptions.h"
#include "gdb-events.h"
static int can_use_hardware_watchpoint (struct value *);
-extern void break_at_finish_command (char *, int);
-extern void break_at_finish_at_depth_command (char *, int);
-
-extern void tbreak_at_finish_command (char *, int);
-
static int break_command_1 (char *, int, int, struct breakpoint *);
static void mention (struct breakpoint *);
static int get_number_trailer (char **, int);
-static int do_captured_parse_breakpoint (struct ui_out *, void *);
-
void set_breakpoint_count (int);
typedef enum
char *cond_string,
enum bptype bp_kind);
-static void break_at_finish_at_depth_command_1 (char *arg,
- int flag, int from_tty);
-
-static void break_at_finish_command_1 (char *arg, int flag, int from_tty);
-
static void stop_command (char *arg, int from_tty);
static void stopin_command (char *arg, int from_tty);
#ifndef SOLIB_CREATE_CATCH_LOAD_HOOK
#define SOLIB_CREATE_CATCH_LOAD_HOOK(pid,tempflag,filename,cond_string) \
- error ("catch of library loads not yet implemented on this platform")
+ error (_("catch of library loads not yet implemented on this platform"))
#endif
/* This function is called by the "catch unload" command. It allows
unloaded. */
#ifndef SOLIB_CREATE_CATCH_UNLOAD_HOOK
-#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid,tempflag,filename,cond_string) \
- error ("catch of library unloads not yet implemented on this platform")
+#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid, tempflag, filename, cond_string) \
+ error (_("catch of library unloads not yet implemented on this platform"))
#endif
/* Return whether a breakpoint is an active enabled breakpoint. */
strncpy (varname, start, p - start);
varname[p - start] = '\0';
val = value_of_internalvar (lookup_internalvar (varname));
- if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT)
+ if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
retval = (int) value_as_long (val);
else
{
end_value = get_number (temp);
if (end_value < last_retval)
{
- error ("inverted range");
+ error (_("inverted range"));
}
else if (end_value == last_retval)
{
}
}
else if (! in_range)
- error ("negative value");
+ error (_("negative value"));
else
{
/* pp points to the '-' that betokens a range. All
p = arg;
bnum = get_number (&p);
if (bnum == 0)
- error ("Bad breakpoint argument: '%s'", arg);
+ error (_("Bad breakpoint argument: '%s'"), arg);
ALL_BREAKPOINTS (b)
if (b->number == bnum)
{
b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0);
if (*arg)
- error ("Junk at end of expression");
+ error (_("Junk at end of expression"));
}
}
breakpoints_changed ();
return;
}
- error ("No breakpoint number %d.", bnum);
+ error (_("No breakpoint number %d."), bnum);
}
static void
being read from. */
if (executing_breakpoint_commands)
- error ("Can't use the \"commands\" command among a breakpoint's commands.");
+ error (_("Can't use the \"commands\" command among a breakpoint's commands."));
p = arg;
bnum = get_number (&p);
if (p && *p)
- error ("Unexpected extra arguments following breakpoint number.");
+ error (_("Unexpected extra arguments following breakpoint number."));
ALL_BREAKPOINTS (b)
if (b->number == bnum)
breakpoint_modify_event (b->number);
return;
}
- error ("No breakpoint number %d.", bnum);
+ error (_("No breakpoint number %d."), bnum);
}
\f
/* Like target_read_memory() but if breakpoints are inserted, return
ALL_BP_LOCATIONS (b)
{
if (b->owner->type == bp_none)
- warning ("reading through apparently deleted breakpoint #%d?",
+ warning (_("reading through apparently deleted breakpoint #%d?"),
b->owner->number);
if (b->loc_type != bp_loc_software_breakpoint)
\f
/* A wrapper function for inserting catchpoints. */
-static int
+static void
insert_catchpoint (struct ui_out *uo, void *args)
{
struct breakpoint *b = (struct breakpoint *) args;
switch (b->type)
{
case bp_catch_fork:
- val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
+ target_insert_fork_catchpoint (PIDGET (inferior_ptid));
break;
case bp_catch_vfork:
- val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
+ target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
break;
case bp_catch_exec:
- val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
+ target_insert_exec_catchpoint (PIDGET (inferior_ptid));
break;
default:
internal_error (__FILE__, __LINE__, "unknown breakpoint type");
break;
}
-
- if (val < 0)
- throw_exception (RETURN_ERROR);
-
- return 0;
}
/* Helper routine: free the value chain for a breakpoint (watchpoint). */
the next time the watchpoint is inserted. */
for (v = b->owner->val_chain; v; v = n)
{
- n = v->next;
+ n = value_next (v);
value_free (v);
}
b->owner->val_chain = NULL;
so we must try to set a breakpoint at the LMA.
This will not work for a hardware breakpoint. */
if (bpt->loc_type == bp_loc_hardware_breakpoint)
- warning ("hardware breakpoint %d not supported in overlay!\n",
+ warning (_("hardware breakpoint %d not supported in overlay!"),
bpt->owner->number);
else
{
laziness to determine what memory GDB actually needed
in order to compute the value of the expression. */
v = evaluate_expression (bpt->owner->exp);
- VALUE_CONTENTS (v);
+ value_contents (v);
value_release_to_mark (mark);
bpt->owner->val_chain = v;
bpt->inserted = 1;
/* Look at each value on the value chain. */
- for (; v; v = v->next)
+ for (; v; v = value_next (v))
{
/* If it's a memory location, and GDB actually needed
its contents to evaluate the expression, then we
must watch it. */
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
CORE_ADDR addr;
int len, type;
- addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
- len = TYPE_LENGTH (VALUE_TYPE (v));
+ addr = VALUE_ADDRESS (v) + value_offset (v);
+ len = TYPE_LENGTH (value_type (v));
type = hw_write;
if (bpt->owner->type == bp_read_watchpoint)
type = hw_read;
|| bpt->owner->type == bp_catch_vfork
|| bpt->owner->type == bp_catch_exec)
{
- char *prefix = xstrprintf ("warning: inserting catchpoint %d: ",
- bpt->owner->number);
- struct cleanup *cleanups = make_cleanup (xfree, prefix);
- val = catch_exceptions (uiout, insert_catchpoint, bpt->owner, prefix,
- RETURN_MASK_ERROR);
- do_cleanups (cleanups);
- if (val < 0)
+ struct exception e = catch_exception (uiout, insert_catchpoint,
+ bpt->owner, RETURN_MASK_ERROR);
+ exception_fprintf (gdb_stderr, e, "warning: inserting catchpoint %d: ",
+ bpt->owner->number);
+ if (e.reason < 0)
bpt->owner->enable_state = bp_disabled;
else
bpt->inserted = 1;
struct value *val;
val = evaluate_expression (b->owner->exp);
release_value (val);
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
b->owner->val = val;
}
struct cleanup *old_chain = save_inferior_ptid ();
if (pid == PIDGET (inferior_ptid))
- error ("Cannot detach breakpoints of inferior_ptid");
+ error (_("Cannot detach breakpoints of inferior_ptid"));
/* Set inferior_ptid; remove_breakpoint uses this global. */
inferior_ptid = pid_to_ptid (pid);
return 0;
if (b->owner->type == bp_none)
- warning ("attempted to remove apparently deleted breakpoint #%d?",
+ warning (_("attempted to remove apparently deleted breakpoint #%d?"),
b->owner->number);
if (b->loc_type == bp_loc_software_breakpoint
b->inserted = (is == mark_inserted);
/* Walk down the saved value chain. */
- for (v = b->owner->val_chain; v; v = v->next)
+ for (v = b->owner->val_chain; v; v = value_next (v))
{
/* For each memory reference remove the watchpoint
at that address. */
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
if (v == b->owner->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
CORE_ADDR addr;
int len, type;
- addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
- len = TYPE_LENGTH (VALUE_TYPE (v));
+ addr = VALUE_ADDRESS (v) + value_offset (v);
+ len = TYPE_LENGTH (value_type (v));
type = hw_write;
if (b->owner->type == bp_read_watchpoint)
type = hw_read;
}
/* Failure to remove any of the hardware watchpoints comes here. */
if ((is == mark_uninserted) && (b->inserted))
- warning ("Could not remove hardware watchpoint %d.",
+ warning (_("Could not remove hardware watchpoint %d."),
b->owner->number);
}
else if ((b->owner->type == bp_catch_fork ||
val = target_remove_exec_catchpoint (PIDGET (inferior_ptid));
break;
default:
- warning ("Internal error, %s line %d.", __FILE__, __LINE__);
+ warning (_("Internal error, %s line %d."), __FILE__, __LINE__);
break;
}
if (val)
/* Don't issue the warning unless it's really needed... */
if (warning_needed && (context != inf_exited))
{
- warning ("Exception catchpoints from last run were deleted.");
- warning ("You must reinsert them explicitly.");
+ warning (_("Exception catchpoints from last run were deleted.\n"
+ "You must reinsert them explicitly."));
warning_needed = 0;
}
}
{
int current_thread;
- if (bsp == NULL)
- error ("Internal error (bpstat_find_step_resume_breakpoint)");
+ gdb_assert (bsp != NULL);
current_thread = pid_to_thread_id (inferior_ptid);
return bsp->breakpoint_at;
}
- error ("Internal error (no step_resume breakpoint found)");
+ internal_error (__FILE__, __LINE__, _("No step_resume breakpoint found."));
}
struct value *v;
int found = 0;
- addr = target_stopped_data_address ();
- if (addr == 0)
+ if (!target_stopped_data_address (¤t_target, &addr))
continue;
- for (v = b->val_chain; v; v = v->next)
+ for (v = b->val_chain; v; v = value_next (v))
{
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
{
CORE_ADDR vaddr;
- vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
+ vaddr = VALUE_ADDRESS (v) + value_offset (v);
/* Exact match not required. Within range is
sufficient. */
if (addr >= vaddr &&
- addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
+ addr < vaddr + TYPE_LENGTH (value_type (v)))
found = 1;
}
}
}
enum gdb_rc
-gdb_breakpoint_query (struct ui_out *uiout, int bnum)
+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 (uiout, do_captured_breakpoint_query, &args,
- NULL, RETURN_MASK_ALL);
+ 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,
strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
if (have_bnum)
- warning ("Breakpoint %d address previously adjusted from %s to %s.",
+ warning (_("Breakpoint %d address previously adjusted from %s to %s."),
bnum, astr1, astr2);
else
- warning ("Breakpoint address adjusted from %s to %s.", astr1, astr2);
+ warning (_("Breakpoint address adjusted from %s to %s."), astr1, astr2);
}
/* Adjust a breakpoint's address to account for architectural constraints
if (!disabled_shlib_breaks)
{
target_terminal_ours_for_output ();
- warning ("Temporarily disabling shared library breakpoints:");
+ warning (_("Temporarily disabling shared library breakpoints:"));
}
disabled_shlib_breaks = 1;
- warning ("breakpoint #%d ", b->number);
+ warning (_("breakpoint #%d "), b->number);
}
}
#endif
if (!disabled_shlib_breaks)
{
target_terminal_ours_for_output ();
- warning ("Temporarily disabling breakpoints for unloaded shared library \"%s\"",
+ warning (_("Temporarily disabling breakpoints for unloaded shared library \"%s\""),
so_name);
}
disabled_shlib_breaks = 1;
char **canonical = (char **) NULL;
int thread = -1; /* All threads. */
- /* Set a breakpoint on the specified hook. */
- sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical, NULL);
+ /* Set a breakpoint on the specified hook. */
+ sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL,
+ 0, &canonical, NULL);
addr_end = hookname;
if (sals.nelts == 0)
{
- warning ("Unable to set a breakpoint on dynamic linker callback.");
- warning ("Suggest linking with /opt/langtools/lib/end.o.");
- warning ("GDB will be unable to track shl_load/shl_unload calls");
+ warning (_("Unable to set a breakpoint on dynamic linker callback.\n"
+ "Suggest linking with /opt/langtools/lib/end.o.\n"
+ "GDB will be unable to track shl_load/shl_unload calls."));
return;
}
if (sals.nelts != 1)
{
- warning ("Unable to set unique breakpoint on dynamic linker callback.");
- warning ("GDB will be unable to track shl_load/shl_unload calls");
+ warning (_("Unable to set unique breakpoint on dynamic linker callback.\n"
+ "GDB will be unable to track shl_load/shl_unload calls."));
return;
}
create_solib_unload_event_breakpoint (char *hookname, int tempflag,
char *dll_pathname, char *cond_string)
{
- solib_load_unload_1 (hookname,tempflag, dll_pathname,
+ solib_load_unload_1 (hookname, tempflag, dll_pathname,
cond_string, bp_catch_unload);
}
TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint,
i + sals.nelts, 0);
if (target_resources_ok == 0)
- error ("No hardware breakpoint support in the target.");
+ error (_("No hardware breakpoint support in the target."));
else if (target_resources_ok < 0)
- error ("Hardware breakpoints used exceeds limit.");
+ error (_("Hardware breakpoints used exceeds limit."));
}
/* Now set all the breakpoints. */
b->cond_string = savestring (arg, strlen (arg));
b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0);
if (*arg)
- error ("Junk at end of pending breakpoint condition expression");
+ error (_("Junk at end of pending breakpoint condition expression"));
}
/* If there are commands associated with the breakpoint, they should
be copied too. */
sals->nelts = 1;
}
else
- error ("No default breakpoint address now.");
+ error (_("No default breakpoint address now."));
}
else
{
if (DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
{
if (address == NULL)
- error ("Cannot break without a running program.");
+ error (_("Cannot break without a running program."));
else
- error ("Cannot break on %s without a running program.",
+ error (_("Cannot break on %s without a running program."),
address);
}
#endif
}
}
-static int
+static void
do_captured_parse_breakpoint (struct ui_out *ui, void *data)
{
struct captured_parse_breakpoint_args *args = data;
parse_breakpoint_sals (args->arg_p, args->sals_p, args->addr_string_p,
args->not_found_ptr);
-
- return GDB_RC_OK;
}
/* Set a breakpoint according to ARG (function, linenum or *address)
static int
break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp)
{
+ struct exception e;
int tempflag, hardwareflag;
struct symtabs_and_lines sals;
struct expression **cond = 0;
struct cleanup *old_chain;
struct cleanup *breakpoint_chain = NULL;
struct captured_parse_breakpoint_args parse_args;
- int i, rc;
+ int i;
int pending = 0;
int thread = -1;
int ignore_count = 0;
parse_args.addr_string_p = &addr_string;
parse_args.not_found_ptr = ¬_found;
- rc = catch_exceptions_with_msg (uiout, do_captured_parse_breakpoint,
- &parse_args, NULL, &err_msg,
- RETURN_MASK_ALL);
+ e = catch_exception (uiout, do_captured_parse_breakpoint,
+ &parse_args, RETURN_MASK_ALL);
/* If caller is interested in rc value from parse, set value. */
-
- if (rc != GDB_RC_OK)
+ switch (e.reason)
{
- /* Check for file or function not found. */
- if (not_found)
+ case RETURN_QUIT:
+ exception_print (gdb_stderr, 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)
- return rc;
+ return e.reason;
- error_output_message (NULL, err_msg);
- xfree (err_msg);
+ exception_print (gdb_stderr, e);
- /* 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)
- throw_exception (RETURN_ERROR);
+ deprecated_throw_reason (RETURN_ERROR);
- /* If pending breakpoint support is auto query and the user selects
- no, then simply return the error code. */
+ /* If pending breakpoint support is auto query and the user
+ selects no, then simply return the error code. */
if (pending_break_support == AUTO_BOOLEAN_AUTO &&
!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
- pending breakpoint and selected yes, or pending breakpoint
- behavior is on and thus a pending breakpoint is defaulted
- on behalf of the user. */
+ /* At this point, either the user was queried about setting
+ a pending breakpoint and selected yes, or pending
+ breakpoint behavior is on and thus a pending breakpoint
+ is defaulted on behalf of the user. */
copy_arg = xstrdup (addr_start);
addr_string = ©_arg;
sals.nelts = 1;
sals.sals = &pending_sal;
pending_sal.pc = 0;
pending = 1;
+ break;
+ default:
+ exception_print (gdb_stderr, e);
+ return e.reason;
}
- else
- return rc;
+ default:
+ if (!sals.nelts)
+ return GDB_RC_FAIL;
}
- else if (!sals.nelts)
- return GDB_RC_FAIL;
/* Create a chain of things that always need to be cleaned up. */
old_chain = make_cleanup (null_cleanup, 0);
tmptok = tok;
thread = strtol (tok, &tok, 0);
if (tok == tmptok)
- error ("Junk after thread keyword.");
+ error (_("Junk after thread keyword."));
if (!valid_thread_id (thread))
- error ("Unknown thread %d\n", thread);
+ error (_("Unknown thread %d."), thread);
}
else
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
}
}
create_breakpoints (sals, addr_string, cond, cond_string,
}
if (sals.nelts > 1)
- {
- warning ("Multiple breakpoints were set.");
- warning ("Use the \"delete\" command to delete unwanted breakpoints.");
- }
+ warning (_("Multiple breakpoints were set.\n"
+ "Use the \"delete\" command to delete unwanted breakpoints."));
/* That's it. Discard the cleanups for data inserted into the
breakpoint. */
discard_cleanups (breakpoint_chain);
};
static int
-do_captured_breakpoint (void *data)
+do_captured_breakpoint (struct ui_out *uiout, void *data)
{
struct captured_breakpoint_args *args = data;
struct symtabs_and_lines sals;
address. That way cleanups can take care of freeing any
memory. */
if (*address_end != '\0')
- error ("Garbage %s following breakpoint address", address_end);
+ error (_("Garbage %s following breakpoint address"), address_end);
/* Resolve all line numbers to PC's. */
breakpoint_sals_to_pc (&sals, args->address);
char *tok = args->condition;
cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
if (*tok != '\0')
- error ("Garbage %s follows condition", tok);
+ error (_("Garbage %s follows condition"), tok);
make_cleanup (xfree, cond[i]);
cond_string[i] = xstrdup (args->condition);
}
enum gdb_rc
gdb_breakpoint (char *address, char *condition,
int hardwareflag, int tempflag,
- int thread, int ignore_count)
+ int thread, int ignore_count,
+ char **error_message)
{
struct captured_breakpoint_args args;
args.address = address;
args.tempflag = tempflag;
args.thread = thread;
args.ignore_count = ignore_count;
- return catch_errors (do_captured_breakpoint, &args,
- NULL, RETURN_MASK_ALL);
-}
-
-
-static void
-break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
-{
- struct frame_info *frame;
- CORE_ADDR low, high, selected_pc = 0;
- char *extra_args = NULL;
- char *level_arg;
- int extra_args_len = 0, if_arg = 0;
-
- if (!arg ||
- (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t')))
- {
-
- if (default_breakpoint_valid)
- {
- if (deprecated_selected_frame)
- {
- selected_pc = get_frame_pc (deprecated_selected_frame);
- if (arg)
- if_arg = 1;
- }
- else
- error ("No selected frame.");
- }
- else
- error ("No default breakpoint address now.");
- }
- else
- {
- extra_args = strchr (arg, ' ');
- if (extra_args)
- {
- extra_args++;
- extra_args_len = strlen (extra_args);
- level_arg = (char *) xmalloc (extra_args - arg);
- strncpy (level_arg, arg, extra_args - arg - 1);
- level_arg[extra_args - arg - 1] = '\0';
- }
- else
- {
- level_arg = (char *) xmalloc (strlen (arg) + 1);
- strcpy (level_arg, arg);
- }
-
- frame = parse_frame_specification (level_arg);
- if (frame)
- selected_pc = get_frame_pc (frame);
- else
- selected_pc = 0;
- }
- if (if_arg)
- {
- extra_args = arg;
- extra_args_len = strlen (arg);
- }
-
- if (selected_pc)
- {
- if (find_pc_partial_function (selected_pc, (char **) NULL, &low, &high))
- {
- char *addr_string;
- if (extra_args_len)
- addr_string = xstrprintf ("*0x%s %s", paddr_nz (high), extra_args);
- else
- addr_string = xstrprintf ("*0x%s", paddr_nz (high));
- break_command_1 (addr_string, flag, from_tty, NULL);
- xfree (addr_string);
- }
- else
- error ("No function contains the specified address");
- }
- else
- error ("Unable to set breakpoint at procedure exit");
-}
-
-
-static void
-break_at_finish_command_1 (char *arg, int flag, int from_tty)
-{
- char *addr_string, *break_string, *beg_addr_string;
- CORE_ADDR low, high;
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- struct cleanup *old_chain;
- char *extra_args = NULL;
- int extra_args_len = 0;
- int i, if_arg = 0;
-
- if (!arg ||
- (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t')))
- {
- if (default_breakpoint_valid)
- {
- if (deprecated_selected_frame)
- {
- addr_string = xstrprintf ("*0x%s",
- paddr_nz (get_frame_pc (deprecated_selected_frame)));
- if (arg)
- if_arg = 1;
- }
- else
- error ("No selected frame.");
- }
- else
- error ("No default breakpoint address now.");
- }
- else
- {
- addr_string = (char *) xmalloc (strlen (arg) + 1);
- strcpy (addr_string, arg);
- }
-
- if (if_arg)
- {
- extra_args = arg;
- extra_args_len = strlen (arg);
- }
- else if (arg)
- {
- /* get the stuff after the function name or address */
- extra_args = strchr (arg, ' ');
- if (extra_args)
- {
- extra_args++;
- extra_args_len = strlen (extra_args);
- }
- }
-
- sals.sals = NULL;
- sals.nelts = 0;
-
- beg_addr_string = addr_string;
- sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
- (char ***) NULL, NULL);
-
- xfree (beg_addr_string);
- old_chain = make_cleanup (xfree, sals.sals);
- for (i = 0; (i < sals.nelts); i++)
- {
- sal = sals.sals[i];
- if (find_pc_partial_function (sal.pc, (char **) NULL, &low, &high))
- {
- break_string;
- if (extra_args_len)
- break_string = xstrprintf ("*0x%s %s", paddr_nz (high),
- extra_args);
- else
- break_string = xstrprintf ("*0x%s", paddr_nz (high));
- break_command_1 (break_string, flag, from_tty, NULL);
- xfree (break_string);
- }
- else
- error ("No function contains the specified address");
- }
- if (sals.nelts > 1)
- {
- warning ("Multiple breakpoints were set.\n");
- warning ("Use the \"delete\" command to delete unwanted breakpoints.");
- }
- do_cleanups (old_chain);
+ return catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args,
+ error_message, RETURN_MASK_ALL);
}
if (sal->pc == 0 && sal->symtab != NULL)
{
if (!find_line_pc (sal->symtab, sal->line, &pc))
- error ("No line %d in file \"%s\".",
+ error (_("No line %d in file \"%s\"."),
sal->line, sal->symtab->filename);
sal->pc = pc;
}
break_command_1 (arg, 0, from_tty, NULL);
}
-void
-break_at_finish_command (char *arg, int from_tty)
-{
- break_at_finish_command_1 (arg, 0, from_tty);
-}
-
-void
-break_at_finish_at_depth_command (char *arg, int from_tty)
-{
- break_at_finish_at_depth_command_1 (arg, 0, from_tty);
-}
-
void
tbreak_command (char *arg, int from_tty)
{
break_command_1 (arg, BP_TEMPFLAG, from_tty, NULL);
}
-void
-tbreak_at_finish_command (char *arg, int from_tty)
-{
- break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty);
-}
-
static void
hbreak_command (char *arg, int from_tty)
{
mark = value_mark ();
val = evaluate_expression (exp);
release_value (val);
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
tok = arg;
cond_end = tok;
}
if (*tok)
- error ("Junk at end of command.");
+ error (_("Junk at end of command."));
if (accessflag == hw_read)
bp_type = bp_read_watchpoint;
mem_cnt = can_use_hardware_watchpoint (val);
if (mem_cnt == 0 && bp_type != bp_hardware_watchpoint)
- error ("Expression cannot be implemented with read/access watchpoint.");
+ error (_("Expression cannot be implemented with read/access watchpoint."));
if (mem_cnt != 0)
{
i = hw_watchpoint_used_count (bp_type, &other_type_used);
TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_type, i + mem_cnt,
other_type_used);
if (target_resources_ok == 0 && bp_type != bp_hardware_watchpoint)
- error ("Target does not support this type of hardware watchpoint.");
+ error (_("Target does not support this type of hardware watchpoint."));
if (target_resources_ok < 0 && bp_type != bp_hardware_watchpoint)
- error ("Target can only support one kind of HW watchpoint at a time.");
+ error (_("Target can only support one kind of HW watchpoint at a time."));
}
#if defined(HPUXHPPA)
set watches after getting the program started. */
if (!target_has_execution)
{
- warning ("can't do that without a running program; try \"break main\", \"run\" first");
+ warning (_("can't do that without a running program; try \"break main\"), \"run\" first");
return;
}
#endif /* HPUXHPPA */
function calls are special in any way. So this function may not
notice that an expression involving an inferior function call
can't be watched with hardware watchpoints. FIXME. */
- for (; v; v = v->next)
+ for (; v; v = value_next (v))
{
if (VALUE_LVAL (v) == lval_memory)
{
- if (VALUE_LAZY (v))
+ if (value_lazy (v))
/* A lazy memory lvalue is one that GDB never needed to fetch;
we either just used its address (e.g., `a' in `a.b') or
we never needed it at all (e.g., `a' in `a,b'). */
{
/* Ahh, memory we actually used! Check if we can cover
it with hardware watchpoints. */
- struct type *vtype = check_typedef (VALUE_TYPE (v));
+ struct type *vtype = check_typedef (value_type (v));
/* We only watch structs and arrays if user asked for it
explicitly, never if they just happen to appear in a
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
{
- CORE_ADDR vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
- int len = TYPE_LENGTH (VALUE_TYPE (v));
+ CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v);
+ int len = TYPE_LENGTH (value_type (v));
if (!TARGET_REGION_OK_FOR_HW_WATCHPOINT (vaddr, len))
return 0;
}
}
}
- else if (v->lval != not_lval && v->modifiable == 0)
+ else if (VALUE_LVAL (v) != not_lval
+ && deprecated_value_modifiable (v) == 0)
return 0; /* ??? What does this represent? */
- else if (v->lval == lval_register)
+ else if (VALUE_LVAL (v) == lval_register)
return 0; /* cannot watch a register with a HW watchpoint */
}
0, (char ***) NULL, NULL);
if (sals.nelts != 1)
- error ("Couldn't get information on specified line.");
+ error (_("Couldn't get information on specified line."));
sal = sals.sals[0];
xfree (sals.sals); /* malloc'd, so freed */
if (*arg)
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
resolve_sal_pc (&sal);
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
/* If this target supports it, create a fork or vfork catchpoint
and enable reporting of such events. */
create_vfork_event_catchpoint (tempflag, cond_string);
break;
default:
- error ("unsupported or unknown fork kind; cannot catch it");
+ error (_("unsupported or unknown fork kind; cannot catch it"));
break;
}
}
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
/* If this target supports it, create an exec catchpoint
and enable reporting of such events. */
}
if ((*arg != '\0') && !isspace (*arg))
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
/* Create a load breakpoint that only triggers when a load of
the specified dll (or any dll, if no pathname was specified)
}
if ((*arg != '\0') && !isspace (*arg))
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
/* Create an unload breakpoint that only triggers when an unload of
the specified dll (or any dll, if no pathname was specified)
bptype = bp_catch_catch;
break;
default: /* error condition */
- error ("Internal error -- invalid catchpoint kind");
+ error (_("Internal error -- invalid catchpoint kind"));
}
b = set_raw_breakpoint (*sal, bptype);
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error ("Junk at end of arguments.");
+ error (_("Junk at end of arguments."));
if ((ex_event != EX_EVENT_THROW) &&
(ex_event != EX_EVENT_CATCH))
- error ("Unsupported or unknown exception event; cannot catch it");
+ error (_("Unsupported or unknown exception event; cannot catch it"));
if (handle_gnu_v3_exceptions (tempflag, cond_string, ex_event, from_tty))
return;
return; /* something went wrong with setting up callbacks */
}
- warning ("Unsupported with this platform/compiler combination.");
+ warning (_("Unsupported with this platform/compiler combination."));
}
/* Cover routine to allow wrapping target_enable_exception_catchpoints
/* catch_throw_command_1 (arg1_start, tempflag, from_tty); */
/* return; */
/* Now, this is not allowed */
- error ("Catch requires an event name.");
+ error (_("Catch requires an event name."));
}
arg1_end = ep_find_event_name_end (arg1_start);
if (arg1_end == NULL)
- error ("catch requires an event");
+ error (_("catch requires an event"));
arg1_length = arg1_end + 1 - arg1_start;
/* Try to match what we found against known event names. */
if (strncmp (arg1_start, "signal", arg1_length) == 0)
{
- error ("Catch of signal not yet implemented");
+ error (_("Catch of signal not yet implemented"));
}
else if (strncmp (arg1_start, "catch", arg1_length) == 0)
{
}
else if (strncmp (arg1_start, "thread_start", arg1_length) == 0)
{
- error ("Catch of thread_start not yet implemented");
+ error (_("Catch of thread_start not yet implemented"));
}
else if (strncmp (arg1_start, "thread_exit", arg1_length) == 0)
{
- error ("Catch of thread_exit not yet implemented");
+ error (_("Catch of thread_exit not yet implemented"));
}
else if (strncmp (arg1_start, "thread_join", arg1_length) == 0)
{
- error ("Catch of thread_join not yet implemented");
+ error (_("Catch of thread_join not yet implemented"));
}
else if (strncmp (arg1_start, "start", arg1_length) == 0)
{
- error ("Catch of start not yet implemented");
+ error (_("Catch of start not yet implemented"));
}
else if (strncmp (arg1_start, "exit", arg1_length) == 0)
{
- error ("Catch of exit not yet implemented");
+ error (_("Catch of exit not yet implemented"));
}
else if (strncmp (arg1_start, "fork", arg1_length) == 0)
{
}
else if (strncmp (arg1_start, "stop", arg1_length) == 0)
{
- error ("Catch of stop not yet implemented");
+ error (_("Catch of stop not yet implemented"));
}
/* This doesn't appear to be an event name */
as the name of an exception */
/* catch_throw_command_1 (arg1_start, tempflag, from_tty); */
/* Now this is not allowed */
- error ("Unknown event kind specified for catch");
+ error (_("Unknown event kind specified for catch"));
}
}
sal.symtab = default_breakpoint_symtab;
sal.pc = default_breakpoint_address;
if (sal.symtab == 0)
- error ("No source file specified.");
+ error (_("No source file specified."));
sals.sals[0] = sal;
sals.nelts = 1;
if (found == 0)
{
if (arg)
- error ("No breakpoint at %s.", arg);
+ error (_("No breakpoint at %s."), arg);
else
- error ("No breakpoint at this line.");
+ error (_("No breakpoint at this line."));
}
if (found->next)
bpstat bs;
struct bp_location *loc;
- if (bpt == NULL)
- error ("Internal error (attempted to delete a NULL breakpoint)");
-
+ gdb_assert (bpt != NULL);
/* Has this bp already been deleted? This can happen because multiple
lists can hold pointers to bp's. bpstat lists are especial culprits.
A real solution to this problem might involve reference counts in bp's,
and/or giving them pointers back to their referencing bpstat's, and
teaching delete_breakpoint to only free a bp's storage when no more
- references were extent. A cheaper bandaid was chosen. */
+ references were extent. A cheaper bandaid was chosen. */
if (bpt->type == bp_none)
return;
isn't actually running. target_enable_exception_callback for a
null target ops vector gives an undesirable error message, so we
check here and avoid it. Since currently (1997-09-17) only HP-UX aCC's
- exceptions are supported in this way, it's OK for now. FIXME */
+ exceptions are supported in this way, it's OK for now. FIXME */
if (ep_is_exception_catchpoint (bpt) && target_has_execution)
{
/* Format possible error msg */
switch (b->type)
{
case bp_none:
- warning ("attempted to reset apparently deleted breakpoint #%d?",
+ warning (_("attempted to reset apparently deleted breakpoint #%d?"),
b->number);
return 0;
case bp_breakpoint:
}
b->val = evaluate_expression (b->exp);
release_value (b->val);
- if (VALUE_LAZY (b->val) && breakpoint_enabled (b))
+ if (value_lazy (b->val) && breakpoint_enabled (b))
value_fetch_lazy (b->val);
if (b->cond_string != NULL)
return;
}
- error ("No breakpoint number %d.", bptnum);
+ error (_("No breakpoint number %d."), bptnum);
}
/* Clear the ignore counts of all breakpoints. */
num = get_number (&p);
if (num == 0)
- error ("bad breakpoint number: '%s'", args);
+ error (_("bad breakpoint number: '%s'"), args);
if (*p == 0)
- error ("Second argument (specified ignore-count) is missing.");
+ error (_("Second argument (specified ignore-count) is missing."));
set_ignore_count (num,
longest_to_int (value_as_long (parse_and_eval (p))),
num = get_number_or_range (&p1);
if (num == 0)
{
- warning ("bad breakpoint number at or near '%s'", p);
+ warning (_("bad breakpoint number at or near '%s'"), p);
}
else
{
switch (bpt->type)
{
case bp_none:
- warning ("attempted to disable apparently deleted breakpoint #%d?",
+ warning (_("attempted to disable apparently deleted breakpoint #%d?"),
bpt->number);
continue;
case bp_breakpoint:
TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint,
i + 1, 0);
if (target_resources_ok == 0)
- error ("No hardware breakpoint support in the target.");
+ error (_("No hardware breakpoint support in the target."));
else if (target_resources_ok < 0)
- error ("Hardware breakpoints used exceeds limit.");
+ error (_("Hardware breakpoints used exceeds limit."));
}
if (bpt->pending)
{
struct frame_id saved_frame_id;
- saved_frame_id = get_frame_id (get_selected_frame ());
+ saved_frame_id = get_frame_id (get_selected_frame (NULL));
if (bpt->exp_valid_block != NULL)
{
struct frame_info *fr =
mark = value_mark ();
bpt->val = evaluate_expression (bpt->exp);
release_value (bpt->val);
- if (VALUE_LAZY (bpt->val))
+ if (value_lazy (bpt->val))
value_fetch_lazy (bpt->val);
if (bpt->type == bp_hardware_watchpoint ||
/* The enable command enables the specified breakpoints (or all defined
breakpoints) so they once again become (or continue to be) effective
- in stopping the inferior. */
+ in stopping the inferior. */
static void
enable_command (char *args, int from_tty)
switch (bpt->type)
{
case bp_none:
- warning ("attempted to enable apparently deleted breakpoint #%d?",
+ warning (_("attempted to enable apparently deleted breakpoint #%d?"),
bpt->number);
continue;
case bp_breakpoint:
{
struct symtabs_and_lines sals;
if (string == 0)
- error ("Empty line specification.");
+ error (_("Empty line specification."));
if (default_breakpoint_valid)
sals = decode_line_1 (&string, funfirstline,
default_breakpoint_symtab,
sals = decode_line_1 (&string, funfirstline,
(struct symtab *) NULL, 0, (char ***) NULL, NULL);
if (*string)
- error ("Junk at end of line specification: %s", string);
+ error (_("Junk at end of line specification: %s"), string);
return sals;
}
\f
If on, an unrecognized breakpoint location will cause gdb to create a\n\
pending breakpoint. If off, an unrecognized breakpoint location results in\n\
an error. If auto, an unrecognized breakpoint location results in a\n\
-user-query to see if a pending breakpoint should be created.", "\
-Debugger's behavior regarding pending breakpoints is %s.",
+user-query to see if a pending breakpoint should be created.",
+ NULL, /* PRINT: Debugger's behavior regarding pending breakpoints is %s. */
NULL, NULL,
&breakpoint_set_cmdlist,
&breakpoint_show_cmdlist);