Skip to content

Commit

Permalink
Add freespace GDB command to .gdbinit
Browse files Browse the repository at this point in the history
This just reports how much space there is currently unused between the
top of the heap and the top of the stack.
  • Loading branch information
adamgreen committed Feb 21, 2013
1 parent c4f2f9c commit 1547904
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ end



define freespace
printf "free space: %d bytes\n", (unsigned int)$sp - '_sbrk::heap'
end

document freespace
Displays the free space.

This is the amount of space between the heap and stack that is currently
unused.
end



define maxstacksize
set var $fill_curr=(unsigned int*)'_sbrk::heap'
while ($fill_curr < $sp && *$fill_curr == 0xdeadbeef)
Expand Down

0 comments on commit 1547904

Please sign in to comment.