GCJ/minGW stacktrace

Ranjit Mathew rmathew@hotmail.com
Sun Jan 26 20:22:00 GMT 2003


Andrew Haley wrote:
>  > Another OT issue: by default (i.e. without -d) gcj generates .class
>  > files for a class in a package in the current directory instead of
>  > the directory in which the Java source is defined 
> 
> Not under Linux it doesn't.  At least it didn't the last time I tried.

It works if I compile using '/' as the folder separator
but not if I use '\' - so "gcj -C foo/bar.java" works, but
not "gcj -C foo\bar.java".

The problem is that DOS/Win32-based targets like MinGW,
Cygwin, DJGPP, etc. can have both DIR_SEPARATOR ('/') as well
as DIR_SEPARATOR_2 ('\\') defined for them - the latter
might be absent for other targets.

The following then, *should* be the desired change (not tested
yet) in the front-end:
---------------------------- 8< ----------------------------
--- jcf-write.c	Mon Jan 27 01:35:28 2003
+++ jcf-write.c	Mon Jan 27 01:36:30 2003
@@ -3349,4 +3349,8 @@ make_class_file_name (clas)
        dname = DECL_SOURCE_FILE (TYPE_NAME (clas));
        slash = strrchr (dname, DIR_SEPARATOR);
+      #ifdef DIR_SEPARATOR_2
+      if (! slash)
+        slash = strrchr (dname, DIR_SEPARATOR_2);
+      #endif /* DIR_SEPARATOR_2 */
        if (! slash)
  	{
---------------------------- 8< ----------------------------

Unfortunately, I see a lot of cases in the gcc/java folder
where the code assumes a single directory separator character.
For example, it should use IS_DIR_SEPARATOR( ) rather than
directly comparing against DIR_SEPARATOR. It should also
double-check with DIR_SEPARATOR_2 (like above) if something
fails with DIR_SEPARATOR. And so on...


> Nasty.  Do you know how Visual C++ does its unwinding?  There may be
> enough information to make it work.

At least with VC6, by looking at the generated ASM, I strongly suspect
that it is an SJLJ-based scheme.

Sincerely Yours,
Ranjit.

-- 
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/




More information about the Java mailing list