* Don't randomly guess source filenames
@ 2007-03-16 18:56 Andrew Haley
2007-03-29 17:09 ` Andrew Haley
2007-03-29 18:39 ` Andrew Haley
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Haley @ 2007-03-16 18:56 UTC (permalink / raw)
To: java-patches, gcc-patches
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Don't randomly guess source filenames
2007-03-16 18:56 Don't randomly guess source filenames Andrew Haley
@ 2007-03-29 17:09 ` Andrew Haley
2007-03-29 18:39 ` Andrew Haley
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2007-03-29 17:09 UTC (permalink / raw)
To: java-patches, gcc-patches
Andrew Haley writes:
> 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.
This patch prevents "<unknown>" from leaking into the file table and
somewhat impoves the accuracy of the debuginfo.
Andrew.
2007-03-16 Andrew Haley <aph@redhat.com>
* class.c (push_class): Don't bogusly guess the source filename.
* jcf-parse.c (give_name_to_class): Don't set input_location from
DECL_ARTIFICIAL decls.
Index: java/class.c
===================================================================
--- java/class.c (revision 122746)
+++ java/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;
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c (revision 122746)
+++ java/jcf-parse.c (working copy)
@@ -1221,9 +1221,12 @@
main_input_filename = sfname;
}
#else
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (this_class));
- if (main_input_filename == NULL && jcf == main_jcf)
- main_input_filename = input_filename;
+ if (! DECL_ARTIFICIAL (TYPE_NAME (this_class)))
+ {
+ input_location = DECL_SOURCE_LOCATION (TYPE_NAME (this_class));
+ if (main_input_filename == NULL && jcf == main_jcf)
+ main_input_filename = input_filename;
+ }
#endif
jcf->cpool.data[i].t = this_class;
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Don't randomly guess source filenames
2007-03-16 18:56 Don't randomly guess source filenames Andrew Haley
2007-03-29 17:09 ` Andrew Haley
@ 2007-03-29 18:39 ` Andrew Haley
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2007-03-29 18:39 UTC (permalink / raw)
To: java-patches, gcc-patches
Andrew Haley writes:
> 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.
This patch prevents "<unknown>" from leaking into the file table and
somewhat impoves the accuracy of the debuginfo.
Andrew.
2007-03-16 Andrew Haley <aph@redhat.com>
* class.c (push_class): Don't bogusly guess the source filename.
* jcf-parse.c (give_name_to_class): Don't set input_location from
DECL_ARTIFICIAL decls.
Index: java/class.c
===================================================================
--- java/class.c (revision 122746)
+++ java/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;
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c (revision 122746)
+++ java/jcf-parse.c (working copy)
@@ -1221,9 +1221,12 @@
main_input_filename = sfname;
}
#else
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (this_class));
- if (main_input_filename == NULL && jcf == main_jcf)
- main_input_filename = input_filename;
+ if (! DECL_ARTIFICIAL (TYPE_NAME (this_class)))
+ {
+ input_location = DECL_SOURCE_LOCATION (TYPE_NAME (this_class));
+ if (main_input_filename == NULL && jcf == main_jcf)
+ main_input_filename = input_filename;
+ }
#endif
jcf->cpool.data[i].t = this_class;
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-29 17:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-16 18:56 Don't randomly guess source filenames Andrew Haley
2007-03-29 17:09 ` Andrew Haley
2007-03-29 18:39 ` Andrew Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).