Skip to content

Commit

Permalink
Fix failed section removal in objcopy (#103)
Browse files Browse the repository at this point in the history
* Fix failed section removal in objcopy

* Bump

* Must expand iterator
  • Loading branch information
mahaloz authored Jul 18, 2024
1 parent efee1c7 commit 39379b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion decomp2dbg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.9.3"
__version__ = "3.9.4"

try:
from .clients.client import DecompilerClient
Expand Down
10 changes: 6 additions & 4 deletions decomp2dbg/clients/gdb/symbol_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ def _construct_small_elf(self):
elf = ELFFile(open(f'{fname}.debug', 'rb'))

required_sections = [".text", ".interp", ".rela.dyn", ".dynamic", ".bss"]
for s in elf.iter_sections():
# keep some required sections
if s.name in required_sections:
all_sections = [s.name for s in elf.iter_sections()]
for s_name in all_sections:
# keep some required sections, skip broken ones
if not s_name or s_name in required_sections:
continue
os.system(f"{self._objcopy} --remove-section={s.name} {fname}.debug 2>/dev/null")

os.system(f"{self._objcopy} --remove-section={s_name} {fname}.debug 2>/dev/null")

# cache the small object file for use
self._elf_cache["fname"] = fname + ".debug"
Expand Down

0 comments on commit 39379b0

Please sign in to comment.