]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-step-symless.patch
- typo
[packages/gdb.git] / gdb-step-symless.patch
1 http://sourceware.org/ml/gdb-patches/2012-09/msg00598.html
2 Subject: [patch+7.5] Fix ppc32 7.5 stepping crash regression
3
4 Hello,
5
6 since
7         [PATCH] PowerPC 32 with Secure PLT
8         http://sourceware.org/ml/gdb-patches/2012-01/msg00655.html
9         http://sourceware.org/ml/gdb-patches/2012-01/msg00656.html
10         commit 4d19ed66762845cdcce95f8b1daaceb97cf90c71
11         Author: eager <eager>
12         Date:   Mon Jan 30 17:09:37 2012 +0000
13             Support stepping through PPC PLT with securePLT.
14
15 (gdb) step
16 Single stepping until exit from function main,
17 which has no line number information.
18
19 Program received signal SIGSEGV, Segmentation fault.
20 0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
21 651       if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
22 (gdb) p sym
23 $1 = (struct minimal_symbol *) 0x0
24 (gdb) bt
25 #0  0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
26 #1  0x00000000103fdf44 in in_solib_dynsym_resolve_code (pc=268436636) at solib.c:1185
27 #2  0x000000001025d848 in handle_inferior_event (ecs=0xfffffbbdcf0) at infrun.c:4737
28 [...]
29
30 I will check it in.
31
32 Not regression tested.
33
34
35 Regards,
36 Jan
37
38
39 gdb/
40 2012-09-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
41
42         Fix crash during stepping on ppc32.
43         * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Test NULL
44         SYM.
45
46 gdb/testsuite/
47 2012-09-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
48
49         Fix crash during stepping on ppc32.
50         * gdb.base/step-symless.c: New file.
51         * gdb.base/step-symless.exp: New file.
52
53 diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
54 index c7b70db..ccded83 100644
55 --- a/gdb/ppc-linux-tdep.c
56 +++ b/gdb/ppc-linux-tdep.c
57 @@ -648,8 +648,9 @@ powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
58  
59    /* Check if we are in the resolver.  */
60    sym = lookup_minimal_symbol_by_pc (pc);
61 -  if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
62 -      || (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
63 +  if (sym != NULL
64 +      && (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0
65 +         || strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
66      return 1;
67  
68    return 0;
69 diff --git a/gdb/testsuite/gdb.base/step-symless.c b/gdb/testsuite/gdb.base/step-symless.c
70 new file mode 100644
71 index 0000000..97eaf5e
72 --- /dev/null
73 +++ b/gdb/testsuite/gdb.base/step-symless.c
74 @@ -0,0 +1,38 @@
75 +/* This testcase is part of GDB, the GNU debugger.
76 +
77 +   Copyright 2012 Free Software Foundation, Inc.
78 +
79 +   This program is free software; you can redistribute it and/or modify
80 +   it under the terms of the GNU General Public License as published by
81 +   the Free Software Foundation; either version 3 of the License, or
82 +   (at your option) any later version.
83 +
84 +   This program is distributed in the hope that it will be useful,
85 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
86 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
87 +   GNU General Public License for more details.
88 +
89 +   You should have received a copy of the GNU General Public License
90 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
91 +
92 +static volatile int v;
93 +
94 +static void
95 +symful (void)
96 +{
97 +  v++;
98 +}
99 +
100 +static void
101 +symless (void)
102 +{
103 +  v++;
104 +}
105 +
106 +int
107 +main (void)
108 +{
109 +  symless ();
110 +  symful ();
111 +  return 0;
112 +}
113 diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp
114 new file mode 100644
115 index 0000000..d79edb2
116 --- /dev/null
117 +++ b/gdb/testsuite/gdb.base/step-symless.exp
118 @@ -0,0 +1,41 @@
119 +# Copyright (C) 2012 Free Software Foundation, Inc.
120 +
121 +# This program is free software; you can redistribute it and/or modify
122 +# it under the terms of the GNU General Public License as published by
123 +# the Free Software Foundation; either version 3 of the License, or
124 +# (at your option) any later version.
125 +#
126 +# This program is distributed in the hope that it will be useful,
127 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
128 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
129 +# GNU General Public License for more details.
130 +#
131 +# You should have received a copy of the GNU General Public License
132 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
133 +
134 +standard_testfile
135 +if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} {
136 +    return -1
137 +}
138 +
139 +# We need those symbols global to access them from the .S file.
140 +set test "strip stub symbols"
141 +set objcopy_program [transform objcopy]
142 +set result [catch "exec $objcopy_program -N symless ${binfile}" output]
143 +verbose "result is $result"
144 +verbose "output is $output"
145 +if {$result != 0} {
146 +    fail $test
147 +    return
148 +}
149 +pass $test
150 +
151 +clean_restart $testfile
152 +
153 +if ![runto_main] {
154 +    return -1
155 +}
156 +
157 +gdb_breakpoint symful
158 +
159 +gdb_test "step" "Single stepping until exit.*no line number information.*\r\nBreakpoint \[^\r\n\]* in \\.?symful \\(\\)"
160
This page took 0.509153 seconds and 3 git commands to generate.