Skip to content
Browse files

Add freespace GDB command to .gdbinit

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...
1 parent c4f2f9c commit 1547904b69dbdbc146f11c1edb15729c8f0c9edf @adamgreen adamgreen committed Feb 21, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 .gdbinit
View
13 .gdbinit
@@ -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)

0 comments on commit 1547904

Please sign in to comment.
Something went wrong with that request. Please try again.