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: Andrew Haley <aph at redhat dot com>
- To: "Ranjit Mathew" <rmathew at hotmail dot com>
- Cc: java at gcc dot gnu dot org
- Date: Wed, 19 Feb 2003 14:57:58 +0000 (GMT)
- Subject: Re: addr2line and the name of the executable
- References: <BAY1-F1901B6gVs1tIz000123fe@hotmail.com>
Ranjit Mathew writes:
> > > 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]
You don't _need_ it. It's only useful if someone does something
wicked, such as giving an executable a different name from the class
that provides the implementation. Java does not allow this, and that
it a _very_ good thing.
> - 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.
I see.
> If we need the actual path to the executable, this is best
> served by something like _Jv_platform_getexecutable( ) as
> Mohan's patch suggests.
Okay.
Andrew.