]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-x86-onstack-2of2.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-x86-onstack-2of2.patch
CommitLineData
f412e1b4
PS
1http://sourceware.org/ml/gdb-patches/2012-03/msg00358.html
2Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
3
4Hi,
5
6here is the ON_STACK code again, with fixed alignment for i386 SSE.
7
8It is generalized for all OSes on i386/amd64. I can move it to
9{i386,amd64)-linux-tdep.c but I find this code much more lightweight than
10i386_push_dummy_call which is already present in i386-tdep.
11
12No regressions on
13{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
14gdbsever non-extended mode.
15
16For x86_64-fedora17-linux-gnu it fixes:
17-FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
18-FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame
19+PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
20+PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame
21
22
23Thanks,
24Jan
25
26
27gdb/
282012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com>
29
30 * amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove.
31 (amd64_dicos_init_abi): Remove its installment.
32 * dicos-tdep.c (dicos_init_abi): Remove the
33 set_gdbarch_call_dummy_location call. Update the comment here.
34 * i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove.
35 (i386_dicos_init_abi): Remove its installment.
36 * i386-tdep.c (i386_push_dummy_code): New function.
37 (i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install
38 i386_push_dummy_code.
39
40--- a/gdb/amd64-dicos-tdep.c
41+++ b/gdb/amd64-dicos-tdep.c
42@@ -23,24 +23,6 @@
43 #include "amd64-tdep.h"
44 #include "dicos-tdep.h"
45
46-static CORE_ADDR
47-amd64_dicos_push_dummy_code (struct gdbarch *gdbarch,
48- CORE_ADDR sp, CORE_ADDR funaddr,
49- struct value **args, int nargs,
50- struct type *value_type,
51- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
52- struct regcache *regcache)
53-{
54- int bplen;
55- CORE_ADDR bppc = sp;
56-
57- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
58- *bp_addr = sp - bplen;
59- *real_pc = funaddr;
60-
61- return *bp_addr;
62-}
63-
64 static void
65 amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
66 {
67@@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
68 amd64_init_abi (info, gdbarch);
69
70 dicos_init_abi (gdbarch);
71-
72- set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code);
73 }
74
75 static enum gdb_osabi
76--- a/gdb/dicos-tdep.c
77+++ b/gdb/dicos-tdep.c
78@@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch)
79
80 /* There's no (standard definition of) entry point or a guaranteed
81 text location with a symbol where to place the call dummy, so we
82- put it on the stack. */
83- set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
84+ need it on the stack. Rely on i386_gdbarch_init used also for
85+ amd64 to set up ON_STACK inferior calls. */
86
87 /* DICOS rewinds the PC itself. */
88 set_gdbarch_decr_pc_after_break (gdbarch, 0);
89--- a/gdb/i386-dicos-tdep.c
90+++ b/gdb/i386-dicos-tdep.c
91@@ -22,32 +22,12 @@
92 #include "gdb_string.h"
93 #include "dicos-tdep.h"
94
95-static CORE_ADDR
96-i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
97- CORE_ADDR sp, CORE_ADDR funaddr,
98- struct value **args, int nargs,
99- struct type *value_type,
100- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
101- struct regcache *regcache)
102-{
103- int bplen;
104- CORE_ADDR bppc = sp;
105-
106- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
107- *bp_addr = sp - bplen;
108- *real_pc = funaddr;
109-
110- return *bp_addr;
111-}
112-
113 static void
114 i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
115 {
116 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
117
118 dicos_init_abi (gdbarch);
119-
120- set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
121 }
122
123 static enum gdb_osabi
124--- a/gdb/i386-tdep.c
125+++ b/gdb/i386-tdep.c
126@@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type)
127 return 0;
128 }
129
130+/* Implementation for set_gdbarch_push_dummy_code. */
131+
132+static CORE_ADDR
133+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
134+ struct value **args, int nargs, struct type *value_type,
135+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
136+ struct regcache *regcache)
137+{
138+ int bplen;
139+ CORE_ADDR bppc = sp;
140+
141+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
142+ sp -= bplen;
143+
144+ /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call
145+ does not. ABI requires stack alignment for executables using SSE. */
146+ if (gdbarch_frame_align_p (gdbarch))
147+ sp = gdbarch_frame_align (gdbarch, sp);
148+
149+ *bp_addr = sp;
150+ *real_pc = funaddr;
151+ return sp;
152+}
153+
154 static CORE_ADDR
155 i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
156 struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
157@@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
158 set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
159
160 /* Call dummy code. */
161+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
162+ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
163 set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
164 set_gdbarch_frame_align (gdbarch, i386_frame_align);
165
166
This page took 0.114998 seconds and 4 git commands to generate.