Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show hunk allocation size memory attributes #182

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions amitools/binfmt/hunk/HunkReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ def build_loadseg(self):
seek_begin = False
e["hunk_no"] = hunk_no
e["alloc_size"] = self.header["hunks"][hunk_no]["size"]
e["alloc_type"] = self.header["hunks"][hunk_no]["memf"]
hunk_no += 1
# add an extra overlay "hunk"
elif hunk_type == HUNK_OVERLAY:
Expand Down Expand Up @@ -815,6 +816,7 @@ def build_loadseg(self):
seek_begin = False
e["hunk_no"] = hunk_no
e["alloc_size"] = self.header["hunks"][hunk_no]["size"]
e["alloc_type"] = self.header["hunks"][hunk_no]["memf"]
hunk_no += 1
# unecpected hunk?!
else:
Expand Down
12 changes: 11 additions & 1 deletion amitools/binfmt/hunk/HunkShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ def show_segment(self, hunk, seg_list):
else:
alloc_size = None

if "alloc_type" in main:
alloc_type = main["alloc_type"]
else:
alloc_type = None

self.print_segment_header(
hunk_no,
type_name,
Expand All @@ -103,6 +108,7 @@ def show_segment(self, hunk, seg_list):
data_file_offset,
hunk_file_offset,
alloc_size,
alloc_type,
)
if self.hexdump and "data" in main:
print_hex(main["data"], indent=8)
Expand Down Expand Up @@ -239,10 +245,14 @@ def print_segment_header(
data_file_offset,
hunk_file_offset,
alloc_size,
alloc_type,
):
extra = ""
if alloc_size != None:
extra += "alloc size %08x " % alloc_size
if alloc_type:
extra += "alloc size (%s) %08x " % (alloc_type, alloc_size)
else:
extra += "alloc size %08x " % alloc_size
extra += "file header @%08x" % hunk_file_offset
if data_file_offset != None:
extra += " data @%08x" % data_file_offset
Expand Down