1 #include <aros/config.h>
2 #include <libraries/debug.h>
3 #include <proto/debug.h>
5 #include <proto/exec.h>
7 #include "dos_intern.h"
8 #include "internalloadseg.h"
10 static char *getname(BPTR file
, char **bufferp
, struct DosLibrary
*DOSBase
)
12 /* Some applications pass a non-filehandle to
13 * Dos/InternalLoadSeg, so don't try to register
14 * the hunks if this is not a real FileHandle
16 * A real-life example of this is C:AddDataTypes
19 if (ISFILEHANDLE(file
) && DOSBase
) {
20 char *buffer
= AllocMem(512, MEMF_ANY
);
23 if (NameFromFH(file
, buffer
, 512)) {
24 char *nameptr
= buffer
;
25 /* gdb support needs full paths */
26 #if !AROS_MODULES_DEBUG
27 /* First, go through the name, till end of the string */
29 /* Now, go back until either ":" or "/" is found */
30 while(nameptr
> buffer
&& nameptr
[-1] != ':' && nameptr
[-1] != '/')
40 void register_elf(BPTR file
, BPTR hunks
, struct elfheader
*eh
, struct sheader
*sh
, struct DosLibrary
*DOSBase
)
42 if (DOSBase
&& DebugBase
)
45 char *nameptr
= getname(file
, &buffer
, DOSBase
);
46 struct ELF_DebugInfo dbg
= {eh
, sh
};
47 RegisterModule(nameptr
, hunks
, DEBUG_ELF
, &dbg
);
53 /* DOSBase is NULL if called by m68k RDB filesystem loader.
54 * No DosBase = Open debug.library manually, this enables
55 * us to have RDB segments in debug.library list.
57 void register_hunk(BPTR file
, BPTR hunks
, APTR header
, struct DosLibrary
*DOSBase
)
59 struct Library
*DebugBase
;
61 DebugBase
= IDosBase(DOSBase
)->debugBase
;
63 DebugBase
= OpenLibrary("debug.library", 0);
67 char *nameptr
= getname(file
, &buffer
, DOSBase
);
68 struct HUNK_DebugInfo dbg
= { header
};
69 RegisterModule(nameptr
, hunks
, DEBUG_HUNK
, &dbg
);
73 CloseLibrary(DebugBase
);