2 set var $chunk_curr=(unsigned int)__smoothieHeapBase
3 set var $chunk_number=1
4 while ($chunk_curr < '_sbrk::heap')
5 set var $chunk_size=*(unsigned int*)($chunk_curr+4) & ~1
6 set var $chunk_next=$chunk_curr + $chunk_size
7 set var $chunk_inuse=*(unsigned int*)($chunk_next+4) & 1
8 set var $chunk_tag=*(unsigned int*)$chunk_next
9 printf "Allocation: %u Address: 0x%08X Size:%u ", $chunk_number, $chunk_curr+8, $chunk_size-4
11 info line *($chunk_tag)
15 set var $chunk_curr=$chunk_next
16 set var $chunk_number=$chunk_number+1
21 Walks the heap and dumps each chunk encountered.
22 It will also lists the line and source filename from where the chunk was
23 allocated if not a freed chunk. Requires that HEAP_WALK be set to a value of 1
24 in the Smoothie makefile.
32 set var $heap_base=(unsigned int)$arg0
34 set var $heap_base=(unsigned int)__smoothieHeapBase
36 printf "heap size: %d bytes\n", ('_sbrk::heap' - $heap_base)
40 Displays the current heap size.
41 Can provide an optional argument specifying the location of the base address
42 for the heap. This isn't required if you have HEAP_WALK enabled in the makefile
43 but if that features isn't enabled, you will want to run
44 "maintenance info section .heap" to determine this base address and then
45 pass it as an argument to this comand.
51 printf "stack size: %d bytes\n", 0x10008000 - (unsigned int)$sp
55 Displays the current stack size.
61 printf "free space: %d bytes\n", (unsigned int)$sp - '_sbrk::heap'
65 Displays the free space.
67 This is the amount of space between the heap and stack that is currently
74 set var $fill_curr=(unsigned int*)'_sbrk::heap'
75 while ($fill_curr < $sp && *$fill_curr == 0xdeadbeef)
76 set var $fill_curr = $fill_curr + 1
79 if ($fill_curr == '_sbrk::heap')
80 printf "No free space between heap and stack detected!\n"
82 printf "maximum stack size: %d bytes\n", 0x10008000 - (unsigned int)$fill_curr
87 Displays the maximum stack amount of stack used.
88 This can take awhile to run as it walks the area between the top of heap and
89 the current top of stack to look for where initial fill values have been
90 overwritten by stack writes.
101 set var $ptr=0x10000000
102 while $ptr < 0x10008000
112 Dumps a full crash dump to gdb.txt