2 Copyright © 2013-2014, The AROS Development Team. All rights reserved.
9 /******************************************************************************
26 Dumps debug symbols to the file "SYS:symbols.out" to be used with
27 Callgrind. See "Debugging manual" at www.aros.org.
45 ******************************************************************************/
47 #include <utility/hooks.h>
48 #include <libraries/debug.h>
49 #include <proto/exec.h>
50 #include <proto/dos.h>
51 #include <proto/debug.h>
53 const TEXT version
[] = "$VER: SymbolDump 1.1 (18.5.2014)\n";
55 struct Library
* DebugBase
= NULL
;
57 AROS_UFH3(static void, symbolhandler
,
58 AROS_UFHA(struct Hook
*, hook
, A0
),
59 AROS_UFHA(APTR
, object
, A2
),
60 AROS_UFHA(struct SymbolInfo
*, message
, A1
))
64 FPrintf(hook
->h_Data
, "S|%s|%s|0x%p|0x%p\n", message
->si_ModuleName
, message
->si_SymbolName
,
65 message
->si_SymbolStart
, message
->si_SymbolEnd
);
70 static void OpenLibraries()
72 DebugBase
= OpenLibrary("debug.library", 0L);
75 static void CloseLibraries()
77 CloseLibrary(DebugBase
);
87 output
= Open("SYS:symbols.out", MODE_NEWFILE
);
92 handler
.h_Entry
= (HOOKFUNC
)symbolhandler
;
93 handler
.h_Data
= (APTR
)output
;
95 EnumerateSymbolsA(&handler
, NULL
);