This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Compiling .class files & stabs
Paul Flinders wrote:
> I would have though that stabs for local variables should be possible, and
> I'd find them useful (especially as the app doesn't work when compiled
> with gcj at the moment).
looking at the code give_name_to_locals (gcc/java/decl.c) should name
the arguments this (for a nomal member function), ARG_1, ... ARG_n
which should then get stabs. However although give_name_to_locals
is being called it never does any work - it always exits becasue the value
of DECL_LOCALVARIABLES_OFFSET (current_function_decl) is zero.
As a result the method arguments don't get named.
When should DECL_LOCALVARIABLES_OFFSET (current_function_decl)
be non-zero when give_names_to_locals is called - it was never != 0
for any class in the jdmk, is this plausable?
In any case I think that this patch should be applied - even if the local
variables offset is zero the method arguments should be processed.
--- gcc/java/decl.c~ Mon Feb 5 11:40:19 2001
+++ gcc/java/decl.c Wed Feb 7 14:18:11 2001
@@ -1578,6 +1578,26 @@
int i, n = DECL_LOCALVARIABLES_OFFSET (current_function_decl);
int code_offset = DECL_CODE_OFFSET (current_function_decl);
tree parm;
+
+ /* Fill in default names for the parameters. */
+ for (parm = DECL_ARGUMENTS (current_function_decl), i = 0;
+ parm != NULL_TREE; parm = TREE_CHAIN (parm), i++)
+ {
+ if (DECL_NAME (parm) == NULL_TREE)
+ {
+ int arg_i = METHOD_STATIC (current_function_decl) ? i+1 : i;
+ if (arg_i == 0)
+ DECL_NAME (parm) = get_identifier ("this");
+ else
+ {
+ char buffer[12];
+ sprintf (buffer, "ARG_%d", arg_i);
+ DECL_NAME (parm) = get_identifier (buffer);
+ }
+ DECL_ASSEMBLER_NAME (parm) = DECL_NAME (parm);
+ }
+ }
+
pending_local_decls = NULL_TREE;
if (n == 0)
return;
@@ -1650,24 +1670,6 @@
pending_local_decls = nreverse (pending_local_decls);
- /* Fill in default names for the parameters. */
- for (parm = DECL_ARGUMENTS (current_function_decl), i = 0;
- parm != NULL_TREE; parm = TREE_CHAIN (parm), i++)
- {
- if (DECL_NAME (parm) == NULL_TREE)
- {
- int arg_i = METHOD_STATIC (current_function_decl) ? i+1 : i;
- if (arg_i == 0)
- DECL_NAME (parm) = get_identifier ("this");
- else
- {
- char buffer[12];
- sprintf (buffer, "ARG_%d", arg_i);
- DECL_NAME (parm) = get_identifier (buffer);
- }
- DECL_ASSEMBLER_NAME (parm) = DECL_NAME (parm);
- }
- }
}
tree