Skip to content
Snippets Groups Projects
Commit 3e72c1c3 authored by Jean-Romain Garnier's avatar Jean-Romain Garnier Committed by Chris Lamb
Browse files

Remove offsets before instructions in objdump

parent e9e29040
No related branches found
No related tags found
No related merge requests found
Pipeline #152273 passed
......@@ -202,6 +202,9 @@ class ReadelfStringSection(ReadElfSection):
class ObjdumpSection(Command):
# Remove offsets before instructions (see issue #17)
RE_INSTRUCTION_OFFSET = re.compile(rb"^\s*[0-9a-f]+:")
def __init__(self, path, section_name, *args, **kwargs):
self._path = path
self._path_bin = path.encode("utf-8")
......@@ -226,7 +229,7 @@ class ObjdumpSection(Command):
if line.startswith(b"In archive"):
return b""
return line
return ObjdumpSection.RE_INSTRUCTION_OFFSET.sub(b"", line)
class ObjdumpDisassembleSection(ObjdumpSection):
......@@ -248,8 +251,9 @@ class ObjdumpDisassembleSection(ObjdumpSection):
]
def filter(self, line):
line = super().filter(line)
return ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(r"\1", line)
# Apply this filter first as super() removes offsets
line = ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(r"\1", line)
return super().filter(line)
class ObjdumpDisassembleSectionNoLineNumbers(ObjdumpDisassembleSection):
......
......@@ -4,9 +4,9 @@
0000000000000000 <f>:
f():
0: push %rbp
1: mov %rsp,%rbp
- 4: mov $0x2a,%eax
+ 4: mov $0xffffffff,%eax
9: pop %rbp
a: retq
push %rbp
mov %rsp,%rbp
- mov $0x2a,%eax
+ mov $0xffffffff,%eax
pop %rbp
retq
......@@ -4,9 +4,9 @@
0000000000000000 <f>:
f():
0: push %rbp
1: mov %rsp,%rbp
- 4: mov $0x2a,%eax
+ 4: mov $0xffffffff,%eax
9: pop %rbp
a: retq
push %rbp
mov %rsp,%rbp
- mov $0x2a,%eax
+ mov $0xffffffff,%eax
pop %rbp
retq
......@@ -4,9 +4,9 @@
0000000000000000 <return42_or_3>:
return42_or_3():
0: push %rbp
1: mov %rsp,%rbp
- 4: mov $0x2a,%eax
+ 4: mov $0x2b,%eax
9: pop %rbp
a: retq
push %rbp
mov %rsp,%rbp
- mov $0x2a,%eax
+ mov $0x2b,%eax
pop %rbp
retq
@@ -6,15 +6,15 @@
0000000000000000 <__rust_reallocate>:
__rust_reallocate():
0: push %r15
2: push %r14
4: push %r12
6: push %rbx
7: push %rax
- 8: mov %rdx,%rbx
+ 8: mov %rdx,%rcx
b: mov %rsi,%r15
e: mov %rdi,%r14
11: cmp $0x10,%rcx
15: ja 2d <__rust_reallocate+0x2d>
17: mov %r14,%rdi
1a: mov %rbx,%rsi
1d: add $0x8,%rsp
push %r15
push %r14
push %r12
push %rbx
push %rax
- mov %rdx,%rbx
+ mov %rdx,%rcx
mov %rsi,%r15
mov %rdi,%r14
cmp $0x10,%rcx
ja 2d <__rust_reallocate+0x2d>
mov %r14,%rdi
mov %rbx,%rsi
add $0x8,%rsp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment