temperaturecontrol: allow setting background tool without activating
[clinton/Smoothieware.git] / .gdbinit
CommitLineData
dc2de456
AG
1define heapwalk
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
10 if ($chunk_inuse)
11 info line *($chunk_tag)
12 else
13 printf "FREE CHUNK\n"
14 end
15 set var $chunk_curr=$chunk_next
16 set var $chunk_number=$chunk_number+1
17 end
18end
19
cdefb14d
AG
20document heapwalk
21Walks the heap and dumps each chunk encountered.
22It will also lists the line and source filename from where the chunk was
23allocated if not a freed chunk. Requires that HEAP_WALK be set to a value of 1
24in the Smoothie makefile.
25end
26
27
28
29
30define heapsize
31 if ($argc > 0)
32 set var $heap_base=(unsigned int)$arg0
33 else
34 set var $heap_base=(unsigned int)__smoothieHeapBase
35 end
36 printf "heap size: %d bytes\n", ('_sbrk::heap' - $heap_base)
37end
38
39document heapsize
40Displays the current heap size.
41Can provide an optional argument specifying the location of the base address
42for the heap. This isn't required if you have HEAP_WALK enabled in the makefile
43but if that features isn't enabled, you will want to run
44"maintenance info section .heap" to determine this base address and then
45pass it as an argument to this comand.
46end
47
48
49
50define stacksize
51 printf "stack size: %d bytes\n", 0x10008000 - (unsigned int)$sp
52end
53
54document stacksize
55Displays the current stack size.
56end
57
58
59
1547904b
AG
60define freespace
61 printf "free space: %d bytes\n", (unsigned int)$sp - '_sbrk::heap'
62end
63
64document freespace
65Displays the free space.
66
67This is the amount of space between the heap and stack that is currently
68unused.
69end
70
71
72
cdefb14d
AG
73define maxstacksize
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
77 end
78
79 if ($fill_curr == '_sbrk::heap')
80 printf "No free space between heap and stack detected!\n"
81 else
82 printf "maximum stack size: %d bytes\n", 0x10008000 - (unsigned int)$fill_curr
83 end
84end
85
86document maxstacksize
87Displays the maximum stack amount of stack used.
88This can take awhile to run as it walks the area between the top of heap and
89the current top of stack to look for where initial fill values have been
90overwritten by stack writes.
91end
92
93
94
dc2de456
AG
95define crashdump
96 set pagination off
97 set logging on
98 bt
99 list
100 disass
101 set var $ptr=0x10000000
102 while $ptr < 0x10008000
103 x/4wa $ptr
104 set var $ptr+=16
105 end
106 info registers
107 set logging off
108 set pagination on
109end
cdefb14d
AG
110
111document crashdump
112Dumps a full crash dump to gdb.txt
113end