addr2line and the name of the executable

Ranjit Mathew
Wed Feb 19 13:47:00 GMT 2003

>  > 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

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:

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.


The new MSN 8: advanced junk mail protection and 2 months FREE*

More information about the Java mailing list