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 ******************************************************************************/
56 struct DebugBase
*debugBase
= DBGBASE(DebugBase
);
59 /* We can be called in supervisor mode. No semaphores in the case! */
62 ObtainSemaphoreShared(&debugBase
->db_ModSem
);
64 EnumerateModules(handler
, DebugBase
);
67 ReleaseSemaphore(&debugBase
->db_ModSem
);
72 static inline void callhook(struct Hook
* handler
, CONST_STRPTR modname
, CONST_STRPTR symname
,
75 struct SymbolInfo sinfo
= {0};
77 sinfo
.si_Size
= sizeof(struct SymbolInfo
);
78 sinfo
.si_ModuleName
= modname
;
79 sinfo
.si_SymbolName
= symname
;
80 sinfo
.si_SymbolStart
= start
;
81 sinfo
.si_SymbolEnd
= end
;
83 CALLHOOKPKT(handler
, NULL
, &sinfo
);
86 static void EnumerateModules(struct Hook
* handler
, struct Library
* DebugBase
)
88 struct DebugBase
*debugBase
= DBGBASE(DebugBase
);
91 ForeachNode(&debugBase
->db_Modules
, mod
)
93 dbg_sym_t
*sym
= mod
->m_symbols
;
96 D(bug("[Debug] Checking module %s\n", mod
->m_name
));
98 for (i
= 0; i
< mod
->m_symcnt
; i
++)
100 APTR highest
= sym
[i
].s_highest
;
102 /* Symbols with zero length have zero in s_highest */
104 highest
= sym
[i
].s_lowest
;
106 callhook(handler
, mod
->m_name
, sym
[i
].s_name
, sym
[i
].s_lowest
, sym
[i
].s_highest
);