]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-entryval-inlined.patch
- typo
[packages/gdb.git] / gdb-entryval-inlined.patch
1 http://sourceware.org/ml/gdb-patches/2012-10/msg00095.html
2 Subject: [patch] entry values: Fix resolving in inlined frames
3
4 Hi,
5
6 Breakpoint 1, fn2 (y=<optimized out>, x=6) at gdb.arch/amd64-entry-value-inline.c:32
7 32            y = -2 + x;       /* break-here */
8 (gdb) info addr y
9 (gdb) bt
10 #0  fn2 (y=<optimized out>, x=6) at gdb.arch/amd64-entry-value-inline.c:32
11 #1  fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42
12 #2  0x00000000004004af in main () at gdb.arch/amd64-entry-value-inline.c:48
13 (gdb) info frame
14 Stack level 0, frame at 0x7fffffffdb68:
15  rip = 0x4005bc in fn2 (gdb.arch/amd64-entry-value-inline.c:32); saved rip 0x4004af
16  inlined into frame 1
17 [...]
18 (gdb) set debug entry-values 1
19 (gdb) p y
20 DW_OP_GNU_entry_value resolving expects callee fn1 at 0x4005a0 but the called frame is for fn3 at 0x4005b0
21
22 FAIL:
23 -----
24 $1 = <optimized out>
25 PASS:
26 -----
27 $1 = 25
28
29 (gdb) p/x $pc
30 $2 = 0x4005bc
31 (gdb) up
32 #1  fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42
33 (gdb) p/x $pc
34 $3 = 0x4005bc
35
36 The problem is that DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value binding
37 exists between DW_TAG_subprogram, nor DW_TAG_inlined_subroutine as described
38 by Jakub Jelinek.  This makes sense, when we look at DW_TAG_GNU_call_site and
39 we just unwind the current inlined frame we get the same PC - this is no new
40 information.
41
42 TAILCALL_FRAME is a different case, while also an artificial frame the
43 sequence cannot be determined at compile time and the binding
44 DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value exists also for
45 TAILCALL_FRAMEs.
46
47 I will check it in.
48
49 No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.
50
51
52 Thanks,
53 Jan
54
55
56 gdb/
57 2012-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
58
59         Fix entry values resolving in inlined frames.
60         * dwarf2loc.c (dwarf_expr_reg_to_entry_parameter): Move func_addr,
61         gdbarch and caller_frame initialization later.  Skip INLINE_FRAME
62         entries of FRAME.
63
64 gdb/testsuite/
65 2012-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
66
67         Fix entry values resolving in inlined frames.
68         * gdb.arch/amd64-entry-value-inline.S: New file.
69         * gdb.arch/amd64-entry-value-inline.c: New file.
70         * gdb.arch/amd64-entry-value-inline.exp: New file.
71
72 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
73 index e8d39fe..0bdc042 100644
74 --- a/gdb/dwarf2loc.c
75 +++ b/gdb/dwarf2loc.c
76 @@ -980,16 +980,27 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
77                                    union call_site_parameter_u kind_u,
78                                    struct dwarf2_per_cu_data **per_cu_return)
79  {
80 -  CORE_ADDR func_addr = get_frame_func (frame);
81 -  CORE_ADDR caller_pc;
82 -  struct gdbarch *gdbarch = get_frame_arch (frame);
83 -  struct frame_info *caller_frame = get_prev_frame (frame);
84 +  CORE_ADDR func_addr, caller_pc;
85 +  struct gdbarch *gdbarch;
86 +  struct frame_info *caller_frame;
87    struct call_site *call_site;
88    int iparams;
89    /* Initialize it just to avoid a GCC false warning.  */
90    struct call_site_parameter *parameter = NULL;
91    CORE_ADDR target_addr;
92  
93 +  /* Skip any inlined frames, entry value call sites work between real
94 +     functions.  They do not make sense between inline functions as even PC
95 +     does not change there.  */
96 +  while (get_frame_type (frame) == INLINE_FRAME)
97 +    {
98 +      frame = get_prev_frame (frame);
99 +      gdb_assert (frame != NULL);
100 +    }
101 +
102 +  func_addr = get_frame_func (frame);
103 +  gdbarch = get_frame_arch (frame);
104 +  caller_frame = get_prev_frame (frame);
105    if (gdbarch != frame_unwind_arch (frame))
106      {
107        struct minimal_symbol *msym = lookup_minimal_symbol_by_pc (func_addr);
108 diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
109 new file mode 100644
110 index 0000000..5f353f5
111 --- /dev/null
112 +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
113 @@ -0,0 +1,672 @@
114 +/* This testcase is part of GDB, the GNU debugger.
115 +
116 +   Copyright 2012 Free Software Foundation, Inc.
117 +
118 +   This program is free software; you can redistribute it and/or modify
119 +   it under the terms of the GNU General Public License as published by
120 +   the Free Software Foundation; either version 3 of the License, or
121 +   (at your option) any later version.
122 +
123 +   This program is distributed in the hope that it will be useful,
124 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
125 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
126 +   GNU General Public License for more details.
127 +
128 +   You should have received a copy of the GNU General Public License
129 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
130 +
131 +/* This file is compiled from gdb.arch/amd64-entry-value-inline.c
132 +   using -g -dA -S -O2.  */
133 +
134 +       .file   "amd64-entry-value-inline.c"
135 +       .text
136 +.Ltext0:
137 +       .p2align 4,,15
138 +       .type   fn1, @function
139 +fn1:
140 +.LFB0:
141 +       .file 1 "gdb.arch/amd64-entry-value-inline.c"
142 +       # gdb.arch/amd64-entry-value-inline.c:22
143 +       .loc 1 22 0
144 +       .cfi_startproc
145 +.LVL0:
146 +# BLOCK 2 freq:10000 seq:0
147 +# PRED: ENTRY [100.0%]  (FALLTHRU)
148 +       # gdb.arch/amd64-entry-value-inline.c:23
149 +       .loc 1 23 0
150 +       movl    v(%rip), %eax
151 +       addl    $1, %eax
152 +       movl    %eax, v(%rip)
153 +# SUCC: EXIT [100.0%] 
154 +       ret
155 +       .cfi_endproc
156 +.LFE0:
157 +       .size   fn1, .-fn1
158 +       .p2align 4,,15
159 +       .globl  fn3
160 +       .type   fn3, @function
161 +fn3:
162 +.LFB2:
163 +       # gdb.arch/amd64-entry-value-inline.c:41
164 +       .loc 1 41 0
165 +       .cfi_startproc
166 +.LVL1:
167 +# BLOCK 2 freq:10000 seq:0
168 +# PRED: ENTRY [100.0%]  (FALLTHRU)
169 +.LBB4:
170 +.LBB5:
171 +       # gdb.arch/amd64-entry-value-inline.c:29
172 +       .loc 1 29 0
173 +       testl   %esi, %esi
174 +.LBE5:
175 +.LBE4:
176 +       # gdb.arch/amd64-entry-value-inline.c:41
177 +       .loc 1 41 0
178 +       pushq   %rbx
179 +       .cfi_def_cfa_offset 16
180 +       .cfi_offset 3, -16
181 +       # gdb.arch/amd64-entry-value-inline.c:41
182 +       .loc 1 41 0
183 +       movl    %edi, %ebx
184 +.LBB7:
185 +.LBB6:
186 +# SUCC: 3 [39.0%]  (FALLTHRU,CAN_FALLTHRU) 4 [61.0%]  (CAN_FALLTHRU)
187 +       # gdb.arch/amd64-entry-value-inline.c:29
188 +       .loc 1 29 0
189 +       je      .L3
190 +# BLOCK 3 freq:3898 seq:1
191 +# PRED: 2 [39.0%]  (FALLTHRU,CAN_FALLTHRU)
192 +       # gdb.arch/amd64-entry-value-inline.c:31
193 +       .loc 1 31 0
194 +       call    fn1
195 +.LVL2:
196 +       # gdb.arch/amd64-entry-value-inline.c:32
197 +       .loc 1 32 0
198 +       leal    -2(%rbx), %eax
199 +.LVL3:
200 +       # gdb.arch/amd64-entry-value-inline.c:33
201 +       .loc 1 33 0
202 +       movl    %eax, %edi
203 +       imull   %eax, %edi
204 +       addl    $1, %edi
205 +.LVL4:
206 +       imull   %edi, %eax
207 +.LVL5:
208 +       # gdb.arch/amd64-entry-value-inline.c:34
209 +       .loc 1 34 0
210 +       leal    (%rbx,%rax), %edi
211 +       call    fn1
212 +.LVL6:
213 +# SUCC: 4 [100.0%]  (FALLTHRU,CAN_FALLTHRU)
214 +# BLOCK 4 freq:10000 seq:2
215 +# PRED: 2 [61.0%]  (CAN_FALLTHRU) 3 [100.0%]  (FALLTHRU,CAN_FALLTHRU)
216 +.L3:
217 +.LBE6:
218 +.LBE7:
219 +       # gdb.arch/amd64-entry-value-inline.c:43
220 +       .loc 1 43 0
221 +       movl    %ebx, %eax
222 +       popq    %rbx
223 +       .cfi_def_cfa_offset 8
224 +.LVL7:
225 +# SUCC: EXIT [100.0%] 
226 +       ret
227 +       .cfi_endproc
228 +.LFE2:
229 +       .size   fn3, .-fn3
230 +       .section        .text.startup,"ax",@progbits
231 +       .p2align 4,,15
232 +       .globl  main
233 +       .type   main, @function
234 +main:
235 +.LFB3:
236 +       # gdb.arch/amd64-entry-value-inline.c:47
237 +       .loc 1 47 0
238 +       .cfi_startproc
239 +# BLOCK 2 freq:10000 seq:0
240 +# PRED: ENTRY [100.0%]  (FALLTHRU)
241 +       # gdb.arch/amd64-entry-value-inline.c:48
242 +       .loc 1 48 0
243 +       movl    $25, %esi
244 +       movl    $6, %edi
245 +       call    fn3
246 +.LVL8:
247 +       # gdb.arch/amd64-entry-value-inline.c:50
248 +       .loc 1 50 0
249 +       xorl    %eax, %eax
250 +# SUCC: EXIT [100.0%] 
251 +       ret
252 +       .cfi_endproc
253 +.LFE3:
254 +       .size   main, .-main
255 +       .local  v
256 +       .comm   v,4,4
257 +       .text
258 +.Letext0:
259 +       .section        .debug_info,"",@progbits
260 +.Ldebug_info0:
261 +       .long   0x164   # Length of Compilation Unit Info
262 +       .value  0x4     # DWARF version number
263 +       .long   .Ldebug_abbrev0 # Offset Into Abbrev. Section
264 +       .byte   0x8     # Pointer Size (in bytes)
265 +       .uleb128 0x1    # (DIE (0xb) DW_TAG_compile_unit)
266 +       .long   .LASF0  # DW_AT_producer: "GNU C 4.8.0 20121005 (experimental) -mtune=generic -march=x86-64 -g -O2"
267 +       .byte   0x1     # DW_AT_language
268 +       .long   .LASF1  # DW_AT_name: "gdb.arch/amd64-entry-value-inline.c"
269 +       .long   .LASF2  # DW_AT_comp_dir: ""
270 +       .long   .Ldebug_ranges0+0x30    # DW_AT_ranges
271 +       .quad   0       # DW_AT_low_pc
272 +       .long   .Ldebug_line0   # DW_AT_stmt_list
273 +       .uleb128 0x2    # (DIE (0x29) DW_TAG_subprogram)
274 +       .ascii "fn1\0"  # DW_AT_name
275 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
276 +       .byte   0x15    # DW_AT_decl_line
277 +                       # DW_AT_prototyped
278 +       .quad   .LFB0   # DW_AT_low_pc
279 +       .quad   .LFE0-.LFB0     # DW_AT_high_pc
280 +       .uleb128 0x1    # DW_AT_frame_base
281 +       .byte   0x9c    # DW_OP_call_frame_cfa
282 +                       # DW_AT_GNU_all_call_sites
283 +       .long   0x52    # DW_AT_sibling
284 +       .uleb128 0x3    # (DIE (0x46) DW_TAG_formal_parameter)
285 +       .ascii "x\0"    # DW_AT_name
286 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
287 +       .byte   0x15    # DW_AT_decl_line
288 +       .long   0x52    # DW_AT_type
289 +       .uleb128 0x1    # DW_AT_location
290 +       .byte   0x55    # DW_OP_reg5
291 +       .byte   0       # end of children of DIE 0x29
292 +       .uleb128 0x4    # (DIE (0x52) DW_TAG_base_type)
293 +       .byte   0x4     # DW_AT_byte_size
294 +       .byte   0x5     # DW_AT_encoding
295 +       .ascii "int\0"  # DW_AT_name
296 +       .uleb128 0x5    # (DIE (0x59) DW_TAG_subprogram)
297 +       .ascii "fn2\0"  # DW_AT_name
298 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
299 +       .byte   0x1b    # DW_AT_decl_line
300 +                       # DW_AT_prototyped
301 +       .long   0x52    # DW_AT_type
302 +       .byte   0x1     # DW_AT_inline
303 +       .long   0x7c    # DW_AT_sibling
304 +       .uleb128 0x6    # (DIE (0x69) DW_TAG_formal_parameter)
305 +       .ascii "x\0"    # DW_AT_name
306 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
307 +       .byte   0x1b    # DW_AT_decl_line
308 +       .long   0x52    # DW_AT_type
309 +       .uleb128 0x6    # (DIE (0x72) DW_TAG_formal_parameter)
310 +       .ascii "y\0"    # DW_AT_name
311 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
312 +       .byte   0x1b    # DW_AT_decl_line
313 +       .long   0x52    # DW_AT_type
314 +       .byte   0       # end of children of DIE 0x59
315 +       .uleb128 0x7    # (DIE (0x7c) DW_TAG_subprogram)
316 +                       # DW_AT_external
317 +       .ascii "fn3\0"  # DW_AT_name
318 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
319 +       .byte   0x28    # DW_AT_decl_line
320 +                       # DW_AT_prototyped
321 +       .long   0x52    # DW_AT_type
322 +       .quad   .LFB2   # DW_AT_low_pc
323 +       .quad   .LFE2-.LFB2     # DW_AT_high_pc
324 +       .uleb128 0x1    # DW_AT_frame_base
325 +       .byte   0x9c    # DW_OP_call_frame_cfa
326 +                       # DW_AT_GNU_all_call_sites
327 +       .long   0x115   # DW_AT_sibling
328 +       .uleb128 0x8    # (DIE (0x9d) DW_TAG_formal_parameter)
329 +       .ascii "x\0"    # DW_AT_name
330 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
331 +       .byte   0x28    # DW_AT_decl_line
332 +       .long   0x52    # DW_AT_type
333 +       .long   .LLST0  # DW_AT_location
334 +       .uleb128 0x8    # (DIE (0xaa) DW_TAG_formal_parameter)
335 +       .ascii "y\0"    # DW_AT_name
336 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
337 +       .byte   0x28    # DW_AT_decl_line
338 +       .long   0x52    # DW_AT_type
339 +       .long   .LLST1  # DW_AT_location
340 +       .uleb128 0x9    # (DIE (0xb7) DW_TAG_inlined_subroutine)
341 +       .long   0x59    # DW_AT_abstract_origin
342 +       .quad   .LBB4   # DW_AT_entry_pc
343 +       .long   .Ldebug_ranges0+0       # DW_AT_ranges
344 +       .byte   0x1     # DW_AT_call_file (gdb.arch/amd64-entry-value-inline.c)
345 +       .byte   0x2a    # DW_AT_call_line
346 +       .uleb128 0xa    # (DIE (0xca) DW_TAG_formal_parameter)
347 +       .long   0x72    # DW_AT_abstract_origin
348 +       .long   .LLST2  # DW_AT_location
349 +       .uleb128 0xa    # (DIE (0xd3) DW_TAG_formal_parameter)
350 +       .long   0x69    # DW_AT_abstract_origin
351 +       .long   .LLST0  # DW_AT_location
352 +       .uleb128 0xb    # (DIE (0xdc) DW_TAG_GNU_call_site)
353 +       .quad   .LVL2   # DW_AT_low_pc
354 +       .long   0x29    # DW_AT_abstract_origin
355 +       .long   0xf4    # DW_AT_sibling
356 +       .uleb128 0xc    # (DIE (0xed) DW_TAG_GNU_call_site_parameter)
357 +       .uleb128 0x1    # DW_AT_location
358 +       .byte   0x55    # DW_OP_reg5
359 +       .uleb128 0x2    # DW_AT_GNU_call_site_value
360 +       .byte   0x73    # DW_OP_breg3
361 +       .sleb128 0
362 +       .byte   0       # end of children of DIE 0xdc
363 +       .uleb128 0xd    # (DIE (0xf4) DW_TAG_GNU_call_site)
364 +       .quad   .LVL6   # DW_AT_low_pc
365 +       .long   0x29    # DW_AT_abstract_origin
366 +       .uleb128 0xc    # (DIE (0x101) DW_TAG_GNU_call_site_parameter)
367 +       .uleb128 0x1    # DW_AT_location
368 +       .byte   0x55    # DW_OP_reg5
369 +       .uleb128 0xd    # DW_AT_GNU_call_site_value
370 +       .byte   0x73    # DW_OP_breg3
371 +       .sleb128 -2
372 +       .byte   0x73    # DW_OP_breg3
373 +       .sleb128 -2
374 +       .byte   0x73    # DW_OP_breg3
375 +       .sleb128 -2
376 +       .byte   0x1e    # DW_OP_mul
377 +       .byte   0x23    # DW_OP_plus_uconst
378 +       .uleb128 0x1
379 +       .byte   0x1e    # DW_OP_mul
380 +       .byte   0x73    # DW_OP_breg3
381 +       .sleb128 0
382 +       .byte   0x22    # DW_OP_plus
383 +       .byte   0       # end of children of DIE 0xf4
384 +       .byte   0       # end of children of DIE 0xb7
385 +       .byte   0       # end of children of DIE 0x7c
386 +       .uleb128 0xe    # (DIE (0x115) DW_TAG_subprogram)
387 +                       # DW_AT_external
388 +       .long   .LASF3  # DW_AT_name: "main"
389 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
390 +       .byte   0x2e    # DW_AT_decl_line
391 +       .long   0x52    # DW_AT_type
392 +       .quad   .LFB3   # DW_AT_low_pc
393 +       .quad   .LFE3-.LFB3     # DW_AT_high_pc
394 +       .uleb128 0x1    # DW_AT_frame_base
395 +       .byte   0x9c    # DW_OP_call_frame_cfa
396 +                       # DW_AT_GNU_all_call_sites
397 +       .long   0x14f   # DW_AT_sibling
398 +       .uleb128 0xd    # (DIE (0x136) DW_TAG_GNU_call_site)
399 +       .quad   .LVL8   # DW_AT_low_pc
400 +       .long   0x7c    # DW_AT_abstract_origin
401 +       .uleb128 0xc    # (DIE (0x143) DW_TAG_GNU_call_site_parameter)
402 +       .uleb128 0x1    # DW_AT_location
403 +       .byte   0x55    # DW_OP_reg5
404 +       .uleb128 0x1    # DW_AT_GNU_call_site_value
405 +       .byte   0x36    # DW_OP_lit6
406 +       .uleb128 0xc    # (DIE (0x148) DW_TAG_GNU_call_site_parameter)
407 +       .uleb128 0x1    # DW_AT_location
408 +       .byte   0x54    # DW_OP_reg4
409 +       .uleb128 0x1    # DW_AT_GNU_call_site_value
410 +       .byte   0x49    # DW_OP_lit25
411 +       .byte   0       # end of children of DIE 0x136
412 +       .byte   0       # end of children of DIE 0x115
413 +       .uleb128 0xf    # (DIE (0x14f) DW_TAG_variable)
414 +       .ascii "v\0"    # DW_AT_name
415 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
416 +       .byte   0x12    # DW_AT_decl_line
417 +       .long   0x162   # DW_AT_type
418 +       .uleb128 0x9    # DW_AT_location
419 +       .byte   0x3     # DW_OP_addr
420 +       .quad   v
421 +       .uleb128 0x10   # (DIE (0x162) DW_TAG_volatile_type)
422 +       .long   0x52    # DW_AT_type
423 +       .byte   0       # end of children of DIE 0xb
424 +       .section        .debug_abbrev,"",@progbits
425 +.Ldebug_abbrev0:
426 +       .uleb128 0x1    # (abbrev code)
427 +       .uleb128 0x11   # (TAG: DW_TAG_compile_unit)
428 +       .byte   0x1     # DW_children_yes
429 +       .uleb128 0x25   # (DW_AT_producer)
430 +       .uleb128 0xe    # (DW_FORM_strp)
431 +       .uleb128 0x13   # (DW_AT_language)
432 +       .uleb128 0xb    # (DW_FORM_data1)
433 +       .uleb128 0x3    # (DW_AT_name)
434 +       .uleb128 0xe    # (DW_FORM_strp)
435 +       .uleb128 0x1b   # (DW_AT_comp_dir)
436 +       .uleb128 0xe    # (DW_FORM_strp)
437 +       .uleb128 0x55   # (DW_AT_ranges)
438 +       .uleb128 0x17   # (DW_FORM_sec_offset)
439 +       .uleb128 0x11   # (DW_AT_low_pc)
440 +       .uleb128 0x1    # (DW_FORM_addr)
441 +       .uleb128 0x10   # (DW_AT_stmt_list)
442 +       .uleb128 0x17   # (DW_FORM_sec_offset)
443 +       .byte   0
444 +       .byte   0
445 +       .uleb128 0x2    # (abbrev code)
446 +       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
447 +       .byte   0x1     # DW_children_yes
448 +       .uleb128 0x3    # (DW_AT_name)
449 +       .uleb128 0x8    # (DW_FORM_string)
450 +       .uleb128 0x3a   # (DW_AT_decl_file)
451 +       .uleb128 0xb    # (DW_FORM_data1)
452 +       .uleb128 0x3b   # (DW_AT_decl_line)
453 +       .uleb128 0xb    # (DW_FORM_data1)
454 +       .uleb128 0x27   # (DW_AT_prototyped)
455 +       .uleb128 0x19   # (DW_FORM_flag_present)
456 +       .uleb128 0x11   # (DW_AT_low_pc)
457 +       .uleb128 0x1    # (DW_FORM_addr)
458 +       .uleb128 0x12   # (DW_AT_high_pc)
459 +       .uleb128 0x7    # (DW_FORM_data8)
460 +       .uleb128 0x40   # (DW_AT_frame_base)
461 +       .uleb128 0x18   # (DW_FORM_exprloc)
462 +       .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
463 +       .uleb128 0x19   # (DW_FORM_flag_present)
464 +       .uleb128 0x1    # (DW_AT_sibling)
465 +       .uleb128 0x13   # (DW_FORM_ref4)
466 +       .byte   0
467 +       .byte   0
468 +       .uleb128 0x3    # (abbrev code)
469 +       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
470 +       .byte   0       # DW_children_no
471 +       .uleb128 0x3    # (DW_AT_name)
472 +       .uleb128 0x8    # (DW_FORM_string)
473 +       .uleb128 0x3a   # (DW_AT_decl_file)
474 +       .uleb128 0xb    # (DW_FORM_data1)
475 +       .uleb128 0x3b   # (DW_AT_decl_line)
476 +       .uleb128 0xb    # (DW_FORM_data1)
477 +       .uleb128 0x49   # (DW_AT_type)
478 +       .uleb128 0x13   # (DW_FORM_ref4)
479 +       .uleb128 0x2    # (DW_AT_location)
480 +       .uleb128 0x18   # (DW_FORM_exprloc)
481 +       .byte   0
482 +       .byte   0
483 +       .uleb128 0x4    # (abbrev code)
484 +       .uleb128 0x24   # (TAG: DW_TAG_base_type)
485 +       .byte   0       # DW_children_no
486 +       .uleb128 0xb    # (DW_AT_byte_size)
487 +       .uleb128 0xb    # (DW_FORM_data1)
488 +       .uleb128 0x3e   # (DW_AT_encoding)
489 +       .uleb128 0xb    # (DW_FORM_data1)
490 +       .uleb128 0x3    # (DW_AT_name)
491 +       .uleb128 0x8    # (DW_FORM_string)
492 +       .byte   0
493 +       .byte   0
494 +       .uleb128 0x5    # (abbrev code)
495 +       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
496 +       .byte   0x1     # DW_children_yes
497 +       .uleb128 0x3    # (DW_AT_name)
498 +       .uleb128 0x8    # (DW_FORM_string)
499 +       .uleb128 0x3a   # (DW_AT_decl_file)
500 +       .uleb128 0xb    # (DW_FORM_data1)
501 +       .uleb128 0x3b   # (DW_AT_decl_line)
502 +       .uleb128 0xb    # (DW_FORM_data1)
503 +       .uleb128 0x27   # (DW_AT_prototyped)
504 +       .uleb128 0x19   # (DW_FORM_flag_present)
505 +       .uleb128 0x49   # (DW_AT_type)
506 +       .uleb128 0x13   # (DW_FORM_ref4)
507 +       .uleb128 0x20   # (DW_AT_inline)
508 +       .uleb128 0xb    # (DW_FORM_data1)
509 +       .uleb128 0x1    # (DW_AT_sibling)
510 +       .uleb128 0x13   # (DW_FORM_ref4)
511 +       .byte   0
512 +       .byte   0
513 +       .uleb128 0x6    # (abbrev code)
514 +       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
515 +       .byte   0       # DW_children_no
516 +       .uleb128 0x3    # (DW_AT_name)
517 +       .uleb128 0x8    # (DW_FORM_string)
518 +       .uleb128 0x3a   # (DW_AT_decl_file)
519 +       .uleb128 0xb    # (DW_FORM_data1)
520 +       .uleb128 0x3b   # (DW_AT_decl_line)
521 +       .uleb128 0xb    # (DW_FORM_data1)
522 +       .uleb128 0x49   # (DW_AT_type)
523 +       .uleb128 0x13   # (DW_FORM_ref4)
524 +       .byte   0
525 +       .byte   0
526 +       .uleb128 0x7    # (abbrev code)
527 +       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
528 +       .byte   0x1     # DW_children_yes
529 +       .uleb128 0x3f   # (DW_AT_external)
530 +       .uleb128 0x19   # (DW_FORM_flag_present)
531 +       .uleb128 0x3    # (DW_AT_name)
532 +       .uleb128 0x8    # (DW_FORM_string)
533 +       .uleb128 0x3a   # (DW_AT_decl_file)
534 +       .uleb128 0xb    # (DW_FORM_data1)
535 +       .uleb128 0x3b   # (DW_AT_decl_line)
536 +       .uleb128 0xb    # (DW_FORM_data1)
537 +       .uleb128 0x27   # (DW_AT_prototyped)
538 +       .uleb128 0x19   # (DW_FORM_flag_present)
539 +       .uleb128 0x49   # (DW_AT_type)
540 +       .uleb128 0x13   # (DW_FORM_ref4)
541 +       .uleb128 0x11   # (DW_AT_low_pc)
542 +       .uleb128 0x1    # (DW_FORM_addr)
543 +       .uleb128 0x12   # (DW_AT_high_pc)
544 +       .uleb128 0x7    # (DW_FORM_data8)
545 +       .uleb128 0x40   # (DW_AT_frame_base)
546 +       .uleb128 0x18   # (DW_FORM_exprloc)
547 +       .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
548 +       .uleb128 0x19   # (DW_FORM_flag_present)
549 +       .uleb128 0x1    # (DW_AT_sibling)
550 +       .uleb128 0x13   # (DW_FORM_ref4)
551 +       .byte   0
552 +       .byte   0
553 +       .uleb128 0x8    # (abbrev code)
554 +       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
555 +       .byte   0       # DW_children_no
556 +       .uleb128 0x3    # (DW_AT_name)
557 +       .uleb128 0x8    # (DW_FORM_string)
558 +       .uleb128 0x3a   # (DW_AT_decl_file)
559 +       .uleb128 0xb    # (DW_FORM_data1)
560 +       .uleb128 0x3b   # (DW_AT_decl_line)
561 +       .uleb128 0xb    # (DW_FORM_data1)
562 +       .uleb128 0x49   # (DW_AT_type)
563 +       .uleb128 0x13   # (DW_FORM_ref4)
564 +       .uleb128 0x2    # (DW_AT_location)
565 +       .uleb128 0x17   # (DW_FORM_sec_offset)
566 +       .byte   0
567 +       .byte   0
568 +       .uleb128 0x9    # (abbrev code)
569 +       .uleb128 0x1d   # (TAG: DW_TAG_inlined_subroutine)
570 +       .byte   0x1     # DW_children_yes
571 +       .uleb128 0x31   # (DW_AT_abstract_origin)
572 +       .uleb128 0x13   # (DW_FORM_ref4)
573 +       .uleb128 0x52   # (DW_AT_entry_pc)
574 +       .uleb128 0x1    # (DW_FORM_addr)
575 +       .uleb128 0x55   # (DW_AT_ranges)
576 +       .uleb128 0x17   # (DW_FORM_sec_offset)
577 +       .uleb128 0x58   # (DW_AT_call_file)
578 +       .uleb128 0xb    # (DW_FORM_data1)
579 +       .uleb128 0x59   # (DW_AT_call_line)
580 +       .uleb128 0xb    # (DW_FORM_data1)
581 +       .byte   0
582 +       .byte   0
583 +       .uleb128 0xa    # (abbrev code)
584 +       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
585 +       .byte   0       # DW_children_no
586 +       .uleb128 0x31   # (DW_AT_abstract_origin)
587 +       .uleb128 0x13   # (DW_FORM_ref4)
588 +       .uleb128 0x2    # (DW_AT_location)
589 +       .uleb128 0x17   # (DW_FORM_sec_offset)
590 +       .byte   0
591 +       .byte   0
592 +       .uleb128 0xb    # (abbrev code)
593 +       .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
594 +       .byte   0x1     # DW_children_yes
595 +       .uleb128 0x11   # (DW_AT_low_pc)
596 +       .uleb128 0x1    # (DW_FORM_addr)
597 +       .uleb128 0x31   # (DW_AT_abstract_origin)
598 +       .uleb128 0x13   # (DW_FORM_ref4)
599 +       .uleb128 0x1    # (DW_AT_sibling)
600 +       .uleb128 0x13   # (DW_FORM_ref4)
601 +       .byte   0
602 +       .byte   0
603 +       .uleb128 0xc    # (abbrev code)
604 +       .uleb128 0x410a # (TAG: DW_TAG_GNU_call_site_parameter)
605 +       .byte   0       # DW_children_no
606 +       .uleb128 0x2    # (DW_AT_location)
607 +       .uleb128 0x18   # (DW_FORM_exprloc)
608 +       .uleb128 0x2111 # (DW_AT_GNU_call_site_value)
609 +       .uleb128 0x18   # (DW_FORM_exprloc)
610 +       .byte   0
611 +       .byte   0
612 +       .uleb128 0xd    # (abbrev code)
613 +       .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
614 +       .byte   0x1     # DW_children_yes
615 +       .uleb128 0x11   # (DW_AT_low_pc)
616 +       .uleb128 0x1    # (DW_FORM_addr)
617 +       .uleb128 0x31   # (DW_AT_abstract_origin)
618 +       .uleb128 0x13   # (DW_FORM_ref4)
619 +       .byte   0
620 +       .byte   0
621 +       .uleb128 0xe    # (abbrev code)
622 +       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
623 +       .byte   0x1     # DW_children_yes
624 +       .uleb128 0x3f   # (DW_AT_external)
625 +       .uleb128 0x19   # (DW_FORM_flag_present)
626 +       .uleb128 0x3    # (DW_AT_name)
627 +       .uleb128 0xe    # (DW_FORM_strp)
628 +       .uleb128 0x3a   # (DW_AT_decl_file)
629 +       .uleb128 0xb    # (DW_FORM_data1)
630 +       .uleb128 0x3b   # (DW_AT_decl_line)
631 +       .uleb128 0xb    # (DW_FORM_data1)
632 +       .uleb128 0x49   # (DW_AT_type)
633 +       .uleb128 0x13   # (DW_FORM_ref4)
634 +       .uleb128 0x11   # (DW_AT_low_pc)
635 +       .uleb128 0x1    # (DW_FORM_addr)
636 +       .uleb128 0x12   # (DW_AT_high_pc)
637 +       .uleb128 0x7    # (DW_FORM_data8)
638 +       .uleb128 0x40   # (DW_AT_frame_base)
639 +       .uleb128 0x18   # (DW_FORM_exprloc)
640 +       .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
641 +       .uleb128 0x19   # (DW_FORM_flag_present)
642 +       .uleb128 0x1    # (DW_AT_sibling)
643 +       .uleb128 0x13   # (DW_FORM_ref4)
644 +       .byte   0
645 +       .byte   0
646 +       .uleb128 0xf    # (abbrev code)
647 +       .uleb128 0x34   # (TAG: DW_TAG_variable)
648 +       .byte   0       # DW_children_no
649 +       .uleb128 0x3    # (DW_AT_name)
650 +       .uleb128 0x8    # (DW_FORM_string)
651 +       .uleb128 0x3a   # (DW_AT_decl_file)
652 +       .uleb128 0xb    # (DW_FORM_data1)
653 +       .uleb128 0x3b   # (DW_AT_decl_line)
654 +       .uleb128 0xb    # (DW_FORM_data1)
655 +       .uleb128 0x49   # (DW_AT_type)
656 +       .uleb128 0x13   # (DW_FORM_ref4)
657 +       .uleb128 0x2    # (DW_AT_location)
658 +       .uleb128 0x18   # (DW_FORM_exprloc)
659 +       .byte   0
660 +       .byte   0
661 +       .uleb128 0x10   # (abbrev code)
662 +       .uleb128 0x35   # (TAG: DW_TAG_volatile_type)
663 +       .byte   0       # DW_children_no
664 +       .uleb128 0x49   # (DW_AT_type)
665 +       .uleb128 0x13   # (DW_FORM_ref4)
666 +       .byte   0
667 +       .byte   0
668 +       .byte   0
669 +       .section        .debug_loc,"",@progbits
670 +.Ldebug_loc0:
671 +.LLST0:
672 +       .quad   .LVL1   # Location list begin address (*.LLST0)
673 +       .quad   .LVL2-1 # Location list end address (*.LLST0)
674 +       .value  0x1     # Location expression size
675 +       .byte   0x55    # DW_OP_reg5
676 +       .quad   .LVL2-1 # Location list begin address (*.LLST0)
677 +       .quad   .LVL7   # Location list end address (*.LLST0)
678 +       .value  0x1     # Location expression size
679 +       .byte   0x53    # DW_OP_reg3
680 +       .quad   .LVL7   # Location list begin address (*.LLST0)
681 +       .quad   .LFE2   # Location list end address (*.LLST0)
682 +       .value  0x1     # Location expression size
683 +       .byte   0x50    # DW_OP_reg0
684 +       .quad   0       # Location list terminator begin (*.LLST0)
685 +       .quad   0       # Location list terminator end (*.LLST0)
686 +.LLST1:
687 +       .quad   .LVL1   # Location list begin address (*.LLST1)
688 +       .quad   .LVL2-1 # Location list end address (*.LLST1)
689 +       .value  0x1     # Location expression size
690 +       .byte   0x54    # DW_OP_reg4
691 +       .quad   .LVL2-1 # Location list begin address (*.LLST1)
692 +       .quad   .LFE2   # Location list end address (*.LLST1)
693 +       .value  0x4     # Location expression size
694 +       .byte   0xf3    # DW_OP_GNU_entry_value
695 +       .uleb128 0x1
696 +       .byte   0x54    # DW_OP_reg4
697 +       .byte   0x9f    # DW_OP_stack_value
698 +       .quad   0       # Location list terminator begin (*.LLST1)
699 +       .quad   0       # Location list terminator end (*.LLST1)
700 +.LLST2:
701 +       .quad   .LVL1   # Location list begin address (*.LLST2)
702 +       .quad   .LVL2-1 # Location list end address (*.LLST2)
703 +       .value  0x1     # Location expression size
704 +       .byte   0x54    # DW_OP_reg4
705 +       .quad   .LVL2-1 # Location list begin address (*.LLST2)
706 +       .quad   .LVL3   # Location list end address (*.LLST2)
707 +       .value  0x4     # Location expression size
708 +       .byte   0xf3    # DW_OP_GNU_entry_value
709 +       .uleb128 0x1
710 +       .byte   0x54    # DW_OP_reg4
711 +       .byte   0x9f    # DW_OP_stack_value
712 +       .quad   .LVL3   # Location list begin address (*.LLST2)
713 +       .quad   .LVL4   # Location list end address (*.LLST2)
714 +       .value  0x1     # Location expression size
715 +       .byte   0x50    # DW_OP_reg0
716 +       .quad   .LVL4   # Location list begin address (*.LLST2)
717 +       .quad   .LVL5   # Location list end address (*.LLST2)
718 +       .value  0x6     # Location expression size
719 +       .byte   0x70    # DW_OP_breg0
720 +       .sleb128 0
721 +       .byte   0x75    # DW_OP_breg5
722 +       .sleb128 0
723 +       .byte   0x1e    # DW_OP_mul
724 +       .byte   0x9f    # DW_OP_stack_value
725 +       .quad   .LVL5   # Location list begin address (*.LLST2)
726 +       .quad   .LVL6-1 # Location list end address (*.LLST2)
727 +       .value  0x1     # Location expression size
728 +       .byte   0x50    # DW_OP_reg0
729 +       .quad   .LVL6-1 # Location list begin address (*.LLST2)
730 +       .quad   .LVL6   # Location list end address (*.LLST2)
731 +       .value  0xb     # Location expression size
732 +       .byte   0x73    # DW_OP_breg3
733 +       .sleb128 -2
734 +       .byte   0x73    # DW_OP_breg3
735 +       .sleb128 -2
736 +       .byte   0x73    # DW_OP_breg3
737 +       .sleb128 -2
738 +       .byte   0x1e    # DW_OP_mul
739 +       .byte   0x23    # DW_OP_plus_uconst
740 +       .uleb128 0x1
741 +       .byte   0x1e    # DW_OP_mul
742 +       .byte   0x9f    # DW_OP_stack_value
743 +       .quad   0       # Location list terminator begin (*.LLST2)
744 +       .quad   0       # Location list terminator end (*.LLST2)
745 +       .section        .debug_aranges,"",@progbits
746 +       .long   0x3c    # Length of Address Ranges Info
747 +       .value  0x2     # DWARF Version
748 +       .long   .Ldebug_info0   # Offset of Compilation Unit Info
749 +       .byte   0x8     # Size of Address
750 +       .byte   0       # Size of Segment Descriptor
751 +       .value  0       # Pad to 16 byte boundary
752 +       .value  0
753 +       .quad   .Ltext0 # Address
754 +       .quad   .Letext0-.Ltext0        # Length
755 +       .quad   .LFB3   # Address
756 +       .quad   .LFE3-.LFB3     # Length
757 +       .quad   0
758 +       .quad   0
759 +       .section        .debug_ranges,"",@progbits
760 +.Ldebug_ranges0:
761 +       .quad   .LBB4   # Offset 0
762 +       .quad   .LBE4
763 +       .quad   .LBB7
764 +       .quad   .LBE7
765 +       .quad   0
766 +       .quad   0
767 +       .quad   .Ltext0 # Offset 0x30
768 +       .quad   .Letext0
769 +       .quad   .LFB3   # Offset 0x40
770 +       .quad   .LFE3
771 +       .quad   0
772 +       .quad   0
773 +       .section        .debug_line,"",@progbits
774 +.Ldebug_line0:
775 +       .section        .debug_str,"MS",@progbits,1
776 +.LASF0:
777 +       .string "GNU C 4.8.0 20121005+patches (experimental) -mtune=generic -march=x86-64 -g -O2"
778 +.LASF1:
779 +       .string "gdb.arch/amd64-entry-value-inline.c"
780 +.LASF2:
781 +       .string ""
782 +.LASF3:
783 +       .string "main"
784 +       .ident  "GCC: (GNU) 4.8.0 20121005 (experimental)"
785 +       .section        .note.GNU-stack,"",@progbits
786 diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
787 new file mode 100644
788 index 0000000..f7fefb8
789 --- /dev/null
790 +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
791 @@ -0,0 +1,50 @@
792 +/* This testcase is part of GDB, the GNU debugger.
793 +
794 +   Copyright 2012 Free Software Foundation, Inc.
795 +
796 +   This program is free software; you can redistribute it and/or modify
797 +   it under the terms of the GNU General Public License as published by
798 +   the Free Software Foundation; either version 3 of the License, or
799 +   (at your option) any later version.
800 +
801 +   This program is distributed in the hope that it will be useful,
802 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
803 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
804 +   GNU General Public License for more details.
805 +
806 +   You should have received a copy of the GNU General Public License
807 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
808 +
809 +static volatile int v;
810 +
811 +static __attribute__((noinline, noclone)) void
812 +fn1 (int x)
813 +{
814 +  v++;
815 +}
816 +
817 +static int
818 +fn2 (int x, int y)
819 +{
820 +  if (y)
821 +    {
822 +      fn1 (x);
823 +      y = -2 + x;      /* break-here */
824 +      y = y * y * y + y;
825 +      fn1 (x + y);
826 +    }
827 +  return x;
828 +}
829 +
830 +__attribute__((noinline, noclone)) int
831 +fn3 (int x, int y)
832 +{
833 +  return fn2 (x, y);
834 +}
835 +
836 +int
837 +main ()
838 +{
839 +  fn3 (6, 25);
840 +  return 0;
841 +}
842 diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
843 new file mode 100644
844 index 0000000..6aa92c1
845 --- /dev/null
846 +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
847 @@ -0,0 +1,40 @@
848 +# Copyright (C) 2012 Free Software Foundation, Inc.
849 +#
850 +# This program is free software; you can redistribute it and/or modify
851 +# it under the terms of the GNU General Public License as published by
852 +# the Free Software Foundation; either version 3 of the License, or
853 +# (at your option) any later version.
854 +#
855 +# This program is distributed in the hope that it will be useful,
856 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
857 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
858 +# GNU General Public License for more details.
859 +#
860 +# You should have received a copy of the GNU General Public License
861 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
862 +
863 +set opts {}
864 +standard_testfile .S
865 +
866 +if [info exists COMPILE] {
867 +    # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
868 +    standard_testfile
869 +    lappend opts debug optimize=-O2
870 +} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
871 +    verbose "Skipping ${testfile}."
872 +    return
873 +}
874 +
875 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } {
876 +    return -1
877 +}
878 +
879 +if ![runto_main] {
880 +    return -1
881 +}
882 +
883 +set srcfile $testfile.c
884 +gdb_breakpoint [gdb_get_line_number "break-here"]
885 +
886 +gdb_continue_to_breakpoint "break-here" ".* break-here .*"
887 +gdb_test "p y" " = 25"
888
This page took 0.185595 seconds and 3 git commands to generate.