Indentation fix, cleanup.
[AROS.git] / rom / debug / debug_init.c
blob189a09aabc4fe1a2e6a54fe28650fafa9703b31f
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 */
8 #include <aros/config.h>
9 #include <aros/debug.h>
10 #include <aros/kernel.h>
11 #include <aros/symbolsets.h>
12 #include <proto/exec.h>
13 #include <proto/kernel.h>
15 #include <inttypes.h>
17 #include "debug_intern.h"
20 * A horrible hack. It works only under UNIX.
21 * TODO: rewrite all this crap and provide C subroutines with well
22 * defined API to call them from gdb for debug info lookup. This would
23 * remove a requirement to rewrite _gdbinit every time when something
24 * changes in this library.
26 #ifndef HOST_OS_unix
27 #undef AROS_MODULES_DEBUG
28 #endif
30 #if AROS_MODULES_DEBUG
31 #include "../../arch/all-unix/kernel/hostinterface.h"
32 #endif
34 static int Debug_Init(struct DebugBase *DebugBase)
36 struct TagItem *bootMsg;
37 struct ELF_ModuleInfo *kmod;
38 #if AROS_MODULES_DEBUG
39 struct HostInterface *HostIFace;
40 #endif
42 KernelBase = OpenResource("kernel.resource");
43 if (!KernelBase)
44 return FALSE;
46 NEWLIST(&DebugBase->db_Modules);
47 InitSemaphore(&DebugBase->db_ModSem);
49 bootMsg = KrnGetBootInfo();
50 kmod = (struct ELF_ModuleInfo *)LibGetTagData(KRN_DebugInfo, 0, bootMsg);
53 for (; kmod; kmod = kmod->Next)
55 RegisterModule_ELF(kmod->Name, BNULL, kmod->eh, kmod->sh, (struct Library *)DebugBase);
58 #if AROS_MODULES_DEBUG
59 HostIFace = (APTR)LibGetTagData(KRN_HostInterface, 0, bootMsg);
61 * Provide a pointer to our modules list to the bootstrap.
62 * This is needed because gdb is actually debugging bootstrap
63 * and it can read debug information only from there
65 if (HostIFace && HostIFace->ModListPtr)
66 *HostIFace->ModListPtr = &DebugBase->db_Modules;
67 #endif
69 D(bug("[Debug] Debug_Init() done\n"));
70 return 1;
73 ADD2INITLIB(Debug_Init, 0)