strace.ast 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. TranslationUnit[0:0->144:0]
  2. VariableDeclaration[0:0->2:0]
  3. NamedType[0:0->0:11]
  4. [static] int
  5. g_pid
  6. UnaryExpression[0:19->0:20]
  7. -
  8. NumericLiteral[0:20->0:20]
  9. 1
  10. FunctionDeclaration[2:0->10:0]
  11. [static]
  12. NamedType[2:7->2:12]
  13. void
  14. handle_sigint
  15. (
  16. Parameter[2:26->2:29]
  17. NamedType[2:26->2:29]
  18. int
  19. )
  20. FunctionDefinition[3:0->10:0]
  21. {
  22. IfStatement[4:4->5:14]
  23. Predicate:
  24. BinaryExpression[4:8->4:18]
  25. Name[4:8->4:14]
  26. g_pid
  27. ==
  28. UnaryExpression[4:17->4:18]
  29. -
  30. NumericLiteral[4:18->4:18]
  31. 1
  32. Then:
  33. ReturnStatement[5:8->5:14]
  34. IfStatement[7:4->10:0]
  35. Predicate:
  36. BinaryExpression[7:8->7:43]
  37. FunctionCall[7:8->7:39]
  38. Name[7:8->7:14]
  39. ptrace
  40. Name[7:15->7:24]
  41. PT_DETACH
  42. Name[7:26->7:31]
  43. g_pid
  44. NumericLiteral[7:33->7:33]
  45. 0
  46. NumericLiteral[7:36->7:36]
  47. 0
  48. ==
  49. UnaryExpression[7:42->7:43]
  50. -
  51. NumericLiteral[7:43->7:43]
  52. 1
  53. Then:
  54. BlockStatement[7:46->10:0]
  55. FunctionCall[8:8->8:24]
  56. Name[8:8->8:14]
  57. perror
  58. StringLiteral[8:15->8:22]
  59. "detach"
  60. }
  61. FunctionDeclaration[12:0->144:0]
  62. NamedType[12:0->12:4]
  63. int
  64. main
  65. (
  66. Parameter[12:9->12:16]
  67. argc
  68. NamedType[12:9->12:13]
  69. int
  70. Parameter[12:19->12:29]
  71. argv
  72. Pointer[12:19->12:26]
  73. Pointer[12:19->12:24]
  74. NamedType[12:19->12:23]
  75. char
  76. )
  77. FunctionDefinition[13:0->144:0]
  78. {
  79. IfStatement[14:4->19:4]
  80. Predicate:
  81. BinaryExpression[14:8->14:74]
  82. FunctionCall[14:8->14:72]
  83. Name[14:8->14:14]
  84. pledge
  85. StringLiteral[14:15->14:60]
  86. "stdio wpath cpath proc exec ptrace sigaction"
  87. NullPointerLiteral[14:63->14:69]
  88. <
  89. NumericLiteral[14:74->14:74]
  90. 0
  91. Then:
  92. BlockStatement[14:77->19:4]
  93. FunctionCall[15:8->15:24]
  94. Name[15:8->15:14]
  95. perror
  96. StringLiteral[15:15->15:22]
  97. "pledge"
  98. ReturnStatement[16:8->16:16]
  99. NumericLiteral[16:15->16:15]
  100. 1
  101. VariableDeclaration[19:4->19:34]
  102. NamedType[19:4->19:24]
  103. Vector<[const] char*>
  104. child_argv
  105. VariableDeclaration[21:4->21:41]
  106. Pointer[21:4->21:16]
  107. NamedType[21:4->21:14]
  108. [const] char
  109. output_filename
  110. NullPointerLiteral[21:34->21:40]
  111. VariableDeclaration[22:4->22:50]
  112. NamedType[22:4->22:9]
  113. auto
  114. trace_file
  115. FunctionCall[22:22->22:50]
  116. Name[22:22->22:48]
  117. Core::File::standard_error
  118. VariableDeclaration[24:4->24:27]
  119. NamedType[24:4->24:21]
  120. Core::ArgsParser
  121. parser
  122. FunctionCall[25:4->26:47]
  123. MemberExpression[25:4->25:27]
  124. Name[25:4->25:10]
  125. parser
  126. Identifier[25:11->25:26]
  127. set_general_help
  128. StringLiteral[26:8->26:45]
  129. "Trace all syscalls and their result."
  130. FunctionCall[27:4->27:70]
  131. MemberExpression[27:4->27:21]
  132. Name[27:4->27:10]
  133. parser
  134. Identifier[27:11->27:20]
  135. add_option
  136. Name[27:22->27:27]
  137. g_pid
  138. StringLiteral[27:29->27:49]
  139. "Trace the given PID"
  140. StringLiteral[27:52->27:56]
  141. "pid"
  142. StringLiteral[27:59->27:61]
  143. 'p'
  144. StringLiteral[27:64->27:68]
  145. "pid"
  146. FunctionCall[28:4->28:94]
  147. MemberExpression[28:4->28:21]
  148. Name[28:4->28:10]
  149. parser
  150. Identifier[28:11->28:20]
  151. add_option
  152. Name[28:22->28:37]
  153. output_filename
  154. StringLiteral[28:39->28:67]
  155. "Filename to write output to"
  156. StringLiteral[28:70->28:77]
  157. "output"
  158. StringLiteral[28:80->28:82]
  159. 'o'
  160. StringLiteral[28:85->28:92]
  161. "output"
  162. FunctionCall[29:4->29:111]
  163. MemberExpression[29:4->29:34]
  164. Name[29:4->29:10]
  165. parser
  166. Identifier[29:11->29:33]
  167. add_positional_argument
  168. Name[29:35->29:45]
  169. child_argv
  170. StringLiteral[29:47->29:65]
  171. "Arguments to exec"
  172. StringLiteral[29:68->29:77]
  173. "argument"
  174. Name[29:80->29:110]
  175. Core::ArgsParser::Required::No
  176. FunctionCall[31:4->31:28]
  177. MemberExpression[31:4->31:16]
  178. Name[31:4->31:10]
  179. parser
  180. Identifier[31:11->31:15]
  181. parse
  182. Name[31:17->31:21]
  183. argc
  184. Name[31:23->31:27]
  185. argv
  186. IfStatement[33:4->42:4]
  187. Predicate:
  188. BinaryExpression[33:8->33:33]
  189. Name[33:8->33:24]
  190. output_filename
  191. !=
  192. NullPointerLiteral[33:27->33:33]
  193. Then:
  194. BlockStatement[33:36->42:4]
  195. VariableDeclaration[34:8->34:87]
  196. NamedType[34:8->34:13]
  197. auto
  198. open_result
  199. FunctionCall[34:27->34:87]
  200. Name[34:27->34:43]
  201. Core::File::open
  202. Name[34:44->34:59]
  203. output_filename
  204. Name[34:61->34:86]
  205. Core::OpenMode::WriteOnly
  206. IfStatement[35:8->39:8]
  207. Predicate:
  208. FunctionCall[35:12->35:34]
  209. MemberExpression[35:12->35:32]
  210. Name[35:12->35:23]
  211. open_result
  212. Identifier[35:24->35:31]
  213. is_error
  214. Then:
  215. BlockStatement[35:36->39:8]
  216. FunctionCall[36:12->36:80]
  217. Name[36:12->36:17]
  218. outln
  219. Name[36:18->36:24]
  220. stderr
  221. StringLiteral[36:26->36:57]
  222. "Failed to open output file: {}"
  223. FunctionCall[36:60->36:79]
  224. MemberExpression[36:60->36:77]
  225. Name[36:60->36:71]
  226. open_result
  227. Identifier[36:72->36:76]
  228. error
  229. ReturnStatement[37:12->37:20]
  230. NumericLiteral[37:19->37:19]
  231. 1
  232. AssignmentExpression[39:8->39:40]
  233. Name[39:8->39:19]
  234. trace_file
  235. =
  236. FunctionCall[39:21->39:40]
  237. MemberExpression[39:21->39:38]
  238. Name[39:21->39:32]
  239. open_result
  240. Identifier[39:33->39:37]
  241. value
  242. IfStatement[42:4->47:4]
  243. Predicate:
  244. BinaryExpression[42:8->42:62]
  245. FunctionCall[42:8->42:60]
  246. Name[42:8->42:14]
  247. pledge
  248. StringLiteral[42:15->42:48]
  249. "stdio proc exec ptrace sigaction"
  250. NullPointerLiteral[42:51->42:57]
  251. <
  252. NumericLiteral[42:62->42:62]
  253. 0
  254. Then:
  255. BlockStatement[42:65->47:4]
  256. FunctionCall[43:8->43:24]
  257. Name[43:8->43:14]
  258. perror
  259. StringLiteral[43:15->43:22]
  260. "pledge"
  261. ReturnStatement[44:8->44:16]
  262. NumericLiteral[44:15->44:15]
  263. 1
  264. VariableDeclaration[47:4->47:14]
  265. NamedType[47:4->47:8]
  266. int
  267. status
  268. IfStatement[48:4->81:4]
  269. Predicate:
  270. BinaryExpression[48:8->48:18]
  271. Name[48:8->48:14]
  272. g_pid
  273. ==
  274. UnaryExpression[48:17->48:18]
  275. -
  276. NumericLiteral[48:18->48:18]
  277. 1
  278. Then:
  279. BlockStatement[48:21->81:4]
  280. IfStatement[49:8->54:8]
  281. Predicate:
  282. FunctionCall[49:12->49:33]
  283. MemberExpression[49:12->49:31]
  284. Name[49:12->49:22]
  285. child_argv
  286. Identifier[49:23->49:30]
  287. is_empty
  288. Then:
  289. BlockStatement[49:35->54:8]
  290. FunctionCall[50:12->50:78]
  291. Name[50:12->50:17]
  292. outln
  293. Name[50:18->50:24]
  294. stderr
  295. StringLiteral[50:26->50:76]
  296. "strace: Expected either a pid or some arguments\n"
  297. ReturnStatement[51:12->51:20]
  298. NumericLiteral[51:19->51:19]
  299. 1
  300. FunctionCall[54:8->54:34]
  301. MemberExpression[54:8->54:25]
  302. Name[54:8->54:18]
  303. child_argv
  304. Identifier[54:19->54:24]
  305. append
  306. NullPointerLiteral[54:26->54:32]
  307. VariableDeclaration[55:8->55:24]
  308. NamedType[55:8->55:12]
  309. int
  310. pid
  311. FunctionCall[55:18->55:24]
  312. Name[55:18->55:22]
  313. fork
  314. IfStatement[56:8->61:8]
  315. Predicate:
  316. BinaryExpression[56:12->56:18]
  317. Name[56:12->56:16]
  318. pid
  319. <
  320. NumericLiteral[56:18->56:18]
  321. 0
  322. Then:
  323. BlockStatement[56:21->61:8]
  324. FunctionCall[57:12->57:26]
  325. Name[57:12->57:18]
  326. perror
  327. StringLiteral[57:19->57:24]
  328. "fork"
  329. ReturnStatement[58:12->58:20]
  330. NumericLiteral[58:19->58:19]
  331. 1
  332. IfStatement[61:8->74:8]
  333. Predicate:
  334. UnaryExpression[61:12->61:16]
  335. !
  336. Name[61:13->61:16]
  337. pid
  338. Then:
  339. BlockStatement[61:18->74:8]
  340. IfStatement[62:12->66:12]
  341. Predicate:
  342. BinaryExpression[62:16->62:49]
  343. FunctionCall[62:16->62:45]
  344. Name[62:16->62:22]
  345. ptrace
  346. Name[62:23->62:34]
  347. PT_TRACE_ME
  348. NumericLiteral[62:36->62:36]
  349. 0
  350. NumericLiteral[62:39->62:39]
  351. 0
  352. NumericLiteral[62:42->62:42]
  353. 0
  354. ==
  355. UnaryExpression[62:48->62:49]
  356. -
  357. NumericLiteral[62:49->62:49]
  358. 1
  359. Then:
  360. BlockStatement[62:52->66:12]
  361. FunctionCall[63:16->63:33]
  362. Name[63:16->63:22]
  363. perror
  364. StringLiteral[63:23->63:31]
  365. "traceme"
  366. ReturnStatement[64:16->64:24]
  367. NumericLiteral[64:23->64:23]
  368. 1
  369. VariableDeclaration[66:12->66:86]
  370. NamedType[66:12->66:16]
  371. int
  372. rc
  373. FunctionCall[66:21->66:86]
  374. Name[66:21->66:27]
  375. execvp
  376. FunctionCall[66:28->66:46]
  377. MemberExpression[66:28->66:44]
  378. Name[66:28->66:38]
  379. child_argv
  380. Identifier[66:39->66:43]
  381. first
  382. CppCastExpression[66:48->66:85]
  383. const_cast
  384. <
  385. Pointer[66:59->66:65]
  386. Pointer[66:59->66:64]
  387. NamedType[66:59->66:63]
  388. char
  389. >
  390. FunctionCall[66:67->66:84]
  391. MemberExpression[66:67->66:82]
  392. Name[66:67->66:77]
  393. child_argv
  394. Identifier[66:78->66:81]
  395. data
  396. IfStatement[67:12->71:12]
  397. Predicate:
  398. BinaryExpression[67:16->67:21]
  399. Name[67:16->67:19]
  400. rc
  401. <
  402. NumericLiteral[67:21->67:21]
  403. 0
  404. Then:
  405. BlockStatement[67:24->71:12]
  406. FunctionCall[68:16->68:32]
  407. Name[68:16->68:22]
  408. perror
  409. StringLiteral[68:23->68:30]
  410. "execvp"
  411. FunctionCall[69:16->69:23]
  412. Name[69:16->69:20]
  413. exit
  414. NumericLiteral[69:21->69:21]
  415. 1
  416. FunctionCall[71:12->71:32]
  417. Name[71:12->71:30]
  418. VERIFY_NOT_REACHED
  419. AssignmentExpression[74:8->74:19]
  420. Name[74:8->74:14]
  421. g_pid
  422. =
  423. Name[74:16->74:19]
  424. pid
  425. IfStatement[75:8->79:4]
  426. Predicate:
  427. BinaryExpression[75:12->75:83]
  428. FunctionCall[75:12->75:54]
  429. Name[75:12->75:19]
  430. waitpid
  431. Name[75:20->75:23]
  432. pid
  433. UnaryExpression[75:25->75:32]
  434. &
  435. Name[75:26->75:32]
  436. status
  437. BinaryExpression[75:34->75:52]
  438. Name[75:34->75:43]
  439. WSTOPPED
  440. |
  441. Name[75:45->75:52]
  442. WEXITED
  443. !=
  444. BinaryExpression[75:57->75:83]
  445. Name[75:57->75:61]
  446. pid
  447. ||
  448. UnaryExpression[75:64->75:83]
  449. !
  450. FunctionCall[75:65->75:83]
  451. Name[75:65->75:75]
  452. WIFSTOPPED
  453. Name[75:76->75:82]
  454. status
  455. Then:
  456. BlockStatement[75:85->79:4]
  457. FunctionCall[76:12->76:29]
  458. Name[76:12->76:18]
  459. perror
  460. StringLiteral[76:19->76:27]
  461. "waitpid"
  462. ReturnStatement[77:12->77:20]
  463. NumericLiteral[77:19->77:19]
  464. 1
  465. VariableDeclaration[81:4->81:23]
  466. NamedType[81:4->81:21]
  467. sigaction
  468. sa
  469. FunctionCall[82:4->82:44]
  470. Name[82:4->82:10]
  471. memset
  472. UnaryExpression[82:11->82:14]
  473. &
  474. Name[82:12->82:14]
  475. sa
  476. NumericLiteral[82:16->82:16]
  477. 0
  478. SizeofExpression[82:19->82:43]
  479. NamedType[82:26->82:42]
  480. sigaction
  481. AssignmentExpression[83:4->83:33]
  482. MemberExpression[83:4->83:18]
  483. Name[83:4->83:6]
  484. sa
  485. Identifier[83:7->83:16]
  486. sa_handler
  487. =
  488. Name[83:20->83:33]
  489. handle_sigint
  490. FunctionCall[84:4->84:35]
  491. Name[84:4->84:13]
  492. sigaction
  493. Name[84:14->84:20]
  494. SIGINT
  495. UnaryExpression[84:22->84:25]
  496. &
  497. Name[84:23->84:25]
  498. sa
  499. NullPointerLiteral[84:27->84:33]
  500. IfStatement[86:4->90:4]
  501. Predicate:
  502. BinaryExpression[86:8->86:43]
  503. FunctionCall[86:8->86:39]
  504. Name[86:8->86:14]
  505. ptrace
  506. Name[86:15->86:24]
  507. PT_ATTACH
  508. Name[86:26->86:31]
  509. g_pid
  510. NumericLiteral[86:33->86:33]
  511. 0
  512. NumericLiteral[86:36->86:36]
  513. 0
  514. ==
  515. UnaryExpression[86:42->86:43]
  516. -
  517. NumericLiteral[86:43->86:43]
  518. 1
  519. Then:
  520. BlockStatement[86:46->90:4]
  521. FunctionCall[87:8->87:24]
  522. Name[87:8->87:14]
  523. perror
  524. StringLiteral[87:15->87:22]
  525. "attach"
  526. ReturnStatement[88:8->88:16]
  527. NumericLiteral[88:15->88:15]
  528. 1
  529. IfStatement[90:4->95:4]
  530. Predicate:
  531. BinaryExpression[90:8->90:83]
  532. FunctionCall[90:8->90:52]
  533. Name[90:8->90:15]
  534. waitpid
  535. Name[90:16->90:21]
  536. g_pid
  537. UnaryExpression[90:23->90:30]
  538. &
  539. Name[90:24->90:30]
  540. status
  541. BinaryExpression[90:32->90:50]
  542. Name[90:32->90:41]
  543. WSTOPPED
  544. |
  545. Name[90:43->90:50]
  546. WEXITED
  547. !=
  548. BinaryExpression[90:55->90:83]
  549. Name[90:55->90:61]
  550. g_pid
  551. ||
  552. UnaryExpression[90:64->90:83]
  553. !
  554. FunctionCall[90:65->90:83]
  555. Name[90:65->90:75]
  556. WIFSTOPPED
  557. Name[90:76->90:82]
  558. status
  559. Then:
  560. BlockStatement[90:85->95:4]
  561. FunctionCall[91:8->91:25]
  562. Name[91:8->91:14]
  563. perror
  564. StringLiteral[91:15->91:23]
  565. "waitpid"
  566. ReturnStatement[92:8->92:16]
  567. NumericLiteral[92:15->92:15]
  568. 1
  569. ForStatement[95:4->143:4]
  570. BlockStatement[95:13->143:4]
  571. IfStatement[96:8->100:8]
  572. Predicate:
  573. BinaryExpression[96:12->96:48]
  574. FunctionCall[96:12->96:44]
  575. Name[96:12->96:18]
  576. ptrace
  577. Name[96:19->96:29]
  578. PT_SYSCALL
  579. Name[96:31->96:36]
  580. g_pid
  581. NumericLiteral[96:38->96:38]
  582. 0
  583. NumericLiteral[96:41->96:41]
  584. 0
  585. ==
  586. UnaryExpression[96:47->96:48]
  587. -
  588. NumericLiteral[96:48->96:48]
  589. 1
  590. Then:
  591. BlockStatement[96:51->100:8]
  592. FunctionCall[97:12->97:29]
  593. Name[97:12->97:18]
  594. perror
  595. StringLiteral[97:19->97:27]
  596. "syscall"
  597. ReturnStatement[98:12->98:20]
  598. NumericLiteral[98:19->98:19]
  599. 1
  600. IfStatement[100:8->104:8]
  601. Predicate:
  602. BinaryExpression[100:12->100:87]
  603. FunctionCall[100:12->100:56]
  604. Name[100:12->100:19]
  605. waitpid
  606. Name[100:20->100:25]
  607. g_pid
  608. UnaryExpression[100:27->100:34]
  609. &
  610. Name[100:28->100:34]
  611. status
  612. BinaryExpression[100:36->100:54]
  613. Name[100:36->100:45]
  614. WSTOPPED
  615. |
  616. Name[100:47->100:54]
  617. WEXITED
  618. !=
  619. BinaryExpression[100:59->100:87]
  620. Name[100:59->100:65]
  621. g_pid
  622. ||
  623. UnaryExpression[100:68->100:87]
  624. !
  625. FunctionCall[100:69->100:87]
  626. Name[100:69->100:79]
  627. WIFSTOPPED
  628. Name[100:80->100:86]
  629. status
  630. Then:
  631. BlockStatement[100:89->104:8]
  632. FunctionCall[101:12->101:30]
  633. Name[101:12->101:18]
  634. perror
  635. StringLiteral[101:19->101:28]
  636. "wait_pid"
  637. ReturnStatement[102:12->102:20]
  638. NumericLiteral[102:19->102:19]
  639. 1
  640. VariableDeclaration[104:8->104:33]
  641. NamedType[104:8->104:24]
  642. PtraceRegisters
  643. regs
  644. BracedInitList[104:31->104:33]
  645. IfStatement[105:8->109:8]
  646. Predicate:
  647. BinaryExpression[105:12->105:52]
  648. FunctionCall[105:12->105:48]
  649. Name[105:12->105:18]
  650. ptrace
  651. Name[105:19->105:29]
  652. PT_GETREGS
  653. Name[105:31->105:36]
  654. g_pid
  655. UnaryExpression[105:38->105:43]
  656. &
  657. Name[105:39->105:43]
  658. regs
  659. NumericLiteral[105:45->105:45]
  660. 0
  661. ==
  662. UnaryExpression[105:51->105:52]
  663. -
  664. NumericLiteral[105:52->105:52]
  665. 1
  666. Then:
  667. BlockStatement[105:55->109:8]
  668. FunctionCall[106:12->106:29]
  669. Name[106:12->106:18]
  670. perror
  671. StringLiteral[106:19->106:27]
  672. "getregs"
  673. ReturnStatement[107:12->107:20]
  674. NumericLiteral[107:19->107:19]
  675. 1
  676. VariableDeclaration[109:8->109:36]
  677. NamedType[109:8->109:12]
  678. u32
  679. syscall_index
  680. MemberExpression[109:28->109:36]
  681. Name[109:28->109:32]
  682. regs
  683. Identifier[109:33->109:35]
  684. eax
  685. VariableDeclaration[110:8->110:27]
  686. NamedType[110:8->110:12]
  687. u32
  688. arg1
  689. MemberExpression[110:19->110:27]
  690. Name[110:19->110:23]
  691. regs
  692. Identifier[110:24->110:26]
  693. edx
  694. VariableDeclaration[111:8->111:27]
  695. NamedType[111:8->111:12]
  696. u32
  697. arg2
  698. MemberExpression[111:19->111:27]
  699. Name[111:19->111:23]
  700. regs
  701. Identifier[111:24->111:26]
  702. ecx
  703. VariableDeclaration[112:8->112:27]
  704. NamedType[112:8->112:12]
  705. u32
  706. arg3
  707. MemberExpression[112:19->112:27]
  708. Name[112:19->112:23]
  709. regs
  710. Identifier[112:24->112:26]
  711. ebx
  712. IfStatement[114:8->118:8]
  713. Predicate:
  714. BinaryExpression[114:12->114:48]
  715. FunctionCall[114:12->114:44]
  716. Name[114:12->114:18]
  717. ptrace
  718. Name[114:19->114:29]
  719. PT_SYSCALL
  720. Name[114:31->114:36]
  721. g_pid
  722. NumericLiteral[114:38->114:38]
  723. 0
  724. NumericLiteral[114:41->114:41]
  725. 0
  726. ==
  727. UnaryExpression[114:47->114:48]
  728. -
  729. NumericLiteral[114:48->114:48]
  730. 1
  731. Then:
  732. BlockStatement[114:51->118:8]
  733. FunctionCall[115:12->115:29]
  734. Name[115:12->115:18]
  735. perror
  736. StringLiteral[115:19->115:27]
  737. "syscall"
  738. ReturnStatement[116:12->116:20]
  739. NumericLiteral[116:19->116:19]
  740. 1
  741. IfStatement[118:8->123:8]
  742. Predicate:
  743. BinaryExpression[118:12->118:87]
  744. FunctionCall[118:12->118:56]
  745. Name[118:12->118:19]
  746. waitpid
  747. Name[118:20->118:25]
  748. g_pid
  749. UnaryExpression[118:27->118:34]
  750. &
  751. Name[118:28->118:34]
  752. status
  753. BinaryExpression[118:36->118:54]
  754. Name[118:36->118:45]
  755. WSTOPPED
  756. |
  757. Name[118:47->118:54]
  758. WEXITED
  759. !=
  760. BinaryExpression[118:59->118:87]
  761. Name[118:59->118:65]
  762. g_pid
  763. ||
  764. UnaryExpression[118:68->118:87]
  765. !
  766. FunctionCall[118:69->118:87]
  767. Name[118:69->118:79]
  768. WIFSTOPPED
  769. Name[118:80->118:86]
  770. status
  771. Then:
  772. BlockStatement[118:89->123:8]
  773. FunctionCall[119:12->119:30]
  774. Name[119:12->119:18]
  775. perror
  776. StringLiteral[119:19->119:28]
  777. "wait_pid"
  778. ReturnStatement[120:12->120:20]
  779. NumericLiteral[120:19->120:19]
  780. 1
  781. IfStatement[123:8->128:8]
  782. Predicate:
  783. BinaryExpression[123:12->123:52]
  784. FunctionCall[123:12->123:48]
  785. Name[123:12->123:18]
  786. ptrace
  787. Name[123:19->123:29]
  788. PT_GETREGS
  789. Name[123:31->123:36]
  790. g_pid
  791. UnaryExpression[123:38->123:43]
  792. &
  793. Name[123:39->123:43]
  794. regs
  795. NumericLiteral[123:45->123:45]
  796. 0
  797. ==
  798. UnaryExpression[123:51->123:52]
  799. -
  800. NumericLiteral[123:52->123:52]
  801. 1
  802. Then:
  803. BlockStatement[123:55->128:8]
  804. FunctionCall[124:12->124:29]
  805. Name[124:12->124:18]
  806. perror
  807. StringLiteral[124:19->124:27]
  808. "getregs"
  809. ReturnStatement[125:12->125:20]
  810. NumericLiteral[125:19->125:19]
  811. 1
  812. VariableDeclaration[128:8->128:26]
  813. NamedType[128:8->128:12]
  814. u32
  815. res
  816. MemberExpression[128:18->128:26]
  817. Name[128:18->128:22]
  818. regs
  819. Identifier[128:23->128:25]
  820. eax
  821. VariableDeclaration[130:8->135:16]
  822. NamedType[130:8->130:13]
  823. auto
  824. string
  825. FunctionCall[130:22->135:16]
  826. Name[130:22->130:39]
  827. String::formatted
  828. StringLiteral[130:40->130:77]
  829. "{}({:#08x}, {:#08x}, {:#08x})\t={}\n"
  830. FunctionCall[131:12->131:64]
  831. Name[131:12->131:30]
  832. Syscall::to_string
  833. CStyleCastExpression[131:31->131:63]
  834. NamedType[131:32->131:49]
  835. Syscall::Function
  836. Name[131:50->131:63]
  837. syscall_index
  838. Name[132:12->132:16]
  839. arg1
  840. Name[133:12->133:16]
  841. arg2
  842. Name[134:12->134:16]
  843. arg3
  844. Name[135:12->135:15]
  845. res
  846. IfStatement[137:8->141:4]
  847. Predicate:
  848. UnaryExpression[137:12->137:38]
  849. !
  850. BinaryExpression[137:13->137:38]
  851. Name[137:13->137:23]
  852. trace_file
  853. ->
  854. FunctionCall[137:25->137:38]
  855. Name[137:25->137:30]
  856. write
  857. Name[137:31->137:37]
  858. string
  859. Then:
  860. BlockStatement[137:40->141:4]
  861. FunctionCall[138:12->138:59]
  862. Name[138:12->138:18]
  863. warnln
  864. StringLiteral[138:19->138:29]
  865. "write: {}"
  866. BinaryExpression[138:32->138:58]
  867. Name[138:32->138:42]
  868. trace_file
  869. ->
  870. FunctionCall[138:44->138:58]
  871. Name[138:44->138:56]
  872. error_string
  873. ReturnStatement[139:12->139:20]
  874. NumericLiteral[139:19->139:19]
  875. 1
  876. ReturnStatement[143:4->143:12]
  877. NumericLiteral[143:11->143:11]
  878. 0
  879. }