Remove Java support

This patch removes the Java support from gdb.  gcj has not seen much
development or use for years now, and was recently removed from GCC.
This patch changes gdb to follow; in the unlikely event that there are
still users using gcj, they can continue to use an older gdb to debug.
Or, they can debug in C++ mode.

Built and regtested on x86-64 Fedora 24.

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  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-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.
This commit is contained in:
Tom Tromey 2016-10-05 08:44:34 -06:00
parent 78b86327b5
commit 9c37b5aed9
47 changed files with 126 additions and 4808 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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, ")");

View File

@ -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

View File

@ -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 */

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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 \

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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
};

View File

@ -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"

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
if (linkage_name[len] != '\0')
{
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')
{
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

View File

@ -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. */

View File

@ -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.

View File

@ -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>

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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
}
}
}
}

View File

@ -1,7 +0,0 @@
public class jmain
{
public static void main (String[] args)
{
return;
}
}

View File

@ -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\.}
}

View File

@ -1,7 +0,0 @@
public class jmisc
{
public static void main (String[] args)
{
return;
}
}

View File

@ -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"

View File

@ -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
}
}

View File

@ -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
}
}
}

View File

@ -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);
}
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"

View File

@ -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 {} {

View File

@ -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:

View File

@ -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 ..."

View File

@ -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. */

View File

@ -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