- Backport `Breakpoints at multiple locations' patch primarily for C++.

This commit is contained in:
Jan Kratochvil 2007-11-03 19:10:29 +00:00
parent 50dab454bd
commit 27c2469e2f
13 changed files with 5254 additions and 1978 deletions

View File

@ -1,21 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=193763
[base]
2007-09-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Updated for the longer `$allocate' marker.
Index: gdb-6.5/gdb/linespec.c
===================================================================
--- gdb-6.5.orig/gdb/linespec.c 2006-08-24 02:57:04.000000000 -0300
+++ gdb-6.5/gdb/linespec.c 2006-08-24 02:57:07.000000000 -0300
@@ -295,7 +295,7 @@ add_minsym_members (const char *class_na
This will give us a list of all the member names including
the function signature. */
completion_name = xmalloc (strlen (class_name) +
- strlen (member_name) + 9);
+ strlen (member_name) + strlen("'::$allocate(") + 1);
completion_name[0] = '\'';
strcpy (completion_name+1, class_name);
/* FIXME: make this the language class separator. */

View File

@ -1,44 +0,0 @@
2004-12-16 Jeff Johnston <jjohnstn@redhat.com>
* cp-demangle.c (d_print_comp): Add support for exposing
not-in-charge constructors/destructors in the demangled
names.
--- gdb-6.3/libiberty/cp-demangle.c.fix Thu Dec 16 16:39:09 2004
+++ gdb-6.3/libiberty/cp-demangle.c Thu Dec 16 16:39:37 2004
@@ -2978,11 +2978,35 @@ d_print_comp (dpi, dc)
case DEMANGLE_COMPONENT_CTOR:
d_print_comp (dpi, dc->u.s_ctor.name);
+ switch (dc->u.s_ctor.kind)
+ {
+ case gnu_v3_complete_object_ctor:
+ /* no decoration */
+ break;
+ case gnu_v3_base_object_ctor:
+ d_append_string (dpi, "$base");
+ break;
+ case gnu_v3_complete_object_allocating_ctor:
+ d_append_string (dpi, "$allocate");
+ break;
+ }
return;
case DEMANGLE_COMPONENT_DTOR:
d_append_char (dpi, '~');
d_print_comp (dpi, dc->u.s_dtor.name);
+ switch (dc->u.s_dtor.kind)
+ {
+ case gnu_v3_deleting_dtor:
+ d_append_string (dpi, "$delete");
+ break;
+ case gnu_v3_complete_object_dtor:
+ /* no decoration */
+ break;
+ case gnu_v3_base_object_dtor:
+ d_append_string (dpi, "$base");
+ break;
+ }
return;
case DEMANGLE_COMPONENT_VTABLE:

View File

@ -1,681 +0,0 @@
2005-01-20 Jeff Johnston <jjohnstn@redhat.com>
* symtab.h (find_line_pc): Change prototype to new api
which returns a list of pc values and the number of list elements.
* symtab.c (find_line_pc): Change function to new api which
returns a list of pc values. Support recognizing a base ctor
or dtor and finding an additional pc value for the in-charge
ctor or dtor accordingly.
(find_line_common): Change api to accept a start_index argument
which determines where to start searching from in the line table.
(find_line_by_pc): New function.
* breakpoint.c (resolve_sal_pc_list): New function.
(breakpoint_sals_to_pc): Support multiple pc values for a
line in a ctor/dtor.
(gdb_breakpoint): Change call to find_line_pc to use new api.
(break_command_1): Move resolve_sals_to_pc earlier due to the
fact it now can extend the sal list.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Change call to
find_line_pc to new api.
* tui/tui-layout.c (extract_display_start_addr): Ditto.
* tui/tui-win.c (make_visible_with_new_height): Ditto.
* tui/tui-winsource.c (tui_update_source_windows_with_addr): Ditto.
2007-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* symtab.c (find_line_pc): Support also the `$allocate' and `$delete'
variants. Support searching for the `$base' name even if the bare name
was found first.
* breakpoint.c (breakpoint_sals_to_pc): Support more than two returned
PC values.
2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (breakpoint_sals_to_pc): New parameter ADDR_STRING_P.
Expand also *ADDR_STRING_P if multiple PCs were found.
(break_command_1, do_captured_breakpoint): Pass also the ADDR_STRING
variable to be updated.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (breakpoint_sals_to_pc): Provide "%42" suffix to the
multiple-PC breakpoints' ADDR_STRINGs.
(breakpoint_re_set_one): New variables ID_S, ID, PC_LIST, NUM_PC_VALUES.
Parse the "%42" suffix of the multiple-PC breakpoints's ADDR_STRINGs.
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/mi/mi-cmd-disas.c
===================================================================
--- gdb-6.7.orig/gdb/mi/mi-cmd-disas.c 2007-08-23 20:08:48.000000000 +0200
+++ gdb-6.7/gdb/mi/mi-cmd-disas.c 2007-10-14 23:26:23.000000000 +0200
@@ -143,11 +143,18 @@ mi_cmd_disassemble (char *command, char
if (line_seen && file_seen)
{
+ CORE_ADDR *pc_list;
+ int num_pc_values;
+
s = lookup_symtab (file_string);
if (s == NULL)
error (_("mi_cmd_disassemble: Invalid filename."));
- if (!find_line_pc (s, line_num, &start))
+ if (!find_line_pc (s, line_num, &pc_list, &num_pc_values))
error (_("mi_cmd_disassemble: Invalid line number"));
+ /* FIXME: What do we do with multiple pc values for ctors/dtors
+ under mi? */
+ start = pc_list[0];
+ xfree (pc_list);
if (find_pc_partial_function (start, NULL, &low, &high) == 0)
error (_("mi_cmd_disassemble: No function contains specified address"));
}
Index: gdb-6.7/gdb/tui/tui-layout.c
===================================================================
--- gdb-6.7.orig/gdb/tui/tui-layout.c 2007-08-23 20:08:50.000000000 +0200
+++ gdb-6.7/gdb/tui/tui-layout.c 2007-10-14 23:26:23.000000000 +0200
@@ -516,7 +516,8 @@ extract_display_start_addr (void)
{
enum tui_layout_type cur_layout = tui_current_layout ();
CORE_ADDR addr;
- CORE_ADDR pc;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
switch (cur_layout)
@@ -525,8 +526,11 @@ extract_display_start_addr (void)
case SRC_DATA_COMMAND:
find_line_pc (cursal.symtab,
TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
- &pc);
- addr = pc;
+ &pc_list, &num_pc_values);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors or
+ inlined functions? */
+ addr = pc_list[0];
+ xfree (pc_list);
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:
Index: gdb-6.7/gdb/tui/tui-win.c
===================================================================
--- gdb-6.7.orig/gdb/tui/tui-win.c 2007-08-23 20:08:50.000000000 +0200
+++ gdb-6.7/gdb/tui/tui-win.c 2007-10-14 23:26:23.000000000 +0200
@@ -1359,8 +1359,16 @@ make_visible_with_new_height (struct tui
}
else
{
+ CORE_ADDR *pc_list;
+ int num_pc_values;
line.loa = LOA_ADDRESS;
- find_line_pc (s, cursal.line, &line.u.addr);
+ if (find_line_pc (s, cursal.line, &pc_list, &num_pc_values))
+ {
+ /* FIXME: What do we do with multiple pc values for
+ ctors/dtors and inlined functions? */
+ line.u.addr = pc_list[0];
+ xfree (pc_list);
+ }
}
tui_update_source_window (win_info, s, line, TRUE);
}
Index: gdb-6.7/gdb/tui/tui-winsource.c
===================================================================
--- gdb-6.7.orig/gdb/tui/tui-winsource.c 2007-08-23 20:08:50.000000000 +0200
+++ gdb-6.7/gdb/tui/tui-winsource.c 2007-10-14 23:26:23.000000000 +0200
@@ -173,14 +173,21 @@ tui_update_source_windows_with_addr (COR
void
tui_update_source_windows_with_line (struct symtab *s, int line)
{
- CORE_ADDR pc;
+ CORE_ADDR pc = 0;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct tui_line_or_address l;
switch (tui_current_layout ())
{
case DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
- find_line_pc (s, line, &pc);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors? */
+ if (find_line_pc (s, line, &pc_list, &num_pc_values))
+ {
+ pc = pc_list[0];
+ xfree (pc_list);
+ }
tui_update_source_windows_with_addr (pc);
break;
default:
@@ -189,7 +196,12 @@ tui_update_source_windows_with_line (str
tui_show_symtab_source (s, l, FALSE);
if (tui_current_layout () == SRC_DISASSEM_COMMAND)
{
- find_line_pc (s, line, &pc);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors? */
+ if (find_line_pc (s, line, &pc_list, &num_pc_values))
+ {
+ pc = pc_list[0];
+ xfree (pc_list);
+ }
tui_show_disassem (pc);
}
break;
Index: gdb-6.7/gdb/symtab.c
===================================================================
--- gdb-6.7.orig/gdb/symtab.c 2007-10-12 22:35:58.000000000 +0200
+++ gdb-6.7/gdb/symtab.c 2007-10-14 23:26:23.000000000 +0200
@@ -73,7 +73,9 @@ static void sources_info (char *, int);
static void output_source_filename (const char *, int *);
-static int find_line_common (struct linetable *, int, int *);
+static int find_line_common (struct linetable *, int, int, int *);
+
+static int find_line_by_pc (struct linetable *, CORE_ADDR, int *);
/* This one is used by linespec.c */
@@ -2252,6 +2254,9 @@ find_pc_line (CORE_ADDR pc, int notcurre
/* Find line number LINE in any symtab whose name is the same as
SYMTAB.
+ If INDEX is non-NULL, use the value as the starting index in the
+ linetable to start at.
+
If found, return the symtab that contains the linetable in which it was
found, set *INDEX to the index in the linetable of the best entry
found, and set *EXACT_MATCH nonzero if the value returned is an
@@ -2268,13 +2273,19 @@ find_line_symtab (struct symtab *symtab,
so far seen. */
int best_index;
+ int start_index;
struct linetable *best_linetable;
struct symtab *best_symtab;
+ if (index)
+ start_index = *index;
+ else
+ start_index = 0;
+
/* First try looking it up in the given symtab. */
best_linetable = LINETABLE (symtab);
best_symtab = symtab;
- best_index = find_line_common (best_linetable, line, &exact);
+ best_index = find_line_common (best_linetable, line, start_index, &exact);
if (best_index < 0 || !exact)
{
/* Didn't find an exact match. So we better keep looking for
@@ -2305,7 +2316,7 @@ find_line_symtab (struct symtab *symtab,
if (strcmp (symtab->filename, s->filename) != 0)
continue;
l = LINETABLE (s);
- ind = find_line_common (l, line, &exact);
+ ind = find_line_common (l, line, start_index, &exact);
if (ind >= 0)
{
if (exact)
@@ -2341,13 +2352,23 @@ done:
Returns zero for invalid line number (and sets the PC to 0).
The source file is specified with a struct symtab. */
+static CORE_ADDR empty_pc_list = (CORE_ADDR)0;
+
int
-find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
+find_line_pc (struct symtab *symtab, int line, CORE_ADDR **pc_array,
+ int *num_elements)
{
struct linetable *l;
- int ind;
+ int ind = 0;
+ char *name;
+ CORE_ADDR main_pc;
+ struct minimal_symbol *minsym;
+ struct minimal_symbol *minsym2;
+
+
+ *pc_array = &empty_pc_list;
+ *num_elements = 0;
- *pc = 0;
if (symtab == 0)
return 0;
@@ -2355,7 +2376,73 @@ find_line_pc (struct symtab *symtab, int
if (symtab != NULL)
{
l = LINETABLE (symtab);
- *pc = l->item[ind].pc;
+ main_pc = l->item[ind].pc;
+ *pc_array = xmalloc (sizeof (CORE_ADDR) * 3);
+ *num_elements = 0;
+ (*pc_array)[(*num_elements)++] = main_pc;
+ minsym = lookup_minimal_symbol_by_pc (main_pc);
+ if (minsym != NULL && minsym->ginfo.language == language_cplus)
+ {
+ char *src = minsym->ginfo.language_specific.cplus_specific.demangled_name;
+ char *src_point = strchr (src, '(');
+ char *s, *point;
+ /* Keep "" last as the trimming part always matches it. */
+ const char *variants[] = {"$base","$allocate","$delete",""};
+ int i;
+
+ if (src_point != NULL)
+ {
+ char *dst = xmalloc (strlen (src) + strlen ("$allocate") + 1);
+ char *dst_point = dst + (src_point - src);
+
+ memcpy (dst, src, src_point - src);
+
+ /* Trim out any variant markers there first. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+
+ if (dst_point - dst >= len
+ && memcmp (dst_point - len, variants[i], len) == 0)
+ {
+ dst_point -= len;
+ /* In fact it should not be needed here. */
+ break;
+ }
+ }
+
+ /* And now try to append all of them. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+ struct minimal_symbol *minsym2;
+
+ memcpy (dst_point, variants[i], len);
+ strcpy (dst_point + len, src_point);
+
+ minsym2 = lookup_minimal_symbol (dst, NULL, NULL);
+ if (minsym2 != NULL)
+ {
+ /* We have recognized we have a ctor or dtor and have
+ located our line in the not-in-charge version. We
+ also have located the in-charge version's minsym.
+ From this, we can find the index for the first line
+ line in the in-charge ctor/dtor and then search forward
+ for the specified line, thereby finding the 2nd match. */
+ int exact;
+ int ind = find_line_by_pc (l, minsym2->ginfo.value.address,
+ &exact);
+ if (ind >= 0)
+ {
+ ind = find_line_common (l, line, ind, &exact);
+ if (ind >= 0 && l->item[ind].pc != main_pc)
+ (*pc_array)[(*num_elements)++] = l->item[ind].pc;
+ }
+ }
+ }
+ xfree (dst);
+ }
+ }
return 1;
}
else
@@ -2373,12 +2460,22 @@ find_line_pc_range (struct symtab_and_li
CORE_ADDR *endptr)
{
CORE_ADDR startaddr;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct symtab_and_line found_sal;
startaddr = sal.pc;
- if (startaddr == 0 && !find_line_pc (sal.symtab, sal.line, &startaddr))
+ if (startaddr == 0
+ && !find_line_pc (sal.symtab, sal.line, &pc_list, &num_pc_values))
return 0;
+ /* FIXME: have to handle ctors/dtors where line equates to multiple
+ pc ranges. */
+ if (startaddr == 0)
+ startaddr = pc_list[0];
+
+ xfree (pc_list);
+
/* This whole function is based on address. For example, if line 10 has
two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then
"info line *0x123" should say the line goes from 0x100 to 0x200
@@ -2408,7 +2505,7 @@ find_line_pc_range (struct symtab_and_li
Set *EXACT_MATCH nonzero if the value returned is an exact match. */
static int
-find_line_common (struct linetable *l, int lineno,
+find_line_common (struct linetable *l, int lineno, int start_index,
int *exact_match)
{
int i;
@@ -2427,7 +2524,7 @@ find_line_common (struct linetable *l, i
return -1;
len = l->nitems;
- for (i = 0; i < len; i++)
+ for (i = start_index; i < len; i++)
{
struct linetable_entry *item = &(l->item[i]);
@@ -2451,6 +2548,52 @@ find_line_common (struct linetable *l, i
return best_index;
}
+/* Given a line table and a pc value, return the index into the line
+ table for the line with pc >= specified pc value.
+ Return -1 if none is found. The value is >= 0 if it is an index.
+
+ Set *EXACT_MATCH nonzero if the value returned is an exact match. */
+
+static int
+find_line_by_pc (struct linetable *l, CORE_ADDR pc,
+ int *exact_match)
+{
+ int i;
+ int len;
+
+ /* BEST is the smallest linenumber > LINENO so far seen,
+ or 0 if none has been seen so far.
+ BEST_INDEX identifies the item for it. */
+
+ if (l == 0)
+ return -1;
+
+ len = l->nitems;
+ for (i = 0; i < len; i++)
+ {
+ struct linetable_entry *item = &(l->item[i]);
+
+ /* Return the first (lowest address) entry which matches or
+ exceeds the given pc value. */
+ if (item->pc == pc)
+ {
+ *exact_match = 1;
+ return i;
+ }
+
+ if (item->pc > pc)
+ {
+ *exact_match = 0;
+ return i;
+ }
+ }
+
+ /* If we got here, we didn't get a match. */
+
+ *exact_match = 0;
+ return -1;
+}
+
int
find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
{
Index: gdb-6.7/gdb/symtab.h
===================================================================
--- gdb-6.7.orig/gdb/symtab.h 2007-08-23 20:08:45.000000000 +0200
+++ gdb-6.7/gdb/symtab.h 2007-10-14 23:26:23.000000000 +0200
@@ -1271,13 +1271,16 @@ extern struct symtab_and_line find_pc_se
/* Given a symtab and line number, return the pc there. */
-extern int find_line_pc (struct symtab *, int, CORE_ADDR *);
+extern int find_line_pc (struct symtab *, int, CORE_ADDR **, int *);
extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
CORE_ADDR *);
extern void resolve_sal_pc (struct symtab_and_line *);
+extern void resolve_sal_pc_list (struct symtab_and_line *, CORE_ADDR **,
+ int *);
+
/* Given a string, return the line specified by it. For commands like "list"
and "breakpoint". */
Index: gdb-6.7/gdb/breakpoint.c
===================================================================
--- gdb-6.7.orig/gdb/breakpoint.c 2007-10-13 05:29:58.000000000 +0200
+++ gdb-6.7/gdb/breakpoint.c 2007-10-14 23:26:23.000000000 +0200
@@ -5325,12 +5325,70 @@ parse_breakpoint_sals (char **address,
static void
breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
- char *address)
+ char *address, char ***addr_string_p)
{
- int i;
- for (i = 0; i < sals->nelts; i++)
- {
- resolve_sal_pc (&sals->sals[i]);
+ int i, j, incr;
+ int num_pc_values = 1;
+
+ /* If a line has multiple pc values, we want to create an sal for
+ each pc value so we will end up creating n breakpoints. */
+ for (i = 0; i < sals->nelts; i+=incr)
+ {
+ CORE_ADDR *pc_list;
+ incr = 1;
+
+ resolve_sal_pc_list (&sals->sals[i], &pc_list, &num_pc_values);
+ if (num_pc_values != 0)
+ sals->sals[i].pc = pc_list[0];
+ if (num_pc_values > 1)
+ {
+ struct symtab_and_line *new_sals =
+ xmalloc ((sals->nelts + num_pc_values - 1)
+ * sizeof (struct symtab_and_line));
+ char **new_addr_string;
+ char *addr_string_base;
+
+ /* Expand the SALS array. */
+ memcpy (new_sals, sals->sals, (i + 1)
+ * sizeof (struct symtab_and_line));
+ /* The one returned SALS entry is copied for all the PCs. */
+ for (j = 1; j < num_pc_values; ++j)
+ {
+ memcpy (&(new_sals[i + j]), &sals->sals[i],
+ sizeof (struct symtab_and_line));
+ }
+ xfree (sals->sals);
+ sals->sals = new_sals;
+ sals->nelts += num_pc_values - 1;
+ for (j = 1; j < num_pc_values; ++j)
+ {
+ sals->sals[i + j].pc = pc_list[j];
+ }
+
+ /* Expand the *ADDR_STRING_P array. */
+ new_addr_string = xmalloc ((sals->nelts + num_pc_values - 1)
+ * sizeof *new_addr_string);
+ memcpy (new_addr_string, *addr_string_p,
+ (i + 1) * sizeof *new_addr_string);
+ /* The existing *ADDR_STRING_P entry must be copied for all the
+ multiple PCs. BREAKPOINT_RE_SET will follow the new trailing "%id"
+ syntax so it will get resolved right even later. Do not use the
+ unambiguous NULL values (resolved to "0x%x" by CREATE_BREAKPOINTS)
+ as the address may change for the shared libraries. */
+ addr_string_base = (*addr_string_p)[i];
+ for (j = 0; j < num_pc_values; ++j)
+ new_addr_string[i + j] = xstrprintf ("%s%%%d", addr_string_base, j);
+ xfree (addr_string_base);
+ memcpy (&new_addr_string[i + num_pc_values], &(*addr_string_p)[i + 1],
+ (sals->nelts - (i + num_pc_values)) * sizeof *new_addr_string);
+ xfree (*addr_string_p);
+ *addr_string_p = new_addr_string;
+
+ incr = num_pc_values;
+ }
+
+ if (num_pc_values != 0)
+ xfree (pc_list);
/* It's possible for the PC to be nonzero, but still an illegal
value on some targets.
@@ -5465,6 +5523,10 @@ break_command_1 (char *arg, int flag, in
if (!pending)
{
+ /* Resolve all line numbers to PC's and verify that the addresses
+ are ok for the target. */
+ breakpoint_sals_to_pc (&sals, addr_start, &addr_string);
+
/* Make sure that all storage allocated to SALS gets freed. */
make_cleanup (xfree, sals.sals);
@@ -5495,11 +5557,6 @@ break_command_1 (char *arg, int flag, in
make_cleanup (xfree, addr_string[i]);
}
- /* Resolve all line numbers to PC's and verify that the addresses
- are ok for the target. */
- if (!pending)
- breakpoint_sals_to_pc (&sals, addr_start);
-
/* Verify that condition can be parsed, before setting any
breakpoints. Allocate a separate condition expression for each
breakpoint. */
@@ -5675,7 +5732,7 @@ do_captured_breakpoint (struct ui_out *u
error (_("Garbage %s following breakpoint address"), address_end);
/* Resolve all line numbers to PC's. */
- breakpoint_sals_to_pc (&sals, args->address);
+ breakpoint_sals_to_pc (&sals, args->address, &addr_string);
/* Verify that conditions can be parsed, before setting any
breakpoints. */
@@ -5732,14 +5789,16 @@ gdb_breakpoint (char *address, char *con
void
resolve_sal_pc (struct symtab_and_line *sal)
{
- CORE_ADDR pc;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
if (sal->pc == 0 && sal->symtab != NULL)
{
- if (!find_line_pc (sal->symtab, sal->line, &pc))
+ if (!find_line_pc (sal->symtab, sal->line, &pc_list, &num_pc_values))
error (_("No line %d in file \"%s\"."),
sal->line, sal->symtab->filename);
- sal->pc = pc;
+ sal->pc = pc_list[0];
+ xfree (pc_list);
}
if (sal->section == 0 && sal->symtab != NULL)
@@ -5776,6 +5835,54 @@ resolve_sal_pc (struct symtab_and_line *
}
}
+/* Helper function for break_command_1 and disassemble_command. */
+
+void
+resolve_sal_pc_list (struct symtab_and_line *sal, CORE_ADDR **pc_list,
+ int *num_pc_values)
+{
+ *num_pc_values = 0;
+ if (sal->pc == 0 && sal->symtab != NULL)
+ {
+ if (!find_line_pc (sal->symtab, sal->line, pc_list, num_pc_values))
+ error ("No line %d in file \"%s\".",
+ sal->line, sal->symtab->filename);
+ sal->pc = (*pc_list)[0];
+ }
+
+ 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);
+ if (bv != NULL)
+ {
+ b = BLOCKVECTOR_BLOCK (bv, index);
+ sym = block_function (b);
+ if (sym != NULL)
+ {
+ fixup_symbol_section (sym, sal->symtab->objfile);
+ sal->section = SYMBOL_BFD_SECTION (sym);
+ }
+ else
+ {
+ /* It really is worthwhile to have the section, so we'll just
+ have to look harder. This case can be executed if we have
+ line numbers but no functions (as can happen in assembly
+ source). */
+
+ struct minimal_symbol *msym;
+
+ msym = lookup_minimal_symbol_by_pc (sal->pc);
+ if (msym)
+ sal->section = SYMBOL_BFD_SECTION (msym);
+ }
+ }
+ }
+}
void
break_command (char *arg, int from_tty)
{
@@ -7320,6 +7427,8 @@ breakpoint_re_set_one (void *bint)
int *not_found_ptr = NULL;
struct symtabs_and_lines sals;
char *s;
+ char *id_s;
+ int id = -1;
enum enable_state save_enable;
switch (b->type)
@@ -7380,11 +7489,44 @@ breakpoint_re_set_one (void *bint)
set_language (b->language);
input_radix = b->input_radix;
s = b->addr_string;
+ for (id_s = s + strlen (s) - 1; id_s >= s; id_s--)
+ {
+ if (isdigit (*id_s))
+ continue;
+ if (*id_s == '%')
+ break;
+ id_s = NULL;
+ break;
+ }
+ if (id_s >= s)
+ {
+ s = alloca (id_s - b->addr_string + 1);
+ memcpy (s, b->addr_string, id_s - b->addr_string);
+ s[id_s - b->addr_string] = 0;
+ id = atoi (id_s + 1);
+ }
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL,
not_found_ptr);
for (i = 0; i < sals.nelts; i++)
{
- resolve_sal_pc (&sals.sals[i]);
+ CORE_ADDR *pc_list;
+ int num_pc_values;
+
+ resolve_sal_pc_list (&sals.sals[i], &pc_list, &num_pc_values);
+ if (num_pc_values > 0)
+ {
+ if (id != -1)
+ {
+ /* The number of PC values should not usually change. */
+ if (id >= num_pc_values)
+ {
+ delete_breakpoint (b);
+ return 0;
+ }
+ sals.sals[i].pc = pc_list[id];
+ }
+ xfree (pc_list);
+ }
/* Reparse conditions, they might contain references to the
old symtab. */

View File

@ -1,52 +0,0 @@
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* linespec.c (collect_methods): Don't do special processing for
destructors as this will be handled in find_methods.
(find_methods): Fix ctor check to also check for dtor.
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/linespec.c
===================================================================
--- gdb-6.7.orig/gdb/linespec.c 2007-10-13 05:26:33.000000000 +0200
+++ gdb-6.7/gdb/linespec.c 2007-10-14 23:31:03.000000000 +0200
@@ -398,12 +398,14 @@ add_matching_methods (int method_counter
/* Check for special case of looking for member that
doesn't have a mangled name provided. This will happen
- when we have in-charge and not-in-charge constructors.
+ when we have in-charge and not-in-charge ctors/dtors.
Since we don't have a mangled name to work with, if we
- look for the symbol, we can only find the class itself.
+ look for the symbol, we can at best find the class itself.
We can find the information we need in the minimal symbol
table which has the full member name information we need. */
- if (strlen (phys_name) <= strlen (class_name))
+ if (strlen (phys_name) <= strlen (class_name)
+ || (strlen (phys_name) == strlen (class_name) + 1
+ && phys_name[0] == '~'))
return add_minsym_members (class_name, phys_name, msym_arr);
/* Destructor is handled by caller, don't add it to
@@ -1731,6 +1733,11 @@ collect_methods (char *copy, struct type
{
int i1 = 0; /* Counter for the symbol array. */
+#if 0
+ /* Ignore this special method for getting destructors because
+ find_methods is more robust and can handle multiple
+ destructors which is the case when gcc generates a not-in-charge
+ vs an in-charge destructor. */
if (destructor_name_p (copy, t))
{
/* Destructors are a special case. */
@@ -1749,6 +1756,7 @@ collect_methods (char *copy, struct type
}
}
else
+#endif
i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr, msym_arr);
return i1;

View File

@ -1,651 +0,0 @@
[base]
2007-09-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
(decode_variable): Renamed to ...
(decode_variable_1) ... here, its parameter NOT_FOUND_PTR and its
exception throwing was moved to ...
(decode_variable_not_found): ... a new function here.
(decode_variable): New function.
2007-10-31 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/linespec.c
===================================================================
--- gdb-6.7.orig/gdb/linespec.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/linespec.c 2007-10-13 05:26:33.000000000 +0200
@@ -36,6 +36,7 @@
#include "linespec.h"
#include "exceptions.h"
#include "language.h"
+#include "gdb_assert.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -75,7 +76,8 @@ static struct symtabs_and_lines find_met
static int collect_methods (char *copy, struct type *t,
struct symbol *sym_class,
- struct symbol **sym_arr);
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr);
static NORETURN void cplusplus_error (const char *name,
const char *fmt, ...)
@@ -84,11 +86,13 @@ static NORETURN void cplusplus_error (co
static int total_number_of_methods (struct type *type);
static int find_methods (struct type *, char *,
- enum language, struct symbol **);
+ enum language, struct symbol **,
+ struct minimal_symbol **);
static int add_matching_methods (int method_counter, struct type *t,
enum language language,
- struct symbol **sym_arr);
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr);
static int add_constructors (int method_counter, struct type *t,
enum language language,
@@ -104,6 +108,9 @@ static int is_objc_method_format (const
static struct symtabs_and_lines decode_line_2 (struct symbol *[],
int, int, char ***);
+static struct symtabs_and_lines decode_line_3 (struct minimal_symbol *[],
+ int, int, char ***);
+
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
int *not_found_ptr);
@@ -194,13 +201,18 @@ total_number_of_methods (struct type *ty
/* Recursive helper function for decode_line_1.
Look for methods named NAME in type T.
Return number of matches.
- Put matches in SYM_ARR, which should have been allocated with
+ Put symbol matches in SYM_ARR, which should have been allocated with
a size of total_number_of_methods (T) * sizeof (struct symbol *).
+ In a special case where we are looking for constructors, we may
+ have to return minimal symbols in the array: MSYM_ARR. This occurs
+ when the compiler does not generate mangled names for the constructor's
+ debug info because there are multiple versions of the constructor
+ (in-charge vs not-in-charge).
Note that this function is g++ specific. */
static int
find_methods (struct type *t, char *name, enum language language,
- struct symbol **sym_arr)
+ struct symbol **sym_arr, struct minimal_symbol **msym_arr)
{
int i1 = 0;
int ibase;
@@ -243,7 +255,7 @@ find_methods (struct type *t, char *name
if (strcmp_iw (name, method_name) == 0)
/* Find all the overloaded methods with that name. */
i1 += add_matching_methods (method_counter, t, language,
- sym_arr + i1);
+ sym_arr + i1, msym_arr);
else if (strncmp (class_name, name, name_len) == 0
&& (class_name[name_len] == '\0'
|| class_name[name_len] == '<'))
@@ -266,21 +278,100 @@ find_methods (struct type *t, char *name
if (i1 == 0)
for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
i1 += find_methods (TYPE_BASECLASS (t, ibase), name,
- language, sym_arr + i1);
+ language, sym_arr + i1, msym_arr);
return i1;
}
+static int
+add_minsym_members (const char *class_name,
+ const char *member_name,
+ struct minimal_symbol **msym_arr)
+{
+ char *completion_name;
+ char **list;
+ int i;
+ int comp_len;
+ int counter = 0;
+
+ /* To find the member, we first cheat and use symbol completion.
+ This will give us a list of all the member names including
+ the function signature. */
+ completion_name = xmalloc (strlen (class_name) +
+ strlen (member_name) + 9);
+ completion_name[0] = '\'';
+ strcpy (completion_name+1, class_name);
+ /* FIXME: make this the language class separator. */
+ strcat (completion_name, "::");
+ strcat (completion_name, member_name);
+ strcat (completion_name, "(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Now that we have the list, we generate an array of their
+ corresponding minimal symbols. */
+ counter = 0;
+ while (list && list[counter] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[counter], NULL, NULL);
+ ++counter;
+ }
+
+ xfree (list);
+
+ /* In the case of constructors, there may be in-charge vs not-in-charge
+ constructors. Check for names with $base which indicates not-in-charge
+ constructors. */
+ comp_len = strlen (completion_name);
+ strcpy (completion_name + comp_len - 1, "$base(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Again we have a list. Add their minimal symbols to the array. */
+ i = 0;
+ while (list && list[i] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL);
+ ++counter;
+ }
+ xfree (list);
+
+ /* Target also the allocating/deleting variants. */
+ if (member_name[0] == '~')
+ strcpy (completion_name + comp_len - 1, "$delete(");
+ else
+ strcpy (completion_name + comp_len - 1, "$allocate(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Again we have a list. Add their minimal symbols to the array. */
+ i = 0;
+ while (list && list[i] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL);
+ ++counter;
+ }
+ xfree (list);
+
+ xfree (completion_name);
+
+ return counter;
+}
+
/* Add the symbols associated to methods of the class whose type is T
and whose name matches the method indexed by METHOD_COUNTER in the
array SYM_ARR. Return the number of methods added. */
static int
add_matching_methods (int method_counter, struct type *t,
- enum language language, struct symbol **sym_arr)
+ enum language language, struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr)
{
int field_counter;
int i1 = 0;
+ int cons_index = 0;
+ char *class_name = type_name_no_tag (t);
+ char **list = NULL;
for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
field_counter >= 0;
@@ -305,6 +396,16 @@ add_matching_methods (int method_counter
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
+ /* Check for special case of looking for member that
+ doesn't have a mangled name provided. This will happen
+ when we have in-charge and not-in-charge constructors.
+ Since we don't have a mangled name to work with, if we
+ look for the symbol, we can only find the class itself.
+ We can find the information we need in the minimal symbol
+ table which has the full member name information we need. */
+ if (strlen (phys_name) <= strlen (class_name))
+ return add_minsym_members (class_name, phys_name, msym_arr);
+
/* Destructor is handled by caller, don't add it to
the list. */
if (is_destructor_name (phys_name) != 0)
@@ -330,6 +431,9 @@ add_matching_methods (int method_counter
}
}
+ if (list)
+ xfree (list);
+
return i1;
}
@@ -610,6 +714,146 @@ decode_line_2 (struct symbol *sym_arr[],
discard_cleanups (old_chain);
return return_values;
}
+
+/* Given a list of NELTS minimal symbols in MSYM_ARR, return a list of lines to
+ operate on (ask user if necessary).
+ If CANONICAL is non-NULL return a corresponding array of mangled names
+ as canonical line specs there. */
+
+static struct symtabs_and_lines
+decode_line_3 (struct minimal_symbol *msym_arr[],
+ int nelts, int funfirstline,
+ char ***canonical)
+{
+ struct symtabs_and_lines values, return_values;
+ char *args, *arg1;
+ int i;
+ char *prompt;
+ char *symname;
+ struct cleanup *old_chain;
+ char **canonical_arr = (char **) NULL;
+
+ values.sals = (struct symtab_and_line *)
+ alloca (nelts * sizeof (struct symtab_and_line));
+ return_values.sals = (struct symtab_and_line *)
+ xmalloc (nelts * sizeof (struct symtab_and_line));
+ old_chain = make_cleanup (xfree, return_values.sals);
+
+ if (canonical)
+ {
+ canonical_arr = (char **) xmalloc (nelts * sizeof (char *));
+ make_cleanup (xfree, canonical_arr);
+ memset (canonical_arr, 0, nelts * sizeof (char *));
+ *canonical = canonical_arr;
+ }
+
+ i = 0;
+ printf_unfiltered ("[0] cancel\n[1] all\n");
+ while (i < nelts)
+ {
+ init_sal (&return_values.sals[i]); /* Initialize to zeroes. */
+ init_sal (&values.sals[i]);
+ if (msym_arr[i])
+ {
+ struct symtabs_and_lines msal = minsym_found (funfirstline,
+ msym_arr[i]);
+ memcpy (&values.sals[i], &msal.sals[0],
+ sizeof (struct symtab_and_line));
+ if (values.sals[i].symtab)
+ printf_unfiltered ("[%d] %s at %s:%d\n",
+ (i + 2),
+ SYMBOL_PRINT_NAME (msym_arr[i]),
+ values.sals[i].symtab->filename,
+ values.sals[i].line);
+ else
+ printf_unfiltered ("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n",
+ (i + 2),
+ SYMBOL_PRINT_NAME (msym_arr[i]),
+ values.sals[i].line);
+
+ }
+ else
+ printf_unfiltered ("?HERE\n");
+ i++;
+ }
+
+ prompt = getenv ("PS2");
+ if (prompt == NULL)
+ {
+ prompt = "> ";
+ }
+ args = command_line_input (prompt, 0, "overload-choice");
+
+ if (args == 0 || *args == 0)
+ error_no_arg ("one or more choice numbers");
+
+ i = 0;
+ while (*args)
+ {
+ int num;
+
+ arg1 = args;
+ while (*arg1 >= '0' && *arg1 <= '9')
+ arg1++;
+ if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
+ error ("Arguments must be choice numbers.");
+
+ num = atoi (args);
+
+ if (num == 0)
+ error ("canceled");
+ else if (num == 1)
+ {
+ if (canonical_arr)
+ {
+ for (i = 0; i < nelts; i++)
+ {
+ if (canonical_arr[i] == NULL)
+ {
+ symname = DEPRECATED_SYMBOL_NAME (msym_arr[i]);
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
+ }
+ }
+ memcpy (return_values.sals, values.sals,
+ (nelts * sizeof (struct symtab_and_line)));
+ return_values.nelts = nelts;
+ discard_cleanups (old_chain);
+ return return_values;
+ }
+
+ if (num >= nelts + 2)
+ {
+ printf_unfiltered ("No choice number %d.\n", num);
+ }
+ else
+ {
+ num -= 2;
+ if (values.sals[num].pc)
+ {
+ if (canonical_arr)
+ {
+ symname = DEPRECATED_SYMBOL_NAME (msym_arr[num]);
+ make_cleanup (xfree, symname);
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
+ return_values.sals[i++] = values.sals[num];
+ values.sals[num].pc = 0;
+ }
+ else
+ {
+ printf_unfiltered ("duplicate request for %d ignored.\n", num);
+ }
+ }
+
+ args = arg1;
+ while (*args == ' ' || *args == '\t')
+ args++;
+ }
+ return_values.nelts = i;
+ discard_cleanups (old_chain);
+ return return_values;
+}
/* The parser of linespec itself. */
@@ -1414,35 +1658,46 @@ find_method (int funfirstline, char ***c
struct symbol **sym_arr = alloca (total_number_of_methods (t)
* sizeof (struct symbol *));
+ struct minimal_symbol **msym_arr = alloca (total_number_of_methods (t)
+ * sizeof (struct minimal_symbol *));
+
+ msym_arr[0] = NULL;
+
/* Find all methods with a matching name, and put them in
sym_arr. */
- i1 = collect_methods (copy, t, sym_class, sym_arr);
+ i1 = collect_methods (copy, t, sym_class, sym_arr, msym_arr);
if (i1 == 1)
{
/* There is exactly one field with that name. */
- sym = sym_arr[0];
-
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- {
- values.sals = (struct symtab_and_line *)
- xmalloc (sizeof (struct symtab_and_line));
- values.nelts = 1;
- values.sals[0] = find_function_start_sal (sym,
- funfirstline);
- }
+ if (msym_arr[0] != NULL)
+ return minsym_found (funfirstline, msym_arr[0]);
else
{
- values.sals = NULL;
- values.nelts = 0;
+ sym = sym_arr[0];
+
+ if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+ {
+ values.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line));
+ values.nelts = 1;
+ values.sals[0] = find_function_start_sal (sym,
+ funfirstline);
+ }
+ else
+ {
+ values.nelts = 0;
+ }
+ return values;
}
- return values;
}
if (i1 > 0)
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
+ if (msym_arr[0] != NULL)
+ return decode_line_3 (msym_arr, i1, funfirstline, canonical);
return decode_line_2 (sym_arr, i1, funfirstline, canonical);
}
else
@@ -1469,11 +1722,12 @@ find_method (int funfirstline, char ***c
}
/* Find all methods named COPY in the class whose type is T, and put
- them in SYM_ARR. Return the number of methods found. */
+ them in SYM_ARR or MSYM_ARR. Return the number of methods found. */
static int
collect_methods (char *copy, struct type *t,
- struct symbol *sym_class, struct symbol **sym_arr)
+ struct symbol *sym_class, struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr)
{
int i1 = 0; /* Counter for the symbol array. */
@@ -1495,7 +1749,7 @@ collect_methods (char *copy, struct type
}
}
else
- i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr);
+ i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr, msym_arr);
return i1;
}
@@ -1717,12 +1971,13 @@ decode_dollar (char *copy, int funfirstl
and do not issue an error message. */
static struct symtabs_and_lines
-decode_variable (char *copy, int funfirstline, char ***canonical,
- struct symtab *file_symtab, int *not_found_ptr)
+decode_variable_1 (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab)
{
struct symbol *sym;
/* The symtab that SYM was found in. */
struct symtab *sym_symtab;
+ struct symtabs_and_lines retval;
struct minimal_symbol *msymbol;
@@ -1740,8 +1995,25 @@ decode_variable (char *copy, int funfirs
msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
- return minsym_found (funfirstline, msymbol);
+ {
+ retval = minsym_found (funfirstline, msymbol);
+
+ /* Create a `filename:linkage_symbol_name' reference. */
+ if (file_symtab == 0)
+ build_canonical_line_spec (retval.sals, SYMBOL_LINKAGE_NAME (msymbol),
+ canonical);
+ return retval;
+ }
+
+ retval.nelts = 0;
+ retval.sals = NULL;
+ return retval;
+}
+
+static void
+decode_variable_not_found (char *copy, int *not_found_ptr)
+{
if (!have_full_symbols () &&
!have_partial_symbols () && !have_minimal_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
@@ -1751,6 +2023,132 @@ decode_variable (char *copy, int funfirs
throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy);
}
+/* Wrapper of DECODE_VARIABLE_1 collecting the results for all the found
+ VARIANTS of the symbol COPY. */
+
+static struct symtabs_and_lines
+decode_variable (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab, int *not_found_ptr)
+{
+ char *src;
+ char *src_point;
+ char *s, *point;
+ /* Keep "" last as the trimming part always matches it. */
+ const char *variants[] = {"$base","$allocate","$delete",""};
+ int i;
+ char *dst, *dst_point;
+ struct
+ {
+ struct symtabs_and_lines sals;
+ char **canonical;
+ } found[ARRAY_SIZE (variants)];
+ struct symtabs_and_lines retval_sals;
+ char **retval_canonical = NULL; /* Shut up GCC. */
+ int filled;
+ int canonicals = 0; /* Shut up GCC. */
+
+ src = copy;
+ src_point = strchr (src, '(');
+ if (src_point == NULL)
+ {
+ struct symtabs_and_lines sals;
+
+ sals = decode_variable_1 (src, funfirstline, canonical, file_symtab);
+ if (sals.nelts > 0)
+ return sals;
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ dst = xmalloc (strlen (src) + strlen ("$allocate") + 1);
+ dst_point = dst + (src_point - src);
+
+ memcpy (dst, src, src_point - src);
+
+ /* Trim out any variant markers there first. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+
+ if (dst_point - dst >= len
+ && memcmp (dst_point - len, variants[i], len) == 0)
+ {
+ dst_point -= len;
+ /* In fact it should not be needed here. */
+ break;
+ }
+ }
+
+ filled = 0;
+ /* And now try to append all of them. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+ struct minimal_symbol *minsym2;
+
+ memcpy (dst_point, variants[i], len);
+ strcpy (dst_point + len, src_point);
+
+ found[i].canonical = NULL;
+ found[i].sals = decode_variable_1 (dst, funfirstline,
+ (canonical == NULL ? NULL
+ : &found[i].canonical),
+ file_symtab);
+ filled += found[i].sals.nelts;
+ }
+ xfree (dst);
+ if (filled == 0)
+ {
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ retval_sals.nelts = filled;
+ retval_sals.sals = xmalloc (filled * sizeof *retval_sals.sals);
+ if (canonical != NULL)
+ {
+ retval_canonical = xmalloc (filled * sizeof *retval_canonical);
+ canonicals = 0;
+ }
+ filled = 0;
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ memcpy (&retval_sals.sals[filled], found[i].sals.sals,
+ found[i].sals.nelts * sizeof *retval_sals.sals);
+ xfree (found[i].sals.sals);
+ if (canonical != NULL)
+ {
+ if (found[i].canonical == NULL)
+ memset (&retval_canonical[filled], 0,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ else
+ {
+ int j;
+
+ memcpy (&retval_canonical[filled], found[i].canonical,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ for (j = 0; j < found[i].sals.nelts; j++)
+ if (found[i].canonical[j] != NULL)
+ canonicals++;
+ xfree (found[i].canonical);
+ }
+ }
+ filled += found[i].sals.nelts;
+ }
+ gdb_assert (filled == retval_sals.nelts);
+
+ if (canonical != NULL)
+ {
+ if (canonicals != 0)
+ *canonical = retval_canonical;
+ else
+ {
+ *canonical = NULL;
+ xfree (retval_canonical);
+ }
+ }
+ return retval_sals;
+}
Index: gdb-6.7/gdb/Makefile.in
===================================================================
--- gdb-6.7.orig/gdb/Makefile.in 2007-10-13 05:09:50.000000000 +0200
+++ gdb-6.7/gdb/Makefile.in 2007-10-13 05:15:13.000000000 +0200
@@ -2233,7 +2233,8 @@ libunwind-frame.o: libunwind-frame.c $(d
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
- $(objc_lang_h) $(linespec_h) $(exceptions_h) $(language_h)
+ $(objc_lang_h) $(linespec_h) $(exceptions_h) $(language_h) \
+ $(gdb_assert_h)
linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \
$(infcall_h) $(gdb_assert_h) $(gdb_string_h) $(linux_fork_h) \
$(linux_nat_h)

View File

@ -1,7 +1,15 @@
Index: gdb-6.7/gdb/dwarf2read.c
2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.1.
2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to post-GDB-6.7.1 multi-PC breakpoints.
Index: gdb-6.7.1/gdb/dwarf2read.c
===================================================================
--- gdb-6.7.orig/gdb/dwarf2read.c 2007-10-13 05:27:15.000000000 +0200
+++ gdb-6.7/gdb/dwarf2read.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/dwarf2read.c 2007-11-02 15:24:10.000000000 +0100
+++ gdb-6.7.1/gdb/dwarf2read.c 2007-11-02 15:24:19.000000000 +0100
@@ -1226,7 +1226,7 @@ dwarf2_build_psymtabs (struct objfile *o
else
dwarf2_per_objfile->loc_buffer = NULL;
@ -11,10 +19,10 @@ Index: gdb-6.7/gdb/dwarf2read.c
|| (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0))
{
Index: gdb-6.7/gdb/auxv.c
Index: gdb-6.7.1/gdb/auxv.c
===================================================================
--- gdb-6.7.orig/gdb/auxv.c 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7/gdb/auxv.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/auxv.c 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7.1/gdb/auxv.c 2007-11-02 15:24:19.000000000 +0100
@@ -80,7 +80,7 @@ procfs_xfer_auxv (struct target_ops *ops
Return 1 if an entry was read into *TYPEP and *VALP. */
int
@ -86,10 +94,10 @@ Index: gdb-6.7/gdb/auxv.c
switch (flavor)
{
case dec:
Index: gdb-6.7/gdb/auxv.h
Index: gdb-6.7.1/gdb/auxv.h
===================================================================
--- gdb-6.7.orig/gdb/auxv.h 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7/gdb/auxv.h 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/auxv.h 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7.1/gdb/auxv.h 2007-11-02 15:24:19.000000000 +0100
@@ -35,14 +35,14 @@ struct target_ops; /* Forward declarati
Return 1 if an entry was read into *TYPEP and *VALP. */
extern int target_auxv_parse (struct target_ops *ops,
@ -107,11 +115,11 @@ Index: gdb-6.7/gdb/auxv.h
/* Print the contents of the target's AUXV on the specified file. */
extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
Index: gdb-6.7/gdb/breakpoint.h
Index: gdb-6.7.1/gdb/breakpoint.h
===================================================================
--- gdb-6.7.orig/gdb/breakpoint.h 2007-10-13 05:09:50.000000000 +0200
+++ gdb-6.7/gdb/breakpoint.h 2007-10-13 05:29:58.000000000 +0200
@@ -153,6 +153,7 @@ enum enable_state
--- gdb-6.7.1.orig/gdb/breakpoint.h 2007-11-02 15:22:24.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.h 2007-11-02 15:24:59.000000000 +0100
@@ -150,6 +150,7 @@ enum enable_state
automatically enabled and reset when the call
"lands" (either completes, or stops at another
eventpoint). */
@ -119,23 +127,21 @@ Index: gdb-6.7/gdb/breakpoint.h
bp_permanent /* There is a breakpoint instruction hard-wired into
the target's code. Don't try to write another
breakpoint instruction on top of it, or restore
@@ -807,8 +808,12 @@ extern void remove_thread_event_breakpoi
@@ -826,6 +827,10 @@ extern void remove_thread_event_breakpoi
extern void disable_breakpoints_in_shlibs (void);
+extern void disable_breakpoints_at_startup (int silent);
+
extern void re_enable_breakpoints_in_shlibs (void);
+void re_enable_breakpoints_at_startup (void);
+extern void re_enable_breakpoints_at_startup (void);
+
extern void create_solib_load_event_breakpoint (char *, int, char *, char *);
extern void create_solib_unload_event_breakpoint (char *, int,
Index: gdb-6.7/gdb/symfile-mem.c
Index: gdb-6.7.1/gdb/symfile-mem.c
===================================================================
--- gdb-6.7.orig/gdb/symfile-mem.c 2007-08-23 20:08:39.000000000 +0200
+++ gdb-6.7/gdb/symfile-mem.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/symfile-mem.c 2007-08-23 20:08:39.000000000 +0200
+++ gdb-6.7.1/gdb/symfile-mem.c 2007-11-02 15:24:19.000000000 +0100
@@ -108,7 +108,7 @@ symbol_file_add_from_memory (struct bfd
}
@ -145,13 +151,13 @@ Index: gdb-6.7/gdb/symfile-mem.c
/* This might change our ideas about frames already looked at. */
reinit_frame_cache ();
Index: gdb-6.7/gdb/infrun.c
Index: gdb-6.7.1/gdb/infrun.c
===================================================================
--- gdb-6.7.orig/gdb/infrun.c 2007-10-13 05:09:50.000000000 +0200
+++ gdb-6.7/gdb/infrun.c 2007-10-13 05:29:58.000000000 +0200
@@ -2305,6 +2305,11 @@ process_event_stop_test:
code segments in shared libraries might be mapped in now. */
re_enable_breakpoints_in_shlibs ();
--- gdb-6.7.1.orig/gdb/infrun.c 2007-11-02 15:21:57.000000000 +0100
+++ gdb-6.7.1/gdb/infrun.c 2007-11-02 15:24:19.000000000 +0100
@@ -2298,6 +2298,11 @@ process_event_stop_test:
#endif
target_terminal_inferior ();
+ /* For PIE executables, we dont really know where the
+ breakpoints are going to be until we start up the
@ -161,10 +167,10 @@ Index: gdb-6.7/gdb/infrun.c
/* If requested, stop when the dynamic linker notifies
gdb of events. This allows the user to get control
and place breakpoints in initializer routines for
Index: gdb-6.7/gdb/objfiles.c
Index: gdb-6.7.1/gdb/objfiles.c
===================================================================
--- gdb-6.7.orig/gdb/objfiles.c 2007-08-23 20:08:36.000000000 +0200
+++ gdb-6.7/gdb/objfiles.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/objfiles.c 2007-08-23 20:08:36.000000000 +0200
+++ gdb-6.7.1/gdb/objfiles.c 2007-11-02 15:24:19.000000000 +0100
@@ -48,6 +48,9 @@
#include "dictionary.h"
#include "source.h"
@ -196,10 +202,10 @@ Index: gdb-6.7/gdb/objfiles.c
}
/* Create the terminating entry of OBJFILE's minimal symbol table.
Index: gdb-6.7/gdb/solib-svr4.c
Index: gdb-6.7.1/gdb/solib-svr4.c
===================================================================
--- gdb-6.7.orig/gdb/solib-svr4.c 2007-10-12 22:34:03.000000000 +0200
+++ gdb-6.7/gdb/solib-svr4.c 2007-10-14 23:04:45.000000000 +0200
--- gdb-6.7.1.orig/gdb/solib-svr4.c 2007-11-02 15:21:46.000000000 +0100
+++ gdb-6.7.1/gdb/solib-svr4.c 2007-11-02 15:24:19.000000000 +0100
@@ -31,6 +31,8 @@
#include "gdbcore.h"
#include "target.h"
@ -355,7 +361,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
*ptr = dyn_ptr;
}
return 1;
@@ -547,6 +638,10 @@ solib_svr4_r_map (void)
@@ -547,6 +642,10 @@ solib_svr4_r_map (void)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
@ -366,7 +372,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
return read_memory_typed_address (debug_base + lmo->r_map_offset,
builtin_type_void_data_ptr);
}
@@ -704,6 +799,11 @@ svr4_current_sos (void)
@@ -704,6 +803,11 @@ svr4_current_sos (void)
struct so_list **link_ptr = &head;
CORE_ADDR ldsomap = 0;
@ -378,7 +384,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
/* Make sure we've looked up the inferior's dynamic linker's base
structure. */
if (! debug_base)
@@ -713,11 +813,21 @@ svr4_current_sos (void)
@@ -713,11 +817,21 @@ svr4_current_sos (void)
/* If we can't find the dynamic linker's base structure, this
must not be a dynamically linked executable. Hmm. */
if (! debug_base)
@ -401,7 +407,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
lm = solib_svr4_r_map ();
while (lm)
@@ -733,23 +843,103 @@ svr4_current_sos (void)
@@ -733,23 +847,103 @@ svr4_current_sos (void)
new->lm_info->lm = xzalloc (lmo->link_map_size);
make_cleanup (xfree, new->lm_info->lm);
@ -506,7 +512,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
@@ -757,23 +947,35 @@ svr4_current_sos (void)
@@ -757,23 +951,35 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
@ -558,7 +564,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
}
/* On Solaris, the dynamic linker is not in the normal list of
@@ -789,6 +991,11 @@ svr4_current_sos (void)
@@ -789,6 +995,11 @@ svr4_current_sos (void)
if (head == NULL)
return svr4_default_sos ();
@ -570,7 +576,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
return head;
}
@@ -868,7 +1075,7 @@ svr4_fetch_objfile_link_map (struct objf
@@ -868,7 +1079,7 @@ svr4_fetch_objfile_link_map (struct objf
/* On some systems, the only way to recognize the link map entry for
the main executable file is by looking at its name. Return
non-zero iff SONAME matches one of the known main executable names. */
@ -579,7 +585,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
static int
match_main (char *soname)
{
@@ -882,6 +1089,7 @@ match_main (char *soname)
@@ -882,6 +1093,7 @@ match_main (char *soname)
return (0);
}
@ -587,7 +593,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
/* Return 1 if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */
@@ -979,6 +1187,11 @@ enable_break (void)
@@ -979,6 +1191,11 @@ enable_break (void)
/* Find the .interp section; if not found, warn the user and drop
into the old breakpoint at symbol code. */
interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
@ -599,7 +605,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
if (interp_sect)
{
unsigned int interp_sect_size;
@@ -1018,6 +1231,9 @@ enable_break (void)
@@ -1018,6 +1235,9 @@ enable_break (void)
if (tmp_fd >= 0)
tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
@ -609,7 +615,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
if (tmp_bfd == NULL)
goto bkpt_at_symbol;
@@ -1115,6 +1331,9 @@ enable_break (void)
@@ -1115,6 +1335,9 @@ enable_break (void)
if (sym_addr != 0)
{
create_solib_event_breakpoint (load_addr + sym_addr);
@ -619,7 +625,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
return 1;
}
@@ -1375,6 +1594,8 @@ svr4_solib_create_inferior_hook (void)
@@ -1375,6 +1598,8 @@ svr4_solib_create_inferior_hook (void)
while (stop_signal != TARGET_SIGNAL_TRAP);
stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
@ -628,7 +634,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
}
static void
@@ -1551,6 +1772,75 @@ svr4_lp64_fetch_link_map_offsets (void)
@@ -1551,6 +1776,75 @@ svr4_lp64_fetch_link_map_offsets (void)
return lmp;
}
@ -704,7 +710,7 @@ Index: gdb-6.7/gdb/solib-svr4.c
struct target_so_ops svr4_so_ops;
@@ -1592,4 +1882,8 @@ _initialize_svr4_solib (void)
@@ -1592,4 +1886,8 @@ _initialize_svr4_solib (void)
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
current_target_so_ops = &svr4_so_ops;
@ -713,10 +719,10 @@ Index: gdb-6.7/gdb/solib-svr4.c
+ "Display the inferior's linkmap.");
+
}
Index: gdb-6.7/gdb/varobj.c
Index: gdb-6.7.1/gdb/varobj.c
===================================================================
--- gdb-6.7.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200
+++ gdb-6.7/gdb/varobj.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200
+++ gdb-6.7.1/gdb/varobj.c 2007-11-02 15:24:19.000000000 +0100
@@ -1116,6 +1116,62 @@ install_new_value (struct varobj *var, s
return changed;
}
@ -780,10 +786,10 @@ Index: gdb-6.7/gdb/varobj.c
/* Update the values for a variable and its children. This is a
two-pronged attack. First, re-parse the value for the root's
expression to see if it's changed. Then go all the way
Index: gdb-6.7/gdb/solist.h
Index: gdb-6.7.1/gdb/solist.h
===================================================================
--- gdb-6.7.orig/gdb/solist.h 2007-08-23 20:08:38.000000000 +0200
+++ gdb-6.7/gdb/solist.h 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/solist.h 2007-08-23 20:08:38.000000000 +0200
+++ gdb-6.7.1/gdb/solist.h 2007-11-02 15:24:19.000000000 +0100
@@ -61,6 +61,8 @@ struct so_list
bfd *abfd;
char symbols_loaded; /* flag: symbols read in yet? */
@ -816,10 +822,10 @@ Index: gdb-6.7/gdb/solist.h
+/* Controls the printing of debugging output. */
+extern int debug_solib;
#endif
Index: gdb-6.7/gdb/varobj.h
Index: gdb-6.7.1/gdb/varobj.h
===================================================================
--- gdb-6.7.orig/gdb/varobj.h 2007-08-31 20:52:05.000000000 +0200
+++ gdb-6.7/gdb/varobj.h 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/varobj.h 2007-08-31 20:52:05.000000000 +0200
+++ gdb-6.7.1/gdb/varobj.h 2007-11-02 15:24:19.000000000 +0100
@@ -114,4 +114,6 @@ extern int varobj_update (struct varobj
extern void varobj_invalidate (void);
@ -827,10 +833,10 @@ Index: gdb-6.7/gdb/varobj.h
+extern void varobj_refresh(void);
+
#endif /* VAROBJ_H */
Index: gdb-6.7/gdb/symfile.c
Index: gdb-6.7.1/gdb/symfile.c
===================================================================
--- gdb-6.7.orig/gdb/symfile.c 2007-09-24 23:48:05.000000000 +0200
+++ gdb-6.7/gdb/symfile.c 2007-10-13 05:32:14.000000000 +0200
--- gdb-6.7.1.orig/gdb/symfile.c 2007-09-24 23:48:05.000000000 +0200
+++ gdb-6.7.1/gdb/symfile.c 2007-11-02 15:24:19.000000000 +0100
@@ -47,6 +47,7 @@
#include "readline/readline.h"
#include "gdb_assert.h"
@ -918,11 +924,11 @@ Index: gdb-6.7/gdb/symfile.c
observer_notify_new_objfile (NULL);
/* Clear globals which might have pointed into a removed objfile.
Index: gdb-6.7/gdb/breakpoint.c
Index: gdb-6.7.1/gdb/breakpoint.c
===================================================================
--- gdb-6.7.orig/gdb/breakpoint.c 2007-10-13 05:27:15.000000000 +0200
+++ gdb-6.7/gdb/breakpoint.c 2007-10-13 05:29:58.000000000 +0200
@@ -840,15 +840,15 @@ insert_watchpoints_for_new_thread (ptid_
--- gdb-6.7.1.orig/gdb/breakpoint.c 2007-11-02 15:24:10.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.c 2007-11-02 15:26:50.000000000 +0100
@@ -847,15 +847,15 @@ insert_watchpoints_for_new_thread (ptid_
struct value *v = b->owner->val_chain;
/* Look at each value on the value chain. */
@ -941,7 +947,7 @@ Index: gdb-6.7/gdb/breakpoint.c
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
@@ -860,8 +860,8 @@ insert_watchpoints_for_new_thread (ptid_
@@ -867,8 +867,8 @@ insert_watchpoints_for_new_thread (ptid_
CORE_ADDR addr;
int len, type;
@ -952,7 +958,7 @@ Index: gdb-6.7/gdb/breakpoint.c
type = hw_write;
if (b->owner->type == bp_read_watchpoint)
type = hw_read;
@@ -2749,12 +2749,12 @@ mark_triggered_watchpoints (CORE_ADDR st
@@ -2767,12 +2767,12 @@ mark_triggered_watchpoints (CORE_ADDR st
|| b->type == bp_read_watchpoint
|| b->type == bp_access_watchpoint)
{
@ -968,7 +974,7 @@ Index: gdb-6.7/gdb/breakpoint.c
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2762,11 +2762,11 @@ mark_triggered_watchpoints (CORE_ADDR st
@@ -2780,11 +2780,11 @@ mark_triggered_watchpoints (CORE_ADDR st
{
CORE_ADDR vaddr;
@ -982,7 +988,7 @@ Index: gdb-6.7/gdb/breakpoint.c
b->watchpoint_triggered = 1;
}
}
@@ -2936,12 +2936,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2957,12 +2957,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->stop = 0;
continue;
}
@ -998,7 +1004,7 @@ Index: gdb-6.7/gdb/breakpoint.c
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2949,11 +2949,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2970,11 +2970,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
{
CORE_ADDR vaddr;
@ -1012,15 +1018,17 @@ Index: gdb-6.7/gdb/breakpoint.c
must_check_value = 1;
}
}
@@ -3996,6 +3996,7 @@ describe_other_breakpoints (CORE_ADDR pc
printf_filtered ("%s%s ",
((b->enable_state == bp_disabled ||
b->enable_state == bp_shlib_disabled ||
+ b->enable_state == bp_startup_disabled ||
b->enable_state == bp_call_disabled)
? " (disabled)"
: b->enable_state == bp_permanent
@@ -4669,6 +4670,62 @@ re_enable_breakpoints_in_shlibs (void)
@@ -4118,7 +4118,8 @@ describe_other_breakpoints (CORE_ADDR pc
printf_filtered (" (thread %d)", b->thread);
printf_filtered ("%s%s ",
((b->enable_state == bp_disabled ||
- b->enable_state == bp_call_disabled)
+ b->enable_state == bp_call_disabled ||
+ b->enable_state == bp_startup_disabled)
? " (disabled)"
: b->enable_state == bp_permanent
? " (permanent)"
@@ -4773,6 +4774,62 @@ disable_breakpoints_in_unloaded_shlib (s
}
}
@ -1083,28 +1091,10 @@ Index: gdb-6.7/gdb/breakpoint.c
static void
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
char *cond_string, enum bptype bp_kind)
@@ -7084,6 +7141,7 @@ delete_breakpoint (struct breakpoint *bp
&& !b->loc->duplicate
&& b->enable_state != bp_disabled
&& b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_startup_disabled
&& !b->pending
&& b->enable_state != bp_call_disabled)
{
@@ -7308,7 +7366,8 @@ breakpoint_re_set_one (void *bint)
break;
save_enable = b->enable_state;
- if (b->enable_state != bp_shlib_disabled)
+ if (b->enable_state != bp_shlib_disabled
+ || b->enable_state != bp_shlib_disabled)
b->enable_state = bp_disabled;
else
/* If resetting a shlib-disabled breakpoint, we don't want to
Index: gdb-6.7/gdb/solib.c
Index: gdb-6.7.1/gdb/solib.c
===================================================================
--- gdb-6.7.orig/gdb/solib.c 2007-08-23 20:08:38.000000000 +0200
+++ gdb-6.7/gdb/solib.c 2007-10-13 05:32:46.000000000 +0200
--- gdb-6.7.1.orig/gdb/solib.c 2007-08-23 20:08:38.000000000 +0200
+++ gdb-6.7.1/gdb/solib.c 2007-11-02 15:24:19.000000000 +0100
@@ -78,6 +78,8 @@ set_solib_ops (struct gdbarch *gdbarch,
/* external data declarations */
@ -1279,10 +1269,10 @@ Index: gdb-6.7/gdb/solib.c
+ NULL, NULL,
+ &setdebuglist, &showdebuglist);
}
Index: gdb-6.7/gdb/elfread.c
Index: gdb-6.7.1/gdb/elfread.c
===================================================================
--- gdb-6.7.orig/gdb/elfread.c 2007-08-23 20:08:28.000000000 +0200
+++ gdb-6.7/gdb/elfread.c 2007-10-13 05:29:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/elfread.c 2007-08-23 20:08:28.000000000 +0200
+++ gdb-6.7.1/gdb/elfread.c 2007-11-02 15:24:19.000000000 +0100
@@ -611,7 +611,7 @@ elf_symfile_read (struct objfile *objfil
/* If we are reinitializing, or if we have never loaded syms yet,
set table to empty. MAINLINE is cleared so that *_read_psymtab
@ -1292,15 +1282,11 @@ Index: gdb-6.7/gdb/elfread.c
{
init_psymbol_list (objfile, 0);
mainline = 0;
2007-10-31 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7 - workaround too early breakpoint address analysis.
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-orig/gdb/Makefile.in gdb-6.7-patched/gdb/Makefile.in
--- gdb-6.7-orig/gdb/Makefile.in 2007-10-31 12:50:10.000000000 +0100
+++ gdb-6.7-patched/gdb/Makefile.in 2007-10-31 00:38:11.000000000 +0100
@@ -1824,7 +1824,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a
Index: gdb-6.7.1/gdb/Makefile.in
===================================================================
--- gdb-6.7.1.orig/gdb/Makefile.in 2007-11-02 15:24:10.000000000 +0100
+++ gdb-6.7.1/gdb/Makefile.in 2007-11-02 15:24:19.000000000 +0100
@@ -1819,7 +1819,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a
$(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \
$(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \
$(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \
@ -1309,9 +1295,10 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-orig/gdb/Makefile.in gdb-6.7-
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
$(gdbtypes_h) $(breakpoint_h)
arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-orig/gdb/amd64-tdep.c gdb-6.7-patched/gdb/amd64-tdep.c
--- gdb-6.7-orig/gdb/amd64-tdep.c 2007-10-31 12:50:09.000000000 +0100
+++ gdb-6.7-patched/gdb/amd64-tdep.c 2007-10-31 00:46:13.000000000 +0100
Index: gdb-6.7.1/gdb/amd64-tdep.c
===================================================================
--- gdb-6.7.1.orig/gdb/amd64-tdep.c 2007-11-02 15:21:46.000000000 +0100
+++ gdb-6.7.1/gdb/amd64-tdep.c 2007-11-02 15:24:19.000000000 +0100
@@ -36,6 +36,7 @@
#include "symfile.h"
#include "dwarf2-frame.h"

View File

@ -1,276 +0,0 @@
[base]
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/testsuite/gdb.cp/constructortest.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.cp/constructortest.cc 2007-10-14 23:29:48.000000000 +0200
@@ -0,0 +1,99 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+class A
+{
+ public:
+ A();
+ ~A();
+ int k;
+ private:
+ int x;
+};
+
+class B: public A
+{
+ public:
+ B();
+ private:
+ int y;
+};
+
+/* C and D are for the $delete destructor. */
+
+class C
+{
+ public:
+ C();
+ virtual ~C();
+ private:
+ int x;
+};
+
+class D: public C
+{
+ public:
+ D();
+ private:
+ int y;
+};
+
+int main(int argc, char *argv[])
+{
+ A* a = new A;
+ B* b = new B;
+ D* d = new D;
+ delete a;
+ delete b;
+ delete d;
+ return 0;
+}
+
+A::A() /* Constructor A */
+{
+ x = 1; /* First line A */
+ k = 4; /* Second line A */
+}
+
+A::~A() /* Destructor A */
+{
+ x = 3; /* First line ~A */
+ k = 6; /* Second line ~A */
+}
+
+B::B()
+{
+ y = 2; /* First line B */
+ k = 5;
+}
+
+C::C() /* Constructor C */
+{
+ x = 1; /* First line C */
+}
+
+C::~C() /* Destructor C */
+{
+ x = 3; /* First line ~C */
+}
+
+D::D()
+{
+ y = 2; /* First line D */
+}
Index: gdb-6.7/gdb/testsuite/gdb.cp/constructortest.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7/gdb/testsuite/gdb.cp/constructortest.exp 2007-10-14 23:29:48.000000000 +0200
@@ -0,0 +1,148 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can break at multiple forms of constructors.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC
+# breakpoints.
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor
+gdb_test_multiple "break A\:\:A" "breaking on A::A" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::A\\(\\) at .*\[\r\n\]*.3. A::A\\\$base\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+}
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
+
+# Now do the same for destructors
+gdb_test "break 'A::~A()'" ""
+gdb_test "break 'A::~A\$base()'" ""
+
+# Verify that we break for the A destructor two times
+# Once for delete a and once for delete b
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
+
+
+# Verify that we can break by line number in a constructor and find
+# both occurrences
+runto_main
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+gdb_test "break $second_line" ".*$second_line.*$second_line.*Multiple breakpoints were set.*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
+
+# Verify that we can break by line number in a destructor and find
+# both occurrences
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+gdb_test "break $second_line_dtor" ".*$second_line_dtor.*$second_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+# FIXME: Analyse this case better.
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
+
+
+# Test now the $delete destructors.
+
+gdb_load ${binfile}
+runto_main
+
+# Break on the various forms of the C::~C destructor
+set test "breaking on C::~C"
+gdb_test_multiple "break C\:\:~C" $test {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. C::~C\\(\\) at .*\[\r\n\]*.3. C::~C\\\$base\\(\\) at .*\[\r\n\]*4. C::~C\\\$delete\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*> $" {
+ fail $test
+ }
+}
+gdb_continue_to_breakpoint "First line ~C"
+
+# Verify that we can break by line number in a destructor and find
+# the $delete occurence
+
+gdb_load ${binfile}
+delete_breakpoints
+
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+gdb_test "break $first_line_dtor" ".*$first_line_dtor.*$first_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+
+# Run to `main' where we begin our tests.
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
+# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS.
+
+if ![gdb_breakpoint main] {
+ gdb_suppress_tests
+}
+gdb_run_cmd
+set test "running to main"
+gdb_test_multiple "" $test {
+ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_continue_to_breakpoint "First line ~C"
Index: gdb-6.7/gdb/testsuite/gdb.cp/templates.exp
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.cp/templates.exp 2007-08-23 20:14:17.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.cp/templates.exp 2007-10-14 23:29:48.000000000 +0200
@@ -142,7 +142,7 @@ proc test_template_breakpoints {} {
# See CLLbs14792
if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
- gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
+ gdb_test_multiple "break 'T5<int>::~T5()'" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
pass "destructor breakpoint"

View File

@ -2,6 +2,10 @@
Port to GDB-6.7.
2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to post-GDB-6.7.1 multi-PC breakpoints.
Index: gdb-6.7/gdb/testsuite/configure.ac
===================================================================
--- gdb-6.7.orig/gdb/testsuite/configure.ac 2007-08-23 19:58:44.000000000 +0200
@ -1059,7 +1063,7 @@ Index: gdb-6.7/gdb/testsuite/gdb.pie/break.exp
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ "Num\[\t \]+Type\[\t \]+Disp\[\t \]+Enb\[\t \]+Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.*
@ -1189,7 +1193,7 @@ Index: gdb-6.7/gdb/testsuite/gdb.pie/break.exp
+#
+# check to see what breakpoints are set (temporary this time)
+#
+gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]
+gdb_test "info break" "Num\[\t \]+Type.*Disp\[\t \]+Enb\[\t \]+Address.*What.*\[\r\n\]
+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]
+\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\]
+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\]

View File

@ -32,10 +32,14 @@
Port to GDB-6.7.
Index: gdb-6.7/gdb/doc/observer.texi
2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to post-GDB-6.7.1 multi-PC breakpoints.
Index: gdb-6.7.1/gdb/doc/observer.texi
===================================================================
--- gdb-6.7.orig/gdb/doc/observer.texi 2007-05-11 21:55:20.000000000 +0200
+++ gdb-6.7/gdb/doc/observer.texi 2007-10-13 04:51:21.000000000 +0200
--- gdb-6.7.1.orig/gdb/doc/observer.texi 2007-05-11 21:55:20.000000000 +0200
+++ gdb-6.7.1/gdb/doc/observer.texi 2007-11-02 15:21:57.000000000 +0100
@@ -129,3 +129,12 @@ Called with @var{objfile} equal to @code
previously loaded symbol table data has now been invalidated.
@end deftypefun
@ -49,11 +53,11 @@ Index: gdb-6.7/gdb/doc/observer.texi
+A low-level SIGTRAP has been discovered. This notification can be used to save
+additional state necessary if the trap is deferred for later handling.
+@end deftypefun
Index: gdb-6.7/gdb/infrun.c
Index: gdb-6.7.1/gdb/infrun.c
===================================================================
--- gdb-6.7.orig/gdb/infrun.c 2007-10-12 22:35:58.000000000 +0200
+++ gdb-6.7/gdb/infrun.c 2007-10-13 04:50:11.000000000 +0200
@@ -1784,9 +1784,19 @@ handle_inferior_event (struct execution_
--- gdb-6.7.1.orig/gdb/infrun.c 2007-11-02 15:21:46.000000000 +0100
+++ gdb-6.7.1/gdb/infrun.c 2007-11-02 15:21:57.000000000 +0100
@@ -1781,9 +1781,19 @@ handle_inferior_event (struct execution_
single step over a watchpoint without disabling the watchpoint. */
if (HAVE_STEPPABLE_WATCHPOINT && STOPPED_BY_WATCHPOINT (ecs->ws))
{
@ -74,7 +78,7 @@ Index: gdb-6.7/gdb/infrun.c
prepare_to_wait (ecs);
return;
}
@@ -1797,6 +1807,8 @@ handle_inferior_event (struct execution_
@@ -1794,6 +1804,8 @@ handle_inferior_event (struct execution_
if (gdbarch_have_nonsteppable_watchpoint (current_gdbarch)
&& STOPPED_BY_WATCHPOINT (ecs->ws))
{
@ -83,7 +87,7 @@ Index: gdb-6.7/gdb/infrun.c
/* At this point, we are stopped at an instruction which has
attempted to write to a piece of memory under control of
a watchpoint. The instruction hasn't actually executed
@@ -1804,15 +1816,12 @@ handle_inferior_event (struct execution_
@@ -1801,15 +1813,12 @@ handle_inferior_event (struct execution_
now, we would get the old value, and therefore no change
would seem to have occurred.
@ -105,7 +109,7 @@ Index: gdb-6.7/gdb/infrun.c
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n");
@@ -1883,6 +1892,41 @@ handle_inferior_event (struct execution_
@@ -1880,6 +1889,41 @@ handle_inferior_event (struct execution_
}
}
@ -147,7 +151,7 @@ Index: gdb-6.7/gdb/infrun.c
/* Look at the cause of the stop, and decide what to do.
The alternatives are:
1) break; to really stop and return to the debugger,
@@ -1935,6 +1979,8 @@ handle_inferior_event (struct execution_
@@ -1932,6 +1976,8 @@ handle_inferior_event (struct execution_
See more comments in inferior.h. */
if (stop_soon == STOP_QUIETLY_NO_SIGSTOP)
{
@ -156,11 +160,11 @@ Index: gdb-6.7/gdb/infrun.c
stop_stepping (ecs);
if (stop_signal == TARGET_SIGNAL_STOP)
stop_signal = TARGET_SIGNAL_0;
Index: gdb-6.7/gdb/breakpoint.c
Index: gdb-6.7.1/gdb/breakpoint.c
===================================================================
--- gdb-6.7.orig/gdb/breakpoint.c 2007-08-30 00:07:47.000000000 +0200
+++ gdb-6.7/gdb/breakpoint.c 2007-10-13 04:50:11.000000000 +0200
@@ -806,6 +806,90 @@ insert_catchpoint (struct ui_out *uo, vo
--- gdb-6.7.1.orig/gdb/breakpoint.c 2007-11-02 15:21:45.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.c 2007-11-02 15:23:04.000000000 +0100
@@ -813,6 +813,90 @@ insert_catchpoint (struct ui_out *uo, vo
}
}
@ -251,7 +255,7 @@ Index: gdb-6.7/gdb/breakpoint.c
/* Helper routine: free the value chain for a breakpoint (watchpoint). */
static void
@@ -1294,6 +1378,7 @@ remove_breakpoints (void)
@@ -1301,6 +1385,7 @@ remove_breakpoints (void)
{
struct bp_location *b;
int val;
@ -259,7 +263,7 @@ Index: gdb-6.7/gdb/breakpoint.c
ALL_BP_LOCATIONS (b)
{
@@ -1301,10 +1386,10 @@ remove_breakpoints (void)
@@ -1308,10 +1393,10 @@ remove_breakpoints (void)
{
val = remove_breakpoint (b, mark_uninserted);
if (val != 0)
@ -272,7 +276,7 @@ Index: gdb-6.7/gdb/breakpoint.c
}
int
@@ -2187,8 +2272,13 @@ print_it_typical (bpstat bs)
@@ -2200,8 +2285,13 @@ print_it_typical (bpstat bs)
break;
case bp_thread_event:
@ -288,7 +292,7 @@ Index: gdb-6.7/gdb/breakpoint.c
printf_filtered (_("Thread Event Breakpoint: gdb should not stop!\n"));
return PRINT_NOTHING;
break;
@@ -2636,6 +2726,54 @@ which its expression is valid.\n");
@@ -2654,6 +2744,54 @@ which its expression is valid.\n");
}
}
@ -343,7 +347,7 @@ Index: gdb-6.7/gdb/breakpoint.c
/* Get a bpstat associated with having just stopped at address
BP_ADDR in thread PTID. STOPPED_BY_WATCHPOINT is 1 if the
target thinks we stopped due to a hardware watchpoint, 0 if we
@@ -2766,82 +2904,61 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2787,82 +2925,61 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->stop = 1;
bs->print = 1;
@ -471,7 +475,7 @@ Index: gdb-6.7/gdb/breakpoint.c
{
char *message = xstrprintf ("Error evaluating expression for watchpoint %d\n",
b->number);
@@ -2870,6 +2987,15 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2891,6 +3008,15 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
break;
case WP_VALUE_NOT_CHANGED:
/* Stop. */
@ -487,7 +491,7 @@ Index: gdb-6.7/gdb/breakpoint.c
++(b->hit_count);
break;
default:
@@ -2885,7 +3011,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2906,7 +3032,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
break;
}
}
@ -496,22 +500,22 @@ Index: gdb-6.7/gdb/breakpoint.c
{
/* This is a case where some watchpoint(s) triggered,
but not at the address of this watchpoint (FOUND
@@ -4186,6 +4312,7 @@ set_raw_breakpoint (struct symtab_and_li
@@ -4292,6 +4418,7 @@ set_raw_breakpoint_without_location (enu
b->exec_pathname = NULL;
b->ops = NULL;
b->pending = 0;
b->condition_not_parsed = 0;
+ b->watchpoint_triggered = 0;
/* Add this breakpoint to the end of the chain
so that a list of breakpoints will come out in order
Index: gdb-6.7/gdb/breakpoint.h
Index: gdb-6.7.1/gdb/breakpoint.h
===================================================================
--- gdb-6.7.orig/gdb/breakpoint.h 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7/gdb/breakpoint.h 2007-10-13 04:50:11.000000000 +0200
@@ -420,6 +420,11 @@ struct breakpoint
/* Is breakpoint pending on shlib loads? */
int pending;
--- gdb-6.7.1.orig/gdb/breakpoint.h 2007-11-02 15:21:45.000000000 +0100
+++ gdb-6.7.1/gdb/breakpoint.h 2007-11-02 15:22:24.000000000 +0100
@@ -439,6 +439,11 @@ struct breakpoint
no location initially so had no context to parse
the condition in. */
int condition_not_parsed;
+
+ /* Has a watchpoint been triggered? This is only used for
+ non-continuable watchpoints which trigger prior to the data
@ -520,7 +524,7 @@ Index: gdb-6.7/gdb/breakpoint.h
};
/* The following stuff is an abstract data type "bpstat" ("breakpoint
@@ -688,6 +693,14 @@ extern void tbreak_command (char *, int)
@@ -707,6 +712,14 @@ extern void tbreak_command (char *, int)
extern int insert_breakpoints (void);
@ -535,10 +539,10 @@ Index: gdb-6.7/gdb/breakpoint.h
extern int remove_breakpoints (void);
/* This function can be used to physically insert eventpoints from the
Index: gdb-6.7/gdb/linux-nat.c
Index: gdb-6.7.1/gdb/linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/linux-nat.c 2007-10-12 22:35:58.000000000 +0200
+++ gdb-6.7/gdb/linux-nat.c 2007-10-13 04:50:11.000000000 +0200
--- gdb-6.7.1.orig/gdb/linux-nat.c 2007-11-02 15:21:46.000000000 +0100
+++ gdb-6.7.1/gdb/linux-nat.c 2007-11-02 15:21:57.000000000 +0100
@@ -34,6 +34,7 @@
#include "gdbthread.h"
#include "gdbcmd.h"
@ -586,10 +590,10 @@ Index: gdb-6.7/gdb/linux-nat.c
/* Handle GNU/Linux's extended waitstatus for trace events. */
if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
{
Index: gdb-6.7/gdb/linux-nat.h
Index: gdb-6.7.1/gdb/linux-nat.h
===================================================================
--- gdb-6.7.orig/gdb/linux-nat.h 2007-10-12 22:35:58.000000000 +0200
+++ gdb-6.7/gdb/linux-nat.h 2007-10-13 04:50:11.000000000 +0200
--- gdb-6.7.1.orig/gdb/linux-nat.h 2007-11-02 15:21:46.000000000 +0100
+++ gdb-6.7.1/gdb/linux-nat.h 2007-11-02 15:21:57.000000000 +0100
@@ -61,6 +61,18 @@ struct lwp_info
/* Next LWP in list. */
@ -609,10 +613,10 @@ Index: gdb-6.7/gdb/linux-nat.h
};
/* Attempt to initialize libthread_db. */
Index: gdb-6.7/gdb/Makefile.in
Index: gdb-6.7.1/gdb/Makefile.in
===================================================================
--- gdb-6.7.orig/gdb/Makefile.in 2007-09-05 02:14:02.000000000 +0200
+++ gdb-6.7/gdb/Makefile.in 2007-10-13 04:50:53.000000000 +0200
--- gdb-6.7.1.orig/gdb/Makefile.in 2007-09-05 02:14:02.000000000 +0200
+++ gdb-6.7.1/gdb/Makefile.in 2007-11-02 15:21:57.000000000 +0100
@@ -2160,7 +2160,7 @@ i387-tdep.o: i387-tdep.c $(defs_h) $(dou
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
@ -631,10 +635,10 @@ Index: gdb-6.7/gdb/Makefile.in
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
$(floatformat_h) $(regcache_h) $(trad_frame_h) $(frame_base_h) \
Index: gdb-6.7/gdb/linux-thread-db.c
Index: gdb-6.7.1/gdb/linux-thread-db.c
===================================================================
--- gdb-6.7.orig/gdb/linux-thread-db.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/linux-thread-db.c 2007-10-13 04:53:59.000000000 +0200
--- gdb-6.7.1.orig/gdb/linux-thread-db.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7.1/gdb/linux-thread-db.c 2007-11-02 15:21:57.000000000 +0100
@@ -34,6 +34,7 @@
#include "target.h"
#include "regcache.h"
@ -685,10 +689,10 @@ Index: gdb-6.7/gdb/linux-thread-db.c
/* Check for a thread event. */
check_event (ptid);
Index: gdb-6.7/gdb/i386-linux-nat.c
Index: gdb-6.7.1/gdb/i386-linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/i386-linux-nat.c 2007-08-23 20:08:34.000000000 +0200
+++ gdb-6.7/gdb/i386-linux-nat.c 2007-10-13 04:50:11.000000000 +0200
--- gdb-6.7.1.orig/gdb/i386-linux-nat.c 2007-08-23 20:08:34.000000000 +0200
+++ gdb-6.7.1/gdb/i386-linux-nat.c 2007-11-02 15:21:57.000000000 +0100
@@ -585,10 +585,9 @@ i386_linux_dr_get (int regnum)
int tid;
unsigned long value;
@ -717,10 +721,10 @@ Index: gdb-6.7/gdb/i386-linux-nat.c
errno = 0;
ptrace (PTRACE_POKEUSER, tid,
Index: gdb-6.7/gdb/ia64-linux-nat.c
Index: gdb-6.7.1/gdb/ia64-linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/ia64-linux-nat.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/ia64-linux-nat.c 2007-10-13 05:07:58.000000000 +0200
--- gdb-6.7.1.orig/gdb/ia64-linux-nat.c 2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7.1/gdb/ia64-linux-nat.c 2007-11-02 15:21:57.000000000 +0100
@@ -27,6 +27,7 @@
#include "regcache.h"
#include "ia64-tdep.h"
@ -912,10 +916,10 @@ Index: gdb-6.7/gdb/ia64-linux-nat.c
+ observer_attach_linux_new_thread (ia64_linux_new_thread);
+ observer_attach_sigtrap (ia64_linux_save_sigtrap_info);
}
Index: gdb-6.7/gdb/amd64-linux-nat.c
Index: gdb-6.7.1/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/amd64-linux-nat.c 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7/gdb/amd64-linux-nat.c 2007-10-13 04:50:11.000000000 +0200
--- gdb-6.7.1.orig/gdb/amd64-linux-nat.c 2007-08-23 20:08:26.000000000 +0200
+++ gdb-6.7.1/gdb/amd64-linux-nat.c 2007-11-02 15:21:57.000000000 +0100
@@ -240,10 +240,9 @@ amd64_linux_dr_get (int regnum)
int tid;
unsigned long value;
@ -944,10 +948,10 @@ Index: gdb-6.7/gdb/amd64-linux-nat.c
errno = 0;
ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value);
Index: gdb-6.7/gdb/s390-nat.c
Index: gdb-6.7.1/gdb/s390-nat.c
===================================================================
--- gdb-6.7.orig/gdb/s390-nat.c 2007-08-23 20:08:37.000000000 +0200
+++ gdb-6.7/gdb/s390-nat.c 2007-10-13 04:50:11.000000000 +0200
--- gdb-6.7.1.orig/gdb/s390-nat.c 2007-08-23 20:08:37.000000000 +0200
+++ gdb-6.7.1/gdb/s390-nat.c 2007-11-02 15:21:57.000000000 +0100
@@ -27,6 +27,7 @@
#include "linux-nat.h"

View File

@ -1,21 +0,0 @@
2005-09-22 Bastien Nocera <bnocera@redhat.com>
* symtab.c (find_line_pc_range): Don't free up pc_list
unconditionally as it may not be allocated.
--- gdb-6.3/gdb/symtab.c.fix 2005-09-22 16:24:06.000000000 -0400
+++ gdb-6.3/gdb/symtab.c 2005-09-22 16:26:17.000000000 -0400
@@ -2427,9 +2427,10 @@ find_line_pc_range (struct symtab_and_li
/* FIXME: have to handle ctors/dtors where line equates to multiple
pc ranges. */
if (startaddr == 0)
- startaddr = pc_list[0];
-
- xfree (pc_list);
+ {
+ startaddr = pc_list[0];
+ xfree (pc_list);
+ }
/* This whole function is based on address. For example, if line 10 has
two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then

View File

@ -1,30 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=200048
diff -ru gdb-6.5-orig/gdb/tui/tui-layout.c gdb-6.5-pr200048/gdb/tui/tui-layout.c
--- gdb-6.5-orig/gdb/tui/tui-layout.c 2006-08-07 21:33:42.000000000 +0200
+++ gdb-6.5-pr200048/gdb/tui/tui-layout.c 2006-08-13 02:26:39.000000000 +0200
@@ -519,13 +519,17 @@
{
case SRC_COMMAND:
case SRC_DATA_COMMAND:
- find_line_pc (cursal.symtab,
+ if (find_line_pc (cursal.symtab,
TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
- &pc_list, &num_pc_values);
- /* FIXME: What do we do with multiple pc values for ctors/dtors or
- inlined functions? */
- addr = pc_list[0];
- xfree (pc_list);
+ &pc_list, &num_pc_values))
+ {
+ /* FIXME: What do we do with multiple pc values for ctors/dtors or
+ inlined functions? */
+ addr = pc_list[0];
+ xfree (pc_list);
+ }
+ else
+ addr = 0;
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.7.1
# The release always contains a leading reserved number, start it at 1.
Release: 1%{?dist}
Release: 2%{?dist}
License: GPL
Group: Development/Debuggers
@ -85,12 +85,6 @@ Patch260: gdb-6.6-scheduler_locking-step-is-default.patch
# Threaded watchpoint support
Patch113: gdb-6.3-threaded-watchpoints-20041213.patch
# Fix to expose multiple constructors to end-user
Patch115: gdb-6.3-constructor-20041216.patch
# Fix to display base constructors from list and breakpoint commands
Patch116: gdb-6.3-linespec-20041213.patch
# Continue removing breakpoints even when failure occurs.
Patch117: gdb-6.3-removebp-20041130.patch
@ -114,13 +108,6 @@ Patch125: gdb-6.3-test-self-20050110.patch
# Fix for non-threaded watchpoints.
Patch128: gdb-6.3-nonthreaded-wp-20050117.patch
# Add PPC .symbols to min-symtable.
Patch130: gdb-6.3-ctorline-20050120.patch
# Fix to support multiple destructors just like multiple constructors
Patch133: gdb-6.3-test-dtorfix-20050121.patch
Patch134: gdb-6.3-dtorfix-20050121.patch
# Fix to support executable moving
Patch136: gdb-6.3-test-movedir-20050125.patch
@ -180,9 +167,6 @@ Patch163: gdb-6.3-inheritancetest-20050726.patch
# Add readnever option
Patch164: gdb-6.3-readnever-20050907.patch
# Remove extraneous xfree
Patch165: gdb-6.3-xfree-20050922.patch
# Fix frame pointer for ia64 sigtramp frame
Patch166: gdb-6.3-ia64-sigtramp-fp-20050926.patch
@ -206,12 +190,6 @@ Patch178: gdb-6.3-catch-debug-registers-error-20060527.patch
# ia32el.
Patch179: gdb-6.3-ia32el-fix-waitpid-20060615.patch
# Bugfix segv on the source display by ^X 1 (fixes Patch130, BZ 200048).
Patch181: gdb-6.5-bz200048-find_line_pc-segv.patch
# Bugfix object names completion (fixes Patch116, BZ 193763).
Patch185: gdb-6.3-bz193763-object-name-completion.patch
# Testcase for corrupted or missing location list information (BZ 196439).
Patch187: gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch
@ -385,6 +363,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
# Apply patches defined above.
%patch232 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
@ -399,8 +378,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
@ -409,9 +386,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch124 -p1
%patch125 -p1
%patch128 -p1
%patch130 -p1
%patch133 -p1
%patch134 -p1
%patch136 -p1
%patch139 -p1
%patch140 -p1
@ -432,7 +406,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch162 -p1
%patch163 -p1
%patch164 -p1
%patch165 -p1
%patch166 -p1
%patch169 -p1
%patch170 -p1
@ -440,8 +413,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch177 -p1
%patch178 -p1
%patch179 -p1
%patch181 -p1
%patch185 -p1
%patch187 -p1
%patch188 -p1
%patch190 -p1
@ -462,7 +433,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch225 -p1
%patch229 -p1
%patch231 -p1
%patch232 -p1
%patch234 -p1
%patch235 -p1
%patch236 -p1
@ -642,6 +612,9 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Sat Nov 3 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.7.1-2
- Backport `Breakpoints at multiple locations' patch primarily for C++.
* Thu Nov 1 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.7.1-1
- Upgrade to GDB 6.7.1. Drop redundant patches, forward-port remaining ones.