addr2line and the name of the executable
Wed Feb 26 05:04:00 GMT 2003
> > > Andrew> gnu.gcj.prognamegnu.gcj.progname should probably be argv,
unmangled by anuything.
> > >
> > > That would mean that my patch would have _Jv_ThisExecutable()
> > > return something different than gnu.gcj.progname.
> >Yes. Definitely. We shouldn't intermix the implementation of
> >gnu.gcj.progname and argv; they have completely different purposes.
I was a bit confused by this statement from Andrew, but still, here's what
(IMHO) we should do based on my understanding of the discussion so far:
a. "gnu.gcj.progname" should be set to whatever is argv. Note that
apparently on Mac OS Classic, argv can actually be equal to NULL,
though this might be irrelevant since there is no port of GCJ on Mac
b. _Jv_ThisExecutable( ) should return the actual executable file that
was used to create the current process, if possible.
c. NameFinder should use _Jv_ThisExecutable( ) to construct the argument
passed to "addr2line -e".
For both (a) and (b), we would need to preserve argv for a while.
(Already defined through the global variable _Jv_argv in prims.cc and
used, for example, by gnu/gcj/runtime/natNameFinder.cc.)
Note that for gnu.gcj.progname (==argv), it is not *necessarily* the
command used to invoke the program, merely a (desirable, IMHO) convention,
especially on UNIX and WinNT/2K/XP - on Win9x for example, it is
expanded to the full path to the current executable.
For (b), we could define a _Jv_platform_getThisExecutable( ) (or some
such function) that:
i. for POSIX, uses whatever we have right now in prims.cc (_Jv_RunMain)
between (and including) "#ifdef DISABLE_MAIN_ARGS" and its counter
ii. for Win32, uses the Win32 GetModuleFileName( ) function.
The current code in (i) could then be replaced by something like
"_Jv_ThisExecutable( _Jv_platform_getThisExecutable( ))".
> case of Win32. Semantically, argv and the full path to the executable
> are the same in the case of Win32, and given that gnu.gcj.progname is
Only in the case of Win9x and not on WinNT/2K/XP:
More information about the Java