From 435483c64b850163d990f3b8d440a999d667f311 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 25 Sep 2007 23:14:55 +0000 Subject: [PATCH] - 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). --- gdb-6.3-ctorline-20050120.patch | 48 +++++++++++++++++++++++++++-- gdb-6.3-test-dtorfix-20050121.patch | 15 ++++----- gdb-6.6-buildid-locate.patch | 30 +++++++++--------- gdb.spec | 6 +++- 4 files changed, 70 insertions(+), 29 deletions(-) diff --git a/gdb-6.3-ctorline-20050120.patch b/gdb-6.3-ctorline-20050120.patch index d45b211..567cbf3 100644 --- a/gdb-6.3-ctorline-20050120.patch +++ b/gdb-6.3-ctorline-20050120.patch @@ -29,6 +29,13 @@ * breakpoint.c (breakpoint_sals_to_pc): Support more than two returned PC values. +2007-09-25 Jan Kratochvil + + * 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. + 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 @@ -472,9 +479,12 @@ 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,10 +5268,44 @@ static void +@@ -5268,12 +5268,69 @@ static void + + static void breakpoint_sals_to_pc (struct symtabs_and_lines *sals, - char *address) +- char *address) ++ char *address, char ***addr_string_p) { - int i; - for (i = 0; i < sals->nelts; i++) @@ -498,6 +508,9 @@ Index: gdb-6.5/gdb/breakpoint.c + struct symtab_and_line *new_sals = + xmalloc ((sals->nelts + num_pc_values - 1) + * sizeof (struct symtab_and_line)); ++ char **new_addr_string; ++ ++ /* 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. */ @@ -513,6 +526,26 @@ Index: gdb-6.5/gdb/breakpoint.c + { + 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 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; ++ } ++ 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; + } + @@ -527,7 +560,7 @@ Index: gdb-6.5/gdb/breakpoint.c { + /* Resolve all line numbers to PC's and verify that the addresses + are ok for the target. */ -+ breakpoint_sals_to_pc (&sals, addr_start); ++ breakpoint_sals_to_pc (&sals, addr_start, &addr_string); + /* Make sure that all storage allocated to SALS gets freed. */ make_cleanup (xfree, sals.sals); @@ -544,6 +577,15 @@ Index: gdb-6.5/gdb/breakpoint.c /* Verify that condition can be parsed, before setting any breakpoints. Allocate a separate condition expression for each breakpoint. */ +@@ -5665,7 +5688,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. */ @@ -5670,14 +5699,16 @@ gdb_breakpoint (char *address, char *con void resolve_sal_pc (struct symtab_and_line *sal) diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index a21adf2..0fe7979 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -10,6 +10,11 @@ Index: gdb/testsuite/ChangeLog * gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the `$delete' destructor variant. +2007-09-25 Jan Kratochvil + + * gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting + the whole GDB. + --- 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 @@ @@ -114,7 +119,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,135 @@ +@@ -0,0 +1,127 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2005, 2007 Free Software Foundation, Inc. @@ -216,10 +221,6 @@ Index: gdb/testsuite/ChangeLog + +# Test now the $delete destructors. + -+# FIXME: Without the full GDB restart we would hit a GDB memory corruption. -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +runto_main + @@ -240,10 +241,6 @@ Index: gdb/testsuite/ChangeLog +# Verify that we can break by line number in a destructor and find +# the $delete occurence + -+# FIXME: Without the full GDB restart we would hit a GDB memory corruption. -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +runto_main + diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 6307c33..595e09a 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -35,7 +35,7 @@ diff -u -rup gdb-6.6-orig/gdb/corelow.c gdb-6.6/gdb/corelow.c #ifndef O_LARGEFILE -@@ -253,6 +257,70 @@ add_to_thread_list (bfd *abfd, asection +@@ -253,6 +257,63 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = pid_to_ptid (thread_id); /* Yes, make it current */ } @@ -93,30 +93,28 @@ diff -u -rup gdb-6.6-orig/gdb/corelow.c gdb-6.6/gdb/corelow.c + + xfree (exec_filename); + -+ if (exec_filename != NULL) -+ { -+#ifdef SOLIB_ADD -+ SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); -+#else -+ solib_add (NULL, 0, ¤t_target, auto_solib_add); -+#endif -+ } ++ /* No automatic SOLIB_ADD as the libraries would get read twice. */ +} + /* This routine opens and sets up the core file bfd. */ static void -@@ -377,6 +445,10 @@ core_open (char *filename, int from_tty) - /* Fetch all registers from core file. */ - target_fetch_registers (-1); +@@ -417,6 +420,15 @@ core_open (char *filename, int from_tty) + ontop = !push_target (&core_ops); + discard_cleanups (old_chain); -+ /* Find build_id identifiers. */ ++ if (ontop) ++ { ++ /* Find the build_id identifiers. If it gets executed after ++ POST_CREATE_INFERIOR we would clash with asking to discard the already ++ loaded VDSO symbols. */ + if (build_id_core_loads != 0) + build_id_locate_exec (from_tty); ++ } + - /* Now, set up the frame cache, and print the top of stack. */ - flush_cached_frames (); - select_frame (get_current_frame ()); + /* This is done first, before anything has a chance to query the + inferior for information such as symbols. */ + post_create_inferior (&core_ops, from_tty); @@ -662,4 +734,13 @@ _initialize_corelow (void) if (!coreops_suppress_target) diff --git a/gdb.spec b/gdb.spec index b67904e..d86c7c7 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: 29%{?dist} +Release: 30%{?dist} License: GPL Group: Development/Debuggers @@ -687,6 +687,10 @@ fi # don't include the files in include, they are part of binutils %changelog +* 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). + * Sun Sep 23 2007 Jan Kratochvil - 6.6-29 - Fixed the kernel VDSO loading (`warning: no loadable sections found in ...'). - Fix the testcase for pending signals (from BZ 233852).