diff --git a/gdb-6.3-ctorline-20050120.patch b/gdb-6.3-ctorline-20050120.patch index 567cbf3..f2ac6a1 100644 --- a/gdb-6.3-ctorline-20050120.patch +++ b/gdb-6.3-ctorline-20050120.patch @@ -36,6 +36,13 @@ (break_command_1, do_captured_breakpoint): Pass also the ADDR_STRING variable to be updated. +2007-10-05 Jan Kratochvil + + * 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. + Index: gdb-6.5/gdb/mi/mi-cmd-disas.c =================================================================== --- gdb-6.5.orig/gdb/mi/mi-cmd-disas.c 2006-07-11 01:30:43.000000000 -0300 @@ -479,7 +486,7 @@ Index: gdb-6.5/gdb/breakpoint.c =================================================================== --- gdb-6.5.orig/gdb/breakpoint.c 2006-07-11 01:30:53.000000000 -0300 +++ gdb-6.5/gdb/breakpoint.c 2006-07-11 01:39:20.000000000 -0300 -@@ -5268,12 +5268,69 @@ static void +@@ -5268,12 +5268,70 @@ static void static void breakpoint_sals_to_pc (struct symtabs_and_lines *sals, @@ -509,6 +516,7 @@ Index: gdb-6.5/gdb/breakpoint.c + 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) @@ -532,15 +540,15 @@ Index: gdb-6.5/gdb/breakpoint.c + * 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 deleted for all the -+ multiple PCs as BREAKPOINT_RE_SET currently does not set all the -+ PCs for a sinle line back again. For NULL values "*0x%x" direct -+ address will be provided by CREATE_BREAKPOINTS. */ -+ xfree ((*addr_string_p)[i]); -+ for (j = 0; j < num_pc_values; ++j) -+ { -+ new_addr_string[i + j] = NULL; -+ } ++ /* 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); @@ -661,3 +669,58 @@ Index: gdb-6.5/gdb/breakpoint.c void break_command (char *arg, int from_tty) { +@@ -7304,6 +7305,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) +@@ -7364,11 +7367,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. */ diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index 0fe7979..2444d1e 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -15,6 +15,11 @@ Index: gdb/testsuite/ChangeLog * gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting the whole GDB. +2007-10-05 Jan Kratochvil + + * gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs + by PIE. + --- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005 +++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005 @@ -0,0 +1,99 @@ @@ -119,7 +124,7 @@ Index: gdb/testsuite/ChangeLog +} --- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005 +++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005 -@@ -0,0 +1,127 @@ +@@ -0,0 +1,145 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2005, 2007 Free Software Foundation, Inc. @@ -150,7 +155,9 @@ Index: gdb/testsuite/ChangeLog +set testfile "constructortest" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { ++# 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 +} + @@ -242,10 +249,26 @@ Index: gdb/testsuite/ChangeLog +# the $delete occurence + +gdb_load ${binfile} -+runto_main ++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" --- gdb-6.3/gdb/testsuite/gdb.cp/templates.exp.fix Fri Jan 21 17:07:10 2005 +++ gdb-6.3/gdb/testsuite/gdb.cp/templates.exp Fri Jan 21 17:09:09 2005 diff --git a/gdb.spec b/gdb.spec index d86c7c7..699e68d 100644 --- a/gdb.spec +++ b/gdb.spec @@ -11,7 +11,7 @@ Name: gdb Version: 6.6 # The release always contains a leading reserved number, start it at 1. -Release: 30%{?dist} +Release: 31%{?dist} License: GPL Group: Development/Debuggers @@ -542,6 +542,8 @@ _FOO # Remove the info and other generated files added by the FSF release # process. +rm -f bfd/doc/*.info +rm -f bfd/doc/*.info-* rm -f gdb/doc/*.info rm -f gdb/doc/*.info-* @@ -687,6 +689,10 @@ fi # don't include the files in include, they are part of binutils %changelog +* Fri Oct 5 2007 Jan Kratochvil - 6.6-31 +- Fix address changes of the ctors/dtors breakpoints w/multiple PCs (BZ 301701). +- Delete an info doc file on `rpmbuild -bp' later rebuilt during `rpmbuild -bc'. + * Tue Sep 25 2007 Jan Kratochvil - 6.6-30 - Fix re-setting of the ctors/dtors breakpoints with multiple PCs (BZ 301701). - Avoid one useless user question in the core files locator (build-id).