X-Git-Url: http://git.hcoop.net/clinton/Smoothieware.git/blobdiff_plain/ef8a6735e95e365c7a32b074c9b0f94d1b8cfedf..1af84f6d7f188f1cae1667c390b05d4f03ddcc96:/.gdbinit diff --git a/.gdbinit b/.gdbinit index 41eefdde..913e782e 100644 --- a/.gdbinit +++ b/.gdbinit @@ -17,6 +17,81 @@ define heapwalk end end +document heapwalk +Walks the heap and dumps each chunk encountered. +It will also lists the line and source filename from where the chunk was +allocated if not a freed chunk. Requires that HEAP_WALK be set to a value of 1 +in the Smoothie makefile. +end + + + + +define heapsize + if ($argc > 0) + set var $heap_base=(unsigned int)$arg0 + else + set var $heap_base=(unsigned int)__smoothieHeapBase + end + printf "heap size: %d bytes\n", ('_sbrk::heap' - $heap_base) +end + +document heapsize +Displays the current heap size. +Can provide an optional argument specifying the location of the base address +for the heap. This isn't required if you have HEAP_WALK enabled in the makefile +but if that features isn't enabled, you will want to run +"maintenance info section .heap" to determine this base address and then +pass it as an argument to this comand. +end + + + +define stacksize + printf "stack size: %d bytes\n", 0x10008000 - (unsigned int)$sp +end + +document stacksize +Displays the current stack size. +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) + set var $fill_curr = $fill_curr + 1 + end + + if ($fill_curr == '_sbrk::heap') + printf "No free space between heap and stack detected!\n" + else + printf "maximum stack size: %d bytes\n", 0x10008000 - (unsigned int)$fill_curr + end +end + +document maxstacksize +Displays the maximum stack amount of stack used. +This can take awhile to run as it walks the area between the top of heap and +the current top of stack to look for where initial fill values have been +overwritten by stack writes. +end + + + define crashdump set pagination off set logging on @@ -32,3 +107,7 @@ define crashdump set logging off set pagination on end + +document crashdump +Dumps a full crash dump to gdb.txt +end