gdb
[external/binutils.git] / gdb / testsuite / gdb.dwarf2 / valop.S
1 /*
2    Copyright 2009 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /* This was compiled from a trivial program just to test the
19    DW_OP_stack_value and DW_OP_implicit_value operators:
20
21     unsigned int func (unsigned int arg) __attribute__ ((__noinline__));
22
23     unsigned int func (unsigned int arg)
24     {
25       unsigned int uses_stack_op = 23;
26       unsigned int uses_lit_op = 0x7fffffff;
27       unsigned int result = arg;
28
29       if (arg % 2)
30         result += uses_lit_op + uses_stack_op;
31       else
32         {
33           ++uses_stack_op;
34           ++uses_lit_op;
35
36           result -= uses_stack_op + uses_lit_op;
37         }
38
39       return result * uses_stack_op;  // line 19, see the .exp file
40     }
41
42     int main (int argc, char *argv[])
43     {
44       return func (1024);
45     }
46
47   Then it was compiled with:
48         
49         gcc -fvar-tracking{,-assignments} -gdwarf-3
50         -fno-inline{,-functions,-small-functions,-functions-called-once}
51         -O2
52
53 */
54
55         .file   "valop.c"
56         .section        .debug_abbrev,"",@progbits
57 .Ldebug_abbrev0:
58         .section        .debug_info,"",@progbits
59 .Ldebug_info0:
60         .section        .debug_line,"",@progbits
61 .Ldebug_line0:
62         .text
63 .Ltext0:
64         .p2align 4,,15
65 .globl func
66         .type   func, @function
67 func:
68 .LFB0:
69         .file 1 "valop.c"
70         .loc 1 4 0
71         .cfi_startproc
72 .LVL0:
73         pushl   %ebp
74         .cfi_def_cfa_offset 8
75         movl    %esp, %ebp
76         .cfi_offset 5, -8
77         .cfi_def_cfa_register 5
78         .loc 1 4 0
79         movl    8(%ebp), %eax
80 .LVL1:
81         .loc 1 9 0
82         testb   $1, %al
83         jne     .L5
84 .LVL2:
85         .loc 1 16 0
86         addl    $2147483624, %eax
87 .LVL3:
88         .loc 1 13 0
89         movl    $24, %edx
90 .LVL4:
91         .loc 1 16 0
92         imull   %edx, %eax
93 .LVL5:
94         .loc 1 20 0
95         popl    %ebp
96         .cfi_remember_state
97         .cfi_restore 5
98         .cfi_def_cfa 4, 4
99         ret
100 .LVL6:
101         .p2align 4,,7
102         .p2align 3
103 .L5:
104         .cfi_restore_state
105         .loc 1 10 0
106         subl    $2147483626, %eax
107 .LVL7:
108         .loc 1 5 0
109         movl    $23, %edx
110 .LVL8:
111         .loc 1 16 0
112         imull   %edx, %eax
113 .LVL9:
114         .loc 1 20 0
115         popl    %ebp
116         .cfi_def_cfa 4, 4
117         .cfi_restore 5
118         ret
119         .cfi_endproc
120 .LFE0:
121         .size   func, .-func
122         .p2align 4,,15
123 .globl _start
124         .type   _start, @function
125 _start:
126 .LFB1:
127         .loc 1 23 0
128         .cfi_startproc
129 .LVL10:
130         pushl   %ebp
131         .cfi_def_cfa_offset 8
132         movl    %esp, %ebp
133         .cfi_offset 5, -8
134         .cfi_def_cfa_register 5
135         subl    $4, %esp
136         .loc 1 24 0
137         movl    $1024, (%esp)
138         call    func
139 .LVL11:
140         .loc 1 25 0
141         leave
142         .cfi_restore 5
143         .cfi_def_cfa 4, 4
144         ret
145         .cfi_endproc
146 .LFE1:
147         .size   _start, .-_start
148 .Letext0:
149         .section        .debug_loc,"",@progbits
150 .Ldebug_loc0:
151 .LLST0:
152         .long   .LVL0-.Ltext0
153         .long   .LVL2-.Ltext0
154         .value  0x4
155         .byte   0x47
156         .byte   0x9f
157         .byte   0x93
158         .uleb128 0x4
159         .long   .LVL2-.Ltext0
160         .long   .LVL4-.Ltext0
161         .value  0x4
162         .byte   0x48
163         .byte   0x9f
164         .byte   0x93
165         .uleb128 0x4
166         .long   .LVL4-.Ltext0
167         .long   .LVL6-.Ltext0
168         .value  0x1
169         .byte   0x52
170         .long   .LVL6-.Ltext0
171         .long   .LVL8-.Ltext0
172         .value  0x4
173         .byte   0x47
174         .byte   0x9f
175         .byte   0x93
176         .uleb128 0x4
177         .long   .LVL8-.Ltext0
178         .long   .LFE0-.Ltext0
179         .value  0x1
180         .byte   0x52
181         .long   0x0
182         .long   0x0
183 .LLST1:
184         .long   .LVL0-.Ltext0
185         .long   .LVL2-.Ltext0
186         .value  0x6
187         .byte   0x9e
188         .uleb128 0x4
189         .long   0x7fffffff
190         .long   .LVL2-.Ltext0
191         .long   .LVL6-.Ltext0
192         .value  0x6
193         .byte   0x9e
194         .uleb128 0x4
195         .long   0x80000000
196         .long   .LVL6-.Ltext0
197         .long   .LFE0-.Ltext0
198         .value  0x6
199         .byte   0x9e
200         .uleb128 0x4
201         .long   0x7fffffff
202         .long   0x0
203         .long   0x0
204 .LLST2:
205         .long   .LVL1-.Ltext0
206         .long   .LVL3-.Ltext0
207         .value  0x1
208         .byte   0x50
209         .long   .LVL3-.Ltext0
210         .long   .LVL5-.Ltext0
211         .value  0x1
212         .byte   0x50
213         .long   .LVL6-.Ltext0
214         .long   .LVL7-.Ltext0
215         .value  0x1
216         .byte   0x50
217         .long   .LVL7-.Ltext0
218         .long   .LVL9-.Ltext0
219         .value  0x1
220         .byte   0x50
221         .long   0x0
222         .long   0x0
223 .LLST3:
224         .long   .LVL10-.Ltext0
225         .long   .LVL11-1-.Ltext0
226         .value  0x2
227         .byte   0x91
228         .sleb128 0
229         .long   0x0
230         .long   0x0
231 .LLST4:
232         .long   .LVL10-.Ltext0
233         .long   .LVL11-1-.Ltext0
234         .value  0x2
235         .byte   0x91
236         .sleb128 4
237         .long   0x0
238         .long   0x0
239         .section        .debug_info
240         .long   0xd4
241         .value  0x3
242         .long   .Ldebug_abbrev0
243         .byte   0x4
244         .uleb128 0x1
245         .long   .LASF9
246         .byte   0x1
247         .long   .LASF10
248         .long   .LASF11
249         .long   .Ltext0
250         .long   .Letext0
251         .long   .Ldebug_line0
252         .uleb128 0x2
253         .byte   0x1
254         .long   .LASF3
255         .byte   0x1
256         .byte   0x3
257         .byte   0x1
258         .long   0x7c
259         .long   .LFB0
260         .long   .LFE0
261         .byte   0x1
262         .byte   0x9c
263         .long   0x7c
264         .uleb128 0x3
265         .string "arg"
266         .byte   0x1
267         .byte   0x3
268         .long   0x7c
269         .byte   0x2
270         .byte   0x91
271         .sleb128 0
272         .uleb128 0x4
273         .long   .LASF0
274         .byte   0x1
275         .byte   0x5
276         .long   0x7c
277         .long   .LLST0
278         .uleb128 0x4
279         .long   .LASF1
280         .byte   0x1
281         .byte   0x6
282         .long   0x7c
283         .long   .LLST1
284         .uleb128 0x4
285         .long   .LASF2
286         .byte   0x1
287         .byte   0x7
288         .long   0x7c
289         .long   .LLST2
290         .byte   0x0
291         .uleb128 0x5
292         .byte   0x4
293         .byte   0x7
294         .long   .LASF7
295         .uleb128 0x2
296         .byte   0x1
297         .long   .LASF4
298         .byte   0x1
299         .byte   0x16
300         .byte   0x1
301         .long   0xbd
302         .long   .LFB1
303         .long   .LFE1
304         .byte   0x1
305         .byte   0x9c
306         .long   0xbd
307         .uleb128 0x6
308         .long   .LASF5
309         .byte   0x1
310         .byte   0x16
311         .long   0xbd
312         .long   .LLST3
313         .uleb128 0x6
314         .long   .LASF6
315         .byte   0x1
316         .byte   0x16
317         .long   0xc4
318         .long   .LLST4
319         .byte   0x0
320         .uleb128 0x7
321         .byte   0x4
322         .byte   0x5
323         .string "int"
324         .uleb128 0x8
325         .byte   0x4
326         .long   0xca
327         .uleb128 0x8
328         .byte   0x4
329         .long   0xd0
330         .uleb128 0x5
331         .byte   0x1
332         .byte   0x6
333         .long   .LASF8
334         .byte   0x0
335         .section        .debug_abbrev
336         .uleb128 0x1
337         .uleb128 0x11
338         .byte   0x1
339         .uleb128 0x25
340         .uleb128 0xe
341         .uleb128 0x13
342         .uleb128 0xb
343         .uleb128 0x3
344         .uleb128 0xe
345         .uleb128 0x1b
346         .uleb128 0xe
347         .uleb128 0x11
348         .uleb128 0x1
349         .uleb128 0x12
350         .uleb128 0x1
351         .uleb128 0x10
352         .uleb128 0x6
353         .byte   0x0
354         .byte   0x0
355         .uleb128 0x2
356         .uleb128 0x2e
357         .byte   0x1
358         .uleb128 0x3f
359         .uleb128 0xc
360         .uleb128 0x3
361         .uleb128 0xe
362         .uleb128 0x3a
363         .uleb128 0xb
364         .uleb128 0x3b
365         .uleb128 0xb
366         .uleb128 0x27
367         .uleb128 0xc
368         .uleb128 0x49
369         .uleb128 0x13
370         .uleb128 0x11
371         .uleb128 0x1
372         .uleb128 0x12
373         .uleb128 0x1
374         .uleb128 0x40
375         .uleb128 0xa
376         .uleb128 0x1
377         .uleb128 0x13
378         .byte   0x0
379         .byte   0x0
380         .uleb128 0x3
381         .uleb128 0x5
382         .byte   0x0
383         .uleb128 0x3
384         .uleb128 0x8
385         .uleb128 0x3a
386         .uleb128 0xb
387         .uleb128 0x3b
388         .uleb128 0xb
389         .uleb128 0x49
390         .uleb128 0x13
391         .uleb128 0x2
392         .uleb128 0xa
393         .byte   0x0
394         .byte   0x0
395         .uleb128 0x4
396         .uleb128 0x34
397         .byte   0x0
398         .uleb128 0x3
399         .uleb128 0xe
400         .uleb128 0x3a
401         .uleb128 0xb
402         .uleb128 0x3b
403         .uleb128 0xb
404         .uleb128 0x49
405         .uleb128 0x13
406         .uleb128 0x2
407         .uleb128 0x6
408         .byte   0x0
409         .byte   0x0
410         .uleb128 0x5
411         .uleb128 0x24
412         .byte   0x0
413         .uleb128 0xb
414         .uleb128 0xb
415         .uleb128 0x3e
416         .uleb128 0xb
417         .uleb128 0x3
418         .uleb128 0xe
419         .byte   0x0
420         .byte   0x0
421         .uleb128 0x6
422         .uleb128 0x5
423         .byte   0x0
424         .uleb128 0x3
425         .uleb128 0xe
426         .uleb128 0x3a
427         .uleb128 0xb
428         .uleb128 0x3b
429         .uleb128 0xb
430         .uleb128 0x49
431         .uleb128 0x13
432         .uleb128 0x2
433         .uleb128 0x6
434         .byte   0x0
435         .byte   0x0
436         .uleb128 0x7
437         .uleb128 0x24
438         .byte   0x0
439         .uleb128 0xb
440         .uleb128 0xb
441         .uleb128 0x3e
442         .uleb128 0xb
443         .uleb128 0x3
444         .uleb128 0x8
445         .byte   0x0
446         .byte   0x0
447         .uleb128 0x8
448         .uleb128 0xf
449         .byte   0x0
450         .uleb128 0xb
451         .uleb128 0xb
452         .uleb128 0x49
453         .uleb128 0x13
454         .byte   0x0
455         .byte   0x0
456         .byte   0x0
457         .section        .debug_pubnames,"",@progbits
458         .long   0x20
459         .value  0x2
460         .long   .Ldebug_info0
461         .long   0xd8
462         .long   0x25
463         .string "func"
464         .long   0x83
465         .string "main"
466         .long   0x0
467         .section        .debug_aranges,"",@progbits
468         .long   0x1c
469         .value  0x2
470         .long   .Ldebug_info0
471         .byte   0x4
472         .byte   0x0
473         .value  0x0
474         .value  0x0
475         .long   .Ltext0
476         .long   .Letext0-.Ltext0
477         .long   0x0
478         .long   0x0
479         .section        .debug_str,"MS",@progbits,1
480 .LASF7:
481         .string "unsigned int"
482 .LASF3:
483         .string "func"
484 .LASF0:
485         .string "uses_stack_op"
486 .LASF5:
487         .string "argc"
488 .LASF10:
489         .string "valop.c"
490 .LASF2:
491         .string "result"
492 .LASF8:
493         .string "char"
494 .LASF9:
495         .string "GNU C 4.5.0 20090818 (experimental) [var-tracking-assignments-branch revision 150964]"
496 .LASF4:
497         .string "main"
498 .LASF11:
499         .string "/tmp"
500 .LASF1:
501         .string "uses_lit_op"
502 .LASF6:
503         .string "argv"
504         .ident  "GCC: (GNU) 4.5.0 20090818 (experimental) [var-tracking-assignments-branch revision 150964]"
505         .section        .note.GNU-stack,"",@progbits