1 #include <aros/debug.h>
2 #include <aros/kernel.h>
3 #include <aros/libcall.h>
4 #include <exec/lists.h>
5 #include <proto/exec.h>
9 #include "debug_intern.h"
11 /*****************************************************************************
14 #include <proto/debug.h>
16 AROS_LH1(void, UnregisterModule
,
19 AROS_LHA(BPTR
, segList
, A0
),
22 struct Library
*, DebugBase
, 6, Debug
)
25 Remove previously registered module from the debug information database
28 segList - DOS segment list for the module to remove
34 The function correctly supports partial removal of the module
35 (when an existing seglist is broken and only a part of the module
46 ******************************************************************************/
52 D(bug("[Debug] UnregisterModule(0x%p)\n", segList
));
53 ObtainSemaphore(&DBGBASE(DebugBase
)->db_ModSem
);
57 ForeachNode(&DBGBASE(DebugBase
)->db_Modules
, seg
)
59 if (seg
->s_seg
== segList
)
61 module_t
*mod
= seg
->s_mod
;
63 D(bug("[Debug] Removing segment 0x%p\n", segList
));
64 Remove((struct Node
*)seg
);
66 /* If module's segment count reached 0, remove the whole
68 if (--mod
->m_segcnt
== 0)
70 D(bug("[Debug] Removing module %s\n", mod
->m_name
));
72 /* Free associated symbols */
74 D(bug("[Debug] Removing symbol table 0x%p\n", mod
->m_symbols
));
75 FreeVec(mod
->m_symbols
);
78 /* Free associated string tables */
80 D(bug("[Debug] Removing symbol name table 0x%p\n", mod
->m_str
));
84 D(bug("[Debug] Removing section name table 0x%p\n", mod
->m_str
));
85 FreeVec(mod
->m_shstr
);
88 /* Free module descriptor at last */
92 FreeMem(seg
, sizeof(struct segment
));
97 /* Advance to next DOS segment */
98 segList
= *(BPTR
*)BADDR(segList
);
101 ReleaseSemaphore(&DBGBASE(DebugBase
)->db_ModSem
);