Created
March 4, 2024 08:33
-
-
Save interma/b553159dc35bfc8c96d97ac4696e8236 to your computer and use it in GitHub Desktop.
gdb script to print the content of memorycontext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set pagination off | |
set logging file gdb.out.values | |
set logging on | |
set $b = ((AllocSetContext*)TopMemoryContext).blocks | |
set $b_loop = 100000 | |
while ($b_loop > 0) | |
set $c = (void *)($b+1) | |
set $c_loop = 100 | |
while ($c_loop > 0) | |
set $h = (struct AllocChunkData *)($c) | |
set $v = $c+sizeof(struct AllocChunkData) | |
printf "size: %d account: %d balance: %ld value: %ld\n", $h->size, $h->sharedHeader->memoryAccountId, $h->sharedHeader->balance, *(Size *)$v | |
set $c_loop=$c_loop-1 | |
set $c = $c+sizeof(struct AllocChunkData)+$h->size | |
end | |
set $b_loop=$b_loop-1 | |
set $b = $b->next | |
end | |
set logging off | |
quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment