2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/config.h>
7 #include <libraries/debug.h>
8 #include <proto/debug.h>
10 #include <proto/exec.h>
12 #include "dos_intern.h"
13 #include "internalloadseg.h"
15 static char *getname(BPTR file
, char **bufferp
, struct DosLibrary
*DOSBase
)
17 /* Some applications pass a non-filehandle to
18 * Dos/InternalLoadSeg, so don't try to register
19 * the hunks if this is not a real FileHandle
21 * A real-life example of this is C:AddDataTypes
24 if (ISFILEHANDLE(file
) && DOSBase
) {
25 char *buffer
= AllocMem(512, MEMF_ANY
);
28 if (NameFromFH(file
, buffer
, 512)) {
29 char *nameptr
= buffer
;
30 /* gdb support needs full paths */
31 #if !AROS_MODULES_DEBUG
32 /* First, go through the name, till end of the string */
34 /* Now, go back until either ":" or "/" is found */
35 while(nameptr
> buffer
&& nameptr
[-1] != ':' && nameptr
[-1] != '/')
45 void register_elf(BPTR file
, BPTR hunks
, struct elfheader
*eh
, struct sheader
*sh
, struct DosLibrary
*DOSBase
)
47 if (DOSBase
&& DebugBase
)
50 char *nameptr
= getname(file
, &buffer
, DOSBase
);
51 struct ELF_DebugInfo dbg
= {eh
, sh
};
52 RegisterModule(nameptr
, hunks
, DEBUG_ELF
, &dbg
);
58 /* DOSBase is NULL if called by m68k RDB filesystem loader.
59 * No DosBase = Open debug.library manually, this enables
60 * us to have RDB segments in debug.library list.
62 void register_hunk(BPTR file
, BPTR hunks
, APTR header
, struct DosLibrary
*DOSBase
)
64 struct Library
*DebugBase
;
66 DebugBase
= IDosBase(DOSBase
)->debugBase
;
68 DebugBase
= OpenLibrary("debug.library", 0);
72 char *nameptr
= getname(file
, &buffer
, DOSBase
);
73 struct HUNK_DebugInfo dbg
= { header
};
74 RegisterModule(nameptr
, hunks
, DEBUG_HUNK
, &dbg
);
78 CloseLibrary(DebugBase
);