[gdb/f18] [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696).

Jan Kratochvil jankratochvil at fedoraproject.org
Wed Sep 26 17:55:05 UTC 2012


commit fb02fc394054612cb232163b0a5f0cd968b7459c
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Wed Sep 26 19:54:59 2012 +0200

    [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696).
    
    - Rebase to FSF GDB 7.5.0.20120926 (7.5 stable branch).
      - Remove the .spec Source keyword URL as not valid now.

 .gitignore                         |    2 +-
 gdb-6.6-buildid-locate.patch       |    2 +-
 gdb-attach-fail-reasons-5of5.patch |   46 +++++-----
 gdb-step-symless.patch             |  160 ++++++++++++++++++++++++++++++++++++
 gdb.spec                           |   17 +++-
 sources                            |    2 +-
 6 files changed, 199 insertions(+), 30 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 66e0ded..beb0963 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
 /gdb-libstdc++-v3-python-r155978.tar.bz2
-/gdb-7.5.tar.bz2
+/gdb-7.5.0.20120926.tar.bz2
diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch
index ada3310..d6f5735 100644
--- a/gdb-6.6-buildid-locate.patch
+++ b/gdb-6.6-buildid-locate.patch
@@ -88,7 +88,7 @@ Index: gdb-7.4.91.20120801/gdb/corelow.c
 +  add_setshow_boolean_cmd ("build-id-core-loads", class_files,
 +			   &build_id_core_loads, _("\
 +Set whether CORE-FILE loads the build-id associated files automatically."), _("\
-+Show whether CORE-FILE loads the build-id associated files automatically.."),
++Show whether CORE-FILE loads the build-id associated files automatically."),
 +			   NULL, NULL, NULL,
 +			   &setlist, &showlist);
  }
diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch
index a7400c7..71711f0 100644
--- a/gdb-attach-fail-reasons-5of5.patch
+++ b/gdb-attach-fail-reasons-5of5.patch
@@ -37,10 +37,10 @@ gdb/gdbserver/
 	(linux_create_inferior, linux_tracefork_child): Call it instead of
 	direct ptrace.
 
-Index: gdb-7.4.50.20120714/gdb/common/linux-ptrace.c
+Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.c
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/common/linux-ptrace.c	2012-07-07 14:13:56.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/common/linux-ptrace.c	2012-07-14 23:30:02.918167283 +0200
+--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.c	2012-09-17 20:28:14.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.c	2012-09-26 19:13:53.508780239 +0200
 @@ -28,6 +28,10 @@
  #include "buffer.h"
  #include "gdb_assert.h"
@@ -60,8 +60,8 @@ Index: gdb-7.4.50.20120714/gdb/common/linux-ptrace.c
 +  linux_ptrace_create_warnings (buffer);
  }
  
- #ifdef __i386__
-@@ -171,3 +177,19 @@ linux_ptrace_init_warnings (void)
+ #if defined __i386__ || defined __x86_64__
+@@ -242,3 +248,19 @@ linux_ptrace_init_warnings (void)
  
    linux_ptrace_test_ret_to_nx ();
  }
@@ -81,10 +81,10 @@ Index: gdb-7.4.50.20120714/gdb/common/linux-ptrace.c
 +			 "(gdb) shell sudo setsebool deny_ptrace=0"));
 +#endif /* HAVE_LIBSELINUX */
 +}
-Index: gdb-7.4.50.20120714/gdb/common/linux-ptrace.h
+Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.h
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/common/linux-ptrace.h	2012-07-07 14:13:56.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/common/linux-ptrace.h	2012-07-14 23:29:20.927399812 +0200
+--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.h	2012-07-07 14:13:56.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.h	2012-09-26 19:13:28.358765406 +0200
 @@ -69,5 +69,6 @@ struct buffer;
  
  extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
@@ -92,10 +92,10 @@ Index: gdb-7.4.50.20120714/gdb/common/linux-ptrace.h
 +extern void linux_ptrace_create_warnings (struct buffer *buffer);
  
  #endif /* COMMON_LINUX_PTRACE_H */
-Index: gdb-7.4.50.20120714/gdb/configure.ac
+Index: gdb-7.5.0.20120926/gdb/configure.ac
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/configure.ac	2012-07-14 23:28:57.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/configure.ac	2012-07-14 23:29:09.492462934 +0200
+--- gdb-7.5.0.20120926.orig/gdb/configure.ac	2012-09-26 19:13:24.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/configure.ac	2012-09-26 19:13:28.410765451 +0200
 @@ -2008,6 +2008,10 @@ then
  	      [Define if you support the personality syscall.])
  fi
