Skip to content

Commit

Permalink
Modify the display behavior of the "struct -r" option so as to scale
Browse files Browse the repository at this point in the history
the minimum display size from the size of a per-architecture long
(32-bits or 64-bits) down to 8-bits, 16-bits or 32-bits when the
requested size is equal to one of the smaller sizes.
([email protected])
  • Loading branch information
Dave Anderson committed Apr 2, 2020
1 parent 42fba65 commit 8c28b56
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,7 @@ raw_data_dump(ulong addr, long count, int symbolic)
long wordcnt;
ulonglong address;
int memtype;
ulong flags = HEXADECIMAL;

switch (sizeof(long))
{
Expand All @@ -2132,6 +2133,22 @@ raw_data_dump(ulong addr, long count, int symbolic)
break;
}

switch (count)
{
case SIZEOF_8BIT:
flags |= DISPLAY_8;
break;
case SIZEOF_16BIT:
flags |= DISPLAY_16;
break;
case SIZEOF_32BIT:
flags |= DISPLAY_32;
break;
default:
flags |= DISPLAY_DEFAULT;
break;
}

if (pc->curcmd_flags & MEMTYPE_FILEADDR) {
address = pc->curcmd_private;
memtype = FILEADDR;
Expand All @@ -2144,7 +2161,7 @@ raw_data_dump(ulong addr, long count, int symbolic)
}

display_memory(address, wordcnt,
HEXADECIMAL|DISPLAY_DEFAULT|(symbolic ? SYMBOLIC : ASCII_ENDLINE),
flags|(symbolic ? SYMBOLIC : ASCII_ENDLINE),
memtype, NULL);
}

Expand Down

0 comments on commit 8c28b56

Please sign in to comment.