This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA]: Java Inferior Call Take 2
- From: Andrew Haley <aph at redhat dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: Jeff Johnston <jjohnstn at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Aug 2004 13:46:20 +0100
- Subject: Re: [RFA]: Java Inferior Call Take 2
- References: <20040623230138.GA6426@nevyn.them.org><40EB1DDD.4070603@redhat.com><4105604A.6030302@redhat.com><20040726194953.GA27001@nevyn.them.org><16654.5193.518989.691842@cuddles.cambridge.redhat.com><16654.23217.847150.837143@cuddles.cambridge.redhat.com><20040802201909.GA1618@nevyn.them.org><16655.56595.839784.222321@cuddles.cambridge.redhat.com><16672.45415.826398.180427@cuddles.cambridge.redhat.com><20040816131759.GA23168@nevyn.them.org><20040816203217.GA14885@nevyn.them.org>
Daniel Jacobowitz writes:
> On Mon, Aug 16, 2004 at 09:18:00AM -0400, Daniel Jacobowitz wrote:
> > On Mon, Aug 16, 2004 at 02:06:47PM +0100, Andrew Haley wrote:
> > > Any news? I'm waiting to commit this.
> >
> > Sorry, I didn't get to try it - I will today!
>
> It works great. With it, none of GDB's existing Java tests seem to
> change, but Jeff's new test works without trying to parse the method
> name out of DW_AT_name. So please go ahead! :-)
So, this should be enough to get inferior calls to Java methosd
working in gdb.
Committed.
Andrew.
2004-08-17 Andrew Haley <aph@redhat.com>
* lang.c (lang_printable_name): Obey verbose flag.
* parse.y (constructor_circularity_msg): Set VERBOSE arg for
lang_printable_name().
(verify_constructor_circularity, get_printable_method_name,
check_abstract_method_definitions, java_check_regular_methods,
java_check_abstract_methods, check_inner_class_access,
fix_constructors, patch_method_invocation, patch_return):
Likewise.
* expr.c (pop_type_0): Likewise.
* java-tree.h (lang_printable_name_wls): Delete.
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.202
diff -u -r1.202 expr.c
--- expr.c 15 Aug 2004 15:45:30 -0000 1.202
+++ expr.c 17 Aug 2004 12:33:28 -0000
@@ -345,9 +345,9 @@
/* lang_printable_name uses a static buffer, so we must save the result
from calling it the first time. */
{
- char *temp = xstrdup (lang_printable_name (type, 0));
+ char *temp = xstrdup (lang_printable_name (type, 2));
*messagep = concat ("expected type '", temp,
- "' but stack contains '", lang_printable_name (t, 0),
+ "' but stack contains '", lang_printable_name (t, 2),
"'", NULL);
free (temp);
}
Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.216
diff -u -r1.216 java-tree.h
--- java-tree.h 10 Aug 2004 04:29:16 -0000 1.216
+++ java-tree.h 17 Aug 2004 12:33:28 -0000
@@ -1322,7 +1322,6 @@
extern tree java_mangle_class_field (struct obstack *, tree);
extern tree java_mangle_class_field_from_string (struct obstack *, char *);
extern tree java_mangle_vtable (struct obstack *, tree);
-extern const char *lang_printable_name_wls (tree, int);
extern void append_gpp_mangled_name (const char *, int);
extern void add_predefined_file (tree);
Index: lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.157
diff -u -r1.157 lang.c
--- lang.c 6 Aug 2004 02:03:47 -0000 1.157
+++ lang.c 17 Aug 2004 12:33:29 -0000
@@ -497,24 +497,14 @@
which is also called directly by java_print_error_function. */
const char *
-lang_printable_name (tree decl, int v __attribute__ ((__unused__)))
+lang_printable_name (tree decl, int v)
{
decl_bufpos = 0;
- put_decl_node (decl);
- put_decl_string ("", 1);
- return decl_buf;
-}
-
-/* Does the same thing that lang_printable_name, but add a leading
- space to the DECL name string -- With Leading Space. */
-
-const char *
-lang_printable_name_wls (tree decl, int v __attribute__ ((__unused__)))
-{
- decl_bufpos = 1;
- put_decl_node (decl);
+ if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
+ put_decl_node (DECL_NAME (decl));
+ else
+ put_decl_node (decl);
put_decl_string ("", 1);
- decl_buf [0] = ' ';
return decl_buf;
}
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.500
diff -u -r1.500 parse.y
--- parse.y 15 Aug 2004 15:45:30 -0000 1.500
+++ parse.y 17 Aug 2004 12:33:33 -0000
@@ -4822,8 +4822,8 @@
constructor_circularity_msg (tree from, tree to)
{
static char string [4096];
- char *t = xstrdup (lang_printable_name (from, 0));
- sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
+ char *t = xstrdup (lang_printable_name (from, 2));
+ sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 2));
free (t);
return string;
}
@@ -4855,7 +4855,7 @@
java_error_count--;
}
}
- t = xstrdup (lang_printable_name (meth, 0));
+ t = xstrdup (lang_printable_name (meth, 2));
parse_error_context (TREE_PURPOSE (c),
"%s: recursive invocation of constructor `%s'",
constructor_circularity_msg (current, meth), t);
@@ -6080,7 +6080,7 @@
DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
}
- to_return = lang_printable_name (decl, 0);
+ to_return = lang_printable_name (decl, 2);
if (DECL_CONSTRUCTOR_P (decl))
DECL_NAME (decl) = name;
@@ -6187,7 +6187,7 @@
(lookup_cl (class_decl),
"Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- t, lang_printable_name (method, 0),
+ t, lang_printable_name (method, 2),
(CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
"interface" : "class"),
IDENTIFIER_POINTER (ccn),
@@ -6365,7 +6365,7 @@
char *t = xstrdup (lang_printable_name (class, 0));
parse_error_context
(method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
- lang_printable_name (method, 0), t);
+ lang_printable_name (method, 2), t);
free (t);
}
@@ -6387,7 +6387,7 @@
tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- lang_printable_name (method, 0),
+ lang_printable_name (method, 2),
IDENTIFIER_POINTER (DECL_NAME (found_decl)));
}
@@ -6396,11 +6396,11 @@
if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
{
char *t = xstrdup
- (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
+ (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
parse_error_context
(method_wfl,
"Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
+ lang_printable_name (found, 2), t,
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
@@ -6418,7 +6418,7 @@
(method_wfl,
"%s methods can't be overridden. Method `%s' is %s in class `%s'",
(METHOD_FINAL (found) ? "Final" : "Static"),
- lang_printable_name (found, 0),
+ lang_printable_name (found, 2),
(METHOD_FINAL (found) ? "final" : "static"),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
@@ -6431,7 +6431,7 @@
parse_error_context
(method_wfl,
"Instance methods can't be overridden by a static method. Method `%s' is an instance method in class `%s'",
- lang_printable_name (found, 0),
+ lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
continue;
@@ -6453,7 +6453,7 @@
{
parse_error_context
(method_wfl,
- "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
+ "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 2),
(METHOD_PUBLIC (method) ? "public" :
(METHOD_PRIVATE (method) ? "private" : "protected")),
IDENTIFIER_POINTER (DECL_NAME
@@ -6596,7 +6596,7 @@
parse_error_context
(method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
- lang_printable_name (found, 0),
+ lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
}
@@ -6623,11 +6623,11 @@
if (found)
{
char *t;
- t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
+ t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
parse_error_context
(DECL_FUNCTION_WFL (found),
"Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
+ lang_printable_name (found, 2), t,
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
@@ -6653,7 +6653,7 @@
(lookup_cl (sub_interface_method),
"Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
- lang_printable_name (found, 0),
+ lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME
(DECL_CONTEXT (sub_interface_method)))),
@@ -7220,7 +7220,7 @@
parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
(CLASS_INTERFACE (decl) ? "interface" : "class"),
- lang_printable_name (decl, 0), access);
+ lang_printable_name (decl, 2), access);
}
/* Accessibility check for top-level classes. If CLASS_NAME is in a
@@ -8815,7 +8815,7 @@
parse_error_context
(lookup_cl (TYPE_NAME (class_type)),
"No constructor matching `%s' found in class `%s'",
- lang_printable_name (mdecl, 0), n);
+ lang_printable_name (mdecl, 2), n);
DECL_NAME (mdecl) = save;
}
@@ -10277,7 +10277,7 @@
}
if (list && !METHOD_STATIC (list))
{
- char *fct_name = xstrdup (lang_printable_name (list, 0));
+ char *fct_name = xstrdup (lang_printable_name (list, 2));
parse_error_context
(identifier_wfl,
"Can't make static reference to method `%s %s' in class `%s'",
@@ -14649,13 +14649,13 @@
parse_error_context (wfl_operator,
"`return' with%s value from `%s %s'",
(error_found == 1 ? "" : "out"),
- t, lang_printable_name (meth, 0));
+ t, lang_printable_name (meth, 2));
free (t);
}
else
parse_error_context (wfl_operator,
"`return' with value from constructor `%s'",
- lang_printable_name (meth, 0));
+ lang_printable_name (meth, 2));
return error_mark_node;
}