Skip to content

Commit

Permalink
Optional 0x prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillou68310 committed Feb 10, 2025
1 parent fc49910 commit 7802ff1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2080,14 +2080,14 @@ def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]:

# Example movb $0x0,0x0(%si)
if not addr_imm:
addr_imm = re.search(r"(?<=,)0x0+(?=\(.*\))", args)
addr_imm = re.search(r"(?<=,)(?:0x)?0+(?=\(.*\))", args)

# Example 0x0,0x8(%edi)
# Example 0x0,%edi
# Example *0x0(,%edx,4)
# Example $0x0,0x4(%edi)
if not addr_imm:
addr_imm = re.search(r"(^\$?|(?<=\*))0x0", args)
addr_imm = re.search(r"(^\$?|(?<=\*))(?:0x)?0", args)

# Offset value

Expand All @@ -2099,17 +2099,19 @@ def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]:

# Example movb $0x0,0x4(%si)
if not addr_imm:
addr_imm = re.search(r"(?<=,)0x[0-9a-f]+", args)
addr_imm = re.search(r"(?<=,)(?:0x)?[0-9a-f]+", args)
offset = True

# Example 0x4,%eax
# Example $0x4,%eax
if not addr_imm:
addr_imm = re.search(r"(^|(?<=\*)|(?:\$))0x[0-9a-f]+", args)
addr_imm = re.search(r"(^|(?<=\*)|(?:\$))(?:0x)?[0-9a-f]+", args)
offset = True

if not addr_imm:
addr_imm = re.search(r"(^|(?<=\*)|(?<=\%[fgdecs]s\:))0x[0-9a-f]+", args)
addr_imm = re.search(
r"(^|(?<=\*)|(?<=\%[fgdecs]s\:))(?:0x)?[0-9a-f]+", args
)
offset = True

if not addr_imm:
Expand Down

0 comments on commit 7802ff1

Please sign in to comment.