2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
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>
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.
27 #undef AROS_MODULES_DEBUG
30 #if AROS_MODULES_DEBUG
31 #include "../../arch/all-unix/kernel/hostinterface.h"
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
;
42 KernelBase
= OpenResource("kernel.resource");
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
;
69 D(bug("[Debug] Debug_Init() done\n"));
73 ADD2INITLIB(Debug_Init
, 0)