aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog39
-rw-r--r--gdb/MAINTAINERS1
-rw-r--r--gdb/Makefile.in7
-rw-r--r--gdb/NEWS2
-rw-r--r--gdb/c-typeprint.c11
-rw-r--r--gdb/c-varobj.c2
-rw-r--r--gdb/defs.h7
-rw-r--r--gdb/doc/ChangeLog7
-rw-r--r--gdb/doc/gdb.texinfo8
-rw-r--r--gdb/doc/guile.texi4
-rw-r--r--gdb/doc/python.texi4
-rw-r--r--gdb/dwarf2read.c122
-rw-r--r--gdb/gdbtypes.h5
-rw-r--r--gdb/gnu-v3-abi.c9
-rw-r--r--gdb/jv-exp.y1434
-rw-r--r--gdb/jv-lang.c1272
-rw-r--r--gdb/jv-lang.h79
-rw-r--r--gdb/jv-typeprint.c355
-rw-r--r--gdb/jv-valprint.c532
-rw-r--r--gdb/jv-varobj.c107
-rw-r--r--gdb/language.c1
-rw-r--r--gdb/linespec.c6
-rw-r--r--gdb/objfiles.c9
-rw-r--r--gdb/psymtab.c9
-rw-r--r--gdb/symtab.c94
-rw-r--r--gdb/symtab.h4
-rw-r--r--gdb/testsuite/ChangeLog12
-rw-r--r--gdb/testsuite/README2
-rw-r--r--gdb/testsuite/gdb.base/default.exp2
-rw-r--r--gdb/testsuite/gdb.base/setshow.exp8
-rw-r--r--gdb/testsuite/gdb.compile/compile.exp4
-rw-r--r--gdb/testsuite/gdb.java/jmain.exp87
-rw-r--r--gdb/testsuite/gdb.java/jmain.java7
-rw-r--r--gdb/testsuite/gdb.java/jmisc.exp104
-rw-r--r--gdb/testsuite/gdb.java/jmisc.java7
-rw-r--r--gdb/testsuite/gdb.java/jnpe.exp55
-rw-r--r--gdb/testsuite/gdb.java/jnpe.java39
-rw-r--r--gdb/testsuite/gdb.java/jprint.exp77
-rw-r--r--gdb/testsuite/gdb.java/jprint.java68
-rw-r--r--gdb/testsuite/gdb.java/jv-exp.exp41
-rw-r--r--gdb/testsuite/gdb.java/jv-print.exp153
-rw-r--r--gdb/testsuite/gdb.python/py-lookup-type.exp2
-rw-r--r--gdb/testsuite/lib/gdb.exp6
-rw-r--r--gdb/testsuite/lib/java.exp123
-rw-r--r--gdb/utils.c2
-rw-r--r--gdb/valprint.h4
-rw-r--r--gdb/varobj.h1
47 files changed, 126 insertions, 4808 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1590c1b..981ccf4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,42 @@
+2016-10-06 Tom Tromey <tom@tromey.com>
+
+ * MAINTAINERS: Remove Java test maintainer.
+ * varobj.h (java_varobj_ops): Don't declare.
+ * valprint.h (struct value_print_options)
+ <pascal_static_field_print>: Update comment.
+ * utils.c (producer_is_gcc): Remove java reference.
+ * symtab.h (struct general_symbol_info): Remove java references.
+ (SYMBOL_SEARCH_NAME): Likewise.
+ * objfiles.c (allocate_objfile): Update comment.
+ * linespec.c (find_linespec_symbols): Remove java references.
+ * gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_baseclass_offset): Remove
+ java references.
+ * gdbtypes.h (struct cplus_struct_type) <is_java>: Remove.
+ (TYPE_CPLUS_REALLY_JAVA): Remove.
+ * c-varobj.c (enum vsections): Update comment.
+ * symtab.c (symbol_set_language, symbol_set_names)
+ (symbol_natural_name, symbol_demangled_name)
+ (demangle_for_lookup, symbol_matches_domain)
+ (default_make_symbol_completion_list_break_on_1): Remove java
+ references.
+ (JAVA_PREFIX, JAVA_PREFIX_LEN): Remove.
+ * psymtab.c (match_partial_symbol, psymtab_search_name)
+ (lookup_partial_symbol): Remove java references.
+ * dwarf2read.c (find_slot_in_mapped_hash): Remove java references.
+ (add_partial_symbol, dwarf2_compute_name, dwarf2_physname)
+ (dwarf2_add_member_fn, is_vtable_name, read_structure_type)
+ (process_structure_scope, read_subroutine_type)
+ (read_subrange_type, load_partial_dies)
+ (new_symbol_full, determine_prefix, typename_concat)
+ (dwarf2_name): Remove java references.
+ (set_cu_language): Treat Java as C++.
+ * c-typeprint.c (c_type_print_args): Remove java reference.
+ * defs.h (enum language) <language_java>: Remove.
+ * Makefile.in (SFILES, HFILES_NO_SRCDIR, COMMON_OBS, YYFILES)
+ (YYOBJ, local-maintainer-clean): Don't mention java files.
+ * jv-exp.y, jv-lang.c, jv-lang.h, jv-typeprint.c, jv-valprint.c,
+ jv-varobj.c: Remove.
+
2016-10-06 Maciej W. Rozycki <macro@imgtec.com>
* mips-tdep.c (mips_pseudo_register_type): Make FCRs always
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 67d1168..802f77d 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -450,7 +450,6 @@ tui Stephane Carrez Stephane.Carrez@gmail.com
ia64 Kevin Buettner kevinb@redhat.com
AIX Kevin Buettner kevinb@redhat.com
GNU/Linux PPC native Kevin Buettner kevinb@redhat.com
-gdb.java tests Anthony Green green@redhat.com
FreeBSD native & host David O'Brien obrien@freebsd.org
event loop Elena Zannoni elena.zannoni@oracle.com
generic symtabs Elena Zannoni elena.zannoni@oracle.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d0a968a..2c88434 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -852,7 +852,6 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
infcmd.c inflow.c infrun.c \
inline-frame.c \
interps.c \
- jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c jv-varobj.c \
language.c linespec.c location.c minidebug.c \
m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c \
macrotab.c macroexp.c macrocmd.c macroscope.c main.c maint.c \
@@ -945,7 +944,7 @@ interps.h auxv.h gdbcmd.h tramp-frame.h mipsnbsd-tdep.h \
amd64-linux-tdep.h linespec.h location.h i387-tdep.h mn10300-tdep.h \
sparc64-tdep.h ppcobsd-tdep.h \
coff-pe-read.h parser-defs.h gdb_ptrace.h mips-linux-tdep.h \
-m68k-tdep.h spu-tdep.h jv-lang.h environ.h amd64-tdep.h \
+m68k-tdep.h spu-tdep.h environ.h amd64-tdep.h \
doublest.h regset.h hppa-tdep.h ppc-linux-tdep.h ppc64-tdep.h \
rs6000-tdep.h rs6000-aix-tdep.h \
common/gdb_locale.h arch-utils.h trad-frame.h gnu-nat.h \
@@ -1059,7 +1058,6 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
ui-out.o cli-out.o \
varobj.o vec.o \
go-lang.o go-valprint.o go-typeprint.o \
- jv-lang.o jv-valprint.o jv-typeprint.o jv-varobj.o \
m2-lang.o opencl-lang.o p-lang.o p-typeprint.o p-valprint.o \
selftest.o sentinel-frame.o \
complaints.o typeprint.o \
@@ -1107,12 +1105,10 @@ YYFILES = c-exp.c \
cp-name-parser.c \
ada-lex.c \
ada-exp.c \
- jv-exp.c \
d-exp.c f-exp.c go-exp.c m2-exp.c p-exp.c rust-exp.c
YYOBJ = c-exp.o \
cp-name-parser.o \
ada-exp.o \
- jv-exp.o \
d-exp.o f-exp.o go-exp.o m2-exp.o p-exp.o rust-exp.o
# Things which need to be built when making a distribution.
@@ -1484,7 +1480,6 @@ local-maintainer-clean:
rm -f c-exp.c \
cp-name-parser.c \
ada-lex.c ada-exp.c \
- jv-exp.tab \
d-exp.c f-exp.c go-exp.c m2-exp.c p-exp.c rust-exp.c
rm -f TAGS $(INFOFILES)
rm -f $(YYFILES)
diff --git a/gdb/NEWS b/gdb/NEWS
index 741813f..4a61438 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -15,6 +15,8 @@
running on MS-Windows use to assign names to threads in the
debugger.
+* Support for Java programs compiled with gcj has been removed.
+
* New targets
Synopsys ARC arc*-*-elf32
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 2564ebc..8b15b6f 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -30,7 +30,6 @@
#include "c-lang.h"
#include "typeprint.h"
#include "cp-abi.h"
-#include "jv-lang.h"
#include "cp-support.h"
static void c_type_print_varspec_prefix (struct type *,
@@ -465,7 +464,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
parameter types get removed their possible const and volatile qualifiers to
match demangled linkage name parameters part of such function type.
LANGUAGE is the language in which TYPE was defined. This is a necessary
- evil since this code is used by the C, C++, and Java backends. */
+ evil since this code is used by the C and C++. */
void
c_type_print_args (struct type *type, struct ui_file *stream,
@@ -504,10 +503,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
param_type = make_cv_type (0, 0, param_type, NULL);
}
- if (language == language_java)
- java_print_type (param_type, "", stream, -1, 0, flags);
- else
- c_print_type (param_type, "", stream, -1, 0, flags);
+ c_print_type (param_type, "", stream, -1, 0, flags);
printed_any = 1;
}
@@ -524,8 +520,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
}
}
else if (!printed_any
- && ((TYPE_PROTOTYPED (type) && language != language_java)
- || language == language_cplus))
+ && (TYPE_PROTOTYPED (type) || language == language_cplus))
fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 48e16f9..b2b239f 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -556,7 +556,7 @@ const struct lang_varobj_ops c_varobj_ops =
c_is_path_expr_parent /* is_path_expr_parent */
};
-/* A little convenience enum for dealing with C++/Java. */
+/* A little convenience enum for dealing with C++. */
enum vsections
{
v_public = 0, v_private, v_protected
diff --git a/gdb/defs.h b/gdb/defs.h
index 6c0215c..5322648 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -196,9 +196,9 @@ extern void quit_serial_event_clear (void);
Note that there's ambiguity between the mangling schemes of some of
these languages, so some symbols could be successfully demangled by
several languages. For that reason, the constants here are sorted
- in the order we'll attempt demangling them. For example: Java and
- Rust use C++ mangling, so must come after C++; Ada must come last
- (see ada_sniff_from_mangled_name). */
+ in the order we'll attempt demangling them. For example: Rust uses
+ C++ mangling, so must come after C++; Ada must come last (see
+ ada_sniff_from_mangled_name). */
enum language
{
@@ -207,7 +207,6 @@ enum language
language_c, /* C */
language_objc, /* Objective-C */
language_cplus, /* C++ */
- language_java, /* Java */
language_d, /* D */
language_go, /* Go */
language_fortran, /* Fortran */
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index c7f6248..c777e91 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-06 Tom Tromey <tom@tromey.com>
+
+ * guile.texi (Types In Guile): Remove Java mentions.
+ * python.texi (Types In Python): Remove Java mentions.
+ * gdb.texinfo (Address Locations, Supported Languages)
+ (Index Section Format): Remove Java mentions.
+
2016-08-15 Doug Evans <dje@google.com>
* gdb.texinfo (Target Description Format): Update docs on "end"
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index cfa00ce..56cd59a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7941,7 +7941,7 @@ Any expression valid in the current working language.
@item @var{funcaddr}
An address of a function or procedure derived from its name. In C,
-C@t{++}, Java, Objective-C, Fortran, minimal, and assembly, this is
+C@t{++}, Objective-C, Fortran, minimal, and assembly, this is
simply the function's name @var{function} (and actually a special case
of a valid expression). In Pascal and Modula-2, this is
@code{&@var{function}}. In Ada, this is @code{@var{function}'Address}
@@ -14440,7 +14440,7 @@ being set automatically by @value{GDBN}.
@node Supported Languages
@section Supported Languages
-@value{GDBN} supports C, C@t{++}, D, Go, Objective-C, Fortran, Java,
+@value{GDBN} supports C, C@t{++}, D, Go, Objective-C, Fortran,
OpenCL C, Pascal, Rust, assembly, Modula-2, and Ada.
@c This is false ...
Some @value{GDBN} features may be used in expressions regardless of the
@@ -41653,7 +41653,7 @@ switch (die->tag)
break;
case DW_TAG_enumerator:
kind = VARIABLE;
- is_static = (language != CPLUS && language != JAVA);
+ is_static = language != CPLUS;
break;
case DW_TAG_subprogram:
kind = FUNCTION;
@@ -41677,7 +41677,7 @@ switch (die->tag)
case DW_TAG_union_type:
case DW_TAG_enumeration_type:
kind = TYPE;
- is_static = (language != CPLUS && language != JAVA);
+ is_static = language != CPLUS;
break;
default:
assert (0);
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 840defc..0030f3f 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1258,7 +1258,7 @@ A string of bits. It is deprecated.
An unknown or erroneous type.
@item TYPE_CODE_METHOD
-A method type, as found in C@t{++} or Java.
+A method type, as found in C@t{++}.
@item TYPE_CODE_METHODPTR
A pointer-to-member-function.
@@ -1322,7 +1322,7 @@ Return the enum value represented by @code{<gdb:field>} @var{field}.
@deffn {Scheme Procedure} field-bitpos field
Return the bit position of @code{<gdb:field>} @var{field}.
This attribute is not available for @code{static} fields (as in
-C@t{++} or Java).
+C@t{++}).
@end deffn
@deffn {Scheme Procedure} field-bitsize field
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index a17e37d..d6507e5 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -949,7 +949,7 @@ Each field is a @code{gdb.Field} object, with some pre-defined attributes:
@table @code
@item bitpos
This attribute is not available for @code{enum} or @code{static}
-(as in C@t{++} or Java) fields. The value is the position, counting
+(as in C@t{++}) fields. The value is the position, counting
in bits, from the start of the containing type.
@item enumval
@@ -1147,7 +1147,7 @@ An unknown or erroneous type.
@vindex TYPE_CODE_METHOD
@item gdb.TYPE_CODE_METHOD
-A method type, as found in C@t{++} or Java.
+A method type, as found in C@t{++}.
@vindex TYPE_CODE_METHODPTR
@item gdb.TYPE_CODE_METHODPTR
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index d0f6e71..c070cd7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -53,7 +53,6 @@
#include "block.h"
#include "addrmap.h"
#include "typeprint.h"
-#include "jv-lang.h"
#include "psympriv.h"
#include <sys/stat.h>
#include "completer.h"
@@ -3007,7 +3006,6 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
int (*cmp) (const char *, const char *);
if (current_language->la_language == language_cplus
- || current_language->la_language == language_java
|| current_language->la_language == language_fortran
|| current_language->la_language == language_d)
{
@@ -6757,8 +6755,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
/* Functions used to compute the fully scoped name of a partial DIE.
Normally, this is simple. For C++, the parent DIE's fully scoped
- name is concatenated with "::" and the partial DIE's name. For
- Java, the same thing occurs except that "." is used instead of "::".
+ name is concatenated with "::" and the partial DIE's name.
Enumerators are an exception; they use the scope of their parent
enumeration type, i.e. the name of the enumeration type is not
prepended to the enumerator.
@@ -7048,8 +7045,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
STRUCT_DOMAIN, LOC_TYPEDEF,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
0, cu->language, objfile);
@@ -7059,8 +7055,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_CONST,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
0, cu->language, objfile);
@@ -8435,9 +8430,8 @@ do_ui_file_peek_last (void *object, const char *buffer, long length)
/* Compute the fully qualified name of DIE in CU. If PHYSNAME is nonzero,
compute the physname for the object, which include a method's:
- - formal parameters (C++/Java),
+ - formal parameters (C++),
- receiver type (Go),
- - return type (Java).
The term "physname" is a bit confusing.
For C++, for example, it is the demangled name.
@@ -8484,7 +8478,7 @@ dwarf2_compute_name (const char *name,
/* These are the only languages we know how to qualify names in. */
if (name != NULL
- && (cu->language == language_cplus || cu->language == language_java
+ && (cu->language == language_cplus
|| cu->language == language_fortran || cu->language == language_d
|| cu->language == language_rust))
{
@@ -8635,27 +8629,18 @@ dwarf2_compute_name (const char *name,
}
}
- /* For Java and C++ methods, append formal parameter type
+ /* For C++ methods, append formal parameter type
information, if PHYSNAME. */
if (physname && die->tag == DW_TAG_subprogram
- && (cu->language == language_cplus
- || cu->language == language_java))
+ && cu->language == language_cplus)
{
struct type *type = read_type_die (die, cu);
c_type_print_args (type, buf, 1, cu->language,
&type_print_raw_options);
- if (cu->language == language_java)
- {
- /* For java, we must append the return type to method
- names. */
- if (die->tag == DW_TAG_subprogram)
- java_print_type (TYPE_TARGET_TYPE (type), "", buf,
- 0, 0, &type_print_raw_options);
- }
- else if (cu->language == language_cplus)
+ if (cu->language == language_cplus)
{
/* Assume that an artificial first parameter is
"this", but do not crash if it is not. RealView
@@ -8703,7 +8688,7 @@ dwarf2_compute_name (const char *name,
not have a name. NAME may either be from a previous call to
dwarf2_name or NULL.
- The output string will be canonicalized (if C++/Java). */
+ The output string will be canonicalized (if C++). */
static const char *
dwarf2_full_name (const char *name, struct die_info *die, struct dwarf2_cu *cu)
@@ -8716,7 +8701,7 @@ dwarf2_full_name (const char *name, struct die_info *die, struct dwarf2_cu *cu)
allocated on the objfile_objstack or NULL if the DIE does not have a
name.
- The output string will be canonicalized (if C++/Java). */
+ The output string will be canonicalized (if C++). */
static const char *
dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
@@ -8768,10 +8753,7 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
else
{
demangled = gdb_demangle (mangled,
- (DMGL_PARAMS | DMGL_ANSI
- | (cu->language == language_java
- ? DMGL_JAVA | DMGL_RET_POSTFIX
- : DMGL_RET_DROP)));
+ (DMGL_PARAMS | DMGL_ANSI | DMGL_RET_DROP));
}
if (demangled)
{
@@ -12901,7 +12883,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
fnp = &new_fnfield->fnfield;
/* Delay processing of the physname until later. */
- if (cu->language == language_cplus || cu->language == language_java)
+ if (cu->language == language_cplus)
{
add_to_method_list (type, i, flp->length - 1, fieldname,
die, cu);
@@ -13087,11 +13069,8 @@ is_vtable_name (const char *name, struct dwarf2_cu *cu)
static const char vptr[] = "_vptr";
static const char vtable[] = "vtable";
- /* Look for the C++ and Java forms of the vtable. */
- if ((cu->language == language_java
- && startswith (name, vtable))
- || (startswith (name, vptr)
- && is_cplus_marker (name[sizeof (vptr) - 1])))
+ /* Look for the C++ form of the vtable. */
+ if (startswith (name, vptr) && is_cplus_marker (name[sizeof (vptr) - 1]))
return 1;
return 0;
@@ -13194,7 +13173,6 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
if (name != NULL)
{
if (cu->language == language_cplus
- || cu->language == language_java
|| cu->language == language_d
|| cu->language == language_rust)
{
@@ -13468,9 +13446,6 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
}
do_cleanups (back_to);
-
- if (HAVE_CPLUS_STRUCT (type))
- TYPE_CPLUS_REALLY_JAVA (type) = cu->language == language_java;
}
quirk_gcc_member_function_pointer (type, objfile);
@@ -14675,19 +14650,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr)
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = DW_UNSND (attr);
else
- {
- TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
-
- /* GCC/43521: In java, the formal parameter
- "this" is sometimes not marked with DW_AT_artificial. */
- if (cu->language == language_java)
- {
- const char *name = dwarf2_name (child_die, cu);
-
- if (name && !strcmp (name, "this"))
- TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 1;
- }
- }
+ TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
arg_type = die_type (child_die, cu);
/* RealView does not mark THIS as const, which the testsuite
@@ -15023,7 +14986,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
low_default_is_valid = 1;
break;
case language_d:
- case language_java:
case language_objc:
case language_rust:
low.data.const_val = 0;
@@ -15741,8 +15703,7 @@ load_partial_dies (const struct die_reader_specs *reader,
else if (building_psymtab)
add_psymbol_to_list (part_die->name, strlen (part_die->name), 0,
VAR_DOMAIN, LOC_CONST,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
0, cu->language, objfile);
@@ -17077,6 +17038,7 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
case DW_LANG_UPC:
cu->language = language_c;
break;
+ case DW_LANG_Java:
case DW_LANG_C_plus_plus:
case DW_LANG_C_plus_plus_11:
case DW_LANG_C_plus_plus_14:
@@ -17098,9 +17060,6 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
case DW_LANG_Mips_Assembler:
cu->language = language_asm;
break;
- case DW_LANG_Java:
- cu->language = language_java;
- break;
case DW_LANG_Ada83:
case DW_LANG_Ada95:
cu->language = language_ada;
@@ -18659,7 +18618,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
{
- /* NOTE: carlton/2003-11-10: C++ and Java class symbols shouldn't
+ /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't
really ever be static objects: otherwise, if you try
to, say, break of a class's method and you're in a file
which doesn't mention that class, it won't work unless
@@ -18670,16 +18629,12 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
if (!suppress_add)
{
list_to_add = (cu->list_in_scope == &file_symbols
- && (cu->language == language_cplus
- || cu->language == language_java)
+ && cu->language == language_cplus
? &global_symbols : cu->list_in_scope);
/* The semantics of C++ state that "struct foo {
- ... }" also defines a typedef for "foo". A Java
- class declaration also defines a typedef for the
- class. */
+ ... }" also defines a typedef for "foo". */
if (cu->language == language_cplus
- || cu->language == language_java
|| cu->language == language_ada
|| cu->language == language_d
|| cu->language == language_rust)
@@ -18715,8 +18670,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
DW_TAG_class_type, etc. block. */
list_to_add = (cu->list_in_scope == &file_symbols
- && (cu->language == language_cplus
- || cu->language == language_java)
+ && cu->language == language_cplus
? &global_symbols : cu->list_in_scope);
}
break;
@@ -19354,7 +19308,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
struct type *parent_type;
char *retval;
- if (cu->language != language_cplus && cu->language != language_java
+ if (cu->language != language_cplus
&& cu->language != language_fortran && cu->language != language_d
&& cu->language != language_rust)
return "";
@@ -19510,8 +19464,6 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
if (suffix == NULL || suffix[0] == '\0'
|| prefix == NULL || prefix[0] == '\0')
sep = "";
- else if (cu->language == language_java)
- sep = ".";
else if (cu->language == language_d)
{
/* For D, the 'main' function could be defined in any module, but it
@@ -19623,36 +19575,6 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
return DW_STRING (attr);
return CP_ANONYMOUS_NAMESPACE_STR;
- case DW_TAG_subprogram:
- /* Java constructors will all be named "<init>", so return
- the class name when we see this special case. */
- if (cu->language == language_java
- && DW_STRING (attr) != NULL
- && strcmp (DW_STRING (attr), "<init>") == 0)
- {
- struct dwarf2_cu *spec_cu = cu;
- struct die_info *spec_die;
-
- /* GCJ will output '<init>' for Java constructor names.
- For this special case, return the name of the parent class. */
-
- /* GCJ may output subprogram DIEs with AT_specification set.
- If so, use the name of the specified DIE. */
- spec_die = die_specification (die, &spec_cu);
- if (spec_die != NULL)
- return dwarf2_name (spec_die, spec_cu);
-
- do
- {
- die = die->parent;
- if (die->tag == DW_TAG_class_type)
- return dwarf2_name (die, cu);
- }
- while (die->tag != DW_TAG_compile_unit
- && die->tag != DW_TAG_partial_unit);
- }
- break;
-
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 812e73b..4ca0bd8 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -926,10 +926,6 @@ struct cplus_struct_type
int is_dynamic : 2;
- /* * Non-zero if this type came from a Java CU. */
-
- unsigned int is_java : 1;
-
/* * The base class which defined the virtual function table pointer. */
struct type *vptr_basetype;
@@ -1309,7 +1305,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define BASETYPE_VIA_PUBLIC(thistype, index) \
((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
#define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
-#define TYPE_CPLUS_REALLY_JAVA(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_java
#define BASETYPE_VIA_VIRTUAL(thistype, index) \
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 5bf36a2..0e037e6 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -302,10 +302,6 @@ gnuv3_rtti_type (struct value *value,
if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
return NULL;
- /* Java doesn't have RTTI following the C++ ABI. */
- if (TYPE_CPLUS_REALLY_JAVA (values_type))
- return NULL;
-
/* Determine architecture. */
gdbarch = get_type_arch (values_type);
@@ -457,9 +453,8 @@ gnuv3_baseclass_offset (struct type *type, int index,
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
/* If it isn't a virtual base, this is easy. The offset is in the
- type definition. Likewise for Java, which doesn't really have
- virtual inheritance in the C++ sense. */
- if (!BASETYPE_VIA_VIRTUAL (type, index) || TYPE_CPLUS_REALLY_JAVA (type))
+ type definition. */
+ if (!BASETYPE_VIA_VIRTUAL (type, index))
return TYPE_BASECLASS_BITPOS (type, index) / 8;
/* To access a virtual base, we need to use the vbase offset stored in
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
deleted file mode 100644
index 79b8127..0000000
--- a/gdb/jv-exp.y
+++ /dev/null
@@ -1,1434 +0,0 @@
-/* YACC parser for Java expressions, for GDB.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Parse a Java expression from text in a string,
- and return the result as a struct expression pointer.
- That structure contains arithmetic operations in reverse polish,
- with constants represented by operations that are followed by special data.
- See expression.h for the details of the format.
- What is important here is that it can be built up sequentially
- during the process of parsing; the lower levels of the tree always
- come first in the result. Well, almost always; see ArrayAccess.
-
- Note that malloc's and realloc's in this file are transformed to
- xmalloc and xrealloc respectively by the same sed command in the
- makefile that remaps any other malloc/realloc inserted by the parser
- generator. Doing this with #defines and trying to control the interaction
- with include files (<malloc.h> and <stdlib.h> for example) just became
- too messy, particularly when such includes can be inserted at random
- times by the parser generator. */
-
-%{
-
-#include "defs.h"
-#include <ctype.h>
-#include "expression.h"
-#include "value.h"
-#include "parser-defs.h"
-#include "language.h"
-#include "jv-lang.h"
-#include "bfd.h" /* Required by objfiles.h. */
-#include "symfile.h" /* Required by objfiles.h. */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
-#include "block.h"
-#include "completer.h"
-
-#define parse_type(ps) builtin_type (parse_gdbarch (ps))
-#define parse_java_type(ps) builtin_java_type (parse_gdbarch (ps))
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
- etc). */
-#define GDB_YY_REMAP_PREFIX java_
-#include "yy-remap.h"
-
-/* The state of the parser, used internally when we are parsing the
- expression. */
-
-static struct parser_state *pstate = NULL;
-
-int yyparse (void);
-
-static int yylex (void);
-
-void yyerror (char *);
-
-static struct type *java_type_from_name (struct stoken);
-static void push_expression_name (struct parser_state *, struct stoken);
-static void push_fieldnames (struct parser_state *, struct stoken);
-
-static struct expression *copy_exp (struct expression *, int);
-static void insert_exp (struct parser_state *, int, struct expression *);
-
-%}
-
-/* Although the yacc "value" of an expression is not used,
- since the result is stored in the structure being created,
- other node types do have values. */
-
-%union
- {
- LONGEST lval;
- struct {
- LONGEST val;
- struct type *type;
- } typed_val_int;
- struct {
- DOUBLEST dval;
- struct type *type;
- } typed_val_float;
- struct symbol *sym;
- struct type *tval;
- struct stoken sval;
- struct ttype tsym;
- struct symtoken ssym;
- struct block *bval;
- enum exp_opcode opcode;
- struct internalvar *ivar;
- int *ivec;
- }
-
-%{
-/* YYSTYPE gets defined by %union */
-static int parse_number (struct parser_state *, const char *, int,
- int, YYSTYPE *);
-%}
-
-%type <lval> rcurly Dims Dims_opt
-%type <tval> ClassOrInterfaceType ClassType /* ReferenceType Type ArrayType */
-%type <tval> IntegralType FloatingPointType NumericType PrimitiveType ArrayType PrimitiveOrArrayType
-
-%token <typed_val_int> INTEGER_LITERAL
-%token <typed_val_float> FLOATING_POINT_LITERAL
-
-%token <sval> IDENTIFIER
-%token <sval> STRING_LITERAL
-%token <lval> BOOLEAN_LITERAL
-%token <tsym> TYPENAME
-%type <sval> Name SimpleName QualifiedName ForcedName
-
-/* A NAME_OR_INT is a symbol which is not known in the symbol table,
- but which would parse as a valid number in the current input radix.
- E.g. "c" when input_radix==16. Depending on the parse, it will be
- turned into a name or into a number. */
-
-%token <sval> NAME_OR_INT
-
-%token ERROR
-
-/* Special type cases, put in to allow the parser to distinguish different
- legal basetypes. */
-%token LONG SHORT BYTE INT CHAR BOOLEAN DOUBLE FLOAT
-
-%token VARIABLE
-
-%token <opcode> ASSIGN_MODIFY
-
-%token SUPER NEW
-
-%left ','
-%right '=' ASSIGN_MODIFY
-%right '?'
-%left OROR
-%left ANDAND
-%left '|'
-%left '^'
-%left '&'
-%left EQUAL NOTEQUAL
-%left '<' '>' LEQ GEQ
-%left LSH RSH
-%left '+' '-'
-%left '*' '/' '%'
-%right INCREMENT DECREMENT
-%right '.' '[' '('
-
-
-%%
-
-start : exp1
- | type_exp
- ;
-
-type_exp: PrimitiveOrArrayType
- {
- write_exp_elt_opcode (pstate, OP_TYPE);
- write_exp_elt_type (pstate, $1);
- write_exp_elt_opcode (pstate, OP_TYPE);
- }
- ;
-
-PrimitiveOrArrayType:
- PrimitiveType
- | ArrayType
- ;
-
-StringLiteral:
- STRING_LITERAL
- {
- write_exp_elt_opcode (pstate, OP_STRING);
- write_exp_string (pstate, $1);
- write_exp_elt_opcode (pstate, OP_STRING);
- }
-;
-
-Literal:
- INTEGER_LITERAL
- { write_exp_elt_opcode (pstate, OP_LONG);
- write_exp_elt_type (pstate, $1.type);
- write_exp_elt_longcst (pstate, (LONGEST)($1.val));
- write_exp_elt_opcode (pstate, OP_LONG); }
-| NAME_OR_INT
- { YYSTYPE val;
- parse_number (pstate, $1.ptr, $1.length, 0, &val);
- write_exp_elt_opcode (pstate, OP_LONG);
- write_exp_elt_type (pstate, val.typed_val_int.type);
- write_exp_elt_longcst (pstate,
- (LONGEST) val.typed_val_int.val);
- write_exp_elt_opcode (pstate, OP_LONG);
- }
-| FLOATING_POINT_LITERAL
- { write_exp_elt_opcode (pstate, OP_DOUBLE);
- write_exp_elt_type (pstate, $1.type);
- write_exp_elt_dblcst (pstate, $1.dval);
- write_exp_elt_opcode (pstate, OP_DOUBLE); }
-| BOOLEAN_LITERAL
- { write_exp_elt_opcode (pstate, OP_LONG);
- write_exp_elt_type (pstate,
- parse_java_type (pstate)->builtin_boolean);
- write_exp_elt_longcst (pstate, (LONGEST)$1);
- write_exp_elt_opcode (pstate, OP_LONG); }
-| StringLiteral
- ;
-
-/* UNUSED:
-Type:
- PrimitiveType
-| ReferenceType
-;
-*/
-
-PrimitiveType:
- NumericType
-| BOOLEAN
- { $$ = parse_java_type (pstate)->builtin_boolean; }
-;
-
-NumericType:
- IntegralType
-| FloatingPointType
-;
-
-IntegralType:
- BYTE
- { $$ = parse_java_type (pstate)->builtin_byte; }
-| SHORT
- { $$ = parse_java_type (pstate)->builtin_short; }
-| INT
- { $$ = parse_java_type (pstate)->builtin_int; }
-| LONG
- { $$ = parse_java_type (pstate)->builtin_long; }
-| CHAR
- { $$ = parse_java_type (pstate)->builtin_char; }
-;
-
-FloatingPointType:
- FLOAT
- { $$ = parse_java_type (pstate)->builtin_float; }
-| DOUBLE
- { $$ = parse_java_type (pstate)->builtin_double; }
-;
-
-/* UNUSED:
-ReferenceType:
- ClassOrInterfaceType
-| ArrayType
-;
-*/
-
-ClassOrInterfaceType:
- Name
- { $$ = java_type_from_name ($1); }
-;
-
-ClassType:
- ClassOrInterfaceType
-;
-
-ArrayType:
- PrimitiveType Dims
- { $$ = java_array_type ($1, $2); }
-| Name Dims
- { $$ = java_array_type (java_type_from_name ($1), $2); }
-;
-
-Name:
- IDENTIFIER
-| QualifiedName
-;
-
-ForcedName:
- SimpleName
-| QualifiedName
-;
-
-SimpleName:
- IDENTIFIER
-| NAME_OR_INT
-;
-
-QualifiedName:
- Name '.' SimpleName
- { $$.length = $1.length + $3.length + 1;
- if ($1.ptr + $1.length + 1 == $3.ptr
- && $1.ptr[$1.length] == '.')
- $$.ptr = $1.ptr; /* Optimization. */
- else
- {
- char *buf;
-
- buf = (char *) malloc ($$.length + 1);
- make_cleanup (free, buf);
- sprintf (buf, "%.*s.%.*s",
- $1.length, $1.ptr, $3.length, $3.ptr);
- $$.ptr = buf;
- } }
-;
-
-/*
-type_exp: type
- { write_exp_elt_opcode(OP_TYPE);
- write_exp_elt_type($1);
- write_exp_elt_opcode(OP_TYPE);}
- ;
- */
-
-/* Expressions, including the comma operator. */
-exp1 : Expression
- | exp1 ',' Expression
- { write_exp_elt_opcode (pstate, BINOP_COMMA); }
- ;
-
-Primary:
- PrimaryNoNewArray
-| ArrayCreationExpression
-;
-
-PrimaryNoNewArray:
- Literal
-| '(' Expression ')'
-| ClassInstanceCreationExpression
-| FieldAccess
-| MethodInvocation
-| ArrayAccess
-| lcurly ArgumentList rcurly
- { write_exp_elt_opcode (pstate, OP_ARRAY);
- write_exp_elt_longcst (pstate, (LONGEST) 0);
- write_exp_elt_longcst (pstate, (LONGEST) $3);
- write_exp_elt_opcode (pstate, OP_ARRAY); }
-;
-
-lcurly:
- '{'
- { start_arglist (); }
-;
-
-rcurly:
- '}'
- { $$ = end_arglist () - 1; }
-;
-
-ClassInstanceCreationExpression:
- NEW ClassType '(' ArgumentList_opt ')'
- { internal_error (__FILE__, __LINE__,
- _("FIXME - ClassInstanceCreationExpression")); }
-;
-
-ArgumentList:
- Expression
- { arglist_len = 1; }
-| ArgumentList ',' Expression
- { arglist_len++; }
-;
-
-ArgumentList_opt:
- /* EMPTY */
- { arglist_len = 0; }
-| ArgumentList
-;
-
-ArrayCreationExpression:
- NEW PrimitiveType DimExprs Dims_opt
- { internal_error (__FILE__, __LINE__,
- _("FIXME - ArrayCreationExpression")); }
-| NEW ClassOrInterfaceType DimExprs Dims_opt
- { internal_error (__FILE__, __LINE__,
- _("FIXME - ArrayCreationExpression")); }
-;
-
-DimExprs:
- DimExpr
-| DimExprs DimExpr
-;
-
-DimExpr:
- '[' Expression ']'
-;
-
-Dims:
- '[' ']'
- { $$ = 1; }
-| Dims '[' ']'
- { $$ = $1 + 1; }
-;
-
-Dims_opt:
- Dims
-| /* EMPTY */
- { $$ = 0; }
-;
-
-FieldAccess:
- Primary '.' SimpleName
- { push_fieldnames (pstate, $3); }
-| VARIABLE '.' SimpleName
- { push_fieldnames (pstate, $3); }
-/*| SUPER '.' SimpleName { FIXME } */
-;
-
-FuncStart:
- Name '('
- { push_expression_name (pstate, $1); }
-;
-
-MethodInvocation:
- FuncStart
- { start_arglist(); }
- ArgumentList_opt ')'
- { write_exp_elt_opcode (pstate, OP_FUNCALL);
- write_exp_elt_longcst (pstate, (LONGEST) end_arglist ());
- write_exp_elt_opcode (pstate, OP_FUNCALL); }
-| Primary '.' SimpleName '(' ArgumentList_opt ')'
- { error (_("Form of method invocation not implemented")); }
-| SUPER '.' SimpleName '(' ArgumentList_opt ')'
- { error (_("Form of method invocation not implemented")); }
-;
-
-ArrayAccess:
- Name '[' Expression ']'
- {
- /* Emit code for the Name now, then exchange it in the
- expout array with the Expression's code. We could
- introduce a OP_SWAP code or a reversed version of
- BINOP_SUBSCRIPT, but that makes the rest of GDB pay
- for our parsing kludges. */
- struct expression *name_expr;
-
- push_expression_name (pstate, $1);
- name_expr = copy_exp (pstate->expout, pstate->expout_ptr);
- pstate->expout_ptr -= name_expr->nelts;
- insert_exp (pstate,
- pstate->expout_ptr
- - length_of_subexp (pstate->expout,
- pstate->expout_ptr),
- name_expr);
- free (name_expr);
- write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT);
- }
-| VARIABLE '[' Expression ']'
- { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
-| PrimaryNoNewArray '[' Expression ']'
- { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
-;
-
-PostfixExpression:
- Primary
-| Name
- { push_expression_name (pstate, $1); }
-| VARIABLE
- /* Already written by write_dollar_variable. */
-| PostIncrementExpression
-| PostDecrementExpression
-;
-
-PostIncrementExpression:
- PostfixExpression INCREMENT
- { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
-;
-
-PostDecrementExpression:
- PostfixExpression DECREMENT
- { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); }
-;
-
-UnaryExpression:
- PreIncrementExpression
-| PreDecrementExpression
-| '+' UnaryExpression
-| '-' UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_NEG); }
-| '*' UnaryExpression
- { write_exp_elt_opcode (pstate,
- UNOP_IND); } /*FIXME not in Java */
-| UnaryExpressionNotPlusMinus
-;
-
-PreIncrementExpression:
- INCREMENT UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
-;
-
-PreDecrementExpression:
- DECREMENT UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); }
-;
-
-UnaryExpressionNotPlusMinus:
- PostfixExpression
-| '~' UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
-| '!' UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
-| CastExpression
- ;
-
-CastExpression:
- '(' PrimitiveType Dims_opt ')' UnaryExpression
- { write_exp_elt_opcode (pstate, UNOP_CAST);
- write_exp_elt_type (pstate, java_array_type ($2, $3));
- write_exp_elt_opcode (pstate, UNOP_CAST); }
-| '(' Expression ')' UnaryExpressionNotPlusMinus
- {
- int last_exp_size = length_of_subexp (pstate->expout,
- pstate->expout_ptr);
- struct type *type;
- int i;
- int base = pstate->expout_ptr - last_exp_size - 3;
-
- if (base < 0
- || pstate->expout->elts[base+2].opcode != OP_TYPE)
- error (_("Invalid cast expression"));
- type = pstate->expout->elts[base+1].type;
- /* Remove the 'Expression' and slide the
- UnaryExpressionNotPlusMinus down to replace it. */
- for (i = 0; i < last_exp_size; i++)
- pstate->expout->elts[base + i]
- = pstate->expout->elts[base + i + 3];
- pstate->expout_ptr -= 3;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
- type = lookup_pointer_type (type);
- write_exp_elt_opcode (pstate, UNOP_CAST);
- write_exp_elt_type (pstate, type);
- write_exp_elt_opcode (pstate, UNOP_CAST);
- }
-| '(' Name Dims ')' UnaryExpressionNotPlusMinus
- { write_exp_elt_opcode (pstate, UNOP_CAST);
- write_exp_elt_type (pstate,
- java_array_type (java_type_from_name
- ($2), $3));
- write_exp_elt_opcode (pstate, UNOP_CAST); }
-;
-
-
-MultiplicativeExpression:
- UnaryExpression
-| MultiplicativeExpression '*' UnaryExpression
- { write_exp_elt_opcode (pstate, BINOP_MUL); }
-| MultiplicativeExpression '/' UnaryExpression
- { write_exp_elt_opcode (pstate, BINOP_DIV); }
-| MultiplicativeExpression '%' UnaryExpression
- { write_exp_elt_opcode (pstate, BINOP_REM); }
-;
-
-AdditiveExpression:
- MultiplicativeExpression
-| AdditiveExpression '+' MultiplicativeExpression
- { write_exp_elt_opcode (pstate, BINOP_ADD); }
-| AdditiveExpression '-' MultiplicativeExpression
- { write_exp_elt_opcode (pstate, BINOP_SUB); }
-;
-
-ShiftExpression:
- AdditiveExpression
-| ShiftExpression LSH AdditiveExpression
- { write_exp_elt_opcode (pstate, BINOP_LSH); }
-| ShiftExpression RSH AdditiveExpression
- { write_exp_elt_opcode (pstate, BINOP_RSH); }
-/* | ShiftExpression >>> AdditiveExpression { FIXME } */
-;
-
-RelationalExpression:
- ShiftExpression
-| RelationalExpression '<' ShiftExpression
- { write_exp_elt_opcode (pstate, BINOP_LESS); }
-| RelationalExpression '>' ShiftExpression
- { write_exp_elt_opcode (pstate, BINOP_GTR); }
-| RelationalExpression LEQ ShiftExpression
- { write_exp_elt_opcode (pstate, BINOP_LEQ); }
-| RelationalExpression GEQ ShiftExpression
- { write_exp_elt_opcode (pstate, BINOP_GEQ); }
-/* | RelationalExpresion INSTANCEOF ReferenceType { FIXME } */
-;
-
-EqualityExpression:
- RelationalExpression
-| EqualityExpression EQUAL RelationalExpression
- { write_exp_elt_opcode (pstate, BINOP_EQUAL); }
-| EqualityExpression NOTEQUAL RelationalExpression
- { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
-;
-
-AndExpression:
- EqualityExpression
-| AndExpression '&' EqualityExpression
- { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
-;
-
-ExclusiveOrExpression:
- AndExpression
-| ExclusiveOrExpression '^' AndExpression
- { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
-;
-InclusiveOrExpression:
- ExclusiveOrExpression
-| InclusiveOrExpression '|' ExclusiveOrExpression
- { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
-;
-
-ConditionalAndExpression:
- InclusiveOrExpression
-| ConditionalAndExpression ANDAND InclusiveOrExpression
- { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
-;
-
-ConditionalOrExpression:
- ConditionalAndExpression
-| ConditionalOrExpression OROR ConditionalAndExpression
- { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
-;
-
-ConditionalExpression:
- ConditionalOrExpression
-| ConditionalOrExpression '?' Expression ':' ConditionalExpression
- { write_exp_elt_opcode (pstate, TERNOP_COND); }
-;
-
-AssignmentExpression:
- ConditionalExpression
-| Assignment
-;
-
-Assignment:
- LeftHandSide '=' ConditionalExpression
- { write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
-| LeftHandSide ASSIGN_MODIFY ConditionalExpression
- { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
- write_exp_elt_opcode (pstate, $2);
- write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
-;
-
-LeftHandSide:
- ForcedName
- { push_expression_name (pstate, $1); }
-| VARIABLE
- /* Already written by write_dollar_variable. */
-| FieldAccess
-| ArrayAccess
-;
-
-
-Expression:
- AssignmentExpression
-;
-
-%%
-/* Take care of parsing a number (anything that starts with a digit).
- Set yylval and return the token type; update lexptr.
- LEN is the number of characters in it. */
-
-/*** Needs some error checking for the float case ***/
-
-static int
-parse_number (struct parser_state *par_state,
- const char *p, int len, int parsed_float, YYSTYPE *putithere)
-{
- ULONGEST n = 0;
- ULONGEST limit, limit_div_base;
-
- int c;
- int base = input_radix;
-
- struct type *type;
-
- if (parsed_float)
- {
- const char *suffix;
- int suffix_len;
-
- if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix))
- return ERROR;
-
- suffix_len = p + len - suffix;
-
- if (suffix_len == 0)
- putithere->typed_val_float.type
- = parse_type (par_state)->builtin_double;
- else if (suffix_len == 1)
- {
- /* See if it has `f' or `d' suffix (float or double). */
- if (tolower (*suffix) == 'f')
- putithere->typed_val_float.type =
- parse_type (par_state)->builtin_float;
- else if (tolower (*suffix) == 'd')
- putithere->typed_val_float.type =
- parse_type (par_state)->builtin_double;
- else
- return ERROR;
- }
- else
- return ERROR;
-
- return FLOATING_POINT_LITERAL;
- }
-
- /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
- if (p[0] == '0')
- switch (p[1])
- {
- case 'x':
- case 'X':
- if (len >= 3)
- {
- p += 2;
- base = 16;
- len -= 2;
- }
- break;
-
- case 't':
- case 'T':
- case 'd':
- case 'D':
- if (len >= 3)
- {
- p += 2;
- base = 10;
- len -= 2;
- }
- break;
-
- default:
- base = 8;
- break;
- }
-
- c = p[len-1];
- /* A paranoid calculation of (1<<64)-1. */
- limit = (ULONGEST)0xffffffff;
- limit = ((limit << 16) << 16) | limit;
- if (c == 'l' || c == 'L')
- {
- type = parse_java_type (par_state)->builtin_long;
- len--;
- }
- else
- {
- type = parse_java_type (par_state)->builtin_int;
- }
- limit_div_base = limit / (ULONGEST) base;
-
- while (--len >= 0)
- {
- c = *p++;
- if (c >= '0' && c <= '9')
- c -= '0';
- else if (c >= 'A' && c <= 'Z')
- c -= 'A' - 10;
- else if (c >= 'a' && c <= 'z')
- c -= 'a' - 10;
- else
- return ERROR; /* Char not a digit */
- if (c >= base)
- return ERROR;
- if (n > limit_div_base
- || (n *= base) > limit - c)
- error (_("Numeric constant too large"));
- n += c;
- }
-
- /* If the type is bigger than a 32-bit signed integer can be, implicitly
- promote to long. Java does not do this, so mark it as
- parse_type (par_state)->builtin_uint64 rather than
- parse_java_type (par_state)->builtin_long.
- 0x80000000 will become -0x80000000 instead of 0x80000000L, because we
- don't know the sign at this point. */
- if (type == parse_java_type (par_state)->builtin_int
- && n > (ULONGEST)0x80000000)
- type = parse_type (par_state)->builtin_uint64;
-
- putithere->typed_val_int.val = n;
- putithere->typed_val_int.type = type;
-
- return INTEGER_LITERAL;
-}
-
-struct token
-{
- char *oper;
- int token;
- enum exp_opcode opcode;
-};
-
-static const struct token tokentab3[] =
- {
- {">>=", ASSIGN_MODIFY, BINOP_RSH},
- {"<<=", ASSIGN_MODIFY, BINOP_LSH}
- };
-
-static const struct token tokentab2[] =
- {
- {"+=", ASSIGN_MODIFY, BINOP_ADD},
- {"-=", ASSIGN_MODIFY, BINOP_SUB},
- {"*=", ASSIGN_MODIFY, BINOP_MUL},
- {"/=", ASSIGN_MODIFY, BINOP_DIV},
- {"%=", ASSIGN_MODIFY, BINOP_REM},
- {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
- {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
- {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
- {"++", INCREMENT, BINOP_END},
- {"--", DECREMENT, BINOP_END},
- {"&&", ANDAND, BINOP_END},
- {"||", OROR, BINOP_END},
- {"<<", LSH, BINOP_END},
- {">>", RSH, BINOP_END},
- {"==", EQUAL, BINOP_END},
- {"!=", NOTEQUAL, BINOP_END},
- {"<=", LEQ, BINOP_END},
- {">=", GEQ, BINOP_END}
- };
-
-/* Read one token, getting characters through lexptr. */
-
-static int
-yylex (void)
-{
- int c;
- int namelen;
- unsigned int i;
- const char *tokstart;
- const char *tokptr;
- int tempbufindex;
- static char *tempbuf;
- static int tempbufsize;
-
- retry:
-
- prev_lexptr = lexptr;
-
- tokstart = lexptr;
- /* See if it is a special token of length 3. */
- for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
- {
- lexptr += 3;
- yylval.opcode = tokentab3[i].opcode;
- return tokentab3[i].token;
- }
-
- /* See if it is a special token of length 2. */
- for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
- {
- lexptr += 2;
- yylval.opcode = tokentab2[i].opcode;
- return tokentab2[i].token;
- }
-
- switch (c = *tokstart)
- {
- case 0:
- return 0;
-
- case ' ':
- case '\t':
- case '\n':
- lexptr++;
- goto retry;
-
- case '\'':
- /* We either have a character constant ('0' or '\177' for example)
- or we have a quoted symbol reference ('foo(int,int)' in C++
- for example). */
- lexptr++;
- c = *lexptr++;
- if (c == '\\')
- c = parse_escape (parse_gdbarch (pstate), &lexptr);
- else if (c == '\'')
- error (_("Empty character constant"));
-
- yylval.typed_val_int.val = c;
- yylval.typed_val_int.type = parse_java_type (pstate)->builtin_char;
-
- c = *lexptr++;
- if (c != '\'')
- {
- namelen = skip_quoted (tokstart) - tokstart;
- if (namelen > 2)
- {
- lexptr = tokstart + namelen;
- if (lexptr[-1] != '\'')
- error (_("Unmatched single quote"));
- namelen -= 2;
- tokstart++;
- goto tryname;
- }
- error (_("Invalid character constant"));
- }
- return INTEGER_LITERAL;
-
- case '(':
- paren_depth++;
- lexptr++;
- return c;
-
- case ')':
- if (paren_depth == 0)
- return 0;
- paren_depth--;
- lexptr++;
- return c;
-
- case ',':
- if (comma_terminates && paren_depth == 0)
- return 0;
- lexptr++;
- return c;
-
- case '.':
- /* Might be a floating point number. */
- if (lexptr[1] < '0' || lexptr[1] > '9')
- goto symbol; /* Nope, must be a symbol. */
- /* FALL THRU into number case. */
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- {
- /* It's a number. */
- int got_dot = 0, got_e = 0, toktype;
- const char *p = tokstart;
- int hex = input_radix > 10;
-
- if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
- {
- p += 2;
- hex = 1;
- }
- else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
- {
- p += 2;
- hex = 0;
- }
-
- for (;; ++p)
- {
- /* This test includes !hex because 'e' is a valid hex digit
- and thus does not indicate a floating point number when
- the radix is hex. */
- if (!hex && !got_e && (*p == 'e' || *p == 'E'))
- got_dot = got_e = 1;
- /* This test does not include !hex, because a '.' always indicates
- a decimal floating point number regardless of the radix. */
- else if (!got_dot && *p == '.')
- got_dot = 1;
- else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
- && (*p == '-' || *p == '+'))
- /* This is the sign of the exponent, not the end of the
- number. */
- continue;
- /* We will take any letters or digits. parse_number will
- complain if past the radix, or if L or U are not final. */
- else if ((*p < '0' || *p > '9')
- && ((*p < 'a' || *p > 'z')
- && (*p < 'A' || *p > 'Z')))
- break;
- }
- toktype = parse_number (pstate, tokstart, p - tokstart,
- got_dot|got_e, &yylval);
- if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\""), err_copy);
- }
- lexptr = p;
- return toktype;
- }
-
- case '+':
- case '-':
- case '*':
- case '/':
- case '%':
- case '|':
- case '&':
- case '^':
- case '~':
- case '!':
- case '<':
- case '>':
- case '[':
- case ']':
- case '?':
- case ':':
- case '=':
- case '{':
- case '}':
- symbol:
- lexptr++;
- return c;
-
- case '"':
-
- /* Build the gdb internal form of the input string in tempbuf,
- translating any standard C escape forms seen. Note that the
- buffer is null byte terminated *only* for the convenience of
- debugging gdb itself and printing the buffer contents when
- the buffer contains no embedded nulls. Gdb does not depend
- upon the buffer being null byte terminated, it uses the length
- string instead. This allows gdb to handle C strings (as well
- as strings in other languages) with embedded null bytes */
-
- tokptr = ++tokstart;
- tempbufindex = 0;
-
- do {
- /* Grow the static temp buffer if necessary, including allocating
- the first one on demand. */
- if (tempbufindex + 1 >= tempbufsize)
- {
- tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
- }
- switch (*tokptr)
- {
- case '\0':
- case '"':
- /* Do nothing, loop will terminate. */
- break;
- case '\\':
- tokptr++;
- c = parse_escape (parse_gdbarch (pstate), &tokptr);
- if (c == -1)
- {
- continue;
- }
- tempbuf[tempbufindex++] = c;
- break;
- default:
- tempbuf[tempbufindex++] = *tokptr++;
- break;
- }
- } while ((*tokptr != '"') && (*tokptr != '\0'));
- if (*tokptr++ != '"')
- {
- error (_("Unterminated string in expression"));
- }
- tempbuf[tempbufindex] = '\0'; /* See note above */
- yylval.sval.ptr = tempbuf;
- yylval.sval.length = tempbufindex;
- lexptr = tokptr;
- return (STRING_LITERAL);
- }
-
- if (!(c == '_' || c == '$'
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
- /* We must have come across a bad character (e.g. ';'). */
- error (_("Invalid character '%c' in expression"), c);
-
- /* It's a name. See how long it is. */
- namelen = 0;
- for (c = tokstart[namelen];
- (c == '_'
- || c == '$'
- || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z')
- || (c >= 'A' && c <= 'Z')
- || c == '<');
- )
- {
- if (c == '<')
- {
- int i = namelen;
- while (tokstart[++i] && tokstart[i] != '>');
- if (tokstart[i] == '>')
- namelen = i;
- }
- c = tokstart[++namelen];
- }
-
- /* The token "if" terminates the expression and is NOT
- removed from the input stream. */
- if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
- {
- return 0;
- }
-
- lexptr += namelen;
-
- tryname:
-
- /* Catch specific keywords. Should be done with a data structure. */
- switch (namelen)
- {
- case 7:
- if (strncmp (tokstart, "boolean", 7) == 0)
- return BOOLEAN;
- break;
- case 6:
- if (strncmp (tokstart, "double", 6) == 0)
- return DOUBLE;
- break;
- case 5:
- if (strncmp (tokstart, "short", 5) == 0)
- return SHORT;
- if (strncmp (tokstart, "false", 5) == 0)
- {
- yylval.lval = 0;
- return BOOLEAN_LITERAL;
- }
- if (strncmp (tokstart, "super", 5) == 0)
- return SUPER;
- if (strncmp (tokstart, "float", 5) == 0)
- return FLOAT;
- break;
- case 4:
- if (strncmp (tokstart, "long", 4) == 0)
- return LONG;
- if (strncmp (tokstart, "byte", 4) == 0)
- return BYTE;
- if (strncmp (tokstart, "char", 4) == 0)
- return CHAR;
- if (strncmp (tokstart, "true", 4) == 0)
- {
- yylval.lval = 1;
- return BOOLEAN_LITERAL;
- }
- break;
- case 3:
- if (strncmp (tokstart, "int", 3) == 0)
- return INT;
- if (strncmp (tokstart, "new", 3) == 0)
- return NEW;
- break;
- default:
- break;
- }
-
- yylval.sval.ptr = tokstart;
- yylval.sval.length = namelen;
-
- if (*tokstart == '$')
- {
- write_dollar_variable (pstate, yylval.sval);
- return VARIABLE;
- }
-
- /* Input names that aren't symbols but ARE valid hex numbers,
- when the input radix permits them, can be names or numbers
- depending on the parse. Note we support radixes > 16 here. */
- if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
- (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
- {
- YYSTYPE newlval; /* Its value is ignored. */
- int hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
- if (hextype == INTEGER_LITERAL)
- return NAME_OR_INT;
- }
- return IDENTIFIER;
-}
-
-int
-java_parse (struct parser_state *par_state)
-{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
- /* Setting up the parser state. */
- gdb_assert (par_state != NULL);
- pstate = par_state;
-
- result = yyparse ();
- do_cleanups (c);
-
- return result;
-}
-
-void
-yyerror (char *msg)
-{
- if (prev_lexptr)
- lexptr = prev_lexptr;
-
- if (msg)
- error (_("%s: near `%s'"), msg, lexptr);
- else
- error (_("error in expression, near `%s'"), lexptr);
-}
-
-static struct type *
-java_type_from_name (struct stoken name)
-{
- char *tmp = copy_name (name);
- struct type *typ = java_lookup_class (tmp);
- if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
- error (_("No class named `%s'"), tmp);
- return typ;
-}
-
-/* If NAME is a valid variable name in this scope, push it and return 1.
- Otherwise, return 0. */
-
-static int
-push_variable (struct parser_state *par_state, struct stoken name)
-{
- char *tmp = copy_name (name);
- struct field_of_this_result is_a_field_of_this;
- struct block_symbol sym;
-
- sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
- &is_a_field_of_this);
- if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF)
- {
- if (symbol_read_needs_frame (sym.symbol))
- {
- if (innermost_block == 0 ||
- contained_in (sym.block, innermost_block))
- innermost_block = sym.block;
- }
-
- write_exp_elt_opcode (par_state, OP_VAR_VALUE);
- write_exp_elt_block (par_state, sym.block);
- write_exp_elt_sym (par_state, sym.symbol);
- write_exp_elt_opcode (par_state, OP_VAR_VALUE);
- return 1;
- }
- if (is_a_field_of_this.type != NULL)
- {
- /* it hangs off of `this'. Must not inadvertently convert from a
- method call to data ref. */
- if (innermost_block == 0 ||
- contained_in (sym.block, innermost_block))
- innermost_block = sym.block;
- write_exp_elt_opcode (par_state, OP_THIS);
- write_exp_elt_opcode (par_state, OP_THIS);
- write_exp_elt_opcode (par_state, STRUCTOP_PTR);
- write_exp_string (par_state, name);
- write_exp_elt_opcode (par_state, STRUCTOP_PTR);
- return 1;
- }
- return 0;
-}
-
-/* Assuming a reference expression has been pushed, emit the
- STRUCTOP_PTR ops to access the field named NAME. If NAME is a
- qualified name (has '.'), generate a field access for each part. */
-
-static void
-push_fieldnames (struct parser_state *par_state, struct stoken name)
-{
- int i;
- struct stoken token;
- token.ptr = name.ptr;
- for (i = 0; ; i++)
- {
- if (i == name.length || name.ptr[i] == '.')
- {
- /* token.ptr is start of current field name. */
- token.length = &name.ptr[i] - token.ptr;
- write_exp_elt_opcode (par_state, STRUCTOP_PTR);
- write_exp_string (par_state, token);
- write_exp_elt_opcode (par_state, STRUCTOP_PTR);
- token.ptr += token.length + 1;
- }
- if (i >= name.length)
- break;
- }
-}
-
-/* Helper routine for push_expression_name.
- Handle a qualified name, where DOT_INDEX is the index of the first '.' */
-
-static void
-push_qualified_expression_name (struct parser_state *par_state,
- struct stoken name, int dot_index)
-{
- struct stoken token;
- char *tmp;
- struct type *typ;
-
- token.ptr = name.ptr;
- token.length = dot_index;
-
- if (push_variable (par_state, token))
- {
- token.ptr = name.ptr + dot_index + 1;
- token.length = name.length - dot_index - 1;
- push_fieldnames (par_state, token);
- return;
- }
-
- token.ptr = name.ptr;
- for (;;)
- {
- token.length = dot_index;
- tmp = copy_name (token);
- typ = java_lookup_class (tmp);
- if (typ != NULL)
- {
- if (dot_index == name.length)
- {
- write_exp_elt_opcode (par_state, OP_TYPE);
- write_exp_elt_type (par_state, typ);
- write_exp_elt_opcode (par_state, OP_TYPE);
- return;
- }
- dot_index++; /* Skip '.' */
- name.ptr += dot_index;
- name.length -= dot_index;
- dot_index = 0;
- while (dot_index < name.length && name.ptr[dot_index] != '.')
- dot_index++;
- token.ptr = name.ptr;
- token.length = dot_index;
- write_exp_elt_opcode (par_state, OP_SCOPE);
- write_exp_elt_type (par_state, typ);
- write_exp_string (par_state, token);
- write_exp_elt_opcode (par_state, OP_SCOPE);
- if (dot_index < name.length)
- {
- dot_index++;
- name.ptr += dot_index;
- name.length -= dot_index;
- push_fieldnames (par_state, name);
- }
- return;
- }
- else if (dot_index >= name.length)
- break;
- dot_index++; /* Skip '.' */
- while (dot_index < name.length && name.ptr[dot_index] != '.')
- dot_index++;
- }
- error (_("unknown type `%.*s'"), name.length, name.ptr);
-}
-
-/* Handle Name in an expression (or LHS).
- Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
-
-static void
-push_expression_name (struct parser_state *par_state, struct stoken name)
-{
- char *tmp;
- struct type *typ;
- int i;
-
- for (i = 0; i < name.length; i++)
- {
- if (name.ptr[i] == '.')
- {
- /* It's a Qualified Expression Name. */
- push_qualified_expression_name (par_state, name, i);
- return;
- }
- }
-
- /* It's a Simple Expression Name. */
-
- if (push_variable (par_state, name))
- return;
- tmp = copy_name (name);
- typ = java_lookup_class (tmp);
- if (typ != NULL)
- {
- write_exp_elt_opcode (par_state, OP_TYPE);
- write_exp_elt_type (par_state, typ);
- write_exp_elt_opcode (par_state, OP_TYPE);
- }
- else
- {
- struct bound_minimal_symbol msymbol;
-
- msymbol = lookup_bound_minimal_symbol (tmp);
- if (msymbol.minsym != NULL)
- write_exp_msymbol (par_state, msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command"));
- else
- error (_("No symbol \"%s\" in current context."), tmp);
- }
-
-}
-
-
-/* The following two routines, copy_exp and insert_exp, aren't specific to
- Java, so they could go in parse.c, but their only purpose is to support
- the parsing kludges we use in this file, so maybe it's best to isolate
- them here. */
-
-/* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
- into a freshly malloc'ed struct expression. Its language_defn is set
- to null. */
-static struct expression *
-copy_exp (struct expression *expr, int endpos)
-{
- int len = length_of_subexp (expr, endpos);
- struct expression *newobj
- = (struct expression *) malloc (sizeof (*newobj) + EXP_ELEM_TO_BYTES (len));
-
- newobj->nelts = len;
- memcpy (newobj->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
- newobj->language_defn = 0;
-
- return newobj;
-}
-
-/* Insert the expression NEW into the current expression (expout) at POS. */
-static void
-insert_exp (struct parser_state *par_state, int pos, struct expression *newobj)
-{
- int newlen = newobj->nelts;
- int i;
-
- /* Grow expout if necessary. In this function's only use at present,
- this should never be necessary. */
- increase_expout_size (par_state, newlen);
-
- for (i = par_state->expout_ptr - 1; i >= pos; i--)
- par_state->expout->elts[i + newlen] = par_state->expout->elts[i];
-
- memcpy (par_state->expout->elts + pos, newobj->elts,
- EXP_ELEM_TO_BYTES (newlen));
- par_state->expout_ptr += newlen;
-}
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
deleted file mode 100644
index 6bf72b9..0000000
--- a/gdb/jv-lang.c
+++ /dev/null
@@ -1,1272 +0,0 @@
-/* Java language support routines for GDB, the GNU debugger.
-
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "defs.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "expression.h"
-#include "parser-defs.h"
-#include "language.h"
-#include "symfile.h"
-#include "objfiles.h"
-#include "value.h"
-#include "c-lang.h"
-#include "jv-lang.h"
-#include "varobj.h"
-#include "gdbcore.h"
-#include "block.h"
-#include "demangle.h"
-#include "dictionary.h"
-#include <ctype.h>
-#include "charset.h"
-#include "valprint.h"
-#include "cp-support.h"
-
-/* Local functions */
-
-extern void _initialize_java_language (void);
-
-static int java_demangled_signature_length (const char *);
-static void java_demangled_signature_copy (char *, const char *);
-
-static struct compunit_symtab *get_java_class_symtab (struct gdbarch *gdbarch);
-static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
-static int java_class_is_primitive (struct value *clas);
-static struct value *java_value_string (char *ptr, int len);
-
-static void java_emit_char (int c, struct type *type,
- struct ui_file * stream, int quoter);
-
-static char *java_class_name_from_physname (const char *physname);
-
-static const struct objfile_data *jv_dynamics_objfile_data_key;
-
-/* The dynamic objfile is kept per-program-space. This key lets us
- associate the objfile with the program space. */
-
-static const struct program_space_data *jv_dynamics_progspace_key;
-
-static struct type *java_link_class_type (struct gdbarch *,
- struct type *, struct value *);
-
-/* An instance of this structure is used to store some data that must
- be freed. */
-
-struct jv_per_objfile_data
-{
- /* The expandable dictionary we use. */
- struct dictionary *dict;
-};
-
-/* A function called when the dynamics_objfile is freed. We use this
- to clean up some internal state. */
-static void
-jv_per_objfile_free (struct objfile *objfile, void *data)
-{
- struct jv_per_objfile_data *jv_data = (struct jv_per_objfile_data *) data;
- struct objfile *dynamics_objfile;
-
- dynamics_objfile
- = (struct objfile *) program_space_data (current_program_space,
- jv_dynamics_progspace_key);
- gdb_assert (objfile == dynamics_objfile);
-
- if (jv_data->dict)
- dict_free (jv_data->dict);
- xfree (jv_data);
-
- set_program_space_data (current_program_space,
- jv_dynamics_progspace_key,
- NULL);
-}
-
-/* FIXME: carlton/2003-02-04: This is the main or only caller of
- allocate_objfile with first argument NULL; as a result, this code
- breaks every so often. Somebody should write a test case that
- exercises GDB in various ways (e.g. something involving loading a
- dynamic library) after this code has been called. */
-
-static struct objfile *
-get_dynamics_objfile (struct gdbarch *gdbarch)
-{
- struct objfile *dynamics_objfile;
-
- dynamics_objfile
- = (struct objfile *) program_space_data (current_program_space,
- jv_dynamics_progspace_key);
-
- if (dynamics_objfile == NULL)
- {
- struct jv_per_objfile_data *data;
-
- /* Mark it as shared so that it is cleared when the inferior is
- re-run. */
- dynamics_objfile = allocate_objfile (NULL, NULL,
- OBJF_SHARED | OBJF_NOT_FILENAME);
- dynamics_objfile->per_bfd->gdbarch = gdbarch;
-
- data = XCNEW (struct jv_per_objfile_data);
- set_objfile_data (dynamics_objfile, jv_dynamics_objfile_data_key, data);
-
- set_program_space_data (current_program_space,
- jv_dynamics_progspace_key,
- dynamics_objfile);
- }
- return dynamics_objfile;
-}
-
-static struct compunit_symtab *
-get_java_class_symtab (struct gdbarch *gdbarch)
-{
- struct objfile *objfile = get_dynamics_objfile (gdbarch);
- struct compunit_symtab *class_symtab = objfile->compunit_symtabs;
-
- if (class_symtab == NULL)
- {
- struct blockvector *bv;
- struct block *bl;
- struct jv_per_objfile_data *jv_data;
-
- class_symtab = allocate_compunit_symtab (objfile, "<java-classes>");
- add_compunit_symtab_to_objfile (class_symtab);
- allocate_symtab (class_symtab, "<java-classes>");
-
- COMPUNIT_FILETABS (class_symtab)->language = language_java;
- bv = (struct blockvector *)
- obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct blockvector) + sizeof (struct block *));
- BLOCKVECTOR_NBLOCKS (bv) = 1;
- COMPUNIT_BLOCKVECTOR (class_symtab) = bv;
-
- /* Allocate dummy STATIC_BLOCK. */
- bl = allocate_block (&objfile->objfile_obstack);
- BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack,
- NULL);
- BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl;
-
- /* Allocate GLOBAL_BLOCK. */
- bl = allocate_global_block (&objfile->objfile_obstack);
- BLOCK_DICT (bl) = dict_create_hashed_expandable ();
- set_block_compunit_symtab (bl, class_symtab);
- BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;
-
- /* Arrange to free the dict. */
- jv_data = ((struct jv_per_objfile_data *)
- objfile_data (objfile, jv_dynamics_objfile_data_key));
- jv_data->dict = BLOCK_DICT (bl);
- }
- return class_symtab;
-}
-
-static void
-add_class_symtab_symbol (struct symbol *sym)
-{
- struct compunit_symtab *cust = get_java_class_symtab (symbol_arch (sym));
- const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
-
- dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
-}
-
-static struct symbol *
-add_class_symbol (struct type *type, CORE_ADDR addr)
-{
- struct symbol *sym;
- struct objfile *objfile = get_dynamics_objfile (get_type_arch (type));
-
- sym = allocate_symbol (objfile);
- SYMBOL_SET_LANGUAGE (sym, language_java, &objfile->objfile_obstack);
- SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
- SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
- /* SYMBOL_VALUE (sym) = valu; */
- SYMBOL_TYPE (sym) = type;
- SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
- SYMBOL_VALUE_ADDRESS (sym) = addr;
- return sym;
-}
-
-struct type *
-java_lookup_class (char *name)
-{
- struct symbol *sym;
-
- sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN,
- NULL).symbol;
- if (sym != NULL)
- return SYMBOL_TYPE (sym);
- /* FIXME - should search inferior's symbol table. */
- return NULL;
-}
-
-/* Return a nul-terminated string (allocated on OBSTACK) for
- a name given by NAME (which has type Utf8Const*). */
-
-char *
-get_java_utf8_name (struct obstack *obstack, struct value *name)
-{
- char *chrs;
- struct value *temp = name;
- int name_length;
- CORE_ADDR data_addr;
-
- temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
- name_length = (int) value_as_long (temp);
- data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
- chrs = (char *) obstack_alloc (obstack, name_length + 1);
- chrs[name_length] = '\0';
- read_memory (data_addr, (gdb_byte *) chrs, name_length);
- return chrs;
-}
-
-struct value *
-java_class_from_object (struct value *obj_val)
-{
- /* This is all rather inefficient, since the offsets of vtable and
- class are fixed. FIXME */
- struct value *vtable_val;
-
- if (TYPE_CODE (value_type (obj_val)) == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (obj_val))) == 0)
- obj_val = value_at (get_java_object_type (),
- value_as_address (obj_val));
-
- vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
- return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
-}
-
-/* Check if CLASS_IS_PRIMITIVE(value of clas): */
-static int
-java_class_is_primitive (struct value *clas)
-{
- struct value *vtable = value_struct_elt (&clas, NULL, "vtable",
- NULL, "struct");
- CORE_ADDR i = value_as_address (vtable);
-
- return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
-}
-
-/* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
-
-struct type *
-type_from_class (struct gdbarch *gdbarch, struct value *clas)
-{
- struct type *type;
- char *name;
- struct value *temp;
- struct objfile *objfile;
- struct value *utf8_name;
- char *nptr;
- CORE_ADDR addr;
-
- type = check_typedef (value_type (clas));
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- {
- if (value_logical_not (clas))
- return NULL;
- clas = value_ind (clas);
- }
- addr = value_address (clas);
-
- objfile = get_dynamics_objfile (gdbarch);
- if (java_class_is_primitive (clas))
- {
- struct value *sig;
-
- temp = clas;
- sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
- return java_primitive_type (gdbarch, value_as_long (sig));
- }
-
- /* Get Class name. */
- /* If clasloader non-null, prepend loader address. FIXME */
- temp = clas;
- utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure");
- name = get_java_utf8_name (&objfile->objfile_obstack, utf8_name);
- for (nptr = name; *nptr != 0; nptr++)
- {
- if (*nptr == '/')
- *nptr = '.';
- }
-
- type = java_lookup_class (name);
- if (type != NULL)
- return type;
-
- type = alloc_type (objfile);
- TYPE_CODE (type) = TYPE_CODE_STRUCT;
- INIT_CPLUS_SPECIFIC (type);
-
- if (name[0] == '[')
- {
- char *signature = name;
- int namelen = java_demangled_signature_length (signature);
-
- if (namelen > strlen (name))
- name = (char *) obstack_alloc (&objfile->objfile_obstack, namelen + 1);
- java_demangled_signature_copy (name, signature);
- name[namelen] = '\0';
- temp = clas;
- /* Set array element type. */
- temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure");
- deprecated_set_value_type (temp,
- lookup_pointer_type (value_type (clas)));
- TYPE_TARGET_TYPE (type) = type_from_class (gdbarch, temp);
- }
-
- ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_TAG_NAME (type) = name;
-
- add_class_symtab_symbol (add_class_symbol (type, addr));
- return java_link_class_type (gdbarch, type, clas);
-}
-
-/* Fill in class TYPE with data from the CLAS value. */
-
-static struct type *
-java_link_class_type (struct gdbarch *gdbarch,
- struct type *type, struct value *clas)
-{
- struct value *temp;
- const char *unqualified_name;
- const char *name = TYPE_TAG_NAME (type);
- int ninterfaces, nfields, nmethods;
- int type_is_object = 0;
- struct fn_field *fn_fields;
- struct fn_fieldlist *fn_fieldlists;
- struct value *fields;
- struct value *methods;
- struct value *method = NULL;
- struct value *field = NULL;
- int i, j;
- struct objfile *objfile = get_dynamics_objfile (gdbarch);
- struct type *tsuper;
-
- gdb_assert (name != NULL);
- unqualified_name = strrchr (name, '.');
- if (unqualified_name == NULL)
- unqualified_name = name;
-
- temp = clas;
- temp = value_struct_elt (&temp, NULL, "superclass", NULL, "structure");
- if (strcmp (name, "java.lang.Object") == 0)
- {
- tsuper = get_java_object_type ();
- if (tsuper && TYPE_CODE (tsuper) == TYPE_CODE_PTR)
- tsuper = TYPE_TARGET_TYPE (tsuper);
- type_is_object = 1;
- }
- else
- tsuper = type_from_class (gdbarch, temp);
-
-#if 1
- ninterfaces = 0;
-#else
- temp = clas;
- ninterfaces = value_as_long (value_struct_elt (&temp, NULL, "interface_len",
- NULL, "structure"));
-#endif
- TYPE_N_BASECLASSES (type) = (tsuper == NULL ? 0 : 1) + ninterfaces;
- temp = clas;
- nfields = value_as_long (value_struct_elt (&temp, NULL, "field_count",
- NULL, "structure"));
- nfields += TYPE_N_BASECLASSES (type);
- nfields++; /* Add one for dummy "class" field. */
- TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nfields);
-
- memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);
-
- TYPE_FIELD_PRIVATE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
- B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields);
-
- TYPE_FIELD_PROTECTED_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
- B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields);
-
- TYPE_FIELD_IGNORE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
- B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields);
-
- TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *)
- TYPE_ALLOC (type, B_BYTES (TYPE_N_BASECLASSES (type)));
- B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type));
-
- if (tsuper != NULL)
- {
- TYPE_BASECLASS (type, 0) = tsuper;
- if (type_is_object)
- SET_TYPE_FIELD_PRIVATE (type, 0);
- }
-
- i = strlen (name);
- if (i > 2 && name[i - 1] == ']' && tsuper != NULL)
- {
- /* FIXME */
- TYPE_LENGTH (type) = TYPE_LENGTH (tsuper) + 4; /* size with "length" */
- }
- else
- {
- temp = clas;
- temp = value_struct_elt (&temp, NULL, "size_in_bytes",
- NULL, "structure");
- TYPE_LENGTH (type) = value_as_long (temp);
- }
-
- fields = NULL;
- nfields--; /* First set up dummy "class" field. */
- SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
- TYPE_FIELD_NAME (type, nfields) = "class";
- TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
- SET_TYPE_FIELD_PRIVATE (type, nfields);
-
- for (i = TYPE_N_BASECLASSES (type); i < nfields; i++)
- {
- int accflags;
- int boffset;
-
- if (fields == NULL)
- {
- temp = clas;
- fields = value_struct_elt (&temp, NULL, "fields", NULL, "structure");
- field = value_ind (fields);
- }
- else
- { /* Re-use field value for next field. */
- CORE_ADDR addr
- = value_address (field) + TYPE_LENGTH (value_type (field));
-
- set_value_address (field, addr);
- set_value_lazy (field, 1);
- }
- temp = field;
- temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
- TYPE_FIELD_NAME (type, i) =
- get_java_utf8_name (&objfile->objfile_obstack, temp);
- temp = field;
- accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags",
- NULL, "structure"));
- temp = field;
- temp = value_struct_elt (&temp, NULL, "info", NULL, "structure");
- boffset = value_as_long (value_struct_elt (&temp, NULL, "boffset",
- NULL, "structure"));
- if (accflags & 0x0001) /* public access */
- {
- /* ??? */
- }
- if (accflags & 0x0002) /* private access */
- {
- SET_TYPE_FIELD_PRIVATE (type, i);
- }
- if (accflags & 0x0004) /* protected access */
- {
- SET_TYPE_FIELD_PROTECTED (type, i);
- }
- if (accflags & 0x0008) /* ACC_STATIC */
- SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
- else
- SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
- if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
- {
- TYPE_FIELD_TYPE (type, i) = get_java_object_type (); /* FIXME */
- }
- else
- {
- struct type *ftype;
-
- temp = field;
- temp = value_struct_elt (&temp, NULL, "type", NULL, "structure");
- ftype = type_from_class (gdbarch, temp);
- if (TYPE_CODE (ftype) == TYPE_CODE_STRUCT)
- ftype = lookup_pointer_type (ftype);
- TYPE_FIELD_TYPE (type, i) = ftype;
- }
- }
-
- temp = clas;
- nmethods = value_as_long (value_struct_elt (&temp, NULL, "method_count",
- NULL, "structure"));
- j = nmethods * sizeof (struct fn_field);
- fn_fields = (struct fn_field *)
- obstack_alloc (&objfile->objfile_obstack, j);
- memset (fn_fields, 0, j);
- fn_fieldlists = (struct fn_fieldlist *)
- alloca (nmethods * sizeof (struct fn_fieldlist));
-
- methods = NULL;
- for (i = 0; i < nmethods; i++)
- {
- const char *mname;
- int k;
-
- if (methods == NULL)
- {
- temp = clas;
- methods = value_struct_elt (&temp, NULL, "methods",
- NULL, "structure");
- method = value_ind (methods);
- }
- else
- { /* Re-use method value for next method. */
- CORE_ADDR addr
- = value_address (method) + TYPE_LENGTH (value_type (method));
-
- set_value_address (method, addr);
- set_value_lazy (method, 1);
- }
-
- /* Get method name. */
- temp = method;
- temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
- mname = get_java_utf8_name (&objfile->objfile_obstack, temp);
- if (strcmp (mname, "<init>") == 0)
- mname = unqualified_name;
-
- /* Check for an existing method with the same name.
- * This makes building the fn_fieldslists an O(nmethods**2)
- * operation. That could be using hashing, but I doubt it
- * is worth it. Note that we do maintain the order of methods
- * in the inferior's Method table (as long as that is grouped
- * by method name), which I think is desirable. --PB */
- for (k = 0, j = TYPE_NFN_FIELDS (type);;)
- {
- if (--j < 0)
- { /* No match - new method name. */
- j = TYPE_NFN_FIELDS (type)++;
- fn_fieldlists[j].name = mname;
- fn_fieldlists[j].length = 1;
- fn_fieldlists[j].fn_fields = &fn_fields[i];
- k = i;
- break;
- }
- if (strcmp (mname, fn_fieldlists[j].name) == 0)
- { /* Found an existing method with the same name. */
- int l;
-
- if (mname != unqualified_name)
- obstack_free (&objfile->objfile_obstack, mname);
- mname = fn_fieldlists[j].name;
- fn_fieldlists[j].length++;
- k = i - k; /* Index of new slot. */
- /* Shift intervening fn_fields (between k and i) down. */
- for (l = i; l > k; l--)
- fn_fields[l] = fn_fields[l - 1];
- for (l = TYPE_NFN_FIELDS (type); --l > j;)
- fn_fieldlists[l].fn_fields++;
- break;
- }
- k += fn_fieldlists[j].length;
- }
- fn_fields[k].physname = "";
- fn_fields[k].is_stub = 1;
- /* FIXME */
- fn_fields[k].type = lookup_function_type
- (builtin_java_type (gdbarch)->builtin_void);
- TYPE_CODE (fn_fields[k].type) = TYPE_CODE_METHOD;
- }
-
- j = TYPE_NFN_FIELDS (type) * sizeof (struct fn_fieldlist);
- TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
- obstack_alloc (&objfile->objfile_obstack, j);
- memcpy (TYPE_FN_FIELDLISTS (type), fn_fieldlists, j);
-
- return type;
-}
-
-struct type *
-get_java_object_type (void)
-{
- struct symbol *sym;
-
- sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN, NULL).symbol;
- if (sym == NULL)
- error (_("cannot find java.lang.Object"));
- return SYMBOL_TYPE (sym);
-}
-
-int
-get_java_object_header_size (struct gdbarch *gdbarch)
-{
- struct type *objtype = get_java_object_type ();
-
- if (objtype == NULL)
- return (2 * gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
- else
- return TYPE_LENGTH (objtype);
-}
-
-int
-is_object_type (struct type *type)
-{
- type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- {
- struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type));
- const char *name;
- if (TYPE_CODE (ttype) != TYPE_CODE_STRUCT)
- return 0;
- while (TYPE_N_BASECLASSES (ttype) > 0)
- ttype = TYPE_BASECLASS (ttype, 0);
- name = TYPE_TAG_NAME (ttype);
- if (name != NULL && strcmp (name, "java.lang.Object") == 0)
- return 1;
- name
- = TYPE_NFIELDS (ttype) > 0 ? TYPE_FIELD_NAME (ttype, 0) : (char *) 0;
- if (name != NULL && strcmp (name, "vtable") == 0)
- return 1;
- }
- return 0;
-}
-
-struct type *
-java_primitive_type (struct gdbarch *gdbarch, int signature)
-{
- const struct builtin_java_type *builtin = builtin_java_type (gdbarch);
-
- switch (signature)
- {
- case 'B':
- return builtin->builtin_byte;
- case 'S':
- return builtin->builtin_short;
- case 'I':
- return builtin->builtin_int;
- case 'J':
- return builtin->builtin_long;
- case 'Z':
- return builtin->builtin_boolean;
- case 'C':
- return builtin->builtin_char;
- case 'F':
- return builtin->builtin_float;
- case 'D':
- return builtin->builtin_double;
- case 'V':
- return builtin->builtin_void;
- }
- error (_("unknown signature '%c' for primitive type"), (char) signature);
-}
-
-/* If name[0 .. namelen-1] is the name of a primitive Java type,
- return that type. Otherwise, return NULL. */
-
-struct type *
-java_primitive_type_from_name (struct gdbarch *gdbarch,
- const char *name, int namelen)
-{
- const struct builtin_java_type *builtin = builtin_java_type (gdbarch);
-
- switch (name[0])
- {
- case 'b':
- if (namelen == 4 && memcmp (name, "byte", 4) == 0)
- return builtin->builtin_byte;
- if (namelen == 7 && memcmp (name, "boolean", 7) == 0)
- return builtin->builtin_boolean;
- break;
- case 'c':
- if (namelen == 4 && memcmp (name, "char", 4) == 0)
- return builtin->builtin_char;
- break;
- case 'd':
- if (namelen == 6 && memcmp (name, "double", 6) == 0)
- return builtin->builtin_double;
- break;
- case 'f':
- if (namelen == 5 && memcmp (name, "float", 5) == 0)
- return builtin->builtin_float;
- break;
- case 'i':
- if (namelen == 3 && memcmp (name, "int", 3) == 0)
- return builtin->builtin_int;
- break;
- case 'l':
- if (namelen == 4 && memcmp (name, "long", 4) == 0)
- return builtin->builtin_long;
- break;
- case 's':
- if (namelen == 5 && memcmp (name, "short", 5) == 0)
- return builtin->builtin_short;
- break;
- case 'v':
- if (namelen == 4 && memcmp (name, "void", 4) == 0)
- return builtin->builtin_void;
- break;
- }
- return NULL;
-}
-
-static char *
-java_primitive_type_name (int signature)
-{
- switch (signature)
- {
- case 'B':
- return "byte";
- case 'S':
- return "short";
- case 'I':
- return "int";
- case 'J':
- return "long";
- case 'Z':
- return "boolean";
- case 'C':
- return "char";
- case 'F':
- return "float";
- case 'D':
- return "double";
- case 'V':
- return "void";
- }
- error (_("unknown signature '%c' for primitive type"), (char) signature);
-}
-
-/* Return the length (in bytes) of demangled name of the Java type
- signature string SIGNATURE. */
-
-static int
-java_demangled_signature_length (const char *signature)
-{
- int array = 0;
-
- for (; *signature == '['; signature++)
- array += 2; /* Two chars for "[]". */
- switch (signature[0])
- {
- case 'L':
- /* Subtract 2 for 'L' and ';'. */
- return strlen (signature) - 2 + array;
- default:
- return strlen (java_primitive_type_name (signature[0])) + array;
- }
-}
-
-/* Demangle the Java type signature SIGNATURE, leaving the result in
- RESULT. */
-
-static void
-java_demangled_signature_copy (char *result, const char *signature)
-{
- int array = 0;
- char *ptr;
- int i;
-
- while (*signature == '[')
- {
- array++;
- signature++;
- }
- switch (signature[0])
- {
- case 'L':
- /* Subtract 2 for 'L' and ';', but add 1 for final nul. */
- signature++;
- ptr = result;
- for (; *signature != ';' && *signature != '\0'; signature++)
- {
- if (*signature == '/')
- *ptr++ = '.';
- else
- *ptr++ = *signature;
- }
- break;
- default:
- ptr = java_primitive_type_name (signature[0]);
- i = strlen (ptr);
- strcpy (result, ptr);
- ptr = result + i;
- break;
- }
- while (--array >= 0)
- {
- *ptr++ = '[';
- *ptr++ = ']';
- }
-}
-
-/* Return the demangled name of the Java type signature string SIGNATURE,
- as a freshly allocated copy. */
-
-char *
-java_demangle_type_signature (const char *signature)
-{
- int length = java_demangled_signature_length (signature);
- char *result = (char *) xmalloc (length + 1);
-
- java_demangled_signature_copy (result, signature);
- result[length] = '\0';
- return result;
-}
-
-/* Return the type of TYPE followed by DIMS pairs of [ ].
- If DIMS == 0, TYPE is returned. */
-
-struct type *
-java_array_type (struct type *type, int dims)
-{
- while (dims-- > 0)
- {
- /* FIXME This is bogus! Java arrays are not gdb arrays! */
- type = lookup_array_range_type (type, 0, 0);
- }
-
- return type;
-}
-
-/* Create a Java string in the inferior from a (Utf8) literal. */
-
-static struct value *
-java_value_string (char *ptr, int len)
-{
- error (_("not implemented - java_value_string")); /* FIXME */
-}
-
-/* Return the encoding that should be used for the character type
- TYPE. */
-
-static const char *
-java_get_encoding (struct type *type)
-{
- struct gdbarch *arch = get_type_arch (type);
- const char *encoding;
-
- if (type == builtin_java_type (arch)->builtin_char)
- {
- if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
- encoding = "UTF-16BE";
- else
- encoding = "UTF-16LE";
- }
- else
- encoding = target_charset (arch);
-
- return encoding;
-}
-
-/* Print the character C on STREAM as part of the contents of a literal
- string whose delimiter is QUOTER. Note that that format for printing
- characters and strings is language specific. */
-
-static void
-java_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
-{
- const char *encoding = java_get_encoding (type);
-
- generic_emit_char (c, type, stream, quoter, encoding);
-}
-
-/* Implementation of la_printchar method. */
-
-static void
-java_printchar (int c, struct type *type, struct ui_file *stream)
-{
- fputs_filtered ("'", stream);
- LA_EMIT_CHAR (c, type, stream, '\'');
- fputs_filtered ("'", stream);
-}
-
-/* Implementation of la_printstr method. */
-
-static void
-java_printstr (struct ui_file *stream, struct type *type,
- const gdb_byte *string,
- unsigned int length, const char *encoding, int force_ellipses,
- const struct value_print_options *options)
-{
- const char *type_encoding = java_get_encoding (type);
-
- if (!encoding || !*encoding)
- encoding = type_encoding;
-
- generic_printstr (stream, type, string, length, encoding,
- force_ellipses, '"', 0, options);
-}
-
-static struct value *
-evaluate_subexp_java (struct type *expect_type, struct expression *exp,
- int *pos, enum noside noside)
-{
- int pc = *pos;
- int i;
- const char *name;
- enum exp_opcode op = exp->elts[*pos].opcode;
- struct value *arg1;
- struct value *arg2;
- struct type *type;
-
- switch (op)
- {
- case UNOP_IND:
- if (noside == EVAL_SKIP)
- goto standard;
- (*pos)++;
- arg1 = evaluate_subexp_java (NULL_TYPE, exp, pos, EVAL_NORMAL);
- if (is_object_type (value_type (arg1)))
- {
- struct type *type;
-
- type = type_from_class (exp->gdbarch, java_class_from_object (arg1));
- arg1 = value_cast (lookup_pointer_type (type), arg1);
- }
- return value_ind (arg1);
-
- case BINOP_SUBSCRIPT:
- (*pos)++;
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- /* If the user attempts to subscript something that is not an
- array or pointer type (like a plain int variable for example),
- then report this as an error. */
-
- arg1 = coerce_ref (arg1);
- type = check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- type = check_typedef (TYPE_TARGET_TYPE (type));
- name = TYPE_NAME (type);
- if (name == NULL)
- name = TYPE_TAG_NAME (type);
- i = name == NULL ? 0 : strlen (name);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- && i > 2 && name[i - 1] == ']')
- {
- enum bfd_endian byte_order = gdbarch_byte_order (exp->gdbarch);
- CORE_ADDR address;
- long length, index;
- struct type *el_type;
- gdb_byte buf4[4];
-
- struct value *clas = java_class_from_object (arg1);
- struct value *temp = clas;
- /* Get CLASS_ELEMENT_TYPE of the array type. */
- temp = value_struct_elt (&temp, NULL, "methods",
- NULL, "structure");
- deprecated_set_value_type (temp, value_type (clas));
- el_type = type_from_class (exp->gdbarch, temp);
- if (TYPE_CODE (el_type) == TYPE_CODE_STRUCT)
- el_type = lookup_pointer_type (el_type);
-
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (el_type, VALUE_LVAL (arg1));
- address = value_as_address (arg1);
- address += get_java_object_header_size (exp->gdbarch);
- read_memory (address, buf4, 4);
- length = (long) extract_signed_integer (buf4, 4, byte_order);
- index = (long) value_as_long (arg2);
- if (index >= length || index < 0)
- error (_("array index (%ld) out of bounds (length: %ld)"),
- index, length);
- address = (address + 4) + index * TYPE_LENGTH (el_type);
- return value_at (el_type, address);
- }
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
- {
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
- else
- return value_subscript (arg1, value_as_long (arg2));
- }
- if (name)
- error (_("cannot subscript something of type `%s'"), name);
- else
- error (_("cannot subscript requested type"));
-
- case OP_STRING:
- (*pos)++;
- i = longest_to_int (exp->elts[pc + 1].longconst);
- (*pos) += 3 + BYTES_TO_EXP_ELEM (i + 1);
- if (noside == EVAL_SKIP)
- goto nosideret;
- return java_value_string (&exp->elts[pc + 2].string, i);
-
- case STRUCTOP_PTR:
- arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
- /* Convert object field (such as TYPE.class) to reference. */
- if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT)
- arg1 = value_addr (arg1);
- return arg1;
- default:
- break;
- }
-standard:
- return evaluate_subexp_standard (expect_type, exp, pos, noside);
-nosideret:
- return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
-}
-
-static char *java_demangle (const char *mangled, int options)
-{
- return gdb_demangle (mangled, options | DMGL_JAVA);
-}
-
-/* la_sniff_from_mangled_name for Java. */
-
-static int
-java_sniff_from_mangled_name (const char *mangled, char **demangled)
-{
- *demangled = java_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
- return *demangled != NULL;
-}
-
-/* Find the member function name of the demangled name NAME. NAME
- must be a method name including arguments, in order to correctly
- locate the last component.
-
- This function return a pointer to the first dot before the
- member function name, or NULL if the name was not of the
- expected form. */
-
-static const char *
-java_find_last_component (const char *name)
-{
- const char *p;
-
- /* Find argument list. */
- p = strchr (name, '(');
-
- if (p == NULL)
- return NULL;
-
- /* Back up and find first dot prior to argument list. */
- while (p > name && *p != '.')
- p--;
-
- if (p == name)
- return NULL;
-
- return p;
-}
-
-/* Return the name of the class containing method PHYSNAME. */
-
-static char *
-java_class_name_from_physname (const char *physname)
-{
- char *ret = NULL;
- const char *end;
- char *demangled_name = java_demangle (physname, DMGL_PARAMS | DMGL_ANSI);
-
- if (demangled_name == NULL)
- return NULL;
-
- end = java_find_last_component (demangled_name);
- if (end != NULL)
- {
- ret = (char *) xmalloc (end - demangled_name + 1);
- memcpy (ret, demangled_name, end - demangled_name);
- ret[end - demangled_name] = '\0';
- }
-
- xfree (demangled_name);
- return ret;
-}
-
-/* Table mapping opcodes into strings for printing operators
- and precedences of the operators. */
-
-const struct op_print java_op_print_tab[] =
-{
- {",", BINOP_COMMA, PREC_COMMA, 0},
- {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
- {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
- {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
- {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
- {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
- {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
- {"==", BINOP_EQUAL, PREC_EQUAL, 0},
- {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
- {"<=", BINOP_LEQ, PREC_ORDER, 0},
- {">=", BINOP_GEQ, PREC_ORDER, 0},
- {">", BINOP_GTR, PREC_ORDER, 0},
- {"<", BINOP_LESS, PREC_ORDER, 0},
- {">>", BINOP_RSH, PREC_SHIFT, 0},
- {"<<", BINOP_LSH, PREC_SHIFT, 0},
- {"+", BINOP_ADD, PREC_ADD, 0},
- {"-", BINOP_SUB, PREC_ADD, 0},
- {"*", BINOP_MUL, PREC_MUL, 0},
- {"/", BINOP_DIV, PREC_MUL, 0},
- {"%", BINOP_REM, PREC_MUL, 0},
- {"-", UNOP_NEG, PREC_PREFIX, 0},
- {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
- {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
- {"*", UNOP_IND, PREC_PREFIX, 0},
- {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
- {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
- {NULL, OP_NULL, PREC_PREFIX, 0}
-};
-
-enum java_primitive_types
-{
- java_primitive_type_int,
- java_primitive_type_short,
- java_primitive_type_long,
- java_primitive_type_byte,
- java_primitive_type_boolean,
- java_primitive_type_char,
- java_primitive_type_float,
- java_primitive_type_double,
- java_primitive_type_void,
- nr_java_primitive_types
-};
-
-static void
-java_language_arch_info (struct gdbarch *gdbarch,
- struct language_arch_info *lai)
-{
- const struct builtin_java_type *builtin = builtin_java_type (gdbarch);
-
- lai->string_char_type = builtin->builtin_char;
- lai->primitive_type_vector
- = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_java_primitive_types + 1,
- struct type *);
- lai->primitive_type_vector [java_primitive_type_int]
- = builtin->builtin_int;
- lai->primitive_type_vector [java_primitive_type_short]
- = builtin->builtin_short;
- lai->primitive_type_vector [java_primitive_type_long]
- = builtin->builtin_long;
- lai->primitive_type_vector [java_primitive_type_byte]
- = builtin->builtin_byte;
- lai->primitive_type_vector [java_primitive_type_boolean]
- = builtin->builtin_boolean;
- lai->primitive_type_vector [java_primitive_type_char]
- = builtin->builtin_char;
- lai->primitive_type_vector [java_primitive_type_float]
- = builtin->builtin_float;
- lai->primitive_type_vector [java_primitive_type_double]
- = builtin->builtin_double;
- lai->primitive_type_vector [java_primitive_type_void]
- = builtin->builtin_void;
-
- lai->bool_type_symbol = "boolean";
- lai->bool_type_default = builtin->builtin_boolean;
-}
-
-const struct exp_descriptor exp_descriptor_java =
-{
- print_subexp_standard,
- operator_length_standard,
- operator_check_standard,
- op_name_standard,
- dump_subexp_body_standard,
- evaluate_subexp_java
-};
-
-static const char *java_extensions[] =
-{
- ".java", ".class", NULL
-};
-
-const struct language_defn java_language_defn =
-{
- "java", /* Language name */
- "Java",
- language_java,
- range_check_off,
- case_sensitive_on,
- array_row_major,
- macro_expansion_no,
- java_extensions,
- &exp_descriptor_java,
- java_parse,
- java_yyerror,
- null_post_parser,
- java_printchar, /* Print a character constant */
- java_printstr, /* Function to print string constant */
- java_emit_char, /* Function to print a single character */
- java_print_type, /* Print a type using appropriate syntax */
- default_print_typedef, /* Print a typedef using appropriate syntax */
- java_val_print, /* Print a value using appropriate syntax */
- java_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
- NULL, /* Language specific skip_trampoline */
- "this", /* name_of_this */
- basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
- basic_lookup_transparent_type,/* lookup_transparent_type */
- java_demangle, /* Language specific symbol demangler */
- java_sniff_from_mangled_name,
- java_class_name_from_physname,/* Language specific class name */
- java_op_print_tab, /* expression operators for printing */
- 0, /* not c-style arrays */
- 0, /* String lower bound */
- default_word_break_characters,
- default_make_symbol_completion_list,
- java_language_arch_info,
- default_print_array_index,
- default_pass_by_reference,
- default_get_string,
- NULL, /* la_get_symbol_name_cmp */
- iterate_over_symbols,
- &java_varobj_ops,
- NULL,
- NULL,
- LANG_MAGIC
-};
-
-static void *
-build_java_types (struct gdbarch *gdbarch)
-{
- struct builtin_java_type *builtin_java_type
- = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_java_type);
-
- builtin_java_type->builtin_int
- = arch_integer_type (gdbarch, 32, 0, "int");
- builtin_java_type->builtin_short
- = arch_integer_type (gdbarch, 16, 0, "short");
- builtin_java_type->builtin_long
- = arch_integer_type (gdbarch, 64, 0, "long");
- builtin_java_type->builtin_byte
- = arch_integer_type (gdbarch, 8, 0, "byte");
- builtin_java_type->builtin_boolean
- = arch_boolean_type (gdbarch, 8, 0, "boolean");
- builtin_java_type->builtin_char
- = arch_character_type (gdbarch, 16, 1, "char");
- builtin_java_type->builtin_float
- = arch_float_type (gdbarch, 32, "float", floatformats_ieee_single);
- builtin_java_type->builtin_double
- = arch_float_type (gdbarch, 64, "double", floatformats_ieee_double);
- builtin_java_type->builtin_void
- = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
-
- return builtin_java_type;
-}
-
-static struct gdbarch_data *java_type_data;
-
-const struct builtin_java_type *
-builtin_java_type (struct gdbarch *gdbarch)
-{
- return ((const struct builtin_java_type *)
- gdbarch_data (gdbarch, java_type_data));
-}
-
-void
-_initialize_java_language (void)
-{
- jv_dynamics_objfile_data_key
- = register_objfile_data_with_cleanup (NULL, jv_per_objfile_free);
- jv_dynamics_progspace_key = register_program_space_data ();
-
- java_type_data = gdbarch_data_register_post_init (build_java_types);
-
- add_language (&java_language_defn);
-}
diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h
deleted file mode 100644
index 7183bd6..0000000
--- a/gdb/jv-lang.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Java language support definitions for GDB, the GNU debugger.
-
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef JV_LANG_H
-#define JV_LANG_H
-
-struct value;
-struct type_print_options;
-struct parser_state;
-
-extern int java_parse (struct parser_state *); /* Defined in jv-exp.y */
-
-extern void java_yyerror (char *); /* Defined in jv-exp.y */
-
-struct builtin_java_type
-{
- struct type *builtin_int;
- struct type *builtin_byte;
- struct type *builtin_short;
- struct type *builtin_long;
- struct type *builtin_boolean;
- struct type *builtin_char;
- struct type *builtin_float;
- struct type *builtin_double;
- struct type *builtin_void;
-};
-
-extern const struct builtin_java_type *builtin_java_type (struct gdbarch *);
-
-extern void java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
- struct ui_file *, int,
- const struct value *,
- const struct value_print_options *);
-
-extern void java_value_print (struct value *, struct ui_file *,
- const struct value_print_options *);
-
-extern struct value *java_class_from_object (struct value *);
-
-extern struct type *type_from_class (struct gdbarch *, struct value *);
-
-extern struct type *java_primitive_type (struct gdbarch *, int signature);
-
-extern struct type *java_primitive_type_from_name (struct gdbarch *,
- const char *, int);
-
-extern struct type *java_array_type (struct type *, int);
-
-extern struct type *get_java_object_type (void);
-extern int get_java_object_header_size (struct gdbarch *);
-
-extern struct type *java_lookup_class (char *);
-
-extern int is_object_type (struct type *);
-
-/* Defined in jv-typeprint.c */
-extern void java_print_type (struct type *, const char *,
- struct ui_file *, int, int,
- const struct type_print_options *);
-
-extern char *java_demangle_type_signature (const char *);
-
-#endif
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
deleted file mode 100644
index 00abd9a..0000000
--- a/gdb/jv-typeprint.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* Support for printing Java types for GDB, the GNU debugger.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-#include "defs.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "value.h"
-#include "demangle.h"
-#include "gdb-demangle.h"
-#include "jv-lang.h"
-#include "typeprint.h"
-#include "c-lang.h"
-#include "cp-abi.h"
-#include "cp-support.h"
-
-/* Local functions */
-
-static void java_type_print_base (struct type * type,
- struct ui_file *stream, int show,
- int level,
- const struct type_print_options *flags);
-
-static void
-java_type_print_derivation_info (struct ui_file *stream, struct type *type)
-{
- const char *name;
- int i;
- int n_bases;
- int prev;
-
- n_bases = TYPE_N_BASECLASSES (type);
-
- for (i = 0, prev = 0; i < n_bases; i++)
- {
- int kind;
-
- kind = BASETYPE_VIA_VIRTUAL (type, i) ? 'I' : 'E';
-
- fputs_filtered (kind == prev ? ", "
- : kind == 'I' ? " implements "
- : " extends ",
- stream);
- prev = kind;
- name = type_name_no_tag (TYPE_BASECLASS (type, i));
-
- fprintf_filtered (stream, "%s", name ? name : "(null)");
- }
-
- if (i > 0)
- fputs_filtered (" ", stream);
-}
-
-/* Print the name of the type (or the ultimate pointer target,
- function value or array element), or the description of a
- structure or union.
-
- SHOW positive means print details about the type (e.g. enum values),
- and print structure elements passing SHOW - 1 for show.
- SHOW negative means just print the type name or struct tag if there is one.
- If there is no name, print something sensible but concise like
- "struct {...}".
- SHOW zero means just print the type name or struct tag if there is one.
- If there is no name, print something sensible but not as concise like
- "struct {int x; int y;}".
-
- LEVEL is the number of spaces to indent by.
- We increase it for some recursive calls. */
-
-static void
-java_type_print_base (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags)
-{
- int i;
- int len;
- char *mangled_name;
- char *demangled_name;
-
- QUIT;
- wrap_here (" ");
-
- if (type == NULL)
- {
- fputs_filtered ("<type unknown>", stream);
- return;
- }
-
- /* When SHOW is zero or less, and there is a valid type name, then always
- just print the type name directly from the type. */
-
- if (show <= 0
- && TYPE_NAME (type) != NULL)
- {
- fputs_filtered (TYPE_NAME (type), stream);
- return;
- }
-
- type = check_typedef (type);
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_PTR:
- java_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level,
- flags);
- break;
-
- case TYPE_CODE_STRUCT:
- if (TYPE_TAG_NAME (type) != NULL && TYPE_TAG_NAME (type)[0] == '[')
- { /* array type */
- char *name = java_demangle_type_signature (TYPE_TAG_NAME (type));
-
- fputs_filtered (name, stream);
- xfree (name);
- break;
- }
-
- if (show >= 0)
- fprintf_filtered (stream, "class ");
-
- if (TYPE_TAG_NAME (type) != NULL)
- {
- fputs_filtered (TYPE_TAG_NAME (type), stream);
- if (show > 0)
- fputs_filtered (" ", stream);
- }
-
- wrap_here (" ");
-
- if (show < 0)
- {
- /* If we just printed a tag name, no need to print anything else. */
- if (TYPE_TAG_NAME (type) == NULL)
- fprintf_filtered (stream, "{...}");
- }
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
- {
- java_type_print_derivation_info (stream, type);
-
- fprintf_filtered (stream, "{\n");
- if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
- {
- if (TYPE_STUB (type))
- fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
- else
- fprintfi_filtered (level + 4, stream, "<no data fields>\n");
- }
-
- /* If there is a base class for this type,
- do not print the field that it occupies. */
-
- len = TYPE_NFIELDS (type);
- for (i = TYPE_N_BASECLASSES (type); i < len; i++)
- {
- QUIT;
- /* Don't print out virtual function table. */
- if (startswith (TYPE_FIELD_NAME (type, i), "_vptr")
- && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
- continue;
-
- /* Don't print the dummy field "class". */
- if (startswith (TYPE_FIELD_NAME (type, i), "class"))
- continue;
-
- print_spaces_filtered (level + 4, stream);
-
- if (HAVE_CPLUS_STRUCT (type))
- {
- if (TYPE_FIELD_PROTECTED (type, i))
- fprintf_filtered (stream, "protected ");
- else if (TYPE_FIELD_PRIVATE (type, i))
- fprintf_filtered (stream, "private ");
- else
- fprintf_filtered (stream, "public ");
- }
-
- if (field_is_static (&TYPE_FIELD (type, i)))
- fprintf_filtered (stream, "static ");
-
- java_print_type (TYPE_FIELD_TYPE (type, i),
- TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4, flags);
-
- fprintf_filtered (stream, ";\n");
- }
-
- /* If there are both fields and methods, put a space between. */
- len = TYPE_NFN_FIELDS (type);
- if (len)
- fprintf_filtered (stream, "\n");
-
- /* Print out the methods. */
-
- for (i = 0; i < len; i++)
- {
- struct fn_field *f;
- int j;
- const char *method_name;
- const char *name;
- int is_constructor;
- int n_overloads;
-
- f = TYPE_FN_FIELDLIST1 (type, i);
- n_overloads = TYPE_FN_FIELDLIST_LENGTH (type, i);
- method_name = TYPE_FN_FIELDLIST_NAME (type, i);
- name = type_name_no_tag (type);
- is_constructor = name && strcmp (method_name, name) == 0;
-
- for (j = 0; j < n_overloads; j++)
- {
- const char *real_physname;
- const char *p;
- char *physname;
- int is_full_physname_constructor;
-
- real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);
-
- /* The physname will contain the return type
- after the final closing parenthesis. Strip it off. */
- p = strrchr (real_physname, ')');
- gdb_assert (p != NULL);
- ++p; /* Keep the trailing ')'. */
- physname = (char *) alloca (p - real_physname + 1);
- memcpy (physname, real_physname, p - real_physname);
- physname[p - real_physname] = '\0';
-
- is_full_physname_constructor
- = (TYPE_FN_FIELD_CONSTRUCTOR (f, j)
- || is_constructor_name (physname)
- || is_destructor_name (physname));
-
- QUIT;
-
- print_spaces_filtered (level + 4, stream);
-
- if (TYPE_FN_FIELD_PROTECTED (f, j))
- fprintf_filtered (stream, "protected ");
- else if (TYPE_FN_FIELD_PRIVATE (f, j))
- fprintf_filtered (stream, "private ");
- else if (TYPE_FN_FIELD_PUBLIC (f, j))
- fprintf_filtered (stream, "public ");
-
- if (TYPE_FN_FIELD_ABSTRACT (f, j))
- fprintf_filtered (stream, "abstract ");
- if (TYPE_FN_FIELD_STATIC (f, j))
- fprintf_filtered (stream, "static ");
- if (TYPE_FN_FIELD_FINAL (f, j))
- fprintf_filtered (stream, "final ");
- if (TYPE_FN_FIELD_SYNCHRONIZED (f, j))
- fprintf_filtered (stream, "synchronized ");
- if (TYPE_FN_FIELD_NATIVE (f, j))
- fprintf_filtered (stream, "native ");
-
- if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
- {
- /* Keep GDB from crashing here. */
- fprintf_filtered (stream, "<undefined type> %s;\n",
- TYPE_FN_FIELD_PHYSNAME (f, j));
- break;
- }
- else if (!is_constructor && !is_full_physname_constructor)
- {
- type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
- "", stream, -1);
- fputs_filtered (" ", stream);
- }
-
- if (TYPE_FN_FIELD_STUB (f, j))
- /* Build something we can demangle. */
- mangled_name = gdb_mangle_name (type, i, j);
- else
- mangled_name = physname;
-
- demangled_name =
- gdb_demangle (mangled_name,
- DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA);
-
- if (demangled_name == NULL)
- demangled_name = xstrdup (mangled_name);
-
- {
- char *demangled_no_class;
- char *ptr;
-
- ptr = demangled_no_class = demangled_name;
-
- while (1)
- {
- char c;
-
- c = *ptr++;
-
- if (c == 0 || c == '(')
- break;
- if (c == '.')
- demangled_no_class = ptr;
- }
-
- fputs_filtered (demangled_no_class, stream);
- xfree (demangled_name);
- }
-
- if (TYPE_FN_FIELD_STUB (f, j))
- xfree (mangled_name);
-
- fprintf_filtered (stream, ";\n");
- }
- }
-
- fprintfi_filtered (level, stream, "}");
- }
- break;
-
- default:
- c_type_print_base (type, stream, show, level, flags);
- }
-}
-
-/* LEVEL is the depth to indent lines by. */
-
-void
-java_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level,
- const struct type_print_options *flags)
-{
- int demangled_args;
-
- java_type_print_base (type, stream, show, level, flags);
-
- if (varstring != NULL && *varstring != '\0')
- {
- fputs_filtered (" ", stream);
- fputs_filtered (varstring, stream);
- }
-
- /* For demangled function names, we have the arglist as part of the name,
- so don't print an additional pair of ()'s. */
-
- demangled_args = varstring != NULL && strchr (varstring, '(') != NULL;
- c_type_print_varspec_suffix (type, stream, show, 0, demangled_args, flags);
-}
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
deleted file mode 100644
index 2988737..0000000
--- a/gdb/jv-valprint.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/* Support for printing Java values for GDB, the GNU debugger.
-
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "defs.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "gdbcore.h"
-#include "expression.h"
-#include "value.h"
-#include "demangle.h"
-#include "valprint.h"
-#include "language.h"
-#include "jv-lang.h"
-#include "c-lang.h"
-#include "annotate.h"
-/* Local functions */
-
-void
-java_value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
-{
- struct gdbarch *gdbarch = get_type_arch (value_type (val));
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct type *type;
- CORE_ADDR address;
- int i;
- const char *name;
- struct value_print_options opts;
-
- type = value_type (val);
- address = value_address (val);
-
- if (is_object_type (type))
- {
- CORE_ADDR obj_addr;
- struct value *tem = val;
-
- /* Get the run-time type, and cast the object into that. */
- while (TYPE_CODE (value_type (tem)) == TYPE_CODE_PTR)
- tem = value_ind (tem);
-
- obj_addr = value_address (tem);
-
- if (obj_addr != 0)
- {
- type = type_from_class (gdbarch, java_class_from_object (val));
- type = lookup_pointer_type (type);
-
- val = value_at (type, address);
- type = value_type (val);
- }
- }
-
- if (TYPE_CODE (type) == TYPE_CODE_PTR && !value_logical_not (val))
- type_print (TYPE_TARGET_TYPE (type), "", stream, -1);
-
- name = TYPE_TAG_NAME (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT && name != NULL
- && (i = strlen (name), name[i - 1] == ']'))
- {
- gdb_byte buf4[4];
- long length;
- unsigned int things_printed = 0;
- int reps;
- struct type *el_type
- = java_primitive_type_from_name (gdbarch, name, i - 2);
-
- i = 0;
- read_memory (address + get_java_object_header_size (gdbarch), buf4, 4);
-
- length = (long) extract_signed_integer (buf4, 4, byte_order);
- fprintf_filtered (stream, "{length: %ld", length);
-
- if (el_type == NULL)
- {
- CORE_ADDR element;
- CORE_ADDR next_element = -1; /* Dummy initial value. */
-
- /* Skip object header and length. */
- address += get_java_object_header_size (gdbarch) + 4;
-
- while (i < length && things_printed < options->print_max)
- {
- gdb_byte *buf;
-
- buf = ((gdb_byte *)
- alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT));
- fputs_filtered (", ", stream);
- wrap_here (n_spaces (2));
-
- if (i > 0)
- element = next_element;
- else
- {
- read_memory (address, buf, sizeof (buf));
- address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
- /* FIXME: cagney/2003-05-24: Bogus or what. It
- pulls a host sized pointer out of the target and
- then extracts that as an address (while assuming
- that the address is unsigned)! */
- element = extract_unsigned_integer (buf, sizeof (buf),
- byte_order);
- }
-
- for (reps = 1; i + reps < length; reps++)
- {
- read_memory (address, buf, sizeof (buf));
- address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
- /* FIXME: cagney/2003-05-24: Bogus or what. It
- pulls a host sized pointer out of the target and
- then extracts that as an address (while assuming
- that the address is unsigned)! */
- next_element = extract_unsigned_integer (buf, sizeof (buf),
- byte_order);
- if (next_element != element)
- break;
- }
-
- if (reps == 1)
- fprintf_filtered (stream, "%d: ", i);
- else
- fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
-
- if (element == 0)
- fprintf_filtered (stream, "null");
- else
- fprintf_filtered (stream, "@%s", paddress (gdbarch, element));
-
- things_printed++;
- i += reps;
- }
- }
- else
- {
- struct value *v = allocate_value (el_type);
- struct value *next_v = allocate_value (el_type);
-
- set_value_address (v, (address
- + get_java_object_header_size (gdbarch) + 4));
- set_value_address (next_v, value_raw_address (v));
-
- while (i < length && things_printed < options->print_max)
- {
- fputs_filtered (", ", stream);
- wrap_here (n_spaces (2));
-
- if (i > 0)
- {
- struct value *tmp;
-
- tmp = next_v;
- next_v = v;
- v = tmp;
- }
- else
- {
- set_value_lazy (v, 1);
- set_value_offset (v, 0);
- }
-
- set_value_offset (next_v, value_offset (v));
-
- for (reps = 1; i + reps < length; reps++)
- {
- set_value_lazy (next_v, 1);
- set_value_offset (next_v, value_offset (next_v)
- + TYPE_LENGTH (el_type));
- value_fetch_lazy (next_v);
- if (!value_contents_eq (v, value_embedded_offset (v),
- next_v,
- value_embedded_offset (next_v),
- TYPE_LENGTH (el_type)))
- break;
- }
-
- if (reps == 1)
- fprintf_filtered (stream, "%d: ", i);
- else
- fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
-
- opts = *options;
- opts.deref_ref = 1;
- common_val_print (v, stream, 1, &opts, current_language);
-
- things_printed++;
- i += reps;
- }
- }
-
- if (i < length)
- fprintf_filtered (stream, "...");
-
- fprintf_filtered (stream, "}");
-
- return;
- }
-
- /* If it's type String, print it. */
-
- if (TYPE_CODE (type) == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (type)
- && TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
- && strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
- "java.lang.String") == 0
- && (options->format == 0 || options->format == 's')
- && address != 0
- && value_as_address (val) != 0)
- {
- struct type *char_type;
- struct value *data_val;
- CORE_ADDR data;
- struct value *boffset_val;
- unsigned long boffset;
- struct value *count_val;
- unsigned long count;
- struct value *mark;
-
- fputs_filtered (" ", stream);
-
- mark = value_mark (); /* Remember start of new values. */
-
- data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
- data = value_as_address (data_val);
-
- boffset_val = value_struct_elt (&val, NULL, "boffset", NULL, NULL);
- boffset = value_as_address (boffset_val);
-
- count_val = value_struct_elt (&val, NULL, "count", NULL, NULL);
- count = value_as_address (count_val);
-
- value_free_to_mark (mark); /* Release unnecessary values. */
-
- char_type = builtin_java_type (gdbarch)->builtin_char;
- val_print_string (char_type, NULL, data + boffset, count, stream,
- options);
-
- return;
- }
-
- opts = *options;
- opts.deref_ref = 1;
- common_val_print (val, stream, 0, &opts, current_language);
-}
-
-/* TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
- same meanings as in cp_print_value and c_val_print.
-
- DONT_PRINT is an array of baseclass types that we
- should not print, or zero if called from top level. */
-
-static void
-java_print_value_fields (struct type *type, const gdb_byte *valaddr,
- LONGEST offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse,
- const struct value *val,
- const struct value_print_options *options)
-{
- int i, len, n_baseclasses;
-
- type = check_typedef (type);
-
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- n_baseclasses = TYPE_N_BASECLASSES (type);
-
- if (n_baseclasses > 0)
- {
- int i, n_baseclasses = TYPE_N_BASECLASSES (type);
-
- for (i = 0; i < n_baseclasses; i++)
- {
- int boffset;
- struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = TYPE_NAME (baseclass);
- const gdb_byte *base_valaddr;
-
- if (BASETYPE_VIA_VIRTUAL (type, i))
- continue;
-
- if (basename != NULL && strcmp (basename, "java.lang.Object") == 0)
- continue;
-
- boffset = 0;
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * (recurse + 1), stream);
- }
- fputs_filtered ("<", stream);
- /* Not sure what the best notation is in the case where there is no
- baseclass name. */
- fputs_filtered (basename ? basename : "", stream);
- fputs_filtered ("> = ", stream);
-
- base_valaddr = valaddr;
-
- java_print_value_fields (baseclass, base_valaddr,
- offset + boffset, address,
- stream, recurse + 1, val, options);
- fputs_filtered (", ", stream);
- }
- }
-
- if (!len && n_baseclasses == 1)
- fprintf_filtered (stream, "<No data fields>");
- else
- {
- int fields_seen = 0;
-
- for (i = n_baseclasses; i < len; i++)
- {
- /* If requested, skip printing of static fields. */
- if (field_is_static (&TYPE_FIELD (type, i)))
- {
- const char *name = TYPE_FIELD_NAME (type, i);
-
- if (!options->static_field_print)
- continue;
- if (name != NULL && strcmp (name, "class") == 0)
- continue;
- }
- if (fields_seen)
- fprintf_filtered (stream, ", ");
- else if (n_baseclasses > 0)
- {
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- fputs_filtered ("members of ", stream);
- fputs_filtered (type_name_no_tag (type), stream);
- fputs_filtered (": ", stream);
- }
- }
- fields_seen = 1;
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- else
- {
- wrap_here (n_spaces (2 + 2 * recurse));
- }
-
- annotate_field_begin (TYPE_FIELD_TYPE (type, i));
-
- if (field_is_static (&TYPE_FIELD (type, i)))
- fputs_filtered ("static ", stream);
- fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
- language_cplus,
- DMGL_PARAMS | DMGL_ANSI);
- annotate_field_name_end ();
- fputs_filtered (": ", stream);
- annotate_field_value ();
-
- if (!field_is_static (&TYPE_FIELD (type, i))
- && TYPE_FIELD_PACKED (type, i))
- {
- struct value *v;
-
- /* Bitfields require special handling, especially due to byte
- order problems. */
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_filtered ("<optimized out or zero length>", stream);
- }
- else if (value_bits_synthetic_pointer (val,
- TYPE_FIELD_BITPOS (type,
- i),
- TYPE_FIELD_BITSIZE (type,
- i)))
- {
- fputs_filtered (_("<synthetic pointer>"), stream);
- }
- else
- {
- struct value_print_options opts;
-
- v = value_field_bitfield (type, i, valaddr, offset, val);
-
- opts = *options;
- opts.deref_ref = 0;
- common_val_print (v, stream, recurse + 1,
- &opts, current_language);
- }
- }
- else
- {
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_filtered ("<optimized out or zero length>", stream);
- }
- else if (field_is_static (&TYPE_FIELD (type, i)))
- {
- struct value_print_options opts;
- struct value *v = value_static_field (type, i);
- struct type *t = check_typedef (value_type (v));
-
- if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
- v = value_addr (v);
- opts = *options;
- opts.deref_ref = 0;
- common_val_print (v, stream, recurse + 1,
- &opts, current_language);
- }
- else if (TYPE_FIELD_TYPE (type, i) == NULL)
- fputs_filtered ("<unknown type>", stream);
- else
- {
- struct value_print_options opts = *options;
-
- opts.deref_ref = 0;
- val_print (TYPE_FIELD_TYPE (type, i),
- valaddr,
- offset + TYPE_FIELD_BITPOS (type, i) / 8,
- address, stream, recurse + 1, val, &opts,
- current_language);
- }
- }
- annotate_field_end ();
- }
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- }
- fprintf_filtered (stream, "}");
-}
-
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-java_val_print (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- const struct value *val,
- const struct value_print_options *options)
-{
- struct gdbarch *gdbarch = get_type_arch (type);
- struct type *target_type;
- CORE_ADDR addr;
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_PTR:
- if (options->format && options->format != 's')
- {
- val_print_scalar_formatted (type, valaddr, embedded_offset,
- val, options, 0, stream);
- break;
- }
- addr = unpack_pointer (type, valaddr + embedded_offset);
- if (addr == 0)
- {
- fputs_filtered ("null", stream);
- return;
- }
- target_type = check_typedef (TYPE_TARGET_TYPE (type));
-
- if (TYPE_CODE (target_type) == TYPE_CODE_FUNC)
- {
- /* Try to print what function it points to. */
- print_address_demangle (options, gdbarch, addr, stream, demangle);
- return;
- }
-
- if (options->addressprint && options->format != 's')
- {
- fputs_filtered ("@", stream);
- print_longest (stream, 'x', 0, (ULONGEST) addr);
- }
-
- return;
-
- case TYPE_CODE_CHAR:
- case TYPE_CODE_INT:
- /* Can't just call c_val_print because that prints bytes as C
- chars. */
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
-
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, valaddr, embedded_offset,
- val, &opts, 0, stream);
- }
- else if (TYPE_CODE (type) == TYPE_CODE_CHAR
- || (TYPE_CODE (type) == TYPE_CODE_INT
- && TYPE_LENGTH (type) == 2
- && strcmp (TYPE_NAME (type), "char") == 0))
- LA_PRINT_CHAR ((int) unpack_long (type, valaddr + embedded_offset),
- type, stream);
- else
- val_print_type_code_int (type, valaddr + embedded_offset, stream);
- break;
-
- case TYPE_CODE_STRUCT:
- java_print_value_fields (type, valaddr, embedded_offset,
- address, stream, recurse, val, options);
- break;
-
- default:
- c_val_print (type, valaddr, embedded_offset, address, stream,
- recurse, val, options);
- break;
- }
-}
diff --git a/gdb/jv-varobj.c b/gdb/jv-varobj.c
deleted file mode 100644
index 75be39f..0000000
--- a/gdb/jv-varobj.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* varobj support for Java.
-
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "defs.h"
-#include "varobj.h"
-
-/* Java */
-
-static int
-java_number_of_children (const struct varobj *var)
-{
- return cplus_varobj_ops.number_of_children (var);
-}
-
-static char *
-java_name_of_variable (const struct varobj *parent)
-{
- char *p, *name;
-
- name = cplus_varobj_ops.name_of_variable (parent);
- /* If the name has "-" in it, it is because we
- needed to escape periods in the name... */
- p = name;
-
- while (*p != '\000')
- {
- if (*p == '-')
- *p = '.';
- p++;
- }
-
- return name;
-}
-
-static char *
-java_name_of_child (const struct varobj *parent, int index)
-{
- char *name, *p;
-
- name = cplus_varobj_ops.name_of_child (parent, index);
- /* Escape any periods in the name... */
- p = name;
-
- while (*p != '\000')
- {
- if (*p == '.')
- *p = '-';
- p++;
- }
-
- return name;
-}
-
-static char *
-java_path_expr_of_child (const struct varobj *child)
-{
- return NULL;
-}
-
-static struct value *
-java_value_of_child (const struct varobj *parent, int index)
-{
- return cplus_varobj_ops.value_of_child (parent, index);
-}
-
-static struct type *
-java_type_of_child (const struct varobj *parent, int index)
-{
- return cplus_varobj_ops.type_of_child (parent, index);
-}
-
-static char *
-java_value_of_variable (const struct varobj *var,
- enum varobj_display_formats format)
-{
- return cplus_varobj_ops.value_of_variable (var, format);
-}
-
-/* varobj operations for java. */
-
-const struct lang_varobj_ops java_varobj_ops =
-{
- java_number_of_children,
- java_name_of_variable,
- java_name_of_child,
- java_path_expr_of_child,
- java_value_of_child,
- java_type_of_child,
- java_value_of_variable,
- varobj_default_value_is_changeable_p,
- NULL, /* value_has_mutated */
- varobj_default_is_path_expr_parent
-};
diff --git a/gdb/language.c b/gdb/language.c
index f761002..39faecc 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -39,7 +39,6 @@
#include "varobj.h"
#include "target.h"
#include "parser-defs.h"
-#include "jv-lang.h"
#include "demangle.h"
#include "symfile.h"
#include "cp-support.h"
diff --git a/gdb/linespec.c b/gdb/linespec.c
index ccedec8..ab59544 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3318,12 +3318,6 @@ find_linespec_symbols (struct linespec_state *state,
name into namespaces${SCOPE_OPERATOR}class_name and method_name. */
scope_op = "::";
p = find_toplevel_string (lookup_name, scope_op);
- if (p == NULL)
- {
- /* No C++ scope operator. Try Java. */
- scope_op = ".";
- p = find_toplevel_string (lookup_name, scope_op);
- }
last = NULL;
while (p != NULL)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 71f771d..6e66a8e 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -365,15 +365,6 @@ build_objfile_section_table (struct objfile *objfile)
requests for specific operations. Other bits like OBJF_SHARED are
simply copied through to the new objfile flags member. */
-/* NOTE: carlton/2003-02-04: This function is called with args NULL, 0
- by jv-lang.c, to create an artificial objfile used to hold
- information about dynamically-loaded Java classes. Unfortunately,
- that branch of this function doesn't get tested very frequently, so
- it's prone to breakage. (E.g. at one time the name was set to NULL
- in that situation, which broke a loop over all names in the dynamic
- library loader.) If you change this function, please try to leave
- things in a consistent state even if abfd is NULL. */
-
struct objfile *
allocate_objfile (bfd *abfd, const char *name, int flags)
{
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index edcaa8b..825df77 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -591,9 +591,6 @@ match_partial_symbol (struct objfile *objfile,
{
center = bottom + (top - bottom) / 2;
gdb_assert (center < top);
- if (!do_linear_search
- && (SYMBOL_LANGUAGE (*center) == language_java))
- do_linear_search = 1;
if (ordered_compare (SYMBOL_SEARCH_NAME (*center), name) >= 0)
top = center;
else
@@ -642,7 +639,6 @@ psymtab_search_name (const char *name)
switch (current_language->la_language)
{
case language_cplus:
- case language_java:
{
if (strchr (name, '('))
{
@@ -704,11 +700,6 @@ lookup_partial_symbol (struct objfile *objfile,
if (!(center < top))
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
- if (!do_linear_search
- && SYMBOL_LANGUAGE (*center) == language_java)
- {
- do_linear_search = 1;
- }
if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center),
search_name) >= 0)
{
diff --git a/gdb/symtab.c b/gdb/symtab.c
index e776a0c..4e03cb7 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -668,7 +668,6 @@ symbol_set_language (struct general_symbol_info *gsymbol,
if (gsymbol->language == language_cplus
|| gsymbol->language == language_d
|| gsymbol->language == language_go
- || gsymbol->language == language_java
|| gsymbol->language == language_objc
|| gsymbol->language == language_fortran)
{
@@ -787,25 +786,6 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
comes from the per-BFD storage_obstack. LINKAGE_NAME is copied,
so the pointer can be discarded after calling this function. */
-/* We have to be careful when dealing with Java names: when we run
- into a Java minimal symbol, we don't know it's a Java symbol, so it
- gets demangled as a C++ name. This is unfortunate, but there's not
- much we can do about it: but when demangling partial symbols and
- regular symbols, we'd better not reuse the wrong demangled name.
- (See PR gdb/1039.) We solve this by putting a distinctive prefix
- on Java names when storing them in the hash table. */
-
-/* FIXME: carlton/2003-03-13: This is an unfortunate situation. I
- don't mind the Java prefix so much: different languages have
- different demangling requirements, so it's only natural that we
- need to keep language data around in our demangling cache. But
- it's not good that the minimal symbol has the wrong demangled name.
- Unfortunately, I can't think of any easy solution to that
- problem. */
-
-#define JAVA_PREFIX "##JAVA$$"
-#define JAVA_PREFIX_LEN 8
-
void
symbol_set_names (struct general_symbol_info *gsymbol,
const char *linkage_name, int len, int copy_name,
@@ -814,24 +794,13 @@ symbol_set_names (struct general_symbol_info *gsymbol,
struct demangled_name_entry **slot;
/* A 0-terminated copy of the linkage name. */
const char *linkage_name_copy;
- /* A copy of the linkage name that might have a special Java prefix
- added to it, for use when looking names up in the hash table. */
- const char *lookup_name;
- /* The length of lookup_name. */
- int lookup_len;
struct demangled_name_entry entry;
struct objfile_per_bfd_storage *per_bfd = objfile->per_bfd;
if (gsymbol->language == language_ada)
{
/* In Ada, we do the symbol lookups using the mangled name, so
- we can save some space by not storing the demangled name.
-
- As a side note, we have also observed some overlap between
- the C++ mangling and Ada mangling, similarly to what has
- been observed with Java. Because we don't store the demangled
- name with the symbol, we don't need to use the same trick
- as Java. */
+ we can save some space by not storing the demangled name. */
if (!copy_name)
gsymbol->name = linkage_name;
else
@@ -851,42 +820,20 @@ symbol_set_names (struct general_symbol_info *gsymbol,
if (per_bfd->demangled_names_hash == NULL)
create_demangled_names_hash (objfile);
- /* The stabs reader generally provides names that are not
- NUL-terminated; most of the other readers don't do this, so we
- can just use the given copy, unless we're in the Java case. */
- if (gsymbol->language == language_java)
- {
- char *alloc_name;
-
- lookup_len = len + JAVA_PREFIX_LEN;
- alloc_name = (char *) alloca (lookup_len + 1);
- memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN);
- memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len);
- alloc_name[lookup_len] = '\0';
-
- lookup_name = alloc_name;
- linkage_name_copy = alloc_name + JAVA_PREFIX_LEN;
- }
- else if (linkage_name[len] != '\0')
+ if (linkage_name[len] != '\0')
{
char *alloc_name;
- lookup_len = len;
- alloc_name = (char *) alloca (lookup_len + 1);
+ alloc_name = (char *) alloca (len + 1);
memcpy (alloc_name, linkage_name, len);
- alloc_name[lookup_len] = '\0';
+ alloc_name[len] = '\0';
- lookup_name = alloc_name;
linkage_name_copy = alloc_name;
}
else
- {
- lookup_len = len;
- lookup_name = linkage_name;
- linkage_name_copy = linkage_name;
- }
+ linkage_name_copy = linkage_name;
- entry.mangled = lookup_name;
+ entry.mangled = linkage_name_copy;
slot = ((struct demangled_name_entry **)
htab_find_slot (per_bfd->demangled_names_hash,
&entry, INSERT));
@@ -903,7 +850,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
int demangled_len = demangled_name ? strlen (demangled_name) : 0;
/* Suppose we have demangled_name==NULL, copy_name==0, and
- lookup_name==linkage_name. In this case, we already have the
+ linkage_name_copy==linkage_name. In this case, we already have the
mangled name saved, and we don't have a demangled name. So,
you might think we could save a little space by not recording
this in the hash table at all.
@@ -911,14 +858,14 @@ symbol_set_names (struct general_symbol_info *gsymbol,
It turns out that it is actually important to still save such
an entry in the hash table, because storing this name gives
us better bcache hit rates for partial symbols. */
- if (!copy_name && lookup_name == linkage_name)
+ if (!copy_name && linkage_name_copy == linkage_name)
{
*slot
= ((struct demangled_name_entry *)
obstack_alloc (&per_bfd->storage_obstack,
offsetof (struct demangled_name_entry, demangled)
+ demangled_len + 1));
- (*slot)->mangled = lookup_name;
+ (*slot)->mangled = linkage_name;
}
else
{
@@ -931,9 +878,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
= ((struct demangled_name_entry *)
obstack_alloc (&per_bfd->storage_obstack,
offsetof (struct demangled_name_entry, demangled)
- + lookup_len + demangled_len + 2));
+ + len + demangled_len + 2));
mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
- strcpy (mangled_ptr, lookup_name);
+ strcpy (mangled_ptr, linkage_name_copy);
(*slot)->mangled = mangled_ptr;
}
@@ -946,7 +893,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
(*slot)->demangled[0] = '\0';
}
- gsymbol->name = (*slot)->mangled + lookup_len - len;
+ gsymbol->name = (*slot)->mangled;
if ((*slot)->demangled[0] != '\0')
symbol_set_demangled_name (gsymbol, (*slot)->demangled,
&per_bfd->storage_obstack);
@@ -965,7 +912,6 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
case language_cplus:
case language_d:
case language_go:
- case language_java:
case language_objc:
case language_fortran:
if (symbol_get_demangled_name (gsymbol) != NULL)
@@ -992,7 +938,6 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
case language_cplus:
case language_d:
case language_go:
- case language_java:
case language_objc:
case language_fortran:
dem_name = symbol_get_demangled_name (gsymbol);
@@ -1852,7 +1797,7 @@ demangle_for_lookup (const char *name, enum language lang,
modified_name = name;
- /* If we are using C++, D, Go, or Java, demangle the name before doing a
+ /* If we are using C++, D, or Go, demangle the name before doing a
lookup, so we can always binary search. */
if (lang == language_cplus)
{
@@ -1874,16 +1819,6 @@ demangle_for_lookup (const char *name, enum language lang,
}
}
}
- else if (lang == language_java)
- {
- demangled_name = gdb_demangle (name,
- DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA);
- if (demangled_name)
- {
- modified_name = demangled_name;
- make_cleanup (xfree, demangled_name);
- }
- }
else if (lang == language_d)
{
demangled_name = d_demangle (name, 0);
@@ -2736,11 +2671,9 @@ symbol_matches_domain (enum language symbol_language,
domain_enum domain)
{
/* For C++ "struct foo { ... }" also defines a typedef for "foo".
- A Java class declaration also defines a typedef for the class.
Similarly, any Ada type declaration implicitly defines a typedef. */
if (symbol_language == language_cplus
|| symbol_language == language_d
- || symbol_language == language_java
|| symbol_language == language_ada)
{
if ((domain == VAR_DOMAIN || domain == STRUCT_DOMAIN)
@@ -5370,7 +5303,6 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
/* Prepare SYM_TEXT_LEN for compare_symbol_name. */
if (current_language->la_language == language_cplus
- || current_language->la_language == language_java
|| current_language->la_language == language_fortran)
{
/* These languages may have parameters entered by user but they are never
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 9df4efb..9b1dbb4 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -137,7 +137,7 @@ struct general_symbol_info
struct obstack *obstack;
/* This is used by languages which wish to store a demangled name.
- currently used by Ada, C++, Java, and Objective C. */
+ currently used by Ada, C++, and Objective C. */
const char *demangled_name;
}
language_specific;
@@ -261,7 +261,7 @@ extern const char *symbol_demangled_name
extern int demangle;
/* Macro that returns the name to be used when sorting and searching symbols.
- In C++ and Java, we search for the demangled form of a name,
+ In C++, we search for the demangled form of a name,
and so sort symbols accordingly. In Ada, however, we search by mangled
name. If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
returns the same value (same pointer) as SYMBOL_LINKAGE_NAME. */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 56d28ac..7157544 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2016-10-06 Tom Tromey <tom@tromey.com>
+
+ * gdb.compile/compile.exp: Change java tests to rust.
+ * gdb.base/setshow.exp: Change java tests to rust.
+ * gdb.base/default.exp: Remove java from language list.
+ * README (Examples): Update language example.
+ * gdb.python/py-lookup-type.exp (test_lookup_type): Remove java
+ test.
+ * lib/gdb.exp (skip_java_tests): Remove.
+ * lib/java.exp: Remove.
+ * gdb.java: Remove.
+
2016-10-06 Maciej W. Rozycki <macro@imgtec.com>
* gdb.arch/mips-fcr.exp: New test.
diff --git a/gdb/testsuite/README b/gdb/testsuite/README
index 152318a..037a340 100644
--- a/gdb/testsuite/README
+++ b/gdb/testsuite/README
@@ -484,7 +484,7 @@ ANSI/ISO C, and C++.
gdb.<lang>
Language-specific tests for any language besides C. Examples are
-gdb.cp for C++ and gdb.java for Java.
+gdb.cp for C++ and gdb.rust for Rust.
gdb.<platform>
diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 38c3d4a..b8a449b 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -511,7 +511,7 @@ gdb_test "set history size" "Argument required .integer to set it to.*" "set his
#test set history
gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand.(\[^\r\n\]*\[\r\n\])+List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set history"
#test set language
-gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, c, c.., asm, minimal, d, fortran, objective-c, go, java, modula-2, opencl, pascal, rust." "set language"
+gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, c, c.., asm, minimal, d, fortran, objective-c, go, modula-2, opencl, pascal, rust." "set language"
#test set listsize
gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
#test set print "p" abbreviation
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 2a86cdd..93dd926 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -211,10 +211,10 @@ gdb_test "show history size" "The size of the command history is 100..*" "show h
gdb_test "set language asm" ".*" "set language asm"
#test show language asm
gdb_test "show language" "The current source language is \"asm\"..*" "show language (asm)"
-#test set language java, with a trailing space
-gdb_test_no_output "set language java " "set language java"
-#test show language java
-gdb_test "show language" "The current source language is \"java\"..*" "show language (java)"
+#test set language rust, with a trailing space
+gdb_test_no_output "set language rust " "set language rust"
+#test show language rust
+gdb_test "show language" "The current source language is \"rust\"..*" "show language (rust)"
#test completion for set language.
gdb_test "complete set language min" "set language minimal" \
"complete set language minimal"
diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index f3c1cb9..610cf7e 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -322,9 +322,9 @@ gdb_test "show compile-args" \
"Compile command command-line arguments are .*"
gdb_test "compile code -z" "Unknown argument.*"
-gdb_test "set lang java" \
+gdb_test "set lang rust" \
"Warning: the current language does not match this frame."
-gdb_test "compile code globalvar" "No compiler support for language java\\."
+gdb_test "compile code globalvar" "No compiler support for language rust\\."
gdb_test_no_output "set lang auto"
gdb_test_no_output "compile code union union_type newdecl_u"
diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp
deleted file mode 100644
index de9a6d3..0000000
--- a/gdb/testsuite/gdb.java/jmain.exp
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2000-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# This file was based on jmisc.exp which in turn was written by
-# Anthony Green. (green@redhat.com)
-
-load_lib "java.exp"
-
-if { [skip_java_tests] } { continue }
-
-standard_testfile .java
-if {[compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != ""} {
- continue
-}
-
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test "set print sevenbit-strings" ".*"
-
-# Check that plain old "main" works. The load should both set the
-# language to java and (since --main=jmain), some how set the scope to
-# jmain's main.
-
-# Where the breakpoint should always land
-
-set bpmain "Breakpoint .* file .*jmain.java, line 5\."
-
-# Where GCC PR 16439 puts the breakpoint.
-set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
-
-gdb_load "${binfile}"
-setup_kfail java/1567 *-*-*
-gdb_test "break main" "${bpmain}"
-
-# Check that an unqualified "main" works.
-
-gdb_load "${binfile}"
-setup_kfail java/1565 *-*-*
-gdb_test "break jmain.main" "${bpmain}"
-
-# Check that a fully qualified "main" works.
-gdb_load "${binfile}"
-set cmd "break ${testfile}.main(java.lang.String\[\])"
-set msg $cmd
-gdb_test_multiple $cmd $msg {
- -re "${bpmain}\r\n$gdb_prompt $" {
- pass $msg
- }
- -re "${earlybpmain}\r\n$gdb_prompt $" {
- setup_xfail *-*-* gcc/16439
- fail $msg
- }
- -re "Make breakpoint pending.* \\(y or \\\[n\\\]\\) $" {
- gdb_test "n" "" ""
-
- # Check again with a method signature at the end.
- set cmd "break ${testfile}.main(java.lang.String\[\])void"
- set msg $cmd
- gdb_test_multiple $cmd $msg {
- -re "${bpmain}\r\n$gdb_prompt $" {
- pass $msg
- }
- -re "${earlybpmain}\r\n$gdb_prompt $" {
- setup_xfail *-*-* gcc/16439
- fail $msg
- }
- }
- }
-}
-
diff --git a/gdb/testsuite/gdb.java/jmain.java b/gdb/testsuite/gdb.java/jmain.java
deleted file mode 100644
index ee5c8bb..0000000
--- a/gdb/testsuite/gdb.java/jmain.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class jmain
-{
- public static void main (String[] args)
- {
- return;
- }
-}
diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp
deleted file mode 100644
index 43e68f5..0000000
--- a/gdb/testsuite/gdb.java/jmisc.exp
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright 2000-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# This file was written by Anthony Green. (green@redhat.com)
-#
-
-load_lib "java.exp"
-
-if { [skip_java_tests] } { continue }
-
-standard_testfile .java
-if {[compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != ""} {
- continue
-}
-
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
-
-gdb_test "set print sevenbit-strings" ".*"
-
-if [set_lang_java] then {
- # Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main".
- # As of 2004-02-24 it wasn't working and is being tested separatly.
- # Before GCJ 4.1 (approximately) the demangled name did not include
- # a method signature; after that point it does include a trailing
- # signature.
- runto_main
- set function "${testfile}.main(java.lang.String\[\])"
- gdb_breakpoint "$function" allow-pending
- gdb_breakpoint "${function}void" allow-pending
- gdb_continue_to_breakpoint $function
-
- gdb_test_multiple "ptype jmisc" "ptype jmisc" {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" {
- pass "ptype jmisc"
- }
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" {
- pass "ptype jmisc"
- }
- }
-
- gdb_test "p args" \
- "\\\$1 = java\.lang\.String\\\[]@\[a-f0-9]+"
-
- gdb_test_multiple "p *args" "p *args" {
- -re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $" {
- pass "p *args"
- }
- -re "\\\$2 = cannot find java.lang.Object.*$gdb_prompt $" {
- # Sometimes GCC 4.x does not emit the necessary information
- # about java.lang.Object.
- kfail "p *args" gdb/2214
- }
- }
-
- # The idea of running to 'exit' is that 'exit' is in a different
- # objfile from the rest of the program (provided that program is
- # linked normally with a shared libc). That causes gdb to examine
- # fresh objfiles. There is nothing important about 'exit'
- # semantics; it could be any symbol that is in a shared library.
- # -- chastain 2003-08-06
-
- if [gdb_breakpoint exit] {
- pass "break exit"
- }
- gdb_test_multiple "continue" "continue to exit" {
- -re ".*Breakpoint $decimal, .*exit.*$gdb_prompt $" {
- pass "continue to exit"
- }
- -re ".*internal-error: sect_index_text not initialized.*\\(y or n\\) " {
- # gdb choked on the "anonymous objfile" (probably).
- kfail "gdb/1322" "continue to exit"
- # get back to the gdb prompt
- gdb_test_multiple "no" "internal sync 1" {
- -re ".*\\(y or n\\) " {
- gdb_test_multiple "no" "internal sync 2" {
- -re ".*$gdb_prompt $" { ; }
- }
- }
- }
- }
- }
-
- # Test a non-mathing return type really fails the look up.
- gdb_test_no_output "set breakpoint pending off"
- gdb_test {break jmisc.main(java.lang.String[])int} {Function "jmisc\.main\(java\.lang\.String\[\]\)int" not defined\.}
-}
diff --git a/gdb/testsuite/gdb.java/jmisc.java b/gdb/testsuite/gdb.java/jmisc.java
deleted file mode 100644
index a11ba54..0000000
--- a/gdb/testsuite/gdb.java/jmisc.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class jmisc
-{
- public static void main (String[] args)
- {
- return;
- }
-}
diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
deleted file mode 100644
index 745cdf3..0000000
--- a/gdb/testsuite/gdb.java/jnpe.exp
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright 2009-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-load_lib "java.exp"
-
-standard_testfile .java
-if { [compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != "" } {
- untested "Couldn't compile $subdir/${srcfile}"
- return -1
-}
-
-# Start with a fresh gdb.
-
-clean_restart $testfile
-
-set line [gdb_get_line_number "break here" $testfile.java]
-if ![runto "$testfile.java:$line"] then {
- perror "couldn't run to jnpe.main"
- continue
-}
-
-if {![skip_unwinder_tests]} {
- unsupported "jnpe.exp could not find _Unwind_DebugHook"
- return -1
-}
-
-gdb_test "handle SIGSEGV nostop noprint" \
- "SIGSEGV.*fault" \
- "disable SIGSEGV for next-over-NPE"
-
-# The line where we stop differs according to gcj; just check that we
-# did not already execute the catch point. This is done in a somewhat
-# funny way due to other gcj debuginfo oddities that don't
-# meaningfully affect the user's experience.
-
-gdb_test "next" \
- ".*" \
- "next over NPE"
-
-set line [gdb_get_line_number "stop point"]
-gdb_breakpoint $line
-gdb_test "continue" "Continuing.\[\r\n\]*success\[\r\n\]*Thread .* hit Breakpoint .*:$line\[\r\n\]*.*// stop point\[\r\n\]*" \
- "continue to success for next-over-NPE"
diff --git a/gdb/testsuite/gdb.java/jnpe.java b/gdb/testsuite/gdb.java/jnpe.java
deleted file mode 100644
index ca62399..0000000
--- a/gdb/testsuite/gdb.java/jnpe.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// Test next-over-NPE.
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2009-2016 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-public class jnpe
-{
- public static String npe ()
- {
- return ((Object) null).toString();
- }
-
- public static void main (String[] args)
- {
- try
- {
- System.out.println (npe ()); // break here
- }
- catch (NullPointerException n)
- {
- System.out.println ("success");
- }
-
- System.out.println ("blah"); // stop point
- }
-}
diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp
deleted file mode 100644
index 1974a61..0000000
--- a/gdb/testsuite/gdb.java/jprint.exp
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 2004-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
-#
-
-load_lib "java.exp"
-
-if { [skip_java_tests] } { continue }
-
-standard_testfile .java
-if {[compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != ""} {
- continue
-}
-
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
-
-gdb_test "set print sevenbit-strings" ".*"
-
-if [set_lang_java] then {
- # Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main".
- # As of 2004-02-24 it wasn't working and is being tested separatly.
- # Before GCJ 4.1 (approximately) the demangled name did not include
- # a method signature; after that point it does include a trailing
- # signature.
- runto_main
- set function "${testfile}.main(java.lang.String\[\])"
- gdb_breakpoint "$function" allow-pending
- gdb_breakpoint "${function}void" allow-pending
- gdb_continue_to_breakpoint $function
-
- gdb_test "p jvclass.addprint(4,5,6)" " = 15" "unambiguous static call"
-
- gdb_test "next" ""
- gdb_test "next" ""
-
- gdb_test "p x.print(44)" " = 44" "single argument call"
- gdb_test "p x.print(22,33)" " = 33" "double argument call"
- gdb_test "p x.dothat(55)" " = 62.*" "virtual fn call"
- gdb_test "p x.addprint(1,2,3)" "= 6" "inherited static call"
- gdb_test "p x.addk(44)" " = 121" "inherited virtual fn call"
-
- # Regression test for a crasher.
- # GCC does not output location information for static class members,
- # so GDB will report these as "optimized out". See gcc/43260.
- setup_xfail *-*-* gcc/43260
- gdb_test "print *jprint.props" " = .*" "print a java.util.Properties"
-
- set test "print a java.lang.String"
- gdb_test_multiple "print jprint.hi" $test {
- -re " = java.lang.String \"hi maude\"\r\n$gdb_prompt $" {
- pass $test
- }
- -re "There is no member named data\\.\r\n$gdb_prompt $" {
- # GCJ system debug info for java.lang.String is not installed.
- xfail $test
- }
- }
-}
diff --git a/gdb/testsuite/gdb.java/jprint.java b/gdb/testsuite/gdb.java/jprint.java
deleted file mode 100644
index 5d5131b..0000000
--- a/gdb/testsuite/gdb.java/jprint.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// jprint.java test program.
-//
-// Copyright 2004-2016 Free Software Foundation, Inc.
-//
-// Written by Jeff Johnston <jjohnstn@redhat.com>
-// Contributed by Red Hat
-//
-// This file is part of GDB.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import java.util.Properties;
-
-class jvclass {
- public static int k;
- static {
- k = 77;
- }
- public static int addprint (int x, int y, int z) {
- int sum = x + y + z;
- System.out.println ("sum is " + sum);
- return sum;
- }
-
- public int addk (int x) {
- int sum = x + k;
- System.out.println ("adding k gives " + sum);
- return sum;
- }
-}
-
-public class jprint extends jvclass {
- public static Properties props = new Properties ();
- public static String hi = "hi maude";
-
- public int dothat (int x) {
- int y = x + 3;
- System.out.println ("new value is " + y);
- return y + 4;
- }
- public static int print (int x) {
- System.out.println("x is " + x);
- return x;
- }
- public static int print (int x, int y) {
- System.out.println("y is " + y);
- return y;
- }
- public static void main(String[] args) {
- jprint x = new jprint ();
- x.dothat (44);
- print (k, 33);
- print (x.addk(0), 33);
- }
-}
-
-
diff --git a/gdb/testsuite/gdb.java/jv-exp.exp b/gdb/testsuite/gdb.java/jv-exp.exp
deleted file mode 100644
index 0a88e09..0000000
--- a/gdb/testsuite/gdb.java/jv-exp.exp
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2000-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-load_lib "java.exp"
-
-proc test_comparisons {} {
- global gdb_prompt
-
- # Test various comparisons.
-
- gdb_test "p 1 > 2" " = false"
- gdb_test "p 1 < 2" " = true"
-}
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test "set print sevenbit-strings" ""
-gdb_test "set print address off" "" ""
-gdb_test "set width 0" ""
-
-if [set_lang_java] then {
- test_comparisons
-} else {
- warning "Java expression tests suppressed"
-}
diff --git a/gdb/testsuite/gdb.java/jv-print.exp b/gdb/testsuite/gdb.java/jv-print.exp
deleted file mode 100644
index 96f749e..0000000
--- a/gdb/testsuite/gdb.java/jv-print.exp
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright 1999-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-load_lib "java.exp"
-
-if { [skip_java_tests] } { continue }
-
-proc test_integer_literals_accepted {} {
- global gdb_prompt
-
- # Test various decimal values.
-
- gdb_test "p 123" " = 123"
- gdb_test "p -123" " = -123"
- gdb_test "p/d 123" " = 123"
-
- # Test various octal values.
-
- gdb_test "p 0123" " = 83"
- gdb_test "p 00123" " = 83"
- gdb_test "p -0123" " = -83"
- gdb_test "p/o 0123" " = 0123"
-
- # Test various hexadecimal values.
-
- gdb_test "p 0x123" " = 291"
- gdb_test "p -0x123" " = -291"
- gdb_test "p 0x0123" " = 291"
- gdb_test "p -0x0123" " = -291"
- gdb_test "p 0xABCDEF" " = 11259375"
- gdb_test "p 0xabcdef" " = 11259375"
- gdb_test "p 0xAbCdEf" " = 11259375"
- gdb_test "p/x 0x123" " = 0x123"
-}
-
-proc test_character_literals_accepted {} {
- global gdb_prompt
-
- gdb_test "p 'a'" " = 'a'"
- gdb_test "p/c 'a'" " = 'a'"
- gdb_test "p/c 70" " = 'F'"
- gdb_test "p/x 'a'" " = 0x61"
- gdb_test "p/d 'a'" " = 97"
- gdb_test "p/t 'a'" " = 1100001"
- gdb_test "p/x '\\377'" " = 0xff"
- gdb_test "p '\\''" " = '\\\\''"
- # Note "p '\\'" => "= 92 '\\'"
- gdb_test "p '\\\\'" " = '\\\\\\\\'"
-
- # Test the /c print format.
-}
-
-proc test_integer_literals_rejected {} {
- global gdb_prompt
-
- test_print_reject "p 0x"
- gdb_test "p ''" "Empty character constant"
- gdb_test "p '''" "Empty character constant"
- test_print_reject "p '\\'"
-
- # Note that this turns into "p '\\\'" at gdb's input.
- test_print_reject "p '\\\\\\'"
-
- # Test various decimal values.
-
- test_print_reject "p DEADBEEF"
-
- test_print_reject "p 123DEADBEEF"
- test_print_reject "p 123foobar.bazfoo3"
- test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
- gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
-
- # Test various octal values.
-
- test_print_reject "p 09"
- test_print_reject "p 079"
-
- # Test various hexadecimal values.
-
- test_print_reject "p 0xG"
- test_print_reject "p 0xAG"
-}
-
-proc test_float_accepted {} {
- global gdb_prompt
-
- # Test parsing of fp value with legit text following.
- gdb_test "p 1234.5+1" " = 1235.5" "check fp + text"
-
- # Test all the suffixes (including no suffix).
- gdb_test "p 1." " = 1"
- gdb_test "p 1.5" " = 1.5"
- gdb_test "p 1.f" " = 1"
- gdb_test "p 1.5f" " = 1.5"
- gdb_test "p 1.d" " = 1"
- gdb_test "p 1.5d" " = 1.5"
-
- # Test hexadecimal floating point.
- set test "p 0x1.1"
- gdb_test_multiple $test $test {
- -re " = 1\\.0625\r\n$gdb_prompt $" {
- pass $test
- }
- -re "Invalid number \"0x1\\.1\"\r\n$gdb_prompt $" {
- # Older glibc does not support hex float, newer does.
- xfail $test
- }
- }
-}
-
-proc test_float_rejected {} {
- # Test bad suffixes.
- test_print_reject "p 1.1x"
- test_print_reject "p 1.1ff"
- test_print_reject "p 1.1dd"
-}
-
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test "print \$pc" "No registers\\."
-# FIXME: should also test "print $pc" when there is an execfile but no
-# remote debugging target, process or corefile.
-
-gdb_test "set print sevenbit-strings" ""
-gdb_test "set print address off" "" ""
-gdb_test "set width 0" ""
-
-if [set_lang_java] then {
- test_integer_literals_accepted
- test_character_literals_accepted
- test_integer_literals_rejected
- test_float_accepted
- test_float_rejected
-} else {
- warning "Java print command tests suppressed"
-}
diff --git a/gdb/testsuite/gdb.python/py-lookup-type.exp b/gdb/testsuite/gdb.python/py-lookup-type.exp
index 9d42feb..1fd571a 100644
--- a/gdb/testsuite/gdb.python/py-lookup-type.exp
+++ b/gdb/testsuite/gdb.python/py-lookup-type.exp
@@ -47,8 +47,6 @@ test_lookup_type "fortran" "character"
test_lookup_type "go" "int32"
-test_lookup_type "java" "byte"
-
test_lookup_type "modula-2" "CARDINAL"
test_lookup_type "opencl" "ushort"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1230e77..ab661ce 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1722,12 +1722,6 @@ proc skip_go_tests {} {
return 0
}
-# Return a 1 if I don't even want to try to test java.
-
-proc skip_java_tests {} {
- return 0
-}
-
# Return a 1 if I don't even want to try to test D.
proc skip_d_tests {} {
diff --git a/gdb/testsuite/lib/java.exp b/gdb/testsuite/lib/java.exp
deleted file mode 100644
index 5ddc97b..0000000
--- a/gdb/testsuite/lib/java.exp
+++ /dev/null
@@ -1,123 +0,0 @@
-# This test code is part of GDB, the GNU debugger.
-
-# Copyright 1998-2016 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-load_lib "libgloss.exp"
-
-# GCJ_UNDER_TEST is the compiler under test.
-
-global tmpdir
-
-if ![info exists tmpdir] {
- set tmpdir "/tmp"
-}
-
-set java_initialized 0
-
-#
-# Build the status wrapper library as needed.
-#
-proc java_init { args } {
- global wrapper_file
- global wrap_compile_flags
- global java_initialized
- global GCJ_UNDER_TEST
- global TOOL_EXECUTABLE
- global env
-
- if { $java_initialized == 1 } { return; }
-
- if ![info exists GCJ_UNDER_TEST] {
- if [info exists TOOL_EXECUTABLE] {
- set GCJ_UNDER_TEST $TOOL_EXECUTABLE
- } else {
- if { [info exists env(GCJ)] && $env(GCJ) != "" } {
- set GCJ_UNDER_TEST $env(GCJ)
- } else {
- global tool_root_dir
- global target_alias
-
- if ![is_remote host] {
- set file [lookfor_file $tool_root_dir gcj]
- if { $file == "" } {
- set file [lookfor_file $tool_root_dir gcc/gcj]
- }
- if { $file != "" } {
- set CC "$file -B[file dirname $file]/ --specs=$tool_root_dir/$target_alias/libjava/libgcj-test.spec"
- } else {
- set CC [transform gcj]
- }
- } else {
- set CC [transform gcj]
- }
- set GCJ_UNDER_TEST $CC
- }
- }
- }
-
- set wrapper_file ""
- set wrap_compile_flags ""
- if [target_info exists needs_status_wrapper] {
- set result [build_wrapper "testglue.o"]
- if { $result != "" } {
- set wrapper_file [lindex $result 0]
- set wrap_compile_flags [lindex $result 1]
- } else {
- warning "Status wrapper failed to build."
- }
- }
-
- set java_initialized 1
-}
-
-#
-# Run the test specified by srcfile and resultfile. compile_args and
-# exec_args are options telling this proc how to work.
-#
-proc compile_java_from_source { srcfile binfile compile_args } {
- global GCJ_UNDER_TEST
- global java_initialized
-
- if { $java_initialized != 1 } { java_init }
-
- set args [list "compiler=$GCJ_UNDER_TEST"]
- lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
- if { $compile_args != "" } {
- lappend args "additional_flags=$compile_args"
- }
-
- set result [target_compile $srcfile ${binfile} executable $args]
- gdb_compile_test $srcfile $result
- return $result
-}
-
-# Auxiliary function to set the language to java.
-# The result is 1 (true) for success, 0 (false) for failure.
-
-proc set_lang_java {} {
- if [gdb_test_no_output "set language java"] {
- return 0
- }
- if [gdb_test "show language" ".* source language is \"java\"." \
- "set language to \"java\""] {
- return 0
- }
- return 1
-}
-
-# Local Variables:
-# tcl-indent-level:4
-# End:
diff --git a/gdb/utils.c b/gdb/utils.c
index 9a83053..71c0e00 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -3199,7 +3199,7 @@ producer_is_gcc (const char *producer, int *major, int *minor)
if (minor == NULL)
minor = &min;
- /* Skip any identifier after "GNU " - such as "C11" "C++" or "Java".
+ /* Skip any identifier after "GNU " - such as "C11" or "C++".
A full producer string might look like:
"GNU C 4.7.2"
"GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..."
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 23a4c12..a0f7391 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -77,8 +77,8 @@ struct value_print_options
/* If nonzero, print static fields. */
int static_field_print;
- /* If nonzero, print static fields for Pascal. FIXME: C++ and Java
- share one flag, why not Pascal too? */
+ /* If nonzero, print static fields for Pascal. FIXME: C++ has a
+ flag, why not share with Pascal too? */
int pascal_static_field_print;
/* If non-zero don't do Python pretty-printing. */
diff --git a/gdb/varobj.h b/gdb/varobj.h
index f750482..6b9a71f 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -228,7 +228,6 @@ struct lang_varobj_ops
extern const struct lang_varobj_ops c_varobj_ops;
extern const struct lang_varobj_ops cplus_varobj_ops;
-extern const struct lang_varobj_ops java_varobj_ops;
extern const struct lang_varobj_ops ada_varobj_ops;
#define default_varobj_ops c_varobj_ops