/* NOTE: the following values are a part of MI protocol and represent
values of 'disp' field returned when inferior stops at a breakpoint. */
static char *bpdisps[] = {"del", "dstp", "dis", "keep"};
+
return bpdisps[(int) disp];
}
{
struct counted_command_line *result
= xmalloc (sizeof (struct counted_command_line));
+
result->refc = 1;
result->commands = commands;
return result;
else
{
char *arg = exp;
+
/* I don't know if it matters whether this is the string the user
typed in or the decompiled expression. */
b->cond_string = xstrdup (arg);
check_no_tracepoint_commands (struct command_line *commands)
{
struct command_line *c;
+
for (c = commands; c; c = c->next)
{
int i;
struct command_line *while_stepping = 0;
for (c = commands; c; c = c->next)
{
- char *l = c->line;
if (c->control_type == while_stepping_control)
{
if (b->type == bp_fast_tracepoint)
c2 = while_stepping->body_list[0];
for (; c2; c2 = c2->next)
{
- char *l = c2->line;
if (c2->control_type == while_stepping_control)
error (_("The 'while-stepping' command cannot be nested"));
}
check_tracepoint_command (char *line, void *closure)
{
struct breakpoint *b = closure;
+
validate_actionline (&line, b);
}
insert_catchpoint (struct ui_out *uo, void *args)
{
struct breakpoint *b = (struct breakpoint *) args;
- int val = -1;
gdb_assert (b->type == bp_catchpoint);
gdb_assert (b->ops != NULL && b->ops->insert != NULL);
{
int within_current_scope;
struct frame_id saved_frame_id;
- struct bp_location *loc;
int frame_saved;
- bpstat bs;
/* If this is a local watchpoint, we only want to check if the
watchpoint frame is in scope if the current thread is the thread
{
if (automatic_hardware_breakpoints)
{
- int changed = 0;
enum bp_loc_type new_type;
if (mr->attrib.mode != MEM_RW)
if (new_type != bpt->loc_type)
{
static int said = 0;
+
bpt->loc_type = new_type;
if (!said)
{
ALL_BP_LOCATIONS (b, bp_tmp)
{
- struct thread_info *tp;
- CORE_ADDR last_addr;
-
if (!should_be_inserted (b) || b->inserted)
continue;
remove_breakpoint_1 (struct bp_location *b, insertion_state_t is)
{
int val;
- struct cleanup *old_chain;
if (b->owner->enable_state == bp_permanent)
/* Permanent breakpoints cannot be inserted or removed. */
}
else if (b->loc_type == bp_loc_hardware_watchpoint)
{
- struct value *v;
- struct value *n;
-
b->inserted = (is == mark_inserted);
val = target_remove_watchpoint (b->address, b->length,
b->watchpoint_type);
software_breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc)
{
struct bp_location *bpt, **bptp_tmp;
- int any_breakpoint_here = 0;
ALL_BP_LOCATIONS (bpt, bptp_tmp)
{
{
struct value *mark = value_mark ();
int i = !value_true (evaluate_expression ((struct expression *) exp));
+
value_free_to_mark (mark);
return i;
}
if (is_hardware_watchpoint (b))
{
struct bp_location *loc;
- struct value *v;
b->watchpoint_triggered = watch_triggered_no;
for (loc = b->loc; loc; loc = loc->next)
if (is_watchpoint (b))
{
- CORE_ADDR addr;
- struct value *v;
int must_check_value = 0;
if (b->type == bp_watchpoint)
CORE_ADDR bp_addr, ptid_t ptid)
{
struct breakpoint *b = NULL;
- struct bp_location *bl, **blp_tmp;
+ struct bp_location *bl;
struct bp_location *loc;
/* Root of the chain of bpstat's */
struct bpstats root_bs[1];
bpstat_should_step (void)
{
struct breakpoint *b;
+
ALL_BREAKPOINTS (b)
if (breakpoint_enabled (b) && b->type == bp_watchpoint && b->loc != NULL)
return 1;
int allflag)
{
struct command_line *l;
- struct symbol *sym;
struct ep_type_description
{
enum bptype type;
struct captured_breakpoint_query_args *args = data;
struct breakpoint *b;
struct bp_location *dummy_loc = NULL;
+
ALL_BREAKPOINTS (b)
{
if (args->bnum == b->number)
{
int print_address_bits = breakpoint_address_bits (b);
+
print_one_breakpoint (b, &dummy_loc, print_address_bits, 0);
return GDB_RC_OK;
}
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. */
CORE_ADDR pc, struct obj_section *section)
{
struct bp_location *bl = b->loc;
+
for (; bl; bl = bl->next)
{
if (bl->pspace == pspace
static struct bp_location *
allocate_bp_location (struct breakpoint *bpt)
{
- struct bp_location *loc, *loc_p;
+ struct bp_location *loc;
loc = xmalloc (sizeof (struct bp_location));
memset (loc, 0, sizeof (*loc));
make_breakpoint_permanent (struct breakpoint *b)
{
struct bp_location *bl;
+
b->enable_state = bp_permanent;
/* By definition, permanent breakpoints are already present in the code.
&& b->type == bp_longjmp_master)
{
struct breakpoint *clone = clone_momentary_breakpoint (b);
+
clone->type = bp_longjmp;
clone->thread = thread;
}
ALL_BP_LOCATIONS (loc, locp_tmp)
{
struct breakpoint *b = loc->owner;
+
if ((loc->loc_type == bp_loc_hardware_breakpoint
|| loc->loc_type == bp_loc_software_breakpoint)
&& solib->pspace == loc->pspace
else
{
int i, iter;
+
for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter);
i++)
{
int elem;
+
if (iter >= VEC_length (int, inf->syscalls_counts))
{
int old_size = VEC_length (int, inf->syscalls_counts);
else
{
int i, iter;
+
for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter);
i++)
if (b->syscalls_to_be_caught)
{
int i, iter;
+
for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter);
i++)
{
int i, iter;
char *text = xstrprintf ("%s", "");
+
for (i = 0;
VEC_iterate (int, b->syscalls_to_be_caught, i, iter);
i++)
int enabled)
{
int i;
+
for (i = 0; i < sals.nelts; ++i)
{
struct symtabs_and_lines expanded =
int *not_found_ptr)
{
char *addr_start = *address;
+
*addr_string = NULL;
/* If no arg given, or if first arg is 'if ', use the default
breakpoint. */
if (default_breakpoint_valid)
{
struct symtab_and_line sal;
+
init_sal (&sal); /* initialize to zeroes */
sals->sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
if (addr_start != (*address))
{
int i;
+
for (i = 0; i < sals->nelts; i++)
{
/* Add the string if not present. */
if ((*addr_string)[i] == NULL)
- (*addr_string)[i] = savestring (addr_start, (*address) - addr_start);
+ (*addr_string)[i] = savestring (addr_start,
+ (*address) - addr_start);
}
}
}
char *address)
{
int i;
+
for (i = 0; i < sals->nelts; i++)
resolve_sal_pc (&sals->sals[i]);
}
int toklen;
char *cond_start = NULL;
char *cond_end = NULL;
+
while (*tok == ' ' || *tok == '\t')
tok++;
struct symtabs_and_lines sals;
struct symtab_and_line pending_sal;
char *copy_arg;
- char *err_msg;
char *addr_start = arg;
char **addr_string;
struct cleanup *old_chain;
}
else
{
- struct symtab_and_line sal = {0};
struct breakpoint *b;
make_cleanup (xfree, copy_arg);
}
-
/* Helper function for break_command_1 and disassemble_command. */
void
static void
watch_command_1 (char *arg, int accessflag, int from_tty)
{
- struct gdbarch *gdbarch = get_current_arch ();
struct breakpoint *b, *scope_breakpoint = NULL;
struct expression *exp;
struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
catch_fork_kind;
static void
-catch_fork_command_1 (char *arg, int from_tty, struct cmd_list_element *command)
+catch_fork_command_1 (char *arg, int from_tty,
+ struct cmd_list_element *command)
{
struct gdbarch *gdbarch = get_current_arch ();
char *cond_string = NULL;
}
static void
-catch_exec_command_1 (char *arg, int from_tty, struct cmd_list_element *command)
+catch_exec_command_1 (char *arg, int from_tty,
+ struct cmd_list_element *command)
{
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
}
static void
-print_one_exception_catchpoint (struct breakpoint *b, struct bp_location **last_loc)
+print_one_exception_catchpoint (struct breakpoint *b,
+ struct bp_location **last_loc)
{
struct value_print_options opts;
+
get_user_print_options (&opts);
if (opts.addressprint)
{
int tempflag, int from_tty)
{
char *cond_string = NULL;
- struct symtab_and_line *sal = NULL;
if (!arg)
arg = "";
catch_catch_command (char *arg, int from_tty, struct cmd_list_element *command)
{
int tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
+
catch_exception_command_1 (EX_EVENT_CATCH, arg, tempflag, from_tty);
}
catch_throw_command (char *arg, int from_tty, struct cmd_list_element *command)
{
int tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
+
catch_exception_command_1 (EX_EVENT_THROW, arg, tempflag, from_tty);
}
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
struct symtab_and_line sal;
- enum bptype type;
char *addr_string = NULL;
char *exp_string = NULL;
char *cond_string = NULL;
/* Implement the "catch syscall" command. */
static void
-catch_syscall_command_1 (char *arg, int from_tty, struct cmd_list_element *command)
+catch_syscall_command_1 (char *arg, int from_tty,
+ struct cmd_list_element *command)
{
int tempflag;
VEC(int) *filter;
update_global_location_list_nothrow (int inserting)
{
struct gdb_exception e;
+
TRY_CATCH (e, RETURN_MASK_ERROR)
update_global_location_list (inserting);
}
bpstat_remove_breakpoint (bpstat bps, struct breakpoint *bpt)
{
bpstat bs;
+
for (bs = bps; bs; bs = bs->next)
if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
{
bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
{
struct breakpoint *bpt = data;
+
bpstat_remove_breakpoint (th->stop_bpstat, bpt);
return 0;
}
delete_breakpoint (struct breakpoint *bpt)
{
struct breakpoint *b;
- struct bp_location *loc, *next;
gdb_assert (bpt != NULL);
{
struct bp_location *l;
htab_t htab = htab_create_alloc (13, htab_hash_string,
- (int (*) (const void *, const void *)) streq,
+ (int (*) (const void *,
+ const void *)) streq,
NULL, xcalloc, xfree);
for (l = loc; l != NULL; l = l->next)
{
/* get past catch_errs */
struct breakpoint *b = (struct breakpoint *) bint;
- struct value *mark;
- int i;
int not_found = 0;
int *not_found_ptr = ¬_found;
struct symtabs_and_lines sals = {0};
struct symtabs_and_lines expanded = {0};
char *s;
- enum enable_state save_enable;
struct gdb_exception e;
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
disable_command (char *args, int from_tty)
{
struct breakpoint *bpt;
+
if (args == 0)
ALL_BREAKPOINTS (bpt)
switch (bpt->type)
static void
do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
{
- int target_resources_ok, other_type_used;
- struct value *mark;
+ int target_resources_ok;
if (bpt->type == bp_hardware_breakpoint)
{
enable_command (char *args, int from_tty)
{
struct breakpoint *bpt;
+
if (args == 0)
ALL_BREAKPOINTS (bpt)
switch (bpt->type)
decode_line_spec_1 (char *string, int funfirstline)
{
struct symtabs_and_lines sals;
+
if (string == 0)
error (_("Empty line specification."));
if (default_breakpoint_valid)
/* Check whether a software single-step breakpoint is inserted at PC. */
static int
-single_step_breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc)
+single_step_breakpoint_inserted_here_p (struct address_space *aspace,
+ CORE_ADDR pc)
{
int i;
char *text, char *word)
{
const char **list = get_syscall_names ();
+
return (list == NULL) ? NULL : complete_on_enum (list, text, word);
}