Minor fixes to comments.
[AROS.git] / rom / debug / debug_init.c
blobcc4a7faebab3600ca1aa0a53e0afb306aaad9742
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>
8 #include <inttypes.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.
19 #ifndef HOST_OS_unix
20 #undef AROS_MODULES_DEBUG
21 #endif
23 #if AROS_MODULES_DEBUG
24 #include "../../arch/all-unix/kernel/hostinterface.h"
25 #endif
27 static int Debug_Init(struct DebugBase *DebugBase)
29 struct TagItem *bootMsg;
30 #if AROS_MODULES_DEBUG
31 struct HostInterface *HostIFace;
32 #endif
34 KernelBase = OpenResource("kernel.resource");
35 if (!KernelBase)
36 return FALSE;
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;
53 #endif
55 D(bug("[Debug] Debug_Init() done\n"));
56 return 1;
59 ADD2INITLIB(Debug_Init, 0)