Skip to content

Instantly share code, notes, and snippets.

@awreece
Created May 7, 2012 19:05
Show Gist options
  • Save awreece/2629741 to your computer and use it in GitHub Desktop.
Save awreece/2629741 to your computer and use it in GitHub Desktop.
$ ltrace -x malloc /usr/lib/firefox/firefox
WARNING: Couldn't find symbol "malloc" in file "/usr/lib/firefox/firefox"
--- SIGCHLD (Child exited) ---
+++ exited (status 0) +++
$ nm /usr/lib/firefox/firefox
nm: /usr/lib/firefox/firefox: no symbols
$ objdump -d /usr/lib/firefox/firefox
... <stuff>
00006515 <malloc>:
6515: 56 push %esi
6516: 53 push %ebx
6517: e8 5b b5 ff ff call 1a77 <_start+0xf3>
651c: 81 c3 d8 59 00 00 add $0x59d8,%ebx
6522: 83 ec 14 sub $0x14,%esp
6525: 8b 74 24 20 mov 0x20(%esp),%esi
6529: e8 ce e4 ff ff call 49fc <_start+0x3078>
652e: 84 c0 test %al,%al
6530: 75 33 jne 6565 <malloc+0x50>
6532: 85 f6 test %esi,%esi
6534: 74 0a je 6540 <malloc+0x2b>
6536: 81 fe 00 f0 0f 00 cmp $0xff000,%esi
653c: 77 1c ja 655a <malloc+0x45>
653e: eb 05 jmp 6545 <malloc+0x30>
6540: be 01 00 00 00 mov $0x1,%esi
6545: e8 75 d7 ff ff call 3cbf <_start+0x233b>
654a: 89 f2 mov %esi,%edx
654c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6553: e8 f6 ee ff ff call 544e <_start+0x3aca>
6558: eb 07 jmp 6561 <malloc+0x4c>
655a: 89 f0 mov %esi,%eax
655c: e8 59 f9 ff ff call 5eba <free+0x1e5>
6561: 85 c0 test %eax,%eax
6563: 75 0d jne 6572 <malloc+0x5d>
6565: e8 e6 ac ff ff call 1250 <__errno_location@plt>
656a: c7 00 0c 00 00 00 movl $0xc,(%eax)
6570: 31 c0 xor %eax,%eax
6572: 83 c4 14 add $0x14,%esp
6575: 5b pop %ebx
6576: 5e pop %esi
6577: c3 ret
$ objdump -T /usr/lib/firefox/firefox
/usr/lib/firefox/firefox: file format elf32-i386
DYNAMIC SYMBOL TABLE:
00000000 DF *UND* 00000000 GLIBC_2.0 abort
... <more stuff> ...
00006515 g DF .text 00000063 Base malloc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment