add _siglongjmp to list of longjmp breakpoints.

This commit is contained in:
David Taylor 1997-12-31 07:36:28 +00:00
parent 47d9c13912
commit 6b038bd9e6
2 changed files with 231 additions and 109 deletions

View File

@ -1,3 +1,8 @@
Wed Dec 31 10:33:15 1997 David Taylor <taylor@texas.cygnus.com>
* breakpoint.c (breakpoint_re_set): add _siglongjmp to list of
longjmp breakpoints.
Mon Dec 29 21:25:34 1997 Mark Alexander <marka@cygnus.com> Mon Dec 29 21:25:34 1997 Mark Alexander <marka@cygnus.com>
* dve3900-rom.c: New file to support Densan DVE-R3900/20 board. * dve3900-rom.c: New file to support Densan DVE-R3900/20 board.

View File

@ -1,5 +1,5 @@
/* Everything about breakpoints, for GDB. /* Everything about breakpoints, for GDB.
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "gdb_string.h" #include "gdb_string.h"
#include "demangle.h" #include "demangle.h"
#include "annotate.h" #include "annotate.h"
#include "symfile.h"
#include "objfiles.h"
/* local function prototypes */ /* local function prototypes */
@ -100,10 +102,10 @@ static struct breakpoint *
set_raw_breakpoint PARAMS ((struct symtab_and_line)); set_raw_breakpoint PARAMS ((struct symtab_and_line));
static void static void
check_duplicates PARAMS ((CORE_ADDR)); check_duplicates PARAMS ((CORE_ADDR, asection *));
static void static void
describe_other_breakpoints PARAMS ((CORE_ADDR)); describe_other_breakpoints PARAMS ((CORE_ADDR, asection *));
static void static void
breakpoints_info PARAMS ((char *, int)); breakpoints_info PARAMS ((char *, int));
@ -181,6 +183,10 @@ do_enable_breakpoint PARAMS ((struct breakpoint *, enum bpdisp));
extern int addressprint; /* Print machine addresses? */ extern int addressprint; /* Print machine addresses? */
#if defined (GET_LONGJMP_TARGET) || defined (SOLIB_ADD)
static int internal_breakpoint_number = -1;
#endif
/* Are we executing breakpoint commands? */ /* Are we executing breakpoint commands? */
static int executing_breakpoint_commands; static int executing_breakpoint_commands;
@ -195,6 +201,16 @@ static int executing_breakpoint_commands;
b? (tmp=b->next, 1): 0; \ b? (tmp=b->next, 1): 0; \
b = tmp) b = tmp)
/* True if SHIFT_INST_REGS defined, false otherwise. */
int must_shift_inst_regs =
#if defined(SHIFT_INST_REGS)
1
#else
0
#endif
;
/* True if breakpoint hit counts should be displayed in breakpoint info. */ /* True if breakpoint hit counts should be displayed in breakpoint info. */
int show_breakpoint_hit_counts = 1; int show_breakpoint_hit_counts = 1;
@ -507,7 +523,30 @@ insert_breakpoints ()
if (b->type == bp_hardware_breakpoint) if (b->type == bp_hardware_breakpoint)
val = target_insert_hw_breakpoint(b->address, b->shadow_contents); val = target_insert_hw_breakpoint(b->address, b->shadow_contents);
else else
val = target_insert_breakpoint(b->address, b->shadow_contents); {
/* Check to see if breakpoint is in an overlay section;
if so, we should set the breakpoint at the LMA address.
Only if the section is currently mapped should we ALSO
set a break at the VMA address. */
if (overlay_debugging && b->section &&
section_is_overlay (b->section))
{
CORE_ADDR addr;
addr = overlay_unmapped_address (b->address, b->section);
val = target_insert_breakpoint (addr, b->shadow_contents);
/* This would be the time to check val, to see if the
breakpoint write to the load address succeeded.
However, this might be an ordinary occurrance, eg. if
the unmapped overlay is in ROM. */
val = 0; /* in case unmapped address failed */
if (section_is_mapped (b->section))
val = target_insert_breakpoint (b->address,
b->shadow_contents);
}
else /* ordinary (non-overlay) address */
val = target_insert_breakpoint(b->address, b->shadow_contents);
}
if (val) if (val)
{ {
/* Can't set the breakpoint. */ /* Can't set the breakpoint. */
@ -563,8 +602,14 @@ insert_breakpoints ()
within_current_scope = 1; within_current_scope = 1;
else else
{ {
struct frame_info *fi = struct frame_info *fi;
find_frame_addr_in_frame_chain (b->watchpoint_frame);
/* There might be no current frame at this moment if we are
resuming from a step over a breakpoint.
Set up current frame before trying to find the watchpoint
frame. */
get_current_frame ();
fi = find_frame_addr_in_frame_chain (b->watchpoint_frame);
within_current_scope = (fi != NULL); within_current_scope = (fi != NULL);
if (within_current_scope) if (within_current_scope)
select_frame (fi, -1); select_frame (fi, -1);
@ -617,11 +662,7 @@ insert_breakpoints ()
Hardware watchpoint %d deleted because the program has left the block in\n\ Hardware watchpoint %d deleted because the program has left the block in\n\
which its expression is valid.\n", b->number); which its expression is valid.\n", b->number);
if (b->related_breakpoint) if (b->related_breakpoint)
{ b->related_breakpoint->disposition = del_at_next_stop;
b->related_breakpoint->enable = disable;
b->related_breakpoint->disposition = del_at_next_stop;
}
b->enable = disable;
b->disposition = del_at_next_stop; b->disposition = del_at_next_stop;
} }
@ -667,7 +708,30 @@ remove_breakpoint (b)
if (b->type == bp_hardware_breakpoint) if (b->type == bp_hardware_breakpoint)
val = target_remove_hw_breakpoint(b->address, b->shadow_contents); val = target_remove_hw_breakpoint(b->address, b->shadow_contents);
else else
val = target_remove_breakpoint(b->address, b->shadow_contents); {
/* Check to see if breakpoint is in an overlay section;
if so, we should remove the breakpoint at the LMA address.
If that is not equal to the raw address, then we should
presumable remove the breakpoint there as well. */
if (overlay_debugging && b->section &&
section_is_overlay (b->section))
{
CORE_ADDR addr;
addr = overlay_unmapped_address (b->address, b->section);
val = target_remove_breakpoint (addr, b->shadow_contents);
/* This would be the time to check val, to see if the
shadow breakpoint write to the load address succeeded.
However, this might be an ordinary occurrance, eg. if
the unmapped overlay is in ROM. */
val = 0; /* in case unmapped address failed */
if (section_is_mapped (b->section))
val = target_remove_breakpoint (b->address,
b->shadow_contents);
}
else /* ordinary (non-overlay) address */
val = target_remove_breakpoint(b->address, b->shadow_contents);
}
if (val) if (val)
return val; return val;
b->inserted = 0; b->inserted = 0;
@ -688,11 +752,17 @@ remove_breakpoint (b)
at that address. */ at that address. */
if (v->lval == lval_memory) if (v->lval == lval_memory)
{ {
int addr, len; int addr, len, type;
addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
len = TYPE_LENGTH (VALUE_TYPE (v)); len = TYPE_LENGTH (VALUE_TYPE (v));
val = target_remove_watchpoint (addr, len, b->type); type = 0;
if (b->type == bp_read_watchpoint)
type = 1;
else if (b->type == bp_access_watchpoint)
type = 2;
val = target_remove_watchpoint (addr, len, type);
if (val == -1) if (val == -1)
b->inserted = 1; b->inserted = 1;
val = 0; val = 0;
@ -778,10 +848,36 @@ breakpoint_here_p (pc)
register struct breakpoint *b; register struct breakpoint *b;
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->enable != disabled if (b->enable == enabled
&& b->enable != shlib_disabled && b->address == pc) /* bp is enabled and matches pc */
&& b->address == pc) if (overlay_debugging &&
return 1; section_is_overlay (b->section) &&
!section_is_mapped (b->section))
continue; /* unmapped overlay -- can't be a match */
else
return 1;
return 0;
}
/* breakpoint_inserted_here_p (PC) is just like breakpoint_here_p(), but it
only returns true if there is actually a breakpoint inserted at PC. */
int
breakpoint_inserted_here_p (pc)
CORE_ADDR pc;
{
register struct breakpoint *b;
ALL_BREAKPOINTS (b)
if (b->inserted
&& b->address == pc) /* bp is inserted and matches pc */
if (overlay_debugging &&
section_is_overlay (b->section) &&
!section_is_mapped (b->section))
continue; /* unmapped overlay -- can't be a match */
else
return 1;
return 0; return 0;
} }
@ -795,12 +891,15 @@ int
frame_in_dummy (frame) frame_in_dummy (frame)
struct frame_info *frame; struct frame_info *frame;
{ {
#ifdef CALL_DUMMY
#ifdef USE_GENERIC_DUMMY_FRAMES
return generic_pc_in_call_dummy (frame->pc, frame->frame);
#else
struct breakpoint *b; struct breakpoint *b;
#ifdef CALL_DUMMY
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
{ {
static unsigned LONGEST dummy[] = CALL_DUMMY; static ULONGEST dummy[] = CALL_DUMMY;
if (b->type == bp_call_dummy if (b->type == bp_call_dummy
&& b->frame == frame->frame && b->frame == frame->frame
@ -813,6 +912,7 @@ frame_in_dummy (frame)
&& frame->pc <= b->address) && frame->pc <= b->address)
return 1; return 1;
} }
#endif /* GENERIC_DUMMY_FRAMES */
#endif /* CALL_DUMMY */ #endif /* CALL_DUMMY */
return 0; return 0;
} }
@ -835,7 +935,12 @@ breakpoint_thread_match (pc, pid)
&& b->enable != shlib_disabled && b->enable != shlib_disabled
&& b->address == pc && b->address == pc
&& (b->thread == -1 || b->thread == thread)) && (b->thread == -1 || b->thread == thread))
return 1; if (overlay_debugging &&
section_is_overlay (b->section) &&
!section_is_mapped (b->section))
continue; /* unmapped overlay -- can't be a match */
else
return 1;
return 0; return 0;
} }
@ -1214,11 +1319,7 @@ watchpoint_check (p)
Watchpoint %d deleted because the program has left the block in\n\ Watchpoint %d deleted because the program has left the block in\n\
which its expression is valid.\n", bs->breakpoint_at->number); which its expression is valid.\n", bs->breakpoint_at->number);
if (b->related_breakpoint) if (b->related_breakpoint)
{ b->related_breakpoint->disposition = del_at_next_stop;
b->related_breakpoint->enable = disable;
b->related_breakpoint->disposition = del_at_next_stop;
}
b->enable = disable;
b->disposition = del_at_next_stop; b->disposition = del_at_next_stop;
return WP_DELETED; return WP_DELETED;
@ -1272,10 +1373,8 @@ bpstat_stop_status (pc, not_a_breakpoint)
{ {
register struct breakpoint *b, *temp; register struct breakpoint *b, *temp;
CORE_ADDR bp_addr; CORE_ADDR bp_addr;
#if DECR_PC_AFTER_BREAK != 0 || defined (SHIFT_INST_REGS)
/* True if we've hit a breakpoint (as opposed to a watchpoint). */ /* True if we've hit a breakpoint (as opposed to a watchpoint). */
int real_breakpoint = 0; int real_breakpoint = 0;
#endif
/* Root of the chain of bpstat's */ /* Root of the chain of bpstat's */
struct bpstats root_bs[1]; struct bpstats root_bs[1];
/* Pointer to the last thing in the chain currently. */ /* Pointer to the last thing in the chain currently. */
@ -1297,9 +1396,12 @@ bpstat_stop_status (pc, not_a_breakpoint)
&& b->type != bp_hardware_watchpoint && b->type != bp_hardware_watchpoint
&& b->type != bp_read_watchpoint && b->type != bp_read_watchpoint
&& b->type != bp_access_watchpoint && b->type != bp_access_watchpoint
&& b->type != bp_hardware_breakpoint && b->type != bp_hardware_breakpoint) /* a non-watchpoint bp */
&& b->address != bp_addr) if (b->address != bp_addr || /* address doesn't match or */
continue; (overlay_debugging && /* overlay doesn't match */
section_is_overlay (b->section) &&
!section_is_mapped (b->section)))
continue;
if (b->type == bp_hardware_breakpoint if (b->type == bp_hardware_breakpoint
&& b->address != (bp_addr - DECR_PC_AFTER_HW_BREAK)) && b->address != (bp_addr - DECR_PC_AFTER_HW_BREAK))
@ -1347,11 +1449,7 @@ bpstat_stop_status (pc, not_a_breakpoint)
/* Error from catch_errors. */ /* Error from catch_errors. */
printf_filtered ("Watchpoint %d deleted.\n", b->number); printf_filtered ("Watchpoint %d deleted.\n", b->number);
if (b->related_breakpoint) if (b->related_breakpoint)
{ b->related_breakpoint->disposition = del_at_next_stop;
b->related_breakpoint->enable = disable;
b->related_breakpoint->disposition = del_at_next_stop;
}
b->enable = disable;
b->disposition = del_at_next_stop; b->disposition = del_at_next_stop;
/* We've already printed what needs to be printed. */ /* We've already printed what needs to be printed. */
bs->print_it = print_it_done; bs->print_it = print_it_done;
@ -1398,21 +1496,15 @@ bpstat_stop_status (pc, not_a_breakpoint)
/* Error from catch_errors. */ /* Error from catch_errors. */
printf_filtered ("Watchpoint %d deleted.\n", b->number); printf_filtered ("Watchpoint %d deleted.\n", b->number);
if (b->related_breakpoint) if (b->related_breakpoint)
{ b->related_breakpoint->disposition = del_at_next_stop;
b->related_breakpoint->enable = disable;
b->related_breakpoint->disposition = del_at_next_stop;
}
b->enable = disable;
b->disposition = del_at_next_stop; b->disposition = del_at_next_stop;
/* We've already printed what needs to be printed. */ /* We've already printed what needs to be printed. */
bs->print_it = print_it_done; bs->print_it = print_it_done;
break; break;
} }
} }
#if DECR_PC_AFTER_BREAK != 0 || defined (SHIFT_INST_REGS) else if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs)
else
real_breakpoint = 1; real_breakpoint = 1;
#endif
if (b->frame && b->frame != (get_current_frame ())->frame) if (b->frame && b->frame != (get_current_frame ())->frame)
bs->stop = 0; bs->stop = 0;
@ -1463,8 +1555,8 @@ bpstat_stop_status (pc, not_a_breakpoint)
bs->next = NULL; /* Terminate the chain */ bs->next = NULL; /* Terminate the chain */
bs = root_bs->next; /* Re-grab the head of the chain */ bs = root_bs->next; /* Re-grab the head of the chain */
#if DECR_PC_AFTER_BREAK != 0 || defined (SHIFT_INST_REGS)
if (bs) if ((DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs) && bs)
{ {
if (real_breakpoint) if (real_breakpoint)
{ {
@ -1476,7 +1568,6 @@ bpstat_stop_status (pc, not_a_breakpoint)
#endif /* No SHIFT_INST_REGS. */ #endif /* No SHIFT_INST_REGS. */
} }
} }
#endif /* DECR_PC_AFTER_BREAK != 0. */
/* The value of a hardware watchpoint hasn't changed, but the /* The value of a hardware watchpoint hasn't changed, but the
intermediate memory locations we are watching may have. */ intermediate memory locations we are watching may have. */
@ -1807,7 +1898,7 @@ breakpoint_1 (bnum, allflag)
last_addr = b->address; last_addr = b->address;
if (b->source_file) if (b->source_file)
{ {
sym = find_pc_function (b->address); sym = find_pc_sect_function (b->address, b->section);
if (sym) if (sym)
{ {
fputs_filtered ("in ", gdb_stdout); fputs_filtered ("in ", gdb_stdout);
@ -1927,29 +2018,34 @@ maintenance_info_breakpoints (bnum_exp, from_tty)
/* Print a message describing any breakpoints set at PC. */ /* Print a message describing any breakpoints set at PC. */
static void static void
describe_other_breakpoints (pc) describe_other_breakpoints (pc, section)
register CORE_ADDR pc; CORE_ADDR pc;
asection *section;
{ {
register int others = 0; register int others = 0;
register struct breakpoint *b; register struct breakpoint *b;
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->address == pc) if (b->address == pc)
others++; if (overlay_debugging == 0 ||
b->section == section)
others++;
if (others > 0) if (others > 0)
{ {
printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : ""); printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->address == pc) if (b->address == pc)
{ if (overlay_debugging == 0 ||
others--; b->section == section)
printf_filtered {
("%d%s%s ", others--;
b->number, printf_filtered
((b->enable == disabled || b->enable == shlib_disabled) ("%d%s%s ",
? " (disabled)" : ""), b->number,
(others > 1) ? "," : ((others == 1) ? " and" : "")); ((b->enable == disabled || b->enable == shlib_disabled)
} ? " (disabled)" : ""),
(others > 1) ? "," : ((others == 1) ? " and" : ""));
}
printf_filtered ("also set at pc "); printf_filtered ("also set at pc ");
print_address_numeric (pc, 1, gdb_stdout); print_address_numeric (pc, 1, gdb_stdout);
printf_filtered (".\n"); printf_filtered (".\n");
@ -1977,8 +2073,9 @@ set_default_breakpoint (valid, addr, symtab, line)
This is so that the bpt instruction is only inserted once. */ This is so that the bpt instruction is only inserted once. */
static void static void
check_duplicates (address) check_duplicates (address, section)
CORE_ADDR address; CORE_ADDR address;
asection *section;
{ {
register struct breakpoint *b; register struct breakpoint *b;
register int count = 0; register int count = 0;
@ -1989,7 +2086,8 @@ check_duplicates (address)
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->enable != disabled if (b->enable != disabled
&& b->enable != shlib_disabled && b->enable != shlib_disabled
&& b->address == address) && b->address == address
&& (overlay_debugging == 0 || b->section == section))
{ {
count++; count++;
b->duplicate = count > 1; b->duplicate = count > 1;
@ -2020,6 +2118,7 @@ set_raw_breakpoint (sal)
else else
b->source_file = savestring (sal.symtab->filename, b->source_file = savestring (sal.symtab->filename,
strlen (sal.symtab->filename)); strlen (sal.symtab->filename));
b->section = sal.section;
b->language = current_language->la_language; b->language = current_language->la_language;
b->input_radix = input_radix; b->input_radix = input_radix;
b->thread = -1; b->thread = -1;
@ -2045,14 +2144,12 @@ set_raw_breakpoint (sal)
b1->next = b; b1->next = b;
} }
check_duplicates (sal.pc); check_duplicates (sal.pc, sal.section);
breakpoints_changed (); breakpoints_changed ();
return b; return b;
} }
static int internal_breakpoint_number = -1;
#ifdef GET_LONGJMP_TARGET #ifdef GET_LONGJMP_TARGET
static void static void
@ -2062,6 +2159,7 @@ create_longjmp_breakpoint (func_name)
struct symtab_and_line sal; struct symtab_and_line sal;
struct breakpoint *b; struct breakpoint *b;
INIT_SAL (&sal); /* initialize to zeroes */
if (func_name != NULL) if (func_name != NULL)
{ {
struct minimal_symbol *m; struct minimal_symbol *m;
@ -2072,12 +2170,7 @@ create_longjmp_breakpoint (func_name)
else else
return; return;
} }
else sal.section = find_pc_overlay (sal.pc);
sal.pc = 0;
sal.symtab = NULL;
sal.line = 0;
b = set_raw_breakpoint (sal); b = set_raw_breakpoint (sal);
if (!b) return; if (!b) return;
@ -2105,7 +2198,7 @@ enable_longjmp_breakpoint()
if (b->type == bp_longjmp) if (b->type == bp_longjmp)
{ {
b->enable = enabled; b->enable = enabled;
check_duplicates (b->address); check_duplicates (b->address, b->section);
} }
} }
@ -2119,7 +2212,7 @@ disable_longjmp_breakpoint()
|| b->type == bp_longjmp_resume) || b->type == bp_longjmp_resume)
{ {
b->enable = disabled; b->enable = disabled;
check_duplicates (b->address); check_duplicates (b->address, b->section);
} }
} }
@ -2141,9 +2234,9 @@ create_solib_event_breakpoint (address)
struct breakpoint *b; struct breakpoint *b;
struct symtab_and_line sal; struct symtab_and_line sal;
INIT_SAL (&sal); /* initialize to zeroes */
sal.pc = address; sal.pc = address;
sal.symtab = NULL; sal.section = find_pc_overlay (sal.pc);
sal.line = 0;
b = set_raw_breakpoint (sal); b = set_raw_breakpoint (sal);
b->number = internal_breakpoint_number--; b->number = internal_breakpoint_number--;
b->disposition = donttouch; b->disposition = donttouch;
@ -2232,7 +2325,7 @@ set_longjmp_resume_breakpoint(pc, frame)
b->frame = frame->frame; b->frame = frame->frame;
else else
b->frame = 0; b->frame = 0;
check_duplicates (b->address); check_duplicates (b->address, b->section);
return; return;
} }
} }
@ -2366,8 +2459,7 @@ break_command_1 (arg, flag, from_tty)
sals.sals = NULL; sals.sals = NULL;
sals.nelts = 0; sals.nelts = 0;
sal.line = sal.pc = sal.end = 0; INIT_SAL (&sal); /* initialize to zeroes */
sal.symtab = 0;
/* If no arg given, or if first arg is 'if ', use the default breakpoint. */ /* If no arg given, or if first arg is 'if ', use the default breakpoint. */
@ -2381,6 +2473,7 @@ break_command_1 (arg, flag, from_tty)
sal.pc = default_breakpoint_address; sal.pc = default_breakpoint_address;
sal.line = default_breakpoint_line; sal.line = default_breakpoint_line;
sal.symtab = default_breakpoint_symtab; sal.symtab = default_breakpoint_symtab;
sal.section = find_pc_overlay (sal.pc);
sals.sals[0] = sal; sals.sals[0] = sal;
sals.nelts = 1; sals.nelts = 1;
} }
@ -2493,7 +2586,7 @@ break_command_1 (arg, flag, from_tty)
sal = sals.sals[i]; sal = sals.sals[i];
if (from_tty) if (from_tty)
describe_other_breakpoints (sal.pc); describe_other_breakpoints (sal.pc, sal.section);
b = set_raw_breakpoint (sal); b = set_raw_breakpoint (sal);
set_breakpoint_count (breakpoint_count + 1); set_breakpoint_count (breakpoint_count + 1);
@ -2513,7 +2606,6 @@ break_command_1 (arg, flag, from_tty)
b->enable = enabled; b->enable = enabled;
b->disposition = tempflag ? del : donttouch; b->disposition = tempflag ? del : donttouch;
mention (b); mention (b);
} }
@ -2533,7 +2625,7 @@ resolve_sal_pc (sal)
{ {
CORE_ADDR pc; CORE_ADDR pc;
if (sal->pc == 0 && sal->symtab != 0) if (sal->pc == 0 && sal->symtab != NULL)
{ {
pc = find_line_pc (sal->symtab, sal->line); pc = find_line_pc (sal->symtab, sal->line);
if (pc == 0) if (pc == 0)
@ -2541,6 +2633,23 @@ resolve_sal_pc (sal)
sal->line, sal->symtab->filename); sal->line, sal->symtab->filename);
sal->pc = pc; sal->pc = pc;
} }
if (sal->section == 0 && sal->symtab != NULL)
{
struct blockvector *bv;
struct block *b;
struct symbol *sym;
int index;
bv = blockvector_for_pc_sect (sal->pc, 0, &index, sal->symtab);
b = BLOCKVECTOR_BLOCK (bv, index);
sym = block_function (b);
if (sym != NULL)
{
fixup_symbol_section (sym, sal->symtab->objfile);
sal->section = SYMBOL_BFD_SECTION (block_function (b));
}
}
} }
void void
@ -2598,13 +2707,11 @@ watch_command_1 (arg, accessflag, from_tty)
char *cond_start = NULL; char *cond_start = NULL;
char *cond_end = NULL; char *cond_end = NULL;
struct expression *cond = NULL; struct expression *cond = NULL;
int i, other_type_used, target_resources_ok; int i, other_type_used, target_resources_ok = 0;
enum bptype bp_type; enum bptype bp_type;
int mem_cnt = 0; int mem_cnt = 0;
sal.pc = 0; INIT_SAL (&sal); /* initialize to zeroes */
sal.symtab = NULL;
sal.line = 0;
/* Parse arguments. */ /* Parse arguments. */
innermost_block = NULL; innermost_block = NULL;
@ -2687,15 +2794,15 @@ watch_command_1 (arg, accessflag, from_tty)
expression. */ expression. */
if (innermost_block) if (innermost_block)
{ {
struct breakpoint *scope_breakpoint;
struct symtab_and_line scope_sal;
if (prev_frame) if (prev_frame)
{ {
scope_sal.pc = get_frame_pc (prev_frame); struct breakpoint *scope_breakpoint;
scope_sal.symtab = NULL; struct symtab_and_line scope_sal;
scope_sal.line = 0;
INIT_SAL (&scope_sal); /* initialize to zeroes */
scope_sal.pc = get_frame_pc (prev_frame);
scope_sal.section = find_pc_overlay (scope_sal.pc);
scope_breakpoint = set_raw_breakpoint (scope_sal); scope_breakpoint = set_raw_breakpoint (scope_sal);
set_breakpoint_count (breakpoint_count + 1); set_breakpoint_count (breakpoint_count + 1);
scope_breakpoint->number = breakpoint_count; scope_breakpoint->number = breakpoint_count;
@ -2903,8 +3010,8 @@ map_catch_names (args, function)
#if 0 #if 0
if (function (p)) if (function (p))
{ {
struct sal_chain *next struct sal_chain *next = (struct sal_chain *)
= (struct sal_chain *)alloca (sizeof (struct sal_chain)); alloca (sizeof (struct sal_chain));
next->next = sal_chain; next->next = sal_chain;
next->sal = get_catch_sal (p); next->sal = get_catch_sal (p);
sal_chain = next; sal_chain = next;
@ -3053,8 +3160,7 @@ catch_command_1 (arg, tempflag, from_tty)
char *save_arg; char *save_arg;
int i; int i;
sal.line = sal.pc = sal.end = 0; INIT_SAL (&sal); /* initialize to zeroes */
sal.symtab = 0;
/* If no arg given, or if first arg is 'if ', all active catch clauses /* If no arg given, or if first arg is 'if ', all active catch clauses
are breakpointed. */ are breakpointed. */
@ -3100,7 +3206,7 @@ catch_command_1 (arg, tempflag, from_tty)
sal = sals.sals[i]; sal = sals.sals[i];
if (from_tty) if (from_tty)
describe_other_breakpoints (sal.pc); describe_other_breakpoints (sal.pc, sal.section);
b = set_raw_breakpoint (sal); b = set_raw_breakpoint (sal);
set_breakpoint_count (breakpoint_count + 1); set_breakpoint_count (breakpoint_count + 1);
@ -3125,7 +3231,7 @@ catch_command_1 (arg, tempflag, from_tty)
struct breakpoint * struct breakpoint *
set_breakpoint_sal (sal) set_breakpoint_sal (sal)
struct symtab_and_line sal; struct symtab_and_line sal;
{ {
struct breakpoint *b; struct breakpoint *b;
b = set_raw_breakpoint (sal); b = set_raw_breakpoint (sal);
@ -3189,10 +3295,11 @@ clear_command (arg, from_tty)
} }
else else
{ {
sals.sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); sals.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
INIT_SAL (&sal); /* initialize to zeroes */
sal.line = default_breakpoint_line; sal.line = default_breakpoint_line;
sal.symtab = default_breakpoint_symtab; sal.symtab = default_breakpoint_symtab;
sal.pc = 0;
if (sal.symtab == 0) if (sal.symtab == 0)
error ("No source file specified."); error ("No source file specified.");
@ -3206,9 +3313,12 @@ clear_command (arg, from_tty)
But if sal.pc is zero, clear all bpts on specified line. */ But if sal.pc is zero, clear all bpts on specified line. */
sal = sals.sals[i]; sal = sals.sals[i];
found = (struct breakpoint *) 0; found = (struct breakpoint *) 0;
while (breakpoint_chain while (breakpoint_chain
&& (sal.pc && (sal.pc
? breakpoint_chain->address == sal.pc ? (breakpoint_chain->address == sal.pc &&
(overlay_debugging == 0 ||
breakpoint_chain->section == sal.section))
: (breakpoint_chain->source_file != NULL : (breakpoint_chain->source_file != NULL
&& sal.symtab != NULL && sal.symtab != NULL
&& STREQ (breakpoint_chain->source_file, && STREQ (breakpoint_chain->source_file,
@ -3228,7 +3338,9 @@ clear_command (arg, from_tty)
&& b->next->type != bp_read_watchpoint && b->next->type != bp_read_watchpoint
&& b->next->type != bp_access_watchpoint && b->next->type != bp_access_watchpoint
&& (sal.pc && (sal.pc
? b->next->address == sal.pc ? (b->next->address == sal.pc &&
(overlay_debugging == 0 ||
b->next->section == sal.section))
: (b->next->source_file != NULL : (b->next->source_file != NULL
&& sal.symtab != NULL && sal.symtab != NULL
&& STREQ (b->next->source_file, sal.symtab->filename) && STREQ (b->next->source_file, sal.symtab->filename)
@ -3310,7 +3422,7 @@ delete_breakpoint (bpt)
break; break;
} }
check_duplicates (bpt->address); check_duplicates (bpt->address, bpt->section);
/* If this breakpoint was inserted, and there is another breakpoint /* If this breakpoint was inserted, and there is another breakpoint
at the same address, we need to insert the other breakpoint. */ at the same address, we need to insert the other breakpoint. */
if (bpt->inserted if (bpt->inserted
@ -3320,6 +3432,7 @@ delete_breakpoint (bpt)
{ {
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->address == bpt->address if (b->address == bpt->address
&& b->section == bpt->section
&& !b->duplicate && !b->duplicate
&& b->enable != disabled && b->enable != disabled
&& b->enable != shlib_disabled) && b->enable != shlib_disabled)
@ -3367,6 +3480,7 @@ delete_command (arg, from_tty)
char *arg; char *arg;
int from_tty; int from_tty;
{ {
struct breakpoint *b, *temp;
if (arg == 0) if (arg == 0)
{ {
@ -3375,8 +3489,10 @@ delete_command (arg, from_tty)
|| (breakpoint_chain && query ("Delete all breakpoints? "))) || (breakpoint_chain && query ("Delete all breakpoints? ")))
{ {
/* No arg; clear all breakpoints. */ /* No arg; clear all breakpoints. */
while (breakpoint_chain) ALL_BREAKPOINTS_SAFE(b, temp)
delete_breakpoint (breakpoint_chain); /* do not delete call-dummy breakpoint unles explicitly named! */
if (b->type != bp_call_dummy)
delete_breakpoint (b);
} }
} }
else else
@ -3455,8 +3571,7 @@ breakpoint_re_set_one (bint)
strlen (sals.sals[i].symtab->filename)); strlen (sals.sals[i].symtab->filename));
b->line_number = sals.sals[i].line; b->line_number = sals.sals[i].line;
b->address = sals.sals[i].pc; b->address = sals.sals[i].pc;
check_duplicates (b->address, b->section);
check_duplicates (b->address);
mention (b); mention (b);
@ -3464,6 +3579,7 @@ breakpoint_re_set_one (bint)
rather than once for every breakpoint. */ rather than once for every breakpoint. */
breakpoints_changed (); breakpoints_changed ();
} }
b->section = sals.sals[i].section;
b->enable = save_enable; /* Restore it, this worked. */ b->enable = save_enable; /* Restore it, this worked. */
} }
free ((PTR)sals.sals); free ((PTR)sals.sals);
@ -3560,6 +3676,7 @@ breakpoint_re_set ()
create_longjmp_breakpoint ("longjmp"); create_longjmp_breakpoint ("longjmp");
create_longjmp_breakpoint ("_longjmp"); create_longjmp_breakpoint ("_longjmp");
create_longjmp_breakpoint ("siglongjmp"); create_longjmp_breakpoint ("siglongjmp");
create_longjmp_breakpoint ("_siglongjmp");
create_longjmp_breakpoint (NULL); create_longjmp_breakpoint (NULL);
#endif #endif
@ -3690,7 +3807,7 @@ disable_breakpoint (bpt)
bpt->enable = disabled; bpt->enable = disabled;
check_duplicates (bpt->address); check_duplicates (bpt->address, bpt->section);
if (modify_breakpoint_hook) if (modify_breakpoint_hook)
modify_breakpoint_hook (bpt); modify_breakpoint_hook (bpt);
@ -3745,7 +3862,7 @@ do_enable_breakpoint (bpt, disposition)
bpt->enable = enabled; bpt->enable = enabled;
bpt->disposition = disposition; bpt->disposition = disposition;
check_duplicates (bpt->address); check_duplicates (bpt->address, bpt->section);
breakpoints_changed (); breakpoints_changed ();
if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint || if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint ||