1 #include <aros/config.h>
2 #include <aros/debug.h>
3 #include <aros/kernel.h>
4 #include <aros/symbolsets.h>
5 #include <proto/exec.h>
6 #include <proto/kernel.h>
10 #include "debug_intern.h"
13 * A horrible hack. It works only under UNIX.
14 * TODO: rewrite all this crap and provide C subroutines will well
15 * defined API to call them from gdb for debug info lookup. This would
16 * remove a requirement to rewrite _gdbinit every time when something
17 * changes in this library.
20 #undef AROS_MODULES_DEBUG
23 #if AROS_MODULES_DEBUG
24 #include "../../arch/all-unix/kernel/hostinterface.h"
27 static int Debug_Init(struct DebugBase
*DebugBase
)
29 struct TagItem
*bootMsg
;
30 #if AROS_MODULES_DEBUG
31 struct HostInterface
*HostIFace
;
34 KernelBase
= OpenResource("kernel.resource");
38 NEWLIST(&DebugBase
->db_Modules
);
39 InitSemaphore(&DebugBase
->db_ModSem
);
41 bootMsg
= KrnGetBootInfo();
42 DebugBase
->db_KernelModules
= (struct ELF_ModuleInfo
*)LibGetTagData(KRN_DebugInfo
, 0, bootMsg
);
44 #if AROS_MODULES_DEBUG
45 HostIFace
= (APTR
)LibGetTagData(KRN_HostInterface
, 0, bootMsg
);
47 * Provide a pointer to our modules list to the bootstrap.
48 * This is needed because gdb is actually debugging bootstrap
49 * and it can read debug information only from there
51 if (HostIFace
&& HostIFace
->ModListPtr
)
52 *HostIFace
->ModListPtr
= &DebugBase
->db_Modules
;
55 D(bug("[Debug] Debug_Init() done\n"));
59 ADD2INITLIB(Debug_Init
, 0)