1 handle SIGUSR1 pass noprint nostop
2 handle SIGUSR2 pass noprint nostop
5 set $lib = SysBase->LibList.lh_Head
7 printf "Base OpenC Name\n"
8 printf "---------------------------------------------------------------\n"
9 while ($lib->ln_Succ != 0)
10 printf "%p %5d %s\n", \
12 ((struct Library *)$lib)->lib_OpenCnt, \
14 set $lib = $lib->ln_Succ
18 List the current libraries in the system
22 set $dev = SysBase->DeviceList.lh_Head
23 printf "Base OpenC Name\n"
24 printf "---------------------------------------------------------------\n"
25 while ($dev->ln_Succ != 0)
26 printf "%p %5d %s\n", \
28 ((struct Library *)$dev)->lib_OpenCnt, \
30 set $dev = $dev->ln_Succ
34 List the current devices in the system
38 set $res = SysBase->ResourceList.lh_Head
40 printf "---------------------------------------------------------------\n"
41 while ($res->ln_Succ != 0)
42 printf "%p %s\n", $res, $res->ln_Name
43 set $res = $res->ln_Succ
47 List the current resources in the system
51 set $resp = (struct Resident **)SysBase->ResModules
54 printf "Address Pri Flags Vers Type Name\n"
55 printf "--------------------------------------------------------------\n"
56 while (($resp)[$i] != 0)
57 set $res = ($resp)[$i]
58 printf "%p %4d %02x %3d %3d %s\n", \
60 ((struct Resident *)$res)->rt_Pri, \
61 ((struct Resident *)$res)->rt_Flags, \
62 ((struct Resident *)$res)->rt_Version, \
63 ((struct Resident *)$res)->rt_Type, \
64 ((struct Resident *)$res)->rt_Name
69 List the system resident list
73 set $task = (struct Task *)SysBase->TaskReady.lh_Head
75 printf "Task SigWait SigRecvd StkSize StkUsed Pri Type Name\n"
76 printf "-----------------------------------------------------------------------------\n"
77 while ($task->tc_Node.ln_Succ != 0)
78 printf "%p %p %p %8d %8d %3d %3ld %s\n", \
82 $task->tc_SPUpper - $task->tc_SPLower, \
83 $task->tc_SPUpper - $task->tc_SPReg, \
84 $task->tc_Node.ln_Pri, \
85 $task->tc_Node.ln_Type, \
86 $task->tc_Node.ln_Name
87 set $task = (struct Task *)$task->tc_Node.ln_Succ
91 List of tasks currently ready to run
95 set $task = (struct Task *)SysBase->TaskWait.lh_Head
97 printf "Task SigWait SigRecvd StkSize StkUsed Pri Type Name\n"
98 printf "-----------------------------------------------------------------------------\n"
99 while ($task->tc_Node.ln_Succ != 0)
100 printf "%p %p %p %8d %8d %3d %3ld %s\n", \
103 $task->tc_SigRecvd, \
104 $task->tc_SPUpper - $task->tc_SPLower, \
105 $task->tc_SPUpper - $task->tc_SPReg, \
106 $task->tc_Node.ln_Pri, \
107 $task->tc_Node.ln_Type, \
108 $task->tc_Node.ln_Name
109 set $task = (struct Task *)$task->tc_Node.ln_Succ
113 List of tasks currently waiting for an event
117 set $task = (struct Task *)SysBase->ThisTask
118 printf "Task SigWait SigRecvd StkSize StkUsed Pri Type Name\n"
119 printf "-----------------------------------------------------------------------------\n"
120 printf "%p %p %p %8d %8d %3d %3ld %s\n", \
123 $task->tc_SigRecvd, \
124 $task->tc_SPUpper - $task->tc_SPLower, \
125 $task->tc_SPUpper - $task->tc_SPReg, \
126 $task->tc_Node.ln_Pri, \
127 $task->tc_Node.ln_Type, \
128 $task->tc_Node.ln_Name
131 Print out information about the currently running task.
136 printf "Segment Module\n"
137 printf "---------------------------------------------------------------------\n"
139 set $segnode = (struct segment *)Debug_ModList->mlh_Head
141 while ($segnode->s_node.mln_Succ != 0)
142 printf "%p %12s %2u %32s\n", $segnode->s_lowest, $segnode->s_name, $segnode->s_num, $segnode->s_mod->mod.m_name
144 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
149 List of all the modules currently loaded in memory
155 #first search in modules loaded from disk
156 printf "Searching in the loaded modules...\n"
158 set $segnode = (struct segment *)Debug_ModList->mlh_Head
160 while ($segnode->s_node.mln_Succ != 0) && $cont
161 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
162 printf "Address found in %s, in segment %p.\nIf this is an executable, its .text section starts at %p.\n", $segnode->s_mod->mod.m_name, $segnode->s_seg, $segnode->s_lowest
166 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
170 #then in the resident list
172 printf "Searching in the resident list...\n"
175 set $resp = (struct Resident **)SysBase->ResModules
178 while (($resp)[$i] != 0) && $cont
179 set $res = ($resp)[$i]
181 if ($arg0 >= $res) && ($arg0 <= $res->rt_EndSkip)
182 printf "Address found in %s, which resides at %p\n", $res->rt_Name, $res
190 printf "No matching module for this address\n"
194 -Shows the module that contains the given address
196 -To debug a problem in AROS, do the following:
198 -1. Get a stacktrace with bt or similar.
199 -2. Use findaddr with such an address to find out in which
201 -3. Use add-symbol-file to load that modules symbols.
202 -4. Now you can run bt (or similar) again and you should see the
203 - addresses resolved as symbols.
209 -(gdb) findaddr 0x4058d45b
211 -Searching in the loaded modules...
212 -Address found in Workbench:contrib/Zune/Libs/muimaster.library, which is loaded at 0x405379a4.
213 -If this is an executable, its .text section starts at 0x405379b0.
214 -(gdb) add-symbol-file contrib/Zune/Libs/muimaster.library 0x405379b0
215 -add symbol table from file "contrib/Zune/Libs/muimaster.library" at
216 - .text_addr = 0x405379b0
218 -Reading symbols from contrib/Zune/Libs/muimaster.library...done.
220 -#0 0x4058d45b in strlen (ptr=0x80 <Address 0x80 out of bounds>) at strlen.c:45
221 -#1 0x00000000 in lastx.78 ()
225 set $list = (struct TagItem *)$arg0
227 printf "Tag Data (Hex) Data (Dec)\n"
228 printf "--------------------------------------\n"
230 while $list->ti_Tag != 0
231 # Handle the possible control tag...
232 if $list->ti_Tag == 1
233 printf "TAG_IGNORE\n"
234 else if $list->ti_Tag == 2
235 printf "TAG_MORE %p\n", $list->ti_Data
236 set $list = (struct TagItem *)$list->ti_Data
237 else if $list->ti_Tag == 3
238 printf "TAG_SKIP %d\n", $list->ti_Data
239 set $list = $list + $list->ti_Tag + 1
241 printf "%p %p %9lu\n", $list->ti_Tag, $list->ti_Data, $list->ti_Data
242 set $list = $list + 1
247 document printtaglist
251 set logging file $arg0
252 set logging redirect on
253 set logging overwrite $arg1
265 set $segnode = (struct segment *)Debug_ModList->mlh_Head
266 while ($segnode->s_node.mln_Succ != 0) && $step == 1
267 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
268 printf "%s", $segnode->s_mod->mod.m_name
269 log_to_file segname.tmp on
270 printf "%s", $segnode->s_mod->mod.m_name
272 shell sed -i 's/.*:\(.*\)/\1/' segname.tmp
273 log_to_file loadseg.tmp on
274 printf "add-symbol-file "
276 shell head -n1 segname.tmp >>loadseg.tmp
277 log_to_file loadseg.tmp off
278 printf " %p", $segnode->s_lowest
279 if $segnode->s_node.mln_Succ != 0
280 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
281 while ($segnode->s_node.mln_Succ != 0) && $step < 5
282 if strcmp($segnode->s_name, ".text") == 0
285 printf " -s %s %p", $segnode->s_name, $segnode->s_lowest
286 set $step = $step + 1
287 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
294 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
297 printf "no matching module for this address\n"
300 printf "no debug symbols found\n"
304 Loads the module that contains the given address
311 printf "Hunk num. | Start addr | Size \n"
312 printf "----------+------------+------------\n"
314 printf "%9d | %p | %10d\n", $count, $nextseg + sizeof(BPTR), *((ULONG *)$nextseg - 1) - sizeof(BPTR)
316 set $nextseg = *(BPTR *)$nextseg
317 set $count = $count+1
321 Shows the segments chain of the given seglist