diff --git a/gdb-6.3-pie-20050110.patch b/gdb-6.3-pie-20050110.patch index faad1f7..18fd7f7 100644 --- a/gdb-6.3-pie-20050110.patch +++ b/gdb-6.3-pie-20050110.patch @@ -26,10 +26,10 @@ Fix scan_dyntag() for binaries provided by valgrind (BZ 460319). -Index: gdb-6.8.91.20090917/gdb/amd64-tdep.c +Index: gdb-6.8.91.20090925/gdb/amd64-tdep.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/amd64-tdep.c 2009-09-17 12:48:49.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/amd64-tdep.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/amd64-tdep.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/amd64-tdep.c 2009-09-25 10:25:45.000000000 +0200 @@ -36,6 +36,7 @@ #include "regcache.h" #include "regset.h" @@ -138,10 +138,10 @@ Index: gdb-6.8.91.20090917/gdb/amd64-tdep.c return pc; } -Index: gdb-6.8.91.20090917/gdb/auxv.c +Index: gdb-6.8.91.20090925/gdb/auxv.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/auxv.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/auxv.c 2009-09-25 10:25:45.000000000 +0200 @@ -78,7 +78,7 @@ procfs_xfer_auxv (struct target_ops *ops Return 1 if an entry was read into *TYPEP and *VALP. */ static int @@ -230,10 +230,10 @@ Index: gdb-6.8.91.20090917/gdb/auxv.c break; } -Index: gdb-6.8.91.20090917/gdb/auxv.h +Index: gdb-6.8.91.20090925/gdb/auxv.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/auxv.h 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/auxv.h 2009-09-25 10:25:45.000000000 +0200 @@ -31,14 +31,14 @@ Return 1 if an entry was read into *TYPEP and *VALP. */ extern int target_auxv_parse (struct target_ops *ops, @@ -251,10 +251,10 @@ Index: gdb-6.8.91.20090917/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.8.91.20090917/gdb/dwarf2read.c +Index: gdb-6.8.91.20090925/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:49:20.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/dwarf2read.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/dwarf2read.c 2009-09-25 10:25:45.000000000 +0200 @@ -1717,7 +1717,7 @@ dwarf2_build_psymtabs (struct objfile *o dwarf2_read_section (objfile, &dwarf2_per_objfile->eh_frame); dwarf2_read_section (objfile, &dwarf2_per_objfile->frame); @@ -264,10 +264,10 @@ Index: gdb-6.8.91.20090917/gdb/dwarf2read.c || (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)) { -Index: gdb-6.8.91.20090917/gdb/elfread.c +Index: gdb-6.8.91.20090925/gdb/elfread.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/elfread.c 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/elfread.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/elfread.c 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/elfread.c 2009-09-25 10:25:45.000000000 +0200 @@ -681,7 +681,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 @@ -277,10 +277,10 @@ Index: gdb-6.8.91.20090917/gdb/elfread.c { init_psymbol_list (objfile, 0); mainline = 0; -Index: gdb-6.8.91.20090917/gdb/infrun.c +Index: gdb-6.8.91.20090925/gdb/infrun.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/infrun.c 2009-09-17 12:48:50.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/infrun.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/infrun.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/infrun.c 2009-09-25 10:25:45.000000000 +0200 @@ -3659,6 +3659,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( #endif target_terminal_inferior (); @@ -292,10 +292,10 @@ Index: gdb-6.8.91.20090917/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.8.91.20090917/gdb/objfiles.c +Index: gdb-6.8.91.20090925/gdb/objfiles.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/objfiles.c 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/objfiles.c 2009-09-17 12:50:20.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/objfiles.c 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/objfiles.c 2009-09-25 10:25:45.000000000 +0200 @@ -53,6 +53,9 @@ #include "observer.h" #include "complaints.h" @@ -324,10 +324,10 @@ Index: gdb-6.8.91.20090917/gdb/objfiles.c if (symfile_objfile == NULL) return 0; -Index: gdb-6.8.91.20090917/gdb/solib-svr4.c +Index: gdb-6.8.91.20090925/gdb/solib-svr4.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/solib-svr4.c 2009-09-17 12:48:50.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/solib-svr4.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 10:28:07.000000000 +0200 @@ -47,6 +47,7 @@ #include "exec.h" #include "auxv.h" @@ -704,11 +704,19 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c target_read_string (LM_NAME (new), &buffer, SO_NAME_MAX_PATH_SIZE - 1, &errcode); if (errcode != 0) -@@ -1101,47 +1336,60 @@ svr4_current_sos (void) +@@ -1101,63 +1336,76 @@ svr4_current_sos (void) safe_strerror (errcode)); else { - struct build_id *build_id; +- +- strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); +- new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- /* May get overwritten below. */ +- strcpy (new->so_name, new->so_original_name); +- +- build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new)); +- if (build_id != NULL) + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: LM_NAME is <%s>\n", @@ -718,25 +726,25 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c + if (strcmp (buffer, "") == 0) + free_so (new); + else -+ { + { +- char *name, *build_id_filename; + struct build_id *build_id; - -- strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); -- new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; -- /* May get overwritten below. */ -- strcpy (new->so_name, new->so_original_name); ++ + strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); + new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; + /* May get overwritten below. */ + strcpy (new->so_name, new->so_original_name); -- build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new)); -- if (build_id != NULL) -- { -- char *name, *build_id_filename; +- /* Missing the build-id matching separate debug info file +- would be handled while SO_NAME gets loaded. */ +- name = build_id_to_filename (build_id, &build_id_filename, 0); +- if (name != NULL) + build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new)); + if (build_id != NULL) -+ { + { +- strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); +- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- xfree (name); + char *name, *build_id_filename; + + /* Missing the build-id matching separate debug info file @@ -749,21 +757,46 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c + xfree (name); + } + else -+ debug_print_missing (new->so_name, build_id_filename); ++ { ++ debug_print_missing (new->so_name, build_id_filename); ++ ++ /* In the case the main executable was found according to ++ its build-id (from a core file) prevent loading ++ a different build of a library with accidentally the ++ same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there ++ instead) if the on-disk files no longer match the ++ running program version. */ ++ ++ if (symfile_objfile != NULL ++ && (symfile_objfile->flags ++ & OBJF_BUILD_ID_CORE_LOADED) != 0) ++ new->so_name[0] = 0; ++ } + + xfree (build_id_filename); + xfree (build_id); -+ } + } +- else +- { +- debug_print_missing (new->so_name, build_id_filename); -- /* Missing the build-id matching separate debug info file -- would be handled while SO_NAME gets loaded. */ -- name = build_id_to_filename (build_id, &build_id_filename, 0); -- if (name != NULL) +- /* In the case the main executable was found according to +- its build-id (from a core file) prevent loading +- a different build of a library with accidentally the +- same SO_NAME. +- +- It suppresses bogus backtraces (and prints "??" there +- instead) if the on-disk files no longer match the +- running program version. */ +- +- if (symfile_objfile != NULL +- && (symfile_objfile->flags +- & OBJF_BUILD_ID_CORE_LOADED) != 0) +- new->so_name[0] = 0; + if (debug_solib) - { -- strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); -- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; -- xfree (name); ++ { + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: Processing DSO: %s\n", + new->so_name); @@ -771,8 +804,6 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c + "svr4_current_sos: first link entry %d\n", + IGNORE_FIRST_LINK_MAP_ENTRY (new)); } -- else -- debug_print_missing (new->so_name, build_id_filename); - xfree (build_id_filename); - xfree (build_id); @@ -798,7 +829,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c } /* On Solaris, the dynamic linker is not in the normal list of -@@ -1157,6 +1405,9 @@ svr4_current_sos (void) +@@ -1173,6 +1421,9 @@ svr4_current_sos (void) if (head == NULL) return svr4_default_sos (); @@ -808,7 +839,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c return head; } -@@ -1189,7 +1440,7 @@ svr4_fetch_objfile_link_map (struct objf +@@ -1205,7 +1456,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. */ @@ -817,7 +848,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c static int match_main (char *soname) { -@@ -1203,6 +1454,7 @@ match_main (char *soname) +@@ -1219,6 +1470,7 @@ match_main (char *soname) return (0); } @@ -825,7 +856,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c /* Return 1 if PC lies in the dynamic symbol resolution code of the SVR4 run time loader. */ -@@ -1354,15 +1606,29 @@ enable_break (struct svr4_info *info) +@@ -1370,15 +1622,29 @@ enable_break (struct svr4_info *info) /* Find the program interpreter; if not found, warn the user and drop into the old breakpoint at symbol code. */ interp_name = find_program_interpreter (); @@ -855,7 +886,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c sym_addr = 0; -@@ -1379,6 +1645,9 @@ enable_break (struct svr4_info *info) +@@ -1395,6 +1661,9 @@ enable_break (struct svr4_info *info) { tmp_bfd = solib_bfd_open (interp_name); } @@ -865,7 +896,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c if (tmp_bfd == NULL) goto bkpt_at_symbol; -@@ -1436,16 +1705,16 @@ enable_break (struct svr4_info *info) +@@ -1452,16 +1721,16 @@ enable_break (struct svr4_info *info) interp_sect = bfd_get_section_by_name (tmp_bfd, ".text"); if (interp_sect) { @@ -886,7 +917,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c interp_plt_sect_high = interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect); } -@@ -1480,7 +1749,7 @@ enable_break (struct svr4_info *info) +@@ -1496,7 +1765,7 @@ enable_break (struct svr4_info *info) if (sym_addr != 0) { @@ -895,7 +926,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c xfree (interp_name); return 1; } -@@ -1753,6 +2022,9 @@ svr4_solib_create_inferior_hook (void) +@@ -1769,6 +2038,9 @@ svr4_solib_create_inferior_hook (void) while (tp->stop_signal != TARGET_SIGNAL_TRAP); inf->stop_soon = NO_STOP_QUIETLY; #endif /* defined(_SCO_DS) */ @@ -905,7 +936,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c } static void -@@ -1929,6 +2201,76 @@ svr4_lp64_fetch_link_map_offsets (void) +@@ -1945,6 +2217,76 @@ svr4_lp64_fetch_link_map_offsets (void) return lmp; } @@ -982,7 +1013,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c struct target_so_ops svr4_so_ops; -@@ -1969,4 +2311,7 @@ _initialize_svr4_solib (void) +@@ -1985,4 +2327,7 @@ _initialize_svr4_solib (void) svr4_so_ops.same = svr4_same; observer_attach_inferior_exit (solib_svr4_inferior_exit); @@ -990,10 +1021,10 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c + add_info ("linkmap", info_linkmap_command, + "Display the inferior's linkmap."); } -Index: gdb-6.8.91.20090917/gdb/solib.c +Index: gdb-6.8.91.20090925/gdb/solib.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/solib.c 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/solib.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/solib.c 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/solib.c 2009-09-25 10:25:45.000000000 +0200 @@ -82,6 +82,8 @@ set_solib_ops (struct gdbarch *gdbarch, /* external data declarations */ @@ -1130,10 +1161,10 @@ Index: gdb-6.8.91.20090917/gdb/solib.c + NULL, NULL, + &setdebuglist, &showdebuglist); } -Index: gdb-6.8.91.20090917/gdb/solist.h +Index: gdb-6.8.91.20090925/gdb/solist.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/solist.h 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/solist.h 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/solist.h 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/solist.h 2009-09-25 10:25:45.000000000 +0200 @@ -61,6 +61,8 @@ struct so_list bfd *abfd; char symbols_loaded; /* flag: symbols read in yet? */ @@ -1154,10 +1185,10 @@ Index: gdb-6.8.91.20090917/gdb/solist.h +extern int debug_solib; + #endif -Index: gdb-6.8.91.20090917/gdb/symfile-mem.c +Index: gdb-6.8.91.20090925/gdb/symfile-mem.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/symfile-mem.c 2009-09-17 12:48:49.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/symfile-mem.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/symfile-mem.c 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/symfile-mem.c 2009-09-25 10:25:45.000000000 +0200 @@ -115,7 +115,7 @@ symbol_file_add_from_memory (struct bfd ++i; } @@ -1167,10 +1198,10 @@ Index: gdb-6.8.91.20090917/gdb/symfile-mem.c sai, OBJF_SHARED); /* This might change our ideas about frames already looked at. */ -Index: gdb-6.8.91.20090917/gdb/symfile.c +Index: gdb-6.8.91.20090925/gdb/symfile.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/symfile.c 2009-09-17 12:48:50.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/symfile.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 10:25:45.000000000 +0200 @@ -49,6 +49,7 @@ #include "readline/readline.h" #include "gdb_assert.h" @@ -1250,7 +1281,7 @@ Index: gdb-6.8.91.20090917/gdb/symfile.c free_all_objfiles (); -@@ -3369,6 +3378,8 @@ reread_symbols (void) +@@ -3367,6 +3376,8 @@ reread_symbols (void) /* Discard cleanups as symbol reading was successful. */ discard_cleanups (old_cleanups); @@ -1259,10 +1290,10 @@ Index: gdb-6.8.91.20090917/gdb/symfile.c /* If the mtime has changed between the time we set new_modtime and now, we *want* this to be out of date, so don't call stat again now. */ -Index: gdb-6.8.91.20090917/gdb/target.h +Index: gdb-6.8.91.20090925/gdb/target.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/target.h 2009-09-17 12:48:49.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/target.h 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/target.h 2009-09-25 10:25:38.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/target.h 2009-09-25 10:25:45.000000000 +0200 @@ -545,7 +545,7 @@ struct target_ops Return -1 if there is insufficient buffer for a whole entry. Return 1 if an entry was read into *TYPEP and *VALP. */ @@ -1272,10 +1303,10 @@ Index: gdb-6.8.91.20090917/gdb/target.h /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the sequence of bytes in PATTERN with length PATTERN_LEN. -Index: gdb-6.8.91.20090917/gdb/symfile.h +Index: gdb-6.8.91.20090925/gdb/symfile.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/symfile.h 2009-09-17 12:48:50.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/symfile.h 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 10:25:45.000000000 +0200 @@ -229,7 +229,13 @@ enum symfile_add_flags SYMFILE_MAINLINE = 1 << 2, @@ -1291,10 +1322,10 @@ Index: gdb-6.8.91.20090917/gdb/symfile.h }; extern void syms_from_objfile (struct objfile *, -Index: gdb-6.8.91.20090917/gdb/infcmd.c +Index: gdb-6.8.91.20090925/gdb/infcmd.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/infcmd.c 2009-09-25 10:25:39.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/infcmd.c 2009-09-25 10:25:45.000000000 +0200 @@ -2308,6 +2308,9 @@ attach_command_post_wait (char *args, in post_create_inferior (¤t_target, from_tty); @@ -1305,10 +1336,10 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c /* Install inferior's terminal modes. */ target_terminal_inferior (); -Index: gdb-6.8.91.20090917/gdb/linux-tdep.c +Index: gdb-6.8.91.20090925/gdb/linux-tdep.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/linux-tdep.c 2009-08-04 22:41:13.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/linux-tdep.c 2009-09-17 12:50:07.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/linux-tdep.c 2009-08-04 22:41:13.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/linux-tdep.c 2009-09-25 10:25:45.000000000 +0200 @@ -163,5 +163,7 @@ in this session.\n")); void _initialize_linux_tdep (void) diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 996465d..edc52bd 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,7 +1,7 @@ -Index: gdb-6.8.50.20090909/gdb/corelow.c +Index: gdb-6.8.91.20090925/gdb/corelow.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/corelow.c 2009-09-09 19:09:35.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/corelow.c 2009-09-25 09:39:09.000000000 +0200 @@ -45,6 +45,10 @@ #include "exceptions.h" #include "solib.h" @@ -13,7 +13,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c #ifndef O_LARGEFILE -@@ -273,6 +277,50 @@ add_to_thread_list (bfd *abfd, asection +@@ -273,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current */ } @@ -28,7 +28,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c + char *build_id_filename; + struct cleanup *back_to; + -+ if (exec_bfd != NULL) ++ if (exec_bfd != NULL || symfile_objfile != NULL) + return; + + if (target_auxv_search (¤t_target, AT_ENTRY, &at_entry) <= 0) @@ -52,6 +52,8 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c + make_cleanup (xfree, exec_filename); + exec_file_attach (exec_filename, from_tty); + symbol_file_add_main (exec_filename, from_tty); ++ if (symfile_objfile != NULL) ++ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; + } + else + debug_print_missing (_("the main executable file"), build_id_filename); @@ -64,7 +66,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c /* This routine opens and sets up the core file bfd. */ static void -@@ -371,6 +419,12 @@ core_open (char *filename, int from_tty) +@@ -371,6 +421,12 @@ core_open (char *filename, int from_tty) push_target (&core_ops); discard_cleanups (old_chain); @@ -77,7 +79,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c add_inferior_silent (corelow_pid); /* Do this before acknowledging the inferior, so if -@@ -878,4 +932,11 @@ _initialize_corelow (void) +@@ -878,4 +934,11 @@ _initialize_corelow (void) init_core_ops (); add_target (&core_ops); @@ -89,11 +91,11 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-6.8.50.20090909/gdb/doc/gdb.texinfo +Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/doc/gdb.texinfo 2009-09-09 19:09:31.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/doc/gdb.texinfo 2009-09-09 19:09:35.000000000 +0200 -@@ -13764,6 +13764,27 @@ information files. +--- gdb-6.8.91.20090925.orig/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200 +@@ -13895,6 +13895,27 @@ information files. @end table @@ -121,11 +123,11 @@ Index: gdb-6.8.50.20090909/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named -Index: gdb-6.8.50.20090909/gdb/solib-svr4.c +Index: gdb-6.8.91.20090925/gdb/solib-svr4.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/solib-svr4.c 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/solib-svr4.c 2009-09-09 19:09:35.000000000 +0200 -@@ -1101,9 +1101,33 @@ svr4_current_sos (void) +--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 09:29:57.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 09:43:14.000000000 +0200 +@@ -1101,9 +1101,49 @@ svr4_current_sos (void) safe_strerror (errcode)); else { @@ -154,7 +156,23 @@ Index: gdb-6.8.50.20090909/gdb/solib-svr4.c + xfree (name); + } + else -+ debug_print_missing (new->so_name, build_id_filename); ++ { ++ debug_print_missing (new->so_name, build_id_filename); ++ ++ /* In the case the main executable was found according to ++ its build-id (from a core file) prevent loading ++ a different build of a library with accidentally the ++ same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there ++ instead) if the on-disk files no longer match the ++ running program version. */ ++ ++ if (symfile_objfile != NULL ++ && (symfile_objfile->flags ++ & OBJF_BUILD_ID_CORE_LOADED) != 0) ++ new->so_name[0] = 0; ++ } + + xfree (build_id_filename); + xfree (build_id); @@ -162,10 +180,10 @@ Index: gdb-6.8.50.20090909/gdb/solib-svr4.c } xfree (buffer); -Index: gdb-6.8.50.20090909/gdb/symfile.c +Index: gdb-6.8.91.20090925/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 19:09:31.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 19:09:55.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 09:29:57.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 09:29:58.000000000 +0200 @@ -56,6 +56,7 @@ #include "elf-bfd.h" #include "solib.h" @@ -174,7 +192,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c #include #include -@@ -1174,16 +1175,65 @@ symbol_file_clear (int from_tty) +@@ -1173,16 +1174,65 @@ symbol_file_clear (int from_tty) printf_unfiltered (_("No symbol file now.\n")); } @@ -242,7 +260,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c { struct build_id *retval; -@@ -1199,6 +1249,348 @@ build_id_bfd_get (bfd *abfd) +@@ -1198,6 +1248,348 @@ build_id_bfd_get (bfd *abfd) return retval; } @@ -591,7 +609,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -@@ -1216,7 +1608,7 @@ build_id_verify (const char *filename, s +@@ -1215,7 +1607,7 @@ build_id_verify (const char *filename, s if (abfd == NULL) return 0; @@ -600,7 +618,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), filename); -@@ -1235,8 +1627,9 @@ build_id_verify (const char *filename, s +@@ -1234,8 +1626,9 @@ build_id_verify (const char *filename, s return retval; } @@ -612,7 +630,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c { char *link, *s, *retval = NULL; gdb_byte *data = build_id->data; -@@ -1244,7 +1637,9 @@ build_id_to_debug_filename (struct build +@@ -1243,7 +1636,9 @@ build_id_to_debug_filename (struct build /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 @@ -623,7 +641,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c s = link + sprintf (link, "%s/.build-id/", debug_file_directory); if (size > 0) { -@@ -1255,12 +1650,14 @@ build_id_to_debug_filename (struct build +@@ -1254,12 +1649,14 @@ build_id_to_debug_filename (struct build *s++ = '/'; while (size-- > 0) s += sprintf (s, "%02x", (unsigned) *data++); @@ -640,7 +658,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c if (retval != NULL && !build_id_verify (retval, build_id)) { -@@ -1268,9 +1665,150 @@ build_id_to_debug_filename (struct build +@@ -1267,9 +1664,150 @@ build_id_to_debug_filename (struct build retval = NULL; } @@ -791,7 +809,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c static char * get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) { -@@ -1353,32 +1891,36 @@ static char * +@@ -1352,32 +1890,36 @@ static char * find_separate_debug_file (struct objfile *objfile) { asection *sect; @@ -836,7 +854,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c } basename = get_debug_link_info (objfile, &crc32); -@@ -1386,7 +1928,7 @@ find_separate_debug_file (struct objfile +@@ -1385,7 +1927,7 @@ find_separate_debug_file (struct objfile if (basename == NULL) /* There's no separate debug info, hence there's no way we could load it => no warning. */ @@ -845,7 +863,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c dir = xstrdup (objfile->name); -@@ -1408,24 +1950,19 @@ find_separate_debug_file (struct objfile +@@ -1407,24 +1949,19 @@ find_separate_debug_file (struct objfile if (canon_name && strlen (canon_name) > i) i = strlen (canon_name); @@ -877,7 +895,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c /* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */ strcpy (debugfile, dir); -@@ -1434,12 +1971,7 @@ find_separate_debug_file (struct objfile +@@ -1433,12 +1970,7 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -891,7 +909,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c /* Then try in the global debugfile directory. */ strcpy (debugfile, debug_file_directory); -@@ -1448,12 +1980,7 @@ find_separate_debug_file (struct objfile +@@ -1447,12 +1979,7 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -905,7 +923,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c /* If the file is in the sysroot, try using its base path in the global debugfile directory. */ -@@ -1467,20 +1994,18 @@ find_separate_debug_file (struct objfile +@@ -1466,20 +1993,18 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -933,7 +951,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c } -@@ -4231,4 +4756,16 @@ the global debug-file directory prepende +@@ -4229,4 +4754,16 @@ the global debug-file directory prepende NULL, show_debug_file_directory, &setlist, &showlist); @@ -950,10 +968,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c + + observer_attach_executable_changed (debug_print_executable_changed); } -Index: gdb-6.8.50.20090909/gdb/symfile.h +Index: gdb-6.8.91.20090925/gdb/symfile.h =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 19:09:35.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 09:29:57.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 09:29:58.000000000 +0200 @@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); void free_symfile_segment_data (struct symfile_segment_data *data); @@ -968,10 +986,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.h /* From dwarf2read.c */ extern int dwarf2_has_info (struct objfile *); -Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp +Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 19:09:35.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:57.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:58.000000000 +0200 @@ -1248,6 +1248,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -989,10 +1007,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp return 0; } -Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp +Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:09:35.000000000 +0200 +--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp 2009-09-25 09:29:58.000000000 +0200 @@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } { } } @@ -1010,3 +1028,18 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp detect_async +Index: gdb-6.8.91.20090925/gdb/objfiles.h +=================================================================== +--- gdb-6.8.91.20090925.orig/gdb/objfiles.h 2009-09-25 09:29:57.000000000 +0200 ++++ gdb-6.8.91.20090925/gdb/objfiles.h 2009-09-25 09:38:27.000000000 +0200 +@@ -428,6 +428,10 @@ struct objfile + + #define OBJF_MAIN (1 << 7) + ++/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ ++ ++#define OBJF_BUILD_ID_CORE_LOADED (1 << 12) ++ + /* The object file that the main symbol table was loaded from (e.g. the + argument to the "symbol-file" or "file" command). */ + diff --git a/gdb.spec b/gdb.spec index a80900c..70b7c37 100644 --- a/gdb.spec +++ b/gdb.spec @@ -14,7 +14,7 @@ Version: 6.8.91.20090925 # 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: 1%{?_with_upstream:.upstream}%{?dist} +Release: 2%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ Group: Development/Debuggers @@ -847,6 +847,9 @@ fi %endif %changelog +* Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-2 +- Fix buildid-loading libs w/matching name but different build-id (BZ 524572). + * Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-1 - Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090925 - archer-jankratochvil-fedora12 commit: 4338ea85c798007c32594032f602db9fd230eba9