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