2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
8 #include <aros/debug.h>
9 #include <aros/kernel.h>
10 #include <aros/libcall.h>
11 #include <exec/lists.h>
12 #include <proto/exec.h>
16 #include "debug_intern.h"
18 /*****************************************************************************
21 #include <proto/debug.h>
23 AROS_LH1(void, UnregisterModule
,
26 AROS_LHA(BPTR
, segList
, A0
),
29 struct Library
*, DebugBase
, 6, Debug
)
32 Remove previously registered module from the debug information database
35 segList - DOS segment list for the module to remove
41 The function correctly supports partial removal of the module
42 (when an existing seglist is broken and only a part of the module
53 ******************************************************************************/
59 D(bug("[Debug] UnregisterModule(0x%p)\n", segList
));
60 ObtainSemaphore(&DBGBASE(DebugBase
)->db_ModSem
);
64 ForeachNode(&DBGBASE(DebugBase
)->db_Modules
, seg
)
66 if (seg
->s_seg
== segList
)
68 module_t
*mod
= seg
->s_mod
;
70 D(bug("[Debug] Removing segment 0x%p\n", segList
));
71 Remove((struct Node
*)seg
);
73 /* If module's segment count reached 0, remove the whole
75 if (--mod
->m_segcnt
== 0)
77 D(bug("[Debug] Removing module %s\n", mod
->m_name
));
79 /* Free associated symbols */
81 D(bug("[Debug] Removing symbol table 0x%p\n", mod
->m_symbols
));
82 FreeVec(mod
->m_symbols
);
85 /* Free associated string tables */
87 D(bug("[Debug] Removing symbol name table 0x%p\n", mod
->m_str
));
91 D(bug("[Debug] Removing section name table 0x%p\n", mod
->m_str
));
92 FreeVec(mod
->m_shstr
);
95 /* Free module descriptor at last */
99 FreeMem(seg
, sizeof(struct segment
));
104 /* Advance to next DOS segment */
105 segList
= *(BPTR
*)BADDR(segList
);
108 ReleaseSemaphore(&DBGBASE(DebugBase
)->db_ModSem
);