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.
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->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 printf "%p %12s %2u %32s\n", $kicknode->s_lowest, $kicknode->s_name, $kicknode->s_num, $kicknode->s_module.m_name
154 set $kicknode = $kicknode->s_next
158 List of all the modules currently loaded in memory
164 #first search in modules loaded from disk
165 printf "Searching in the loaded modules...\n"
167 set $segnode = (struct segment *)Debug_ModList->mlh_Head
169 while ($segnode->s_node.mln_Succ != 0) && $cont
170 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
171 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
175 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
180 printf "Searching in the kickstart list...\n"
181 set $kicknode = Debug_KickList
183 while ($kicknode != 0) && $cont
185 if $arg0 >= $kicknode->s_lowest && $arg0 <= $kicknode->s_highest
186 printf "Address found in %s.\nIf this is an executable, its .text section starts at %p.\n", $kicknode->s_module.m_name, $kicknode->s_lowest
190 set $kicknode = $kicknode->s_next
194 #then in the resident list
196 printf "Searching in the resident list...\n"
199 set $resp = (struct Resident **)SysBase->ResModules
202 while (($resp)[$i] != 0) && $cont
203 set $res = ($resp)[$i]
205 if ($arg0 >= $res) && ($arg0 <= $res->rt_EndSkip)
206 printf "Address found in %s, which resides at %p\n", $res->rt_Name, $res
214 printf "No matching module for this address\n"
218 -Shows the module that contains the given address
220 -To debug a problem in AROS, do the following:
222 -1. Get a stacktrace with bt or similar.
223 -2. Use findaddr with such an address to find out in which
225 -3. Use add-symbol-file to load that modules symbols.
226 -4. Now you can run bt (or similar) again and you should see the
227 - addresses resolved as symbols.
233 -(gdb) findaddr 0x4058d45b
235 -Searching in the loaded modules...
236 -Address found in Workbench:contrib/Zune/Libs/muimaster.library, which is loaded at 0x405379a4.
237 -If this is an executable, its .text section starts at 0x405379b0.
238 -(gdb) add-symbol-file contrib/Zune/Libs/muimaster.library 0x405379b0
239 -add symbol table from file "contrib/Zune/Libs/muimaster.library" at
240 - .text_addr = 0x405379b0
242 -Reading symbols from contrib/Zune/Libs/muimaster.library...done.
244 -#0 0x4058d45b in strlen (ptr=0x80 <Address 0x80 out of bounds>) at strlen.c:45
245 -#1 0x00000000 in lastx.78 ()
249 set $list = (struct TagItem *)$arg0
251 printf "Tag Data (Hex) Data (Dec)\n"
252 printf "--------------------------------------\n"
254 while $list->ti_Tag != 0
255 # Handle the possible control tag...
256 if $list->ti_Tag == 1
257 printf "TAG_IGNORE\n"
258 else if $list->ti_Tag == 2
259 printf "TAG_MORE %p\n", $list->ti_Data
260 set $list = (struct TagItem *)$list->ti_Data
261 else if $list->ti_Tag == 3
262 printf "TAG_SKIP %d\n", $list->ti_Data
263 set $list = $list + $list->ti_Tag + 1
265 printf "%p %p %9lu\n", $list->ti_Tag, $list->ti_Data, $list->ti_Data
266 set $list = $list + 1
271 document printtaglist
275 set logging file $arg0
276 set logging redirect on
277 set logging overwrite $arg1
289 set $segnode = (struct segment *)Debug_ModList->mlh_Head
290 while ($segnode->s_node.mln_Succ != 0) && $step == 1
291 if $arg0 >= $segnode->s_lowest && $arg0 <= $segnode->s_highest
292 log_to_file segname.tmp on
293 printf "%s", $segnode->s_mod->mod.m_name
295 shell sed -i 's/.*:\(.*\)/\1/' segname.tmp
296 log_to_file loadseg.tmp on
297 printf "add-symbol-file "
299 shell head -n1 segname.tmp >>loadseg.tmp
300 log_to_file loadseg.tmp off
301 printf " %p", $segnode->s_lowest
302 if $segnode->s_node.mln_Succ != 0
303 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
304 while ($segnode->s_node.mln_Succ != 0) && $step < 5
305 if strcmp($segnode->s_name, ".text") == 0
308 printf " -s %s %p", $segnode->s_name, $segnode->s_lowest
309 set $step = $step + 1
310 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
317 set $segnode = (struct segment *)$segnode->s_node.mln_Succ
320 set $kicknode = Debug_KickList
322 while ($kicknode != 0) && $step == 1
323 if $arg0 >= $kicknode->s_lowest && $arg0 <= $kicknode->s_highest
324 log_to_file segname.tmp on
325 printf "%s", $kicknode->s_module.m_name
327 shell sed -i 's/.*:\(.*\)/\1/' segname.tmp
328 log_to_file loadseg.tmp on
329 printf "add-symbol-file "
331 shell head -n1 segname.tmp >>loadseg.tmp
332 log_to_file loadseg.tmp off
333 printf " %p", $kicknode->s_lowest
334 if $kicknode->s_next != 0
335 set $kicknode = $kicknode->s_next
336 while ($kicknode != 0) && $step < 5
337 if strcmp($kicknode->s_name, ".text") == 0
340 printf " -s %s %p", $kicknode->s_name, $kicknode->s_lowest
341 set $step = $step + 1
342 set $kicknode = $kicknode->s_next
349 set $kicknode = $kicknode->s_next
353 printf "no matching module for this address\n"
356 printf "no debug symbols found\n"
360 Loads the module that contains the given address
367 printf "Hunk num. | Start addr | Size \n"
368 printf "----------+------------+------------\n"
370 printf "%9d | %p | %10d\n", $count, $nextseg + sizeof(BPTR), *((ULONG *)$nextseg - 1) - sizeof(BPTR)
372 set $nextseg = *(BPTR *)$nextseg
373 set $count = $count+1
377 Shows the segments chain of the given seglist