diff --git a/gdb-bz552619-dwarf3-offset-size.patch b/gdb-bz552619-dwarf3-offset-size.patch new file mode 100644 index 0000000..8ff7fa9 --- /dev/null +++ b/gdb-bz552619-dwarf3-offset-size.patch @@ -0,0 +1,51 @@ +FYI: DW_FORM_ref_addr -vs- DWARF 3 +http://sourceware.org/ml/gdb-patches/2010-03/msg00219.html +http://sourceware.org/ml/gdb-cvs/2010-03/msg00039.html + +### src/gdb/ChangeLog 2010/03/04 19:00:18 1.11430 +### src/gdb/ChangeLog 2010/03/04 22:01:09 1.11431 +## -1,3 +1,9 @@ ++2010-03-04 Tom Tromey ++ ++ * dwarf2read.c (skip_one_die) : Use offset size ++ in DWARF 3 and later. ++ (read_attribute_value) : Likewise. ++ + 2010-03-04 Keith Seitz + + * linespec.c (decode_line_1): Update comments for is_quote_enclosed. +--- src/gdb/dwarf2read.c 2010/03/02 17:19:58 1.357 ++++ src/gdb/dwarf2read.c 2010/03/04 22:01:10 1.358 +@@ -2882,8 +2882,15 @@ + skip_attribute: + switch (form) + { +- case DW_FORM_addr: + case DW_FORM_ref_addr: ++ /* In DWARF 2, DW_FORM_ref_addr is address sized; in DWARF 3 ++ and later it is offset sized. */ ++ if (cu->header.version == 2) ++ info_ptr += cu->header.addr_size; ++ else ++ info_ptr += cu->header.offset_size; ++ break; ++ case DW_FORM_addr: + info_ptr += cu->header.addr_size; + break; + case DW_FORM_data1: +@@ -7017,8 +7024,14 @@ + attr->form = form; + switch (form) + { +- case DW_FORM_addr: + case DW_FORM_ref_addr: ++ if (cu->header.version == 2) ++ DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read); ++ else ++ DW_ADDR (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read); ++ info_ptr += bytes_read; ++ break; ++ case DW_FORM_addr: + DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read); + info_ptr += bytes_read; + break; diff --git a/gdb-bz560034-mi-prettyprint-crash.patch b/gdb-bz560034-mi-prettyprint-crash.patch new file mode 100644 index 0000000..c02762f --- /dev/null +++ b/gdb-bz560034-mi-prettyprint-crash.patch @@ -0,0 +1,30 @@ +FYI: fix PR 11098 +http://sourceware.org/ml/gdb-patches/2010-03/msg00117.html +http://sourceware.org/ml/gdb-cvs/2010-03/msg00020.html + +### src/gdb/ChangeLog 2010/03/03 18:05:01 1.11418 +### src/gdb/ChangeLog 2010/03/03 18:32:43 1.11419 +## -1,3 +1,9 @@ ++2010-03-03 Tom Tromey ++ ++ PR mi/11098: ++ * varobj.c (install_new_value): Handle case where new print_value ++ is NULL. ++ + 2010-03-03 Dainis Jonitis + + PR gdb/11345: +--- src/gdb/varobj.c 2010/02/23 17:01:54 1.155 ++++ src/gdb/varobj.c 2010/03/03 18:32:44 1.156 +@@ -1593,7 +1593,10 @@ + { + xfree (print_value); + print_value = value_get_print_value (var->value, var->format, var); +- if (!var->print_value || strcmp (var->print_value, print_value) != 0) ++ if ((var->print_value == NULL && print_value != NULL) ++ || (var->print_value != NULL && print_value == NULL) ++ || (var->print_value != NULL && print_value != NULL ++ && strcmp (var->print_value, print_value) != 0)) + changed = 1; + } + if (var->print_value) diff --git a/gdb-bz561784-lazy-psymtabs-clear.patch b/gdb-bz561784-lazy-psymtabs-clear.patch new file mode 100644 index 0000000..e7d8dfb --- /dev/null +++ b/gdb-bz561784-lazy-psymtabs-clear.patch @@ -0,0 +1,73 @@ +commit 770630ed9a3f11e8ec2d03557bf9852a1bbc507d +Author: Tom Tromey +Date: Fri Feb 26 16:47:37 2010 -0700 + + Fix https://bugzilla.redhat.com/show_bug.cgi?id=561784 + + The bug is that psymtabs_addrmap can be left in an inconsistent + state when lazily reading psymtabs. This doesn't occur with + a non-lazy read because in that case the objfile is destroyed + on error. + + This fix works by clearing out the psymtabs for an objfile + if reading fails. + +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +index 18300c5..0c13fc7 100644 +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -2267,6 +2267,29 @@ build_type_psymtabs (struct objfile *objfile) + process_type_comp_unit, objfile); + } + ++/* A cleanup function that clears an objfile's psymtabs. There are ++ two cases to consider. If we are reading symbols directly, then on ++ a failure the objfile will be destroyed. In this case, clearing ++ the psymtabs is fine -- a little wasted time, but nothing serious. ++ If we are reading symbols lazily, then it is too late to destroy ++ the objfile. Instead we just make it look like the objfile has no ++ psymtabs. */ ++ ++static void ++do_clear_psymtabs (void *arg) ++{ ++ struct objfile *objfile = arg; ++ ++ objfile->psymtabs_addrmap = NULL; ++ objfile->psymtabs = NULL; ++ bcache_xfree (objfile->psymbol_cache); ++ objfile->psymbol_cache = bcache_xmalloc (); ++ xfree (objfile->global_psymbols.list); ++ memset (&objfile->global_psymbols, 0, sizeof (objfile->global_psymbols)); ++ xfree (objfile->static_psymbols.list); ++ memset (&objfile->static_psymbols, 0, sizeof (objfile->static_psymbols)); ++} ++ + /* Build the partial symbol table by doing a quick pass through the + .debug_info and .debug_abbrev sections. */ + +@@ -2277,7 +2300,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) + mmap() on architectures that support it. (FIXME) */ + bfd *abfd = objfile->obfd; + gdb_byte *info_ptr; +- struct cleanup *back_to; ++ struct cleanup *back_to, *clear_psymtabs; + + info_ptr = dwarf2_per_objfile->info.buffer; + +@@ -2291,6 +2314,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) + + objfile->psymtabs_addrmap = + addrmap_create_mutable (&objfile->objfile_obstack); ++ clear_psymtabs = make_cleanup (do_clear_psymtabs, objfile); + + /* Since the objects we're extracting from .debug_info vary in + length, only the individual functions to extract them (like +@@ -2320,6 +2344,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) + dwarf2_per_objfile->info.size); + } + ++ discard_cleanups (clear_psymtabs); + objfile->psymtabs_addrmap = addrmap_create_fixed (objfile->psymtabs_addrmap, + &objfile->objfile_obstack); + diff --git a/gdb-bz562975-std-terminate-double-free.patch b/gdb-bz562975-std-terminate-double-free.patch new file mode 100644 index 0000000..3aa89a1 --- /dev/null +++ b/gdb-bz562975-std-terminate-double-free.patch @@ -0,0 +1,159 @@ +http://sourceware.org/ml/gdb-patches/2010-02/msg00625.html +Subject: RFC: fix bug with std::terminate handler + +I would appreciate comments on this patch. + +This comes from an automatically-reported bug in the Red Hat bugzilla: + + https://bugzilla.redhat.com/show_bug.cgi?id=562975 + +call_function_by_hand installs a momentary breakpoint on std::terminate, +and then deletes it later. However, this can cause a double deletion of +the breakpoint. In the bug, the called function is dlopen, which causes +gdb to enter solib_add, which calls breakpoint_re_set, deleting the +momentary breakpoint. + +This fix works by creating the momentary breakpoint with an internal +breakpoint number, and then trying to delete the breakpoint by number. + +This bug does not always manifest in a crash. In fact, I couldn't make +it crash here, but I could observe the problem under valgrind. + +Built and regtested on x86-64 (compile farm). I also manually verified +it using valgrind. + +I think this patch is mildly ugly, due to the introduction of +set_momentary_breakpoint_at_pc_with_number. However, in the absence of +comments, I plan to check it in after a reasonable waiting period. + +Tom + +2010-02-25 Tom Tromey + + * infcall.c (do_delete_breakpoint_by_number): New function. + (call_function_by_hand): Refer to momentary breakpoint by number. + * breakpoint.h (set_momentary_breakpoint_at_pc_with_number): + Declare. + * breakpoint.c (set_momentary_breakpoint_at_pc_with_number): New + function. + +Index: gdb-7.0.1/gdb/breakpoint.c +=================================================================== +--- gdb-7.0.1.orig/gdb/breakpoint.c 2010-03-12 00:26:46.000000000 +0100 ++++ gdb-7.0.1/gdb/breakpoint.c 2010-03-12 00:26:54.000000000 +0100 +@@ -5647,6 +5647,20 @@ set_momentary_breakpoint_at_pc (struct g + + return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type); + } ++ ++/* Like set_momentary_breakpoint_at_pc, but ensure that the new ++ breakpoint has a number. */ ++ ++struct breakpoint * ++set_momentary_breakpoint_at_pc_with_number (struct gdbarch *gdbarch, ++ CORE_ADDR pc, ++ enum bptype type) ++{ ++ struct breakpoint *result = set_momentary_breakpoint_at_pc (gdbarch, pc, ++ type); ++ result->number = internal_breakpoint_number--; ++ return result; ++} + + + /* Tell the user we have just set a breakpoint B. */ +Index: gdb-7.0.1/gdb/breakpoint.h +=================================================================== +--- gdb-7.0.1.orig/gdb/breakpoint.h 2010-03-12 00:26:46.000000000 +0100 ++++ gdb-7.0.1/gdb/breakpoint.h 2010-03-12 00:26:54.000000000 +0100 +@@ -741,6 +741,9 @@ extern struct breakpoint *set_momentary_ + extern struct breakpoint *set_momentary_breakpoint_at_pc + (struct gdbarch *, CORE_ADDR pc, enum bptype type); + ++extern struct breakpoint *set_momentary_breakpoint_at_pc_with_number ++ (struct gdbarch *, CORE_ADDR pc, enum bptype type); ++ + extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt); + + extern void set_ignore_count (int, int, int); +Index: gdb-7.0.1/gdb/infcall.c +=================================================================== +--- gdb-7.0.1.orig/gdb/infcall.c 2010-03-12 00:26:46.000000000 +0100 ++++ gdb-7.0.1/gdb/infcall.c 2010-03-12 00:27:31.000000000 +0100 +@@ -410,6 +410,18 @@ run_inferior_call (struct thread_info *c + return e; + } + ++/* A cleanup function that deletes a breakpoint, if it still exists, ++ given the breakpoint's number. */ ++ ++static void ++do_delete_breakpoint_by_number (void *arg) ++{ ++ int *num = arg; ++ struct breakpoint *bp = get_breakpoint (*num); ++ if (bp) ++ delete_breakpoint (bp); ++} ++ + /* All this stuff with a dummy frame may seem unnecessarily complicated + (why not just save registers in GDB?). The purpose of pushing a dummy + frame which looks just like a real frame is so that if you call a +@@ -447,7 +459,8 @@ call_function_by_hand (struct value *fun + struct cleanup *args_cleanup; + struct frame_info *frame; + struct gdbarch *gdbarch; +- struct breakpoint *terminate_bp = NULL; ++ int terminate_bp_num = 0; ++ CORE_ADDR terminate_bp_addr = 0; + struct minimal_symbol *tm; + struct cleanup *terminate_bp_cleanup = NULL; + ptid_t call_thread_ptid; +@@ -764,8 +777,13 @@ call_function_by_hand (struct value *fun + struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()", + NULL, NULL); + if (tm != NULL) +- terminate_bp = set_momentary_breakpoint_at_pc ++ { ++ struct breakpoint *bp; ++ bp = set_momentary_breakpoint_at_pc_with_number + (gdbarch, SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint); ++ terminate_bp_num = bp->number; ++ terminate_bp_addr = bp->loc->address; ++ } + } + + /* Everything's ready, push all the info needed to restore the +@@ -779,8 +797,9 @@ call_function_by_hand (struct value *fun + discard_cleanups (inf_status_cleanup); + + /* Register a clean-up for unwind_on_terminating_exception_breakpoint. */ +- if (terminate_bp) +- terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp); ++ if (terminate_bp_num != 0) ++ terminate_bp_cleanup = make_cleanup (do_delete_breakpoint_by_number, ++ &terminate_bp_num); + + /* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - + If you're looking to implement asynchronous dummy-frames, then +@@ -946,9 +965,9 @@ When the function is done executing, GDB + in an inferior function call. Rewind, and warn the + user. */ + +- if (terminate_bp != NULL ++ if (terminate_bp_num != 0 + && (inferior_thread()->stop_bpstat->breakpoint_at->address +- == terminate_bp->loc->address)) ++ == terminate_bp_addr)) + { + /* We must get back to the frame we were before the + dummy call. */ +@@ -997,7 +1016,7 @@ When the function is done executing, GDB + + /* If we get here and the std::terminate() breakpoint has been set, + it has to be cleaned manually. */ +- if (terminate_bp) ++ if (terminate_bp_num != 0) + do_cleanups (terminate_bp_cleanup); + + /* If we get here the called FUNCTION ran to completion, diff --git a/gdb.spec b/gdb.spec index e2ca9f5..66f7986 100644 --- a/gdb.spec +++ b/gdb.spec @@ -36,7 +36,7 @@ Version: 7.0.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 33%{?_with_upstream:.upstream}%{dist} +Release: 34%{?_with_upstream:.upstream}%{dist} License: GPLv3+ Group: Development/Debuggers @@ -474,6 +474,18 @@ Patch424: gdb-bz562517-archer-reread-quick_addrmap.patch # Fix false warning: section .gnu.liblist not found in ... Patch425: gdb-false-warning-gnu.liblist.patch +# Fix parsing of gcc -feliminate-dwarf2-dups binaries (Tom Tromey, BZ 552619). +Patch426: gdb-bz552619-dwarf3-offset-size.patch + +# Fix crash on pretty printed object by MI (Tom Tromey, BZ 560034). +Patch427: gdb-bz560034-mi-prettyprint-crash.patch + +# [delayed-symfile] Fix crash on failed reading psymtab (Tom Tromey, BZ 561784). +Patch428: gdb-bz561784-lazy-psymtabs-clear.patch + +# Fix double-free on std::terminate handler (Tom Tromey, BZ 562975). +Patch429: gdb-bz562975-std-terminate-double-free.patch + BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} Requires: readline%{?_isa} BuildRequires: readline-devel%{?_isa} @@ -736,6 +748,10 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch423 -p1 %patch424 -p1 %patch425 -p1 +%patch426 -p1 +%patch427 -p1 +%patch428 -p1 +%patch429 -p1 # Always verify their applicability. %patch393 -p1 %patch335 -p1 @@ -1061,6 +1077,12 @@ fi %endif %changelog +* Fri Mar 12 2010 Jan Kratochvil - 7.0.1-34.fc12 +- Fix parsing of gcc -feliminate-dwarf2-dups binaries (Tom Tromey, BZ 552619). +- Fix crash on pretty printed object by MI (Tom Tromey, BZ 560034). +- [delayed-symfile] Fix crash on failed reading psymtab (Tom Tromey, BZ 561784). +- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975). + * Sun Feb 28 2010 Jan Kratochvil - 7.0.1-33.fc12 - [delayed-symfile] Backport fix of reread_symbols (Tom Tromey, BZ 562517). - Fix false warning: section .gnu.liblist not found in ...