@@ -107,10 +107,10 @@ Index: gdb-7.4.50.20120714/gdb/configure.ac
  dnl Handle optional features that can be enabled.
  
  # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
-Index: gdb-7.4.50.20120714/gdb/gdbserver/configure.ac
+Index: gdb-7.5.0.20120926/gdb/gdbserver/configure.ac
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/gdbserver/configure.ac	2012-04-19 21:34:51.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/gdbserver/configure.ac	2012-07-14 23:29:09.492462934 +0200
+--- gdb-7.5.0.20120926.orig/gdb/gdbserver/configure.ac	2012-04-19 21:34:51.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbserver/configure.ac	2012-09-26 19:13:28.446765428 +0200
 @@ -438,6 +438,10 @@ if $want_ipa ; then
     fi
  fi
@@ -122,10 +122,10 @@ Index: gdb-7.4.50.20120714/gdb/gdbserver/configure.ac
  AC_SUBST(GDBSERVER_DEPFILES)
  AC_SUBST(GDBSERVER_LIBS)
  AC_SUBST(USE_THREAD_DB)
-Index: gdb-7.4.50.20120714/gdb/gdbserver/linux-low.c
+Index: gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/gdbserver/linux-low.c	2012-07-07 14:13:57.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/gdbserver/linux-low.c	2012-07-14 23:29:09.496462912 +0200
+--- gdb-7.5.0.20120926.orig/gdb/gdbserver/linux-low.c	2012-07-07 14:13:57.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c	2012-09-26 19:13:28.453765471 +0200
 @@ -601,6 +601,28 @@ add_lwp (ptid_t ptid)
    return lwp;
  }
@@ -173,10 +173,10 @@ Index: gdb-7.4.50.20120714/gdb/gdbserver/linux-low.c
    kill (getpid (), SIGSTOP);
  
  #if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
-Index: gdb-7.4.50.20120714/gdb/inf-ptrace.c
+Index: gdb-7.5.0.20120926/gdb/inf-ptrace.c
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/inf-ptrace.c	2012-05-24 18:51:34.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/inf-ptrace.c	2012-07-14 23:29:09.496462912 +0200
+--- gdb-7.5.0.20120926.orig/gdb/inf-ptrace.c	2012-05-24 18:51:34.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/inf-ptrace.c	2012-09-26 19:13:28.458765461 +0200
 @@ -105,7 +105,15 @@ static void
  inf_ptrace_me (void)
  {
@@ -193,10 +193,10 @@ Index: gdb-7.4.50.20120714/gdb/inf-ptrace.c
  }
  
  /* Start a new inferior Unix child process.  EXEC_FILE is the file to
-Index: gdb-7.4.50.20120714/gdb/linux-nat.c
+Index: gdb-7.5.0.20120926/gdb/linux-nat.c
 ===================================================================
---- gdb-7.4.50.20120714.orig/gdb/linux-nat.c	2012-07-14 23:21:32.000000000 +0200
-+++ gdb-7.4.50.20120714/gdb/linux-nat.c	2012-07-14 23:29:09.497462907 +0200
+--- gdb-7.5.0.20120926.orig/gdb/linux-nat.c	2012-09-26 19:13:22.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/linux-nat.c	2012-09-26 19:13:28.468765469 +0200
 @@ -1574,6 +1574,7 @@ linux_nat_create_inferior (struct target
  #ifdef HAVE_PERSONALITY
    int personality_orig = 0, personality_set = 0;
diff --git a/gdb-step-symless.patch b/gdb-step-symless.patch
new file mode 100644
index 0000000..5bca453
--- /dev/null
+++ b/gdb-step-symless.patch
@@ -0,0 +1,160 @@
+http://sourceware.org/ml/gdb-patches/2012-09/msg00598.html
+Subject: [patch+7.5] Fix ppc32 7.5 stepping crash regression
+
+Hello,
+
+since
+	[PATCH] PowerPC 32 with Secure PLT
+	http://sourceware.org/ml/gdb-patches/2012-01/msg00655.html
+	http://sourceware.org/ml/gdb-patches/2012-01/msg00656.html
+	commit 4d19ed66762845cdcce95f8b1daaceb97cf90c71
+	Author: eager <eager>
+	Date:   Mon Jan 30 17:09:37 2012 +0000
+	    Support stepping through PPC PLT with securePLT.
+
+(gdb) step
+Single stepping until exit from function main,
+which has no line number information.
+
+Program received signal SIGSEGV, Segmentation fault.
+0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
+651	  if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
+(gdb) p sym
+$1 = (struct minimal_symbol *) 0x0
+(gdb) bt
+#0  0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
+#1  0x00000000103fdf44 in in_solib_dynsym_resolve_code (pc=268436636) at solib.c:1185
+#2  0x000000001025d848 in handle_inferior_event (ecs=0xfffffbbdcf0) at infrun.c:4737
+[...]
+
+I will check it in.
+
+Not regression tested.
+
+
+Regards,
+Jan
+
+
+gdb/
+2012-09-26  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Fix crash during stepping on ppc32.
+	* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Test NULL
+	SYM.
+
+gdb/testsuite/
+2012-09-26  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Fix crash during stepping on ppc32.
+	* gdb.base/step-symless.c: New file.
+	* gdb.base/step-symless.exp: New file.
+
+diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
+index c7b70db..ccded83 100644
+--- a/gdb/ppc-linux-tdep.c
++++ b/gdb/ppc-linux-tdep.c
+@@ -648,8 +648,9 @@ powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
+ 
+   /* Check if we are in the resolver.  */
+   sym = lookup_minimal_symbol_by_pc (pc);
+-  if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
+-      || (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
++  if (sym != NULL
++      && (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0
++	  || strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
+     return 1;
+ 
+   return 0;
+diff --git a/gdb/testsuite/gdb.base/step-symless.c b/gdb/testsuite/gdb.base/step-symless.c
+new file mode 100644
+index 0000000..97eaf5e
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-symless.c
+@@ -0,0 +1,38 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++static volatile int v;
++
++static void
++symful (void)
++{
++  v++;
++}
++
++static void
++symless (void)
++{
++  v++;
++}
++
++int
++main (void)
++{
++  symless ();
++  symful ();
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp
+new file mode 100644
+index 0000000..d79edb2
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-symless.exp
+@@ -0,0 +1,41 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++standard_testfile
++if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} {
++    return -1
++}
++
++# We need those symbols global to access them from the .S file.
++set test "strip stub symbols"
++set objcopy_program [transform objcopy]
++set result [catch "exec $objcopy_program -N symless ${binfile}" output]
++verbose "result is $result"
++verbose "output is $output"
++if {$result != 0} {
++    fail $test
++    return
++}
++pass $test
++
++clean_restart $testfile
++
++if ![runto_main] {
++    return -1
++}
++
++gdb_breakpoint symful
++
++gdb_test "step" "Single stepping until exit.*no line number information.*\r\nBreakpoint \[^\r\n\]* in \\.?symful \\(\\)"
+
diff --git a/gdb.spec b/gdb.spec
index 3ed128a..8ad31ab 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -27,20 +27,20 @@
 Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
 Name: %{?scl_prefix}gdb
 
-%global snap       20120817
+%global snap       20120926
 # See timestamp of source gnulib installed into gdb/gnulib/ .
 %global snapgnulib 20120623
-Version: 7.5
+Version: 7.5.0.%{snap}
 
 # 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: 20%{?dist}
+Release: 21%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
 # Do not provide URL for snapshots as the file lasts there only for 2 days.
 # ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
-Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
+Source: gdb-%{version}.tar.bz2
 Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL: http://gnu.org/software/gdb/
 
@@ -565,6 +565,9 @@ Patch703: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
 #=fedora
 Patch716: gdb-minidebuginfo.patch
 
+# [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696).
+Patch725: gdb-step-symless.patch
+
 %if 0%{!?rhel:1} || 0%{?rhel} > 6
 # RL_STATE_FEDORA_GDB would not be found for:
 # Patch642: gdb-readline62-ask-more-rh.patch
@@ -873,6 +876,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c
 %patch698 -p1
 %patch703 -p1
 %patch716 -p1
+%patch725 -p1
 
 %patch393 -p1
 %if 0%{!?el5:1} || 0%{?scl:1}
@@ -1369,6 +1373,11 @@ fi
 %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
 
 %changelog
+* Wed Sep 26 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.5-21.fc18
+- [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696).
+- Rebase to FSF GDB 7.5.0.20120926 (7.5 stable branch).
+  - Remove the .spec Source keyword URL as not valid now.
+
 * Fri Sep 14 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.5-20.fc18
 - [RHEL-6] Disable no longer valid workaround of man pages .gz suffix.
 
diff --git a/sources b/sources
index 45b960d..f5cf524 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
 4981307aa9619bbec5b73261e4e41c8d  gdb-libstdc++-v3-python-r155978.tar.bz2
-24a6779a9fe0260667710de1b082ef61  gdb-7.5.tar.bz2
+813b1d4f93e0eb56ff81d147de2286fb  gdb-7.5.0.20120926.tar.bz2


More information about the scm-commits mailing list