From 92dc0e18679b2f36d9d97a676d258457eb56498a Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 16 Nov 2007 02:15:40 +0000 Subject: [PATCH] - Fix `errno' resolving across separate debuginfo files. - Fix segfault on no file loaded, `set debug solib 1', `info sharedlibrary'. - Extend the testsuite run for all the languages if %{dist} is defined. - Support gdb.fortran/ tests by substituting the g77 compiler by gfortran. --- gdb-6.3-pie-20050110.patch | 24 ++++++++++--------- ...337-resolve-tls-without-debuginfo-v2.patch | 10 ++++++-- gdb.spec | 22 ++++++++++++++++- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/gdb-6.3-pie-20050110.patch b/gdb-6.3-pie-20050110.patch index 3bb085f..1386770 100644 --- a/gdb-6.3-pie-20050110.patch +++ b/gdb-6.3-pie-20050110.patch @@ -6,6 +6,10 @@ Port to post-GDB-6.7.1 multi-PC breakpoints. +2007-11-09 Jan Kratochvil + + * solib-svr4.c (svr4_current_sos): Fix segfault on NULL EXEC_BFD. + Index: gdb-6.7.1/gdb/dwarf2read.c =================================================================== --- gdb-6.7.1.orig/gdb/dwarf2read.c 2007-11-02 15:24:10.000000000 +0100 @@ -375,16 +379,16 @@ Index: gdb-6.7.1/gdb/solib-svr4.c @@ -704,6 +803,11 @@ svr4_current_sos (void) struct so_list **link_ptr = &head; CORE_ADDR ldsomap = 0; ++ const char *filename = exec_bfd ? exec_bfd->filename : ""; + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, -+ "svr4_current_sos: exec_bfd %s\n", -+ exec_bfd->filename); ++ "svr4_current_sos: exec_bfd %s\n", filename); + /* Make sure we've looked up the inferior's dynamic linker's base structure. */ if (! debug_base) -@@ -713,11 +817,21 @@ svr4_current_sos (void) +@@ -713,11 +817,20 @@ 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) @@ -393,7 +397,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, + "svr4_current_sos: no DT_DEBUG found in %s -- return now\n", -+ exec_bfd->filename); ++ filename); + return svr4_default_sos (); + } } @@ -402,8 +406,7 @@ Index: gdb-6.7.1/gdb/solib-svr4.c `struct so_list' nodes. */ + if (debug_solib) + fprintf_unfiltered (gdb_stdlog, -+ "svr4_current_sos: walk link map in %s\n", -+ exec_bfd->filename); ++ "svr4_current_sos: walk link map in %s\n", filename); lm = solib_svr4_r_map (); while (lm) @@ -428,8 +431,9 @@ Index: gdb-6.7.1/gdb/solib-svr4.c SVR4, it has no name. For others (Solaris 2.3 for example), it does have a name, so we can no longer use a missing name to decide when to ignore it. */ - if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0) +- if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0) - free_so (new); ++ if (exec_bfd != NULL && IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0) + { + /* It is the first link map entry, i.e. it is the main executable. */ + @@ -564,14 +568,12 @@ Index: gdb-6.7.1/gdb/solib-svr4.c } /* On Solaris, the dynamic linker is not in the normal list of -@@ -789,6 +995,11 @@ svr4_current_sos (void) +@@ -789,6 +995,9 @@ svr4_current_sos (void) if (head == NULL) return svr4_default_sos (); + if (debug_solib) -+ fprintf_unfiltered (gdb_stdlog, -+ "svr4_current_sos: ENDS %s\n", -+ exec_bfd->filename); ++ fprintf_unfiltered (gdb_stdlog, "svr4_current_sos: ENDS %s\n", filename); + return head; } diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 7523f5f..d713087 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -160,7 +160,7 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/target.c gdb-6.7.1-patc /* Using the objfile specified in BATON, find the address for the current thread's thread-local storage with offset OFFSET. */ CORE_ADDR -@@ -906,7 +925,22 @@ target_translate_tls_address (struct obj +@@ -904,7 +923,28 @@ target_translate_tls_address (struct obj /* It wouldn't be wrong here to try a gdbarch method, too; finding TLS is an ABI-specific thing. But we don't do that yet. */ else @@ -171,7 +171,13 @@ diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/target.c gdb-6.7.1-patc + msymbol = lookup_minimal_symbol ("errno", NULL, NULL); + if (msymbol != NULL + && SYMBOL_VALUE_ADDRESS (msymbol) == offset -+ && SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd) ++ && (SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd ++ || (objfile->separate_debug_objfile != NULL ++ && SYMBOL_BFD_SECTION (msymbol)->owner ++ == objfile->separate_debug_objfile->obfd) ++ || (objfile->separate_debug_objfile_backlink != NULL ++ && SYMBOL_BFD_SECTION (msymbol)->owner ++ == objfile->separate_debug_objfile_backlink->obfd))) + { + if (!catch_errors (resolve_errno, (void *) &addr, "", + RETURN_MASK_ALL)) diff --git a/gdb.spec b/gdb.spec index 825572f..04ff35a 100644 --- a/gdb.spec +++ b/gdb.spec @@ -11,7 +11,7 @@ Name: gdb Version: 6.7.1 # The release always contains a leading reserved number, start it at 1. -Release: 3%{?dist} +Release: 4%{?dist} License: GPL Group: Development/Debuggers @@ -331,11 +331,21 @@ BuildRequires: flex bison sharutils expat-devel Requires: readline BuildRequires: readline-devel +# BuildRequires only for the complete testsuite run. +# Omit them on local user builds. +%if 0%{?dist:1} +# gcc-objc++ is not covered by the GDB testsuite. +BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc +# Copied from gcc-4.1.2-32 +%ifarch %{ix86} x86_64 ia64 ppc alpha +BuildRequires: gcc-gnat +%endif %define multilib_64_archs sparc64 ppc64 s390x x86_64 %ifarch %{multilib_64_archs} sparc ppc # Ensure glibc{,-devel} is installed for both multilib arches BuildRequires: /lib/libc.so.6 %{_exec_prefix}/lib/libc.so /lib64/libc.so.6 %{_exec_prefix}/lib64/libc.so %endif +%endif %ifarch ia64 BuildRequires: libunwind-devel >= 0.99-0.1.frysk20070405cvs @@ -486,6 +496,10 @@ rm -fr %{gdb_build} mkdir %{gdb_build} cd %{gdb_build} +# g77 executable is no longer present in Fedora gcc-4.x+. +g77="`which gfortran 2>/dev/null`" +test -n "$g77" && ln -s "$g77" ./g77 + # FIXME: The configure option --enable-gdb-build-warnings=,-Werror # below can conflict with user settings. For instance, passing a # combination of -Wall and -O0 from the file rpmrc will always cause @@ -615,6 +629,12 @@ fi # don't include the files in include, they are part of binutils %changelog +* Fri Nov 16 2007 Jan Kratochvil - 6.7.1-4 +- Fix `errno' resolving across separate debuginfo files. +- Fix segfault on no file loaded, `set debug solib 1', `info sharedlibrary'. +- Extend the testsuite run for all the languages if %%{dist} is defined. +- Support gdb.fortran/ tests by substituting the g77 compiler by gfortran. + * Sun Nov 4 2007 Jan Kratochvil - 6.7.1-3 - Fix `errno' resolving on recent glibc with broken DW_AT_MIPS_linkage_name. - Imported new test for 6.7 PPC hiding of call-volatile parameter register.