2 Copyright © 2013, The AROS Development Team. All rights reserved.
9 #include <libraries/debug.h>
10 #include <proto/kernel.h>
11 #include <proto/exec.h>
12 #include <aros/debug.h>
14 #include "debug_intern.h"
16 static void EnumerateModules(struct Hook
* handler
, struct Library
* DebugBase
);
18 /*****************************************************************************
21 #include <proto/debug.h>
23 AROS_LH2(void, EnumerateSymbolsA
,
26 AROS_LHA(struct Hook
*, handler
, A0
),
27 AROS_LHA(struct TagItem
*, tags
, A1
),
30 struct Library
*, DebugBase
, 8, Debug
)
33 Function will call the handler hook for all symbols from kickstart and
34 loaded modules that match the given search criteria.
36 The message that is passed to hook contains a pointer to struct SymbolInfo.
52 ******************************************************************************/
58 /* We can be called in supervisor mode. No semaphores in the case! */
61 ObtainSemaphoreShared(&DBGBASE(DebugBase
)->db_ModSem
);
63 EnumerateModules(handler
, DebugBase
);
66 ReleaseSemaphore(&DBGBASE(DebugBase
)->db_ModSem
);
71 static inline void callhook(struct Hook
* handler
, CONST_STRPTR modname
, CONST_STRPTR symname
,
74 struct SymbolInfo sinfo
= {0};
76 sinfo
.si_Size
= sizeof(struct SymbolInfo
);
77 sinfo
.si_ModuleName
= modname
;
78 sinfo
.si_SymbolName
= symname
;
79 sinfo
.si_SymbolStart
= start
;
80 sinfo
.si_SymbolEnd
= end
;
82 CALLHOOKPKT(handler
, NULL
, &sinfo
);
85 static void EnumerateModules(struct Hook
* handler
, struct Library
* DebugBase
)
89 ForeachNode(&DBGBASE(DebugBase
)->db_Modules
, mod
)
91 dbg_sym_t
*sym
= mod
->m_symbols
;
94 D(bug("[Debug] Checking module %s\n", mod
->m_name
));
96 for (i
= 0; i
< mod
->m_symcnt
; i
++)
98 APTR highest
= sym
[i
].s_highest
;
100 /* Symbols with zero length have zero in s_highest */
102 highest
= sym
[i
].s_lowest
;
104 callhook(handler
, mod
->m_name
, sym
[i
].s_name
, sym
[i
].s_lowest
, sym
[i
].s_highest
);