home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Developer CD v1.2
/
amidev_cd_12.iso
/
devcon
/
milan_1991
/
devcon91.3
/
debug
/
debugger
/
s
/
wack
/
exec.macros
next >
Wrap
Text File
|
1992-09-01
|
14KB
|
418 lines
;exec.macros V1.5
;EXEC Execbase structure
(macro ExecBase
(addsymbol EBase (@l (addsymbol SysBase 4)))
(addsymbol eb_LibNode EBase)
(addsymbol eb_SoftVer (+ eb_LibNode 22))
(addsymbol eb_LowMemChkSum (+ eb_SoftVer 2))
(addsymbol eb_ChkBase (+ eb_LowMemChkSum 2))
(addsymbol eb_ColdCapture (+ eb_ChkBase 4))
(addsymbol eb_CoolCapture (+ eb_ColdCapture 4))
(addsymbol eb_WarmCapture (+ eb_CoolCapture 4))
(addsymbol eb_SysStkUpper (+ eb_WarmCapture 4))
(addsymbol eb_SysStkLower (+ eb_SysStkUpper 4))
(addsymbol eb_MaxLocMem (+ eb_SysStkLower 4))
(addsymbol eb_DebugEntry (+ eb_MaxLocMem 4))
(addsymbol eb_DebugData (+ eb_DebugEntry 4))
(addsymbol eb_AlertData (+ eb_DebugData 4))
(addsymbol eb_MaxExtMem (+ eb_AlertData 4))
(addsymbol eb_ChkSum (+ eb_MaxExtMem 4))
(addsymbol eb_IntVects (+ eb_ChkSum 2))
(addsymbol eb_ThisTask (+ eb_IntVects c0))
(addsymbol eb_IdleCount (+ eb_ThisTask 4))
(addsymbol eb_DispCount (+ eb_IdleCount 4))
(addsymbol eb_Quantum (+ eb_DispCount 4))
(addsymbol eb_Elapsed (+ eb_Quantum 2))
(addsymbol eb_SysFlags (+ eb_Elapsed 2))
(addsymbol eb_IDNestCnt (+ eb_SysFlags 2))
(addsymbol eb_TDNestCnt (+ eb_IDNestCnt 1))
(addsymbol eb_AttnFlags (+ eb_TDNestCnt 1))
(addsymbol eb_AttnResched (+ eb_AttnFlags 2))
(addsymbol eb_ResModules (+ eb_AttnResched 2))
(addsymbol eb_TaskTrapCode (+ eb_ResModules 4))
(addsymbol eb_TaskExceptCode (+ eb_TaskTrapCode 4))
(addsymbol eb_TaskExitCode (+ eb_TaskExceptCode 4))
(addsymbol eb_TaskSigAlloc (+ eb_TaskExitCode 4))
(addsymbol eb_TaskTrapAlloc (+ eb_TaskSigAlloc 4))
(addsymbol eb_MemList (+ eb_TaskTrapAlloc 2))
(addsymbol eb_ResourceList (+ eb_MemList e))
(addsymbol eb_DeviceList (+ eb_ResourceList e))
(addsymbol eb_IntrList (+ eb_DeviceList e))
(addsymbol eb_LibList (+ eb_IntrList e))
(addsymbol eb_PortList (+ eb_LibList e))
(addsymbol eb_TaskReady (+ eb_PortList e))
(addsymbol eb_TaskWait (+ eb_TaskReady e))
(addsymbol eb_SoftInts (+ eb_TaskWait e))
(addsymbol eb_LastAlert (+ eb_SoftInts 50))
(addsymbol eb_VBlankFrequency (+ eb_LastAlert 4))
(addsymbol eb_PowerSupplyFrequency (+ eb_VBlankFrequency 1))
(addsymbol eb_SemaphoreList (+ eb_PowerSupplyFrequency 1))
(addsymbol eb_KickMemPtr (+ eb_SemaphoreList e))
(addsymbol eb_KickTagPtr (+ eb_KickMemPtr 4))
(addsymbol eb_KickCheckSum (+ eb_KickTagPtr 4))
(addsymbol eb_ExecBaseReserve (+ eb_KickCheckSum 4))
(addsymbol eb_ExecBaseNewReserve (+ eb_ExecBaseReserve 1))
)
;EXEC Library structure
(macro Library
(if (!= (nargs) 0)
(addsymbol lib_Node (arg 1))
(addsymbol lib_Node (current)))
(addsymbol lib_Flags (+ lib_Node e))
(addsymbol lib_pad (+ lib_Flags 1))
(addsymbol lib_NegSize (+ lib_pad 1))
(addsymbol lib_PosSize (+ lib_NegSize 2))
(addsymbol lib_Version (+ lib_PosSize 2))
(addsymbol lib_Revision (+ lib_Version 2))
(addsymbol lib_IdString (+ lib_Revision 2))
(addsymbol lib_Sum (+ lib_IdString 4))
(addsymbol lib_OpenCnt (+ lib_Sum 4))
)
;EXEC List structure
(macro List
(if (!= (nargs) 0)
(addsymbol lh_Head (arg 1))
(addsymbol lh_Head (current)))
(addsymbol lh_Tail (+ lh_Head 4))
(addsymbol lh_TailPred (+ lh_Tail 4))
(addsymbol lh_Type (+ lh_TailPred 4))
(addsymbol lh_pad (+ lh_Type 1))
)
;EXEC MemChunk structure
(macro MemChunk
(if (!= (nargs) 0)
(addsymbol mc_Next (arg 1))
(addsymbol mc_Next (current)))
(addsymbol mc_Bytes (+ mc_Next 4))
)
;EXEC MemHeader structure
(macro MemHeader
(if (!= (nargs) 0)
(addsymbol mh_Node (arg 1))
(addsymbol mh_Node (current)))
(addsymbol mh_Attributes (+ mh_Node e))
(addsymbol mh_First (+ mh_Attributes 2))
(addsymbol mh_Lower (+ mh_First 4))
(addsymbol mh_Upper (+ mh_Lower 4))
(addsymbol mh_Free (+ mh_Upper 4))
)
;EXEC Resident structure
(macro Resident
(if (!= (nargs) 0)
(addsymbol rt_MatchWord (arg 1))
(addsymbol rt_MatchWord (current)))
(addsymbol rt_MatchTag (+ rt_MatchWord 2))
(addsymbol rt_EndSkip (+ rt_MatchTag 4))
(addsymbol rt_Flags (+ rt_EndSkip 4))
(addsymbol rt_Version (+ rt_Flags 1))
(addsymbol rt_Type (+ rt_Version 1))
(addsymbol rt_Pri (+ rt_Type 1))
(addsymbol rt_Name (+ rt_Pri 1))
(addsymbol rt_IdString (+ rt_Name 4))
(addsymbol rt_Init (+ rt_IdString 4))
)
;EXEC Task structure
(macro Task
(if (!= (nargs) 0)
(addsymbol tc_Node (arg 1))
(addsymbol tc_Node (current)))
(addsymbol tc_Flags (+ tc_Node e))
(addsymbol tc_State (+ tc_Flags 1))
(addsymbol tc_IDNestCnt (+ tc_State 1))
(addsymbol tc_TDNestCnt (+ tc_IDNestCnt 1))
(addsymbol tc_SigAlloc (+ tc_TDNestCnt 1))
(addsymbol tc_SigWait (+ tc_SigAlloc 4))
(addsymbol tc_SigRecvd (+ tc_SigWait 4))
(addsymbol tc_SigExcept (+ tc_SigRecvd 4))
(addsymbol tc_TrapAlloc (+ tc_SigExcept 4))
(addsymbol tc_TrapAble (+ tc_TrapAlloc 2))
(addsymbol tc_ExceptData (+ tc_TrapAble 2))
(addsymbol tc_ExceptCode (+ tc_ExceptData 4))
(addsymbol tc_TrapData (+ tc_ExceptCode 4))
(addsymbol tc_TrapCode (+ tc_TrapData 4))
(addsymbol tc_SPReg (+ tc_TrapCode 4))
(addsymbol tc_SPLower (+ tc_SPReg 4))
(addsymbol tc_SPUpper (+ tc_SPLower 4))
(addsymbol tc_Switch (+ tc_SPUpper 4))
(addsymbol tc_Launch (+ tc_Switch 4))
(addsymbol tc_MemEntry (+ tc_Launch 4))
(addsymbol tc_UserData (+ tc_MemEntry e))
)
;DOS Process structure
(macro Process
(if (!= (nargs) 0)
(addsymbol pr_Task (arg 1))
(addsymbol pr_Task (current)))
(addsymbol pr_MsgPort (+ pr_Task 5c))
(addsymbol pr_Pad (+ pr_MsgPort 22))
(addsymbol pr_SegList (+ pr_Pad 2))
(addsymbol pr_StackSize (+ pr_SegList 4))
(addsymbol pr_GlobVec (+ pr_StackSize 4))
(addsymbol pr_TaskNum (+ pr_GlobVec 4))
(addsymbol pr_StackBase (+ pr_TaskNum 4))
(addsymbol pr_Result2 (+ pr_StackBase 4))
(addsymbol pr_CurrentDir (+ pr_Result2 4))
(addsymbol pr_CIS (+ pr_CurrentDir 4))
(addsymbol pr_COS (+ pr_CIS 4))
(addsymbol pr_ConsoleTask (+ pr_COS 4))
(addsymbol pr_FileSystemTask (+ pr_ConsoleTask 4))
(addsymbol pr_CLI (+ pr_FileSystemTask 4))
(addsymbol pr_ReturnAddr (+ pr_CLI 4))
(addsymbol pr_PktWait (+ pr_ReturnAddr 4))
(addsymbol pr_WindowPtr (+ pr_PktWait 4))
)
;DOS CommandLineInterface structure
(macro CommandLineInterface
(if (!= (nargs) 0)
(addsymbol cli_Result2 (arg 1))
(addsymbol cli_Result2 (current)))
(addsymbol cli_SetName (+ cli_Result2 4))
(addsymbol cli_CommandDir (+ cli_SetName 4))
(addsymbol cli_ReturnCode (+ cli_CommandDir 4))
(addsymbol cli_CommandName (+ cli_ReturnCode 4))
(addsymbol cli_FailLevel (+ cli_CommandName 4))
(addsymbol cli_Prompt (+ cli_FailLevel 4))
(addsymbol cli_StandardInput (+ cli_Prompt 4))
(addsymbol cli_CurrentInput (+ cli_StandardInput 4))
(addsymbol cli_CommandFile (+ cli_CurrentInput 4))
(addsymbol cli_Interactive (+ cli_CommandFile 4))
(addsymbol cli_Background (+ cli_Interactive 4))
(addsymbol cli_CurrentOutput (+ cli_Background 4))
(addsymbol cli_DefaultStack (+ cli_CurrentOutput 4))
(addsymbol cli_StandardOutput (+ cli_DefaultStack 4))
(addsymbol cli_Module (+ cli_StandardOutput 4))
)
;show some important ExecBase members
(macro ebase
(ExecBase)
(print "ExecBase at %8lx, Version: %ld\n" EBase (@ eb_SoftVer))
(print "ColdCapture $%06lx CoolCapture $%06lx WarmCapture $%06lx\n"
(@l eb_ColdCapture) (@l eb_CoolCapture) (@l eb_WarmCapture))
(print "SysStkUpper $%06lx SysStkLower $%06lx MaxLocMem $%06lx\n"
(@l eb_SysStkUpper) (@l eb_SysStkLower) (@l eb_MaxLocMem))
(print "DebugEntry $%06lx DebugData $%06lx AlertData $%06lx\n"
(@l eb_DebugEntry) (@l eb_DebugData) (@l eb_AlertData))
(print "TrapCode $%06lx ExceptCode $%06lx ExitCode $%06lx\n"
(@l eb_TaskTrapCode) (@l eb_TaskExceptCode) (@l eb_TaskExitCode))
(print "SigAlloc $%08lx TrapAlloc $%04lx\n"
(@l eb_TaskSigAlloc) (@ eb_TaskTrapAlloc))
(print "ThisTask $%06lx SysFlags $%04lx\n"
(@l eb_ThisTask) (@ eb_SysFlags))
(print "IdleCount %8ld DispCount %8ld\n"
(@l eb_IdleCount) (@l eb_DispCount))
(print "Quantum %5ld Elapsed %5ld\n"
(@ eb_Quantum) (@ eb_Elapsed))
(print "IDNestCnt %4ld TDNestCnt %4ld\n"
(@b eb_IDNestCnt) (@b eb_TDNestCnt))
(print "AttnFlags $%04lx\n" (@ eb_AttnFlags))
)
;show one of four lists
(macro showlist
(ExecBase)
(select
(== (arg 1) 1) (List eb_DeviceList)
(== (arg 1) 2) (List eb_LibList)
(== (arg 1) 3) (List eb_ResourceList)
(== (arg 1) 4) (List (current)))
(print "Address NT Pri Ver Rev Name\n")
(for (Node (@l lh_Head)) (!= (@l ln_Succ) 0) (Node (@l ln_Succ))
(
(Library ln_Succ)
(print "$%6lx %2lx " lib_Node (@b ln_Type))
(signb (@b ln_Pri))
(print " %3ld %3ld \"%s\"\n" (@ lib_Version) (@ lib_Revision)
(@l ln_Name))
))
)
;show device list
(macro devices
(showlist 1)
)
;show library list
(macro libraries
(showlist 2)
)
;show resource list
(macro resources
(showlist 3)
)
;show a list of nodes
(macro nodes
(showlist 4)
)
;show memory allocation list
(macro memory
(ExecBase)
(MemHeader (@l eb_MemList))
(forbid)
(print "$%lx attr:%lx lower:$%lx upper:$%lx first:$%lx free:$%ld.\n"
mh_Node (@ mh_Attributes) (@l mh_Lower) (@l mh_Upper) (@l mh_First)
(@l mh_Free))
(for (MemChunk (@l mh_First)) (!= mc_Next 0) (MemChunk (@l mc_Next))
(
(print " %6lx size:%6lx (%ld.)\n" mc_Next (@l mc_Bytes)
(@l mc_Bytes))
))
(permit)
)
;show system modules
(macro modules (local res)
(ExecBase)
(print "Address Pri Type Ver Name\n")
(= res (@l eb_ResModules))
(while(!= (@l res) 0)
(
(Resident (@l res))
(print "$%6lx " (@l res))
(signb (@b rt_Pri))
(print " %4ld %3ld %s" (@b rt_Type) (@b rt_Version) (@l rt_IdString))
(= res (+ res 4))
))
)
;print task state
(macro PrintTaskState (local state)
(= state (@b tc_State))
(if (or (< state 0) (> state 6)) (= state 0))
(select
(== state 0) (print "????")
(== state 1) (print " add")
(== state 2) (print " run")
(== state 3) (print "redy")
(== state 4) (print "wait")
(== state 5) (print "expt")
(== state 6) (print "remv")
)
)
;tasks subroutine: show task
(macro ShowTaskHead
(Task ln_Succ)
(print "$%06lx %2ld " tc_Node (@b ln_Type))
(signb (@b ln_Pri))
(PrintTaskState)
(print " $%08lx $%06lx \"%s\"\n" (@l tc_SigWait) (@l tc_SPReg)
(@l ln_Name))
)
;show all tasks
(macro tasks
(ExecBase)
(print "Address NT Pri Stat SigWait SPReg Name\n")
(disable)
(Node (@l eb_ThisTask))
(ShowTaskHead)
(List eb_TaskReady)
(for (Node (@l lh_Head)) (!= (@l ln_Succ) 0) (Node (@l ln_Succ))
(ShowTaskHead)
)
(List eb_TaskWait)
(for (Node (@l lh_Head)) (!= (@l ln_Succ) 0) (Node (@l ln_Succ))
(ShowTaskHead)
)
(enable)
)
;format given address or current frame as a Task
(macro showtask (local i cpu AFB_68020)
(if (!= (nargs) 0)
(Task (arg 1))
(Task (current)))
(ExecBase)
(= AFB_68020 1)
(Node tc_Node)
(print "'%s', in " (@l ln_Name))
(PrintTaskState)
(print " state (#%ld) at priority " (@b tc_State))
(signb (@b ln_Pri))
(print " \n")
(print "Type %ld Flags %02lx IDNestCnt %ld TDNestCnt %ld\n"
(@b ln_Type) (@b tc_Flags) (@b tc_IDNestCnt) (@b tc_TDNestCnt))
(print "Signal: Alloc %08lx Wait %08lx Recvd %08lx Except %08lx\n"
(@l tc_SigAlloc) (@l tc_SigWait) (@l tc_SigRecvd) (@l tc_SigExcept))
(print "Trap: Data %08lx Code %08lx Alloc %04lx Able %04lx\n"
(@l tc_TrapData) (@l tc_TrapCode) (@ tc_TrapAlloc) (@ tc_TrapAble))
(print "Except: Data %08lx Code %08lx\n"
(@l tc_ExceptData) (@l tc_ExceptCode))
(print "Stack: Reg %08lx Lower %08lx Upper %08lx\n"
(@l tc_SPReg) (@l tc_SPLower) (@l tc_SPUpper))
(if (and (@ eb_AttnFlags) AFB_68020) (= cpu 4) (= cpu 0))
(if (or (== (@b tc_State) 3) (== (@b tc_State) 4))
(
(print "CPURegs: PC %08lx SR %04lx\n"
(@l (+ cpu (@l tc_SPReg))) (@ (+ (+ 4 cpu) (@l tc_SPReg))))
(print "D: ")
(for (= i 0) (< i 8) (= i (+ 1 i))
(print "%08lx " (@l (+ (+ (+ 6 cpu) (@l tc_SPReg)) (* i 4)))))
(print "\nA: ")
(for (= i 8) (< i f) (= i (+ 1 i))
(print "%08lx " (@l (+ (+ (+ 6 cpu) (@l tc_SPReg)) (* i 4)))))
))
(print "\n")
)
;format given address or current frame as a Process
(macro showprocess (local addr)
(if (!= (nargs) 0)
(= addr (arg 1))
(= addr (current)))
(showtask addr)
(Process addr)
(print "Process Dependent ------------------------------------------\n")
(print "SegList $%08lx StackSize $%08lx GlobVec $%08lx\n"
(LTOB pr_SegList) (@l pr_StackSize) (@l pr_GlobVec))
(print "TaskNum %8ld StackBase $%08lx Result2 %8ld\n"
(@l pr_TaskNum) (LTOB pr_StackBase) (@l pr_Result2))
(print "CurrentDir $%08lx CIS $%08lx COS $%08lx\n"
(LTOB pr_CurrentDir) (LTOB pr_CIS) (LTOB pr_COS))
(print "ConsoleTask $%08lx FileSysTask $%08lx CLI $%08lx\n"
(@l pr_ConsoleTask) (@l pr_FileSystemTask) (LTOB pr_CLI))
(print "ReturnAddr $%08lx PktWait $%08lx\n"
(@l pr_ReturnAddr) (@l pr_PktWait))
(if (== 0 (@l pr_CLI))
(return 0))
(print "\nCLI Dependent ----------------------------------------------\n")
(CommandLineInterface (LTOB pr_CLI))
(print "Command: ") (BSTR cli_CommandName)
(print ", Directory: ") (BSTR cli_SetName)
(print "\n")
(print "Module (SegList) $%08lx\n" (LTOB cli_Module))
(print "DefaultStack $%08lx ReturnCode %8ld\n"
(@l cli_DefaultStack) (@l cli_ReturnCode))
)
;key bindings
(key '~0 libraries)
(key '~1 modules)
(key '~2 devices)
(key '~3 resources)
(key '~4 memory)
(key '~5 tasks)
(key '~6 showtask)
(key '~7 showprocess)
(key '~8 ebase)
(key '~9 symbols)