This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: addr2line and the name of the executable
- From: "Ranjit Mathew" <rmathew at hotmail dot com>
- To: aph at redhat dot com
- Cc: java at gcc dot gnu dot org
- Date: Wed, 19 Feb 2003 19:17:08 +0530
- Subject: Re: addr2line and the name of the executable
- Bcc:
> So the property "gnu.gcj.progname" would not really be "the name by
> which the program was invoked" - isn't that (sort of) wrong?
The comment only says "similar to". It depends on what you want the
information for. If you really want the file, that's just what you
need.
Most of the uses for argv[0] that I've seen are typically like:
...
if( argc < 2)
{
printf( "Usage: %s <whatever>\n", argv[0]);
exit( 1);
}
In "normal" Java programs, this is replaced by
"Usage: java FooBar <whatever>" since this used to be the only
way to invoke a Java program. However, with a natively
compiled Java program, one cannot assume this and needs
access to something like argv[0] - this was the whole
point of my asking for, what became the "gnu.gcj.progname"
property. See this thread for the background:
http://gcc.gnu.org/ml/java/2002-10/threads.html#00149
It is in this light that I consider the current
implementation to be in error.
If we need the actual path to the executable, this is best
served by something like _Jv_platform_getexecutable( ) as
Mohan's patch suggests.
Ranjit.
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail