valop.S 7.9 KB

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