ChangeLog 2003-02-25 Mohan Embar * configure.in: added AC_DEFINE(HAVE_PLATFORM_GETEXENAME) for mingw * acconfig.h: new HAVE_PLATFORM_GETEXENAME: undefine * configure: rebuilt * include/config.h.in: rebuilt (using autoheader) * prims.cc: if HAVE_PLATFORM_GETEXENAME is defined, declare an external _Jv_platform_exename for retrieving our process' executable name. This mechanism overrides any other means of deterimining the executable name except DISABLE_MAIN_ARGS * win32.cc: _Jv_platform_exename implementation using Win32 GetModuleFileName Index: acconfig.h =================================================================== RCS file: /cvsroot/gcc/gcc/libjava/acconfig.h,v retrieving revision 1.26 diff -u -2 -r1.26 acconfig.h --- acconfig.h 29 Aug 2002 18:05:14 -0000 1.26 +++ acconfig.h 25 Feb 2003 13:42:48 -0000 @@ -138,4 +138,7 @@ #undef HAVE_PROC_SELF_EXE +/* Define if you have a platform-specific _Jv_platform_exename */ +#undef HAVE_PLATFORM_GETEXENAME + /* Define if you have dladdr() */ #undef HAVE_DLADDR Index: configure.in =================================================================== RCS file: /cvsroot/gcc/gcc/libjava/configure.in,v retrieving revision 1.142.4.6 diff -u -2 -r1.142.4.6 configure.in --- configure.in 20 Feb 2003 09:12:24 -0000 1.142.4.6 +++ configure.in 25 Feb 2003 13:42:50 -0000 @@ -542,4 +542,9 @@ AC_DEFINE(HAVE_PROC_SELF_EXE) ;; + *mingw*) + # Has a platform-specific mechanism for + # for retrieving the name of the executable. + AC_DEFINE(HAVE_PLATFORM_GETEXENAME) + ;; esac fi Index: prims.cc =================================================================== RCS file: /cvsroot/gcc/gcc/libjava/prims.cc,v retrieving revision 1.76 diff -u -2 -r1.76 prims.cc --- prims.cc 5 Dec 2002 00:49:29 -0000 1.76 +++ prims.cc 25 Feb 2003 13:42:52 -0000 @@ -100,8 +100,14 @@ void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event); #endif - extern "C" void _Jv_ThrowSignal (jthrowable) __attribute ((noreturn)); +#ifdef HAVE_PLATFORM_GETEXENAME +extern "C" void _Jv_platform_exename(char* buf, int size); + // this platform has a specific way of retrieving our executable + // name which overrides other mechanisms (such as assuming + // argv[0], etc.) +#endif + // Just like _Jv_Throw, but fill in the stack trace first. Although // this is declared extern in order that its name not be mangled, it @@ -962,8 +968,11 @@ -#ifdef DISABLE_MAIN_ARGS +#if defined(DISABLE_MAIN_ARGS) _Jv_ThisExecutable ("[Embedded App]"); -#else -#ifdef HAVE_PROC_SELF_EXE +#elif defined(HAVE_PLATFORM_GETEXENAME) + char exec_name[300]; + _Jv_platform_exename(exec_name, sizeof(exec_name)); + _Jv_ThisExecutable (exec_name); +#elif defined(HAVE_PROC_SELF_EXE) char exec_name[20]; sprintf (exec_name, "/proc/%d/exe", getpid ()); @@ -971,6 +980,5 @@ #else _Jv_ThisExecutable (argv[0]); -#endif /* HAVE_PROC_SELF_EXE */ -#endif /* DISABLE_MAIN_ARGS */ +#endif /* DISABLE_MAIN_ARGS, HAVE_PLATFORM_GETEXENAME, HAVE_PROC_SELF_EXE */ try Index: win32.cc =================================================================== RCS file: /cvsroot/gcc/gcc/libjava/win32.cc,v retrieving revision 1.12.22.2 diff -u -2 -r1.12.22.2 win32.cc --- win32.cc 19 Feb 2003 16:27:22 -0000 1.12.22.2 +++ win32.cc 25 Feb 2003 13:42:52 -0000 @@ -197,4 +197,9 @@ } +extern "C" void _Jv_platform_exename(char* buf, int size) +{ + GetModuleFileName(NULL, buf, size); +} + /* Store up to SIZE return address of the current program state in ARRAY and return the exact number of values stored. */