Added a test for MUIA_Listview_SelectChange.
[AROS.git] / rom / dos / internalloadseg_support.c
blob9899fd74d7a47d5bd68f291ea05d069423f52592
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/config.h>
7 #include <libraries/debug.h>
8 #include <proto/debug.h>
9 #include <proto/dos.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
22 * from AmigaOS 3.9
24 if (ISFILEHANDLE(file) && DOSBase) {
25 char *buffer = AllocMem(512, MEMF_ANY);
26 if (buffer) {
27 *bufferp = buffer;
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 */
33 while(*nameptr++);
34 /* Now, go back until either ":" or "/" is found */
35 while(nameptr > buffer && nameptr[-1] != ':' && nameptr[-1] != '/')
36 nameptr--;
37 #endif
38 return nameptr;
42 return "unknown";
45 void register_elf(BPTR file, BPTR hunks, struct elfheader *eh, struct sheader *sh, struct DosLibrary *DOSBase)
47 if (DOSBase && DebugBase)
49 char *buffer = NULL;
50 char *nameptr = getname(file, &buffer, DOSBase);
51 struct ELF_DebugInfo dbg = {eh, sh};
52 RegisterModule(nameptr, hunks, DEBUG_ELF, &dbg);
53 FreeMem(buffer, 512);
57 #undef DebugBase
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;
65 if (DOSBase)
66 DebugBase = IDosBase(DOSBase)->debugBase;
67 else
68 DebugBase = OpenLibrary("debug.library", 0);
69 if (DebugBase)
71 char *buffer = NULL;
72 char *nameptr = getname(file, &buffer, DOSBase);
73 struct HUNK_DebugInfo dbg = { header };
74 RegisterModule(nameptr, hunks, DEBUG_HUNK, &dbg);
75 FreeMem(buffer, 512);
77 if (!DOSBase)
78 CloseLibrary(DebugBase);