1 handle SIGUSR1 pass noprint nostop
2 handle SIGUSR2 pass noprint nostop
5 set $lib = ((struct ExecBase *)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 = ((struct ExecBase *)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 = ((struct ExecBase *)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 **)((struct ExecBase *)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 *)((struct ExecBase *)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 *)((struct ExecBase *)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 *)((struct ExecBase *)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.
135 printf "Segment Module\n"
138 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->m_name
144 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
148 printf "---------------------------------------------------------------------\n"
149 set $kicknode = Debug_KickList
151 while ($kicknode != 0)
152 set $eh = $kicknode->eh
153 set $sh = $kicknode->sh
154 set $shnum = $eh->shnum
158 if ($sh->addr != 0) && ($sh->size != 0)
159 printf "%p %12s %2u %32s\n", $sh->addr, $i, $kicknode->Name
164 set $kicknode = $kicknode->Next
168 List of all the modules currently loaded in memory
174 #first search in modules loaded from disk
175 printf "Searching in the loaded modules...\n"
177 set $segnode = (struct segment *)Debug_ModList->mlh_Head
179 while ($segnode->s_node.mln_Succ != 0) && $cont
180 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
181 printf "Address found in %s, in segment %p.\nIf this is an executable, its .text section starts at %p.\n", $segnode->s_mod->m_name, $segnode->s_seg, $segnode->s_lowest
185 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
190 printf "Searching in the kickstart list...\n"
191 set $kicknode = Debug_KickList
193 while ($kicknode != 0) && $cont
194 set $eh = $kicknode->eh
195 set $sh = $kicknode->sh
196 set $shnum = $eh->shnum
199 while ($i < $shnum) && $cont
200 if ($sh->addr != 0) && ($sh->size != 0)
201 set $lowest = $sh->addr
202 set $highest = $sh->addr + $sh->size - 1
204 if $arg0 >= $lowest && $arg0 <= $highest
205 printf "Address found in %s in section number %d starting at %p.\n", $kicknode->Name, $i, $lowest
213 set $kicknode = $kicknode->Next
217 #then in the resident list
219 printf "Searching in the resident list...\n"
222 set $resp = (struct Resident **)((struct ExecBase *)SysBase)->ResModules
225 while (($resp)[$i] != 0) && $cont
226 set $res = ($resp)[$i]
228 if ($arg0 >= $res) && ($arg0 <= $res->rt_EndSkip)
229 printf "Address found in %s, which resides at %p\n", $res->rt_Name, $res
237 printf "No matching module for this address\n"
241 -Shows the module that contains the given address
243 -To debug a problem in AROS, do the following:
245 -1. Get a stacktrace with bt or similar.
246 -2. Use findaddr with such an address to find out in which
248 -3. Use add-symbol-file to load that modules symbols.
249 -4. Now you can run bt (or similar) again and you should see the
250 - addresses resolved as symbols.
256 -(gdb) findaddr 0x4058d45b
258 -Searching in the loaded modules...
259 -Address found in Workbench:contrib/Zune/Libs/muimaster.library, which is loaded at 0x405379a4.
260 -If this is an executable, its .text section starts at 0x405379b0.
261 -(gdb) add-symbol-file contrib/Zune/Libs/muimaster.library 0x405379b0
262 -add symbol table from file "contrib/Zune/Libs/muimaster.library" at
263 - .text_addr = 0x405379b0
265 -Reading symbols from contrib/Zune/Libs/muimaster.library...done.
267 -#0 0x4058d45b in strlen (ptr=0x80 <Address 0x80 out of bounds>) at strlen.c:45
268 -#1 0x00000000 in lastx.78 ()
272 set $list = (struct TagItem *)$arg0
274 printf "Tag Data (Hex) Data (Dec)\n"
275 printf "--------------------------------------\n"
277 while $list->ti_Tag != 0
278 # Handle the possible control tag...
279 if $list->ti_Tag == 1
280 printf "TAG_IGNORE\n"
281 else if $list->ti_Tag == 2
282 printf "TAG_MORE %p\n", $list->ti_Data
283 set $list = (struct TagItem *)$list->ti_Data
284 else if $list->ti_Tag == 3
285 printf "TAG_SKIP %d\n", $list->ti_Data
286 set $list = $list + $list->ti_Tag + 1
288 printf "%p %p %9lu\n", $list->ti_Tag, $list->ti_Data, $list->ti_Data
289 set $list = $list + 1
294 document printtaglist
298 set logging file $arg0
299 set logging redirect on
300 set logging overwrite $arg1
312 set $segnode = (struct segment *)Debug_ModList->mlh_Head
313 while ($segnode->s_node.mln_Succ != 0) && $step == 1
314 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
315 log_to_file segname.tmp on
316 printf "%s", $segnode->s_mod->m_name
318 shell sed -i 's/.*:\(.*\)/\1/' segname.tmp
319 log_to_file loadseg.tmp on
320 printf "add-symbol-file "
322 shell head -n1 segname.tmp >>loadseg.tmp
323 log_to_file loadseg.tmp off
324 printf " %p", $segnode->s_lowest
325 if $segnode->s_node.mln_Succ != 0
326 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
327 while ($segnode->s_node.mln_Succ != 0) && $step < 5
328 if strcmp($segnode->s_name, ".text") == 0
331 printf " -s %s %p", $segnode->s_name, $segnode->s_lowest
332 set $step = $step + 1
333 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
340 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
343 set $kicknode = Debug_KickList
345 while ($kicknode != 0) && $step == 1
346 set $eh = $kicknode->eh
347 set $sh = $kicknode->sh
348 set $shnum = $eh->shnum
351 while ($i < $shnum) && $cont
352 if ($sh->addr != 0) && ($sh->size != 0)
353 set $lowest = $sh->addr
354 set $highest = $sh->addr + $sh->size - 1
356 if $arg0 >= $lowest && $arg0 <= $highest
358 set $shstrndx = $eh->shstrndx
361 if ($shstrndx < 0xFF00)
362 set $shstr = $shstrndx
363 if ($shstrndx > 0xFFFF)
364 set $shstr = $shstrndx - (0x10000 - 0xFF00)
366 log_to_file segname.tmp on
367 printf "%s", $kicknode->s_module.m_name
369 shell sed -i 's/.*:\(.*\)/\1/' segname.tmp
370 log_to_file loadseg.tmp on
371 printf "add-symbol-file "
373 shell head -n1 segname.tmp >>loadseg.tmp
374 log_to_file loadseg.tmp off
375 printf " %p", $s_lowest
380 if ($sh->addr != 0) && ($sh->size != 0)
381 set $segname = $kicknode->sh[$shstr] + $sh->name
382 printf " -s %s %p", $segname, $sh->addr
384 set $step = $step + 1
396 set $kicknode = $kicknode->Next
400 printf "no matching module for this address\n"
402 printf "no debug symbols found\n"
406 Loads the module that contains the given address
413 printf "Hunk num. | Start addr | Size \n"
414 printf "----------+------------+------------\n"
416 printf "%9d | %p | %10d\n", $count, $nextseg + sizeof(BPTR), *((ULONG *)$nextseg - 1) - sizeof(BPTR)
418 set $nextseg = *(BPTR *)$nextseg
419 set $count = $count+1
423 Shows the segments chain of the given seglist