Don't randomly guess source filenames

Andrew Haley aph@redhat.com
Fri Mar 16 17:27:00 GMT 2007


We were guessing source filename based on classname.  Unsurprisingly,
this often doesn't work, and we end up with a ton of nonexistent
filenames in our debuginfo.  This confuses some tools.

Fixed thusly.

This doesn't destroy any real debuginfo, because as soon as we find a
SourceFile attribute in a .class file we use it.  This removes
hundreds of bogus filenames, and AFAICS doesn't lose any real ones.

In the case of .class files with no debuginfo, we generate no
debuginfo for the corresponding object files.

Andrew.


2007-03-16  Andrew Haley  <aph@redhat.com>

	* class.c (push_class): Don't bogusly guess the source filename.

Index: class.c
===================================================================
--- class.c	(revision 122746)
+++ class.c	(working copy)
@@ -426,8 +426,7 @@
   tree decl, signature;
   location_t saved_loc = input_location;
 #ifndef USE_MAPPED_LOCATION
-  tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
-  input_filename = IDENTIFIER_POINTER (source_name);
+  input_filename = "<unknown>";
   input_line = 0;
 #endif
   CLASS_P (class_type) = 1;



More information about the Java-patches mailing list