[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
objdump '--stop-address' option stop on a wrong ending address
From: |
BERBAR Florian |
Subject: |
objdump '--stop-address' option stop on a wrong ending address |
Date: |
Fri, 4 Nov 2016 23:52:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
Hi list,
I try to extract function assembly code with objdump using
"--start-address" and "--stop-address" options but the stop address stop
on the second to last address.
Exemple : Extraction of "printf_size_info" function form "libc.so.6"
- Get "printf_size_info" function symbol address
$ objdump -T /lib/x86_64-linux-gnu/libc.so.6 | grep printf_size_info
0000000000050c40 g DF .text 000000000000001f GLIBC_2.2.5
printf_size_info
- Add the size of the function (4th column) to the base address of the
function (1st column) to get the ending address
0x50c40+0x1f = 0x50c5f
- Extract the function assembly code
$ objdump --start-address=0x50c40 --stop-address=0x50c5f -d
/lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6: format de fichier elf64-x86-64
Déassemblage de la section .text :
0000000000050c40 <printf_size_info@@GLIBC_2.2.5>:
50c40: 48 85 f6 test %rsi,%rsi
50c43: 74 14 je 50c59
<printf_size_info@@GLIBC_2.2.5+0x19>
50c45: 0f b6 47 0c movzbl 0xc(%rdi),%eax
50c49: 83 e0 01 and $0x1,%eax
50c4c: 3c 01 cmp $0x1,%al
50c4e: 19 c0 sbb %eax,%eax
50c50: 30 c0 xor %al,%al
50c52: 05 07 01 00 00 add $0x107,%eax
50c57: 89 02 mov %eax,(%rdx)
50c59: b8 01 00 00 00 mov $0x1,%eax
50c5e: c3 retq
As you can see the last address is wrong. The assembly code stop on
0x50c5e instead of 0x50c5f.
I've tried on these versions :
- "GNU objdump (GNU Binutils) 2.27" version from the official mirror
(http://ftp.gnu.org/gnu/binutils/).
- "GNU objdump (GNU Binutils for Debian) 2.25" from the offical Debian
Jessie repository.
My Linux installation is :
"3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64
GNU/Linux" Full updated.
Thank you
Florian
0x346BBA8F.asc
Description: application/pgp-keys
signature.asc
Description: OpenPGP digital signature
- objdump '--stop-address' option stop on a wrong ending address,
BERBAR Florian <=