This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for Preview: _Jv_ThisExecutable (The Saga Continues)


Mohan Embar writes:
 > Andrew (and/or anyone else),
 > 
 > I'm stuck on something and need your help. If my analysis
 > is incorrect, let me know.
 > 
 > Prior to my patch, _Jv_RunMain() was the only place that
 > _Jv_ThisExecutable() was ever initialized. I don't see how
 > stacktraces could have ever worked if _Jv_RunMain() were
 > never invoked, as appears to be the case of Andrew Shuttlewood.

Hmm.  I suppose you get hex.

 > After my patch, _Jv_ThisExecutable() will work only for Posix if
 > HAVE_PROC_SELF_EXE is defined. Otherwise, _Jv_ThisExecutable()
 > will bomb because it will attempt to pass back _Jv_argv[0].
 > 
 > So my updated patch will need to fix this too.
 > 
 > How do I do this? I can think of several possible ways:
 > 
 > - Readd a  _Jv_ThisExecutable() setter (which I took away in my patch)
 >   which allows a back-door way of specifying this and hope that they
 >   call it?

 > - Provide a _Jv_SetArgs() method which they should invoke manually to
 >   set _Jv_argc and _Jv_argv and hope that call this?

 > - Pray that they set _Jv_argc and _Jv_argv manually?
 > - Require some gcj-specific Java VM init args which specify the executable name?
 > 
 > ...or is there some better way?
 > 
 > Depending on the solution, the gnu.gcj.progname problem might be
 > indirectly fixed too.

As I understand it, JNI_CreateJavaVM() is the portable way to do this,
and it has a JavaVMInitArgs arg that can pass system properties.  We
could make JNI_CreateJavaVM() read gnu.gcj.progname and pass that to
_Jv_ThisExecutable().

However, all that we need at the moment is for the runtime not to
crash, and that means that we don't set gnu.gcj.progname unless
_Jv_argv has been set.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]