gdb/jv-lang.c - gdb

Global variables defined

Data types defined

Functions defined

Source code

  1. /* Java language support routines for GDB, the GNU debugger.

  2.    Copyright (C) 1997-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #include "defs.h"
  15. #include "symtab.h"
  16. #include "gdbtypes.h"
  17. #include "expression.h"
  18. #include "parser-defs.h"
  19. #include "language.h"
  20. #include "symfile.h"
  21. #include "objfiles.h"
  22. #include "value.h"
  23. #include "c-lang.h"
  24. #include "jv-lang.h"
  25. #include "varobj.h"
  26. #include "gdbcore.h"
  27. #include "block.h"
  28. #include "demangle.h"
  29. #include "dictionary.h"
  30. #include <ctype.h>
  31. #include "charset.h"
  32. #include "valprint.h"
  33. #include "cp-support.h"

  34. /* Local functions */

  35. extern void _initialize_java_language (void);

  36. static int java_demangled_signature_length (const char *);
  37. static void java_demangled_signature_copy (char *, const char *);

  38. static struct compunit_symtab *get_java_class_symtab (struct gdbarch *gdbarch);
  39. static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
  40. static int java_class_is_primitive (struct value *clas);
  41. static struct value *java_value_string (char *ptr, int len);

  42. static void java_emit_char (int c, struct type *type,
  43.                             struct ui_file * stream, int quoter);

  44. static char *java_class_name_from_physname (const char *physname);

  45. static const struct objfile_data *jv_dynamics_objfile_data_key;

  46. /* The dynamic objfile is kept per-program-space.  This key lets us
  47.    associate the objfile with the program space.  */

  48. static const struct program_space_data *jv_dynamics_progspace_key;

  49. static struct type *java_link_class_type (struct gdbarch *,
  50.                                           struct type *, struct value *);

  51. /* An instance of this structure is used to store some data that must
  52.    be freed.  */

  53. struct jv_per_objfile_data
  54. {
  55.   /* The expandable dictionary we use.  */
  56.   struct dictionary *dict;
  57. };

  58. /* A function called when the dynamics_objfile is freed.  We use this
  59.    to clean up some internal state.  */
  60. static void
  61. jv_per_objfile_free (struct objfile *objfile, void *data)
  62. {
  63.   struct jv_per_objfile_data *jv_data = data;
  64.   struct objfile *dynamics_objfile;

  65.   dynamics_objfile = program_space_data (current_program_space,
  66.                                          jv_dynamics_progspace_key);
  67.   gdb_assert (objfile == dynamics_objfile);

  68.   if (jv_data->dict)
  69.     dict_free (jv_data->dict);
  70.   xfree (jv_data);

  71.   set_program_space_data (current_program_space,
  72.                           jv_dynamics_progspace_key,
  73.                           NULL);
  74. }

  75. /* FIXME: carlton/2003-02-04: This is the main or only caller of
  76.    allocate_objfile with first argument NULL; as a result, this code
  77.    breaks every so often.  Somebody should write a test case that
  78.    exercises GDB in various ways (e.g. something involving loading a
  79.    dynamic library) after this code has been called.  */

  80. static struct objfile *
  81. get_dynamics_objfile (struct gdbarch *gdbarch)
  82. {
  83.   struct objfile *dynamics_objfile;

  84.   dynamics_objfile = program_space_data (current_program_space,
  85.                                          jv_dynamics_progspace_key);

  86.   if (dynamics_objfile == NULL)
  87.     {
  88.       struct jv_per_objfile_data *data;

  89.       /* Mark it as shared so that it is cleared when the inferior is
  90.          re-run.  */
  91.       dynamics_objfile = allocate_objfile (NULL, NULL,
  92.                                            OBJF_SHARED | OBJF_NOT_FILENAME);
  93.       dynamics_objfile->per_bfd->gdbarch = gdbarch;

  94.       data = XCNEW (struct jv_per_objfile_data);
  95.       set_objfile_data (dynamics_objfile, jv_dynamics_objfile_data_key, data);

  96.       set_program_space_data (current_program_space,
  97.                               jv_dynamics_progspace_key,
  98.                               dynamics_objfile);
  99.     }
  100.   return dynamics_objfile;
  101. }

  102. static struct compunit_symtab *
  103. get_java_class_symtab (struct gdbarch *gdbarch)
  104. {
  105.   struct objfile *objfile = get_dynamics_objfile (gdbarch);
  106.   struct compunit_symtab *class_symtab = objfile->compunit_symtabs;

  107.   if (class_symtab == NULL)
  108.     {
  109.       struct blockvector *bv;
  110.       struct block *bl;
  111.       struct jv_per_objfile_data *jv_data;

  112.       class_symtab = allocate_compunit_symtab (objfile, "<java-classes>");
  113.       add_compunit_symtab_to_objfile (class_symtab);
  114.       allocate_symtab (class_symtab, "<java-classes>");

  115.       COMPUNIT_FILETABS (class_symtab)->language = language_java;
  116.       bv = (struct blockvector *)
  117.         obstack_alloc (&objfile->objfile_obstack,
  118.                        sizeof (struct blockvector) + sizeof (struct block *));
  119.       BLOCKVECTOR_NBLOCKS (bv) = 1;
  120.       COMPUNIT_BLOCKVECTOR (class_symtab) = bv;

  121.       /* Allocate dummy STATIC_BLOCK.  */
  122.       bl = allocate_block (&objfile->objfile_obstack);
  123.       BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack,
  124.                                             NULL);
  125.       BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl;

  126.       /* Allocate GLOBAL_BLOCK.  */
  127.       bl = allocate_global_block (&objfile->objfile_obstack);
  128.       BLOCK_DICT (bl) = dict_create_hashed_expandable ();
  129.       set_block_compunit_symtab (bl, class_symtab);
  130.       BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;

  131.       /* Arrange to free the dict.  */
  132.       jv_data = objfile_data (objfile, jv_dynamics_objfile_data_key);
  133.       jv_data->dict = BLOCK_DICT (bl);
  134.     }
  135.   return class_symtab;
  136. }

  137. static void
  138. add_class_symtab_symbol (struct symbol *sym)
  139. {
  140.   struct compunit_symtab *cust = get_java_class_symtab (symbol_arch (sym));
  141.   const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);

  142.   dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
  143. }

  144. static struct symbol *
  145. add_class_symbol (struct type *type, CORE_ADDR addr)
  146. {
  147.   struct symbol *sym;
  148.   struct objfile *objfile = get_dynamics_objfile (get_type_arch (type));

  149.   sym = allocate_symbol (objfile);
  150.   SYMBOL_SET_LANGUAGE (sym, language_java, &objfile->objfile_obstack);
  151.   SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
  152.   SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
  153.   /*  SYMBOL_VALUE (sym) = valu; */
  154.   SYMBOL_TYPE (sym) = type;
  155.   SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
  156.   SYMBOL_VALUE_ADDRESS (sym) = addr;
  157.   return sym;
  158. }

  159. struct type *
  160. java_lookup_class (char *name)
  161. {
  162.   struct symbol *sym;

  163.   sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN, NULL);
  164.   if (sym != NULL)
  165.     return SYMBOL_TYPE (sym);
  166.   /* FIXME - should search inferior's symbol table.  */
  167.   return NULL;
  168. }

  169. /* Return a nul-terminated string (allocated on OBSTACK) for
  170.    a name given by NAME (which has type Utf8Const*).  */

  171. char *
  172. get_java_utf8_name (struct obstack *obstack, struct value *name)
  173. {
  174.   char *chrs;
  175.   struct value *temp = name;
  176.   int name_length;
  177.   CORE_ADDR data_addr;

  178.   temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
  179.   name_length = (int) value_as_long (temp);
  180.   data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
  181.   chrs = obstack_alloc (obstack, name_length + 1);
  182.   chrs[name_length] = '\0';
  183.   read_memory (data_addr, (gdb_byte *) chrs, name_length);
  184.   return chrs;
  185. }

  186. struct value *
  187. java_class_from_object (struct value *obj_val)
  188. {
  189.   /* This is all rather inefficient, since the offsets of vtable and
  190.      class are fixed.  FIXME */
  191.   struct value *vtable_val;

  192.   if (TYPE_CODE (value_type (obj_val)) == TYPE_CODE_PTR
  193.       && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (obj_val))) == 0)
  194.     obj_val = value_at (get_java_object_type (),
  195.                         value_as_address (obj_val));

  196.   vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
  197.   return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
  198. }

  199. /* Check if CLASS_IS_PRIMITIVE(value of clas): */
  200. static int
  201. java_class_is_primitive (struct value *clas)
  202. {
  203.   struct value *vtable = value_struct_elt (&clas, NULL, "vtable",
  204.                                            NULL, "struct");
  205.   CORE_ADDR i = value_as_address (vtable);

  206.   return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
  207. }

  208. /* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type.  */

  209. struct type *
  210. type_from_class (struct gdbarch *gdbarch, struct value *clas)
  211. {
  212.   struct type *type;
  213.   char *name;
  214.   struct value *temp;
  215.   struct objfile *objfile;
  216.   struct value *utf8_name;
  217.   char *nptr;
  218.   CORE_ADDR addr;

  219.   type = check_typedef (value_type (clas));
  220.   if (TYPE_CODE (type) == TYPE_CODE_PTR)
  221.     {
  222.       if (value_logical_not (clas))
  223.         return NULL;
  224.       clas = value_ind (clas);
  225.     }
  226.   addr = value_address (clas);

  227.   objfile = get_dynamics_objfile (gdbarch);
  228.   if (java_class_is_primitive (clas))
  229.     {
  230.       struct value *sig;

  231.       temp = clas;
  232.       sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
  233.       return java_primitive_type (gdbarch, value_as_long (sig));
  234.     }

  235.   /* Get Class name.  */
  236.   /* If clasloader non-null, prepend loader addressFIXME */
  237.   temp = clas;
  238.   utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure");
  239.   name = get_java_utf8_name (&objfile->objfile_obstack, utf8_name);
  240.   for (nptr = name; *nptr != 0; nptr++)
  241.     {
  242.       if (*nptr == '/')
  243.         *nptr = '.';
  244.     }

  245.   type = java_lookup_class (name);
  246.   if (type != NULL)
  247.     return type;

  248.   type = alloc_type (objfile);
  249.   TYPE_CODE (type) = TYPE_CODE_STRUCT;
  250.   INIT_CPLUS_SPECIFIC (type);

  251.   if (name[0] == '[')
  252.     {
  253.       char *signature = name;
  254.       int namelen = java_demangled_signature_length (signature);

  255.       if (namelen > strlen (name))
  256.         name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
  257.       java_demangled_signature_copy (name, signature);
  258.       name[namelen] = '\0';
  259.       temp = clas;
  260.       /* Set array element type.  */
  261.       temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure");
  262.       deprecated_set_value_type (temp,
  263.                                  lookup_pointer_type (value_type (clas)));
  264.       TYPE_TARGET_TYPE (type) = type_from_class (gdbarch, temp);
  265.     }

  266.   ALLOCATE_CPLUS_STRUCT_TYPE (type);
  267.   TYPE_TAG_NAME (type) = name;

  268.   add_class_symtab_symbol (add_class_symbol (type, addr));
  269.   return java_link_class_type (gdbarch, type, clas);
  270. }

  271. /* Fill in class TYPE with data from the CLAS value.  */

  272. static struct type *
  273. java_link_class_type (struct gdbarch *gdbarch,
  274.                       struct type *type, struct value *clas)
  275. {
  276.   struct value *temp;
  277.   const char *unqualified_name;
  278.   const char *name = TYPE_TAG_NAME (type);
  279.   int ninterfaces, nfields, nmethods;
  280.   int type_is_object = 0;
  281.   struct fn_field *fn_fields;
  282.   struct fn_fieldlist *fn_fieldlists;
  283.   struct value *fields;
  284.   struct value *methods;
  285.   struct value *method = NULL;
  286.   struct value *field = NULL;
  287.   int i, j;
  288.   struct objfile *objfile = get_dynamics_objfile (gdbarch);
  289.   struct type *tsuper;

  290.   gdb_assert (name != NULL);
  291.   unqualified_name = strrchr (name, '.');
  292.   if (unqualified_name == NULL)
  293.     unqualified_name = name;

  294.   temp = clas;
  295.   temp = value_struct_elt (&temp, NULL, "superclass", NULL, "structure");
  296.   if (strcmp (name, "java.lang.Object") == 0)
  297.     {
  298.       tsuper = get_java_object_type ();
  299.       if (tsuper && TYPE_CODE (tsuper) == TYPE_CODE_PTR)
  300.         tsuper = TYPE_TARGET_TYPE (tsuper);
  301.       type_is_object = 1;
  302.     }
  303.   else
  304.     tsuper = type_from_class (gdbarch, temp);

  305. #if 1
  306.   ninterfaces = 0;
  307. #else
  308.   temp = clas;
  309.   ninterfaces = value_as_long (value_struct_elt (&temp, NULL, "interface_len",
  310.                                                  NULL, "structure"));
  311. #endif
  312.   TYPE_N_BASECLASSES (type) = (tsuper == NULL ? 0 : 1) + ninterfaces;
  313.   temp = clas;
  314.   nfields = value_as_long (value_struct_elt (&temp, NULL, "field_count",
  315.                                              NULL, "structure"));
  316.   nfields += TYPE_N_BASECLASSES (type);
  317.   nfields++;                        /* Add one for dummy "class" field.  */
  318.   TYPE_NFIELDS (type) = nfields;
  319.   TYPE_FIELDS (type) = (struct field *)
  320.     TYPE_ALLOC (type, sizeof (struct field) * nfields);

  321.   memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);

  322.   TYPE_FIELD_PRIVATE_BITS (type) =
  323.     (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
  324.   B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields);

  325.   TYPE_FIELD_PROTECTED_BITS (type) =
  326.     (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
  327.   B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields);

  328.   TYPE_FIELD_IGNORE_BITS (type) =
  329.     (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
  330.   B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields);

  331.   TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *)
  332.     TYPE_ALLOC (type, B_BYTES (TYPE_N_BASECLASSES (type)));
  333.   B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type));

  334.   if (tsuper != NULL)
  335.     {
  336.       TYPE_BASECLASS (type, 0) = tsuper;
  337.       if (type_is_object)
  338.         SET_TYPE_FIELD_PRIVATE (type, 0);
  339.     }

  340.   i = strlen (name);
  341.   if (i > 2 && name[i - 1] == ']' && tsuper != NULL)
  342.     {
  343.       /* FIXME */
  344.       TYPE_LENGTH (type) = TYPE_LENGTH (tsuper) + 4;   /* size with "length" */
  345.     }
  346.   else
  347.     {
  348.       temp = clas;
  349.       temp = value_struct_elt (&temp, NULL, "size_in_bytes",
  350.                                NULL, "structure");
  351.       TYPE_LENGTH (type) = value_as_long (temp);
  352.     }

  353.   fields = NULL;
  354.   nfields--;                        /* First set up dummy "class" field.  */
  355.   SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
  356.   TYPE_FIELD_NAME (type, nfields) = "class";
  357.   TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
  358.   SET_TYPE_FIELD_PRIVATE (type, nfields);

  359.   for (i = TYPE_N_BASECLASSES (type); i < nfields; i++)
  360.     {
  361.       int accflags;
  362.       int boffset;

  363.       if (fields == NULL)
  364.         {
  365.           temp = clas;
  366.           fields = value_struct_elt (&temp, NULL, "fields", NULL, "structure");
  367.           field = value_ind (fields);
  368.         }
  369.       else
  370.         {                        /* Re-use field value for next field.  */
  371.           CORE_ADDR addr
  372.             = value_address (field) + TYPE_LENGTH (value_type (field));

  373.           set_value_address (field, addr);
  374.           set_value_lazy (field, 1);
  375.         }
  376.       temp = field;
  377.       temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
  378.       TYPE_FIELD_NAME (type, i) =
  379.         get_java_utf8_name (&objfile->objfile_obstack, temp);
  380.       temp = field;
  381.       accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags",
  382.                                                   NULL, "structure"));
  383.       temp = field;
  384.       temp = value_struct_elt (&temp, NULL, "info", NULL, "structure");
  385.       boffset = value_as_long (value_struct_elt (&temp, NULL, "boffset",
  386.                                                  NULL, "structure"));
  387.       if (accflags & 0x0001)        /* public access */
  388.         {
  389.           /* ??? */
  390.         }
  391.       if (accflags & 0x0002)        /* private access */
  392.         {
  393.           SET_TYPE_FIELD_PRIVATE (type, i);
  394.         }
  395.       if (accflags & 0x0004)        /* protected access */
  396.         {
  397.           SET_TYPE_FIELD_PROTECTED (type, i);
  398.         }
  399.       if (accflags & 0x0008)        /* ACC_STATIC */
  400.         SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
  401.       else
  402.         SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
  403.       if (accflags & 0x8000)        /* FIELD_UNRESOLVED_FLAG */
  404.         {
  405.           TYPE_FIELD_TYPE (type, i) = get_java_object_type ();        /* FIXME */
  406.         }
  407.       else
  408.         {
  409.           struct type *ftype;

  410.           temp = field;
  411.           temp = value_struct_elt (&temp, NULL, "type", NULL, "structure");
  412.           ftype = type_from_class (gdbarch, temp);
  413.           if (TYPE_CODE (ftype) == TYPE_CODE_STRUCT)
  414.             ftype = lookup_pointer_type (ftype);
  415.           TYPE_FIELD_TYPE (type, i) = ftype;
  416.         }
  417.     }

  418.   temp = clas;
  419.   nmethods = value_as_long (value_struct_elt (&temp, NULL, "method_count",
  420.                                               NULL, "structure"));
  421.   j = nmethods * sizeof (struct fn_field);
  422.   fn_fields = (struct fn_field *)
  423.     obstack_alloc (&objfile->objfile_obstack, j);
  424.   memset (fn_fields, 0, j);
  425.   fn_fieldlists = (struct fn_fieldlist *)
  426.     alloca (nmethods * sizeof (struct fn_fieldlist));

  427.   methods = NULL;
  428.   for (i = 0; i < nmethods; i++)
  429.     {
  430.       const char *mname;
  431.       int k;

  432.       if (methods == NULL)
  433.         {
  434.           temp = clas;
  435.           methods = value_struct_elt (&temp, NULL, "methods",
  436.                                       NULL, "structure");
  437.           method = value_ind (methods);
  438.         }
  439.       else
  440.         {                        /* Re-use method value for next method.  */
  441.           CORE_ADDR addr
  442.             = value_address (method) + TYPE_LENGTH (value_type (method));

  443.           set_value_address (method, addr);
  444.           set_value_lazy (method, 1);
  445.         }

  446.       /* Get method name.  */
  447.       temp = method;
  448.       temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
  449.       mname = get_java_utf8_name (&objfile->objfile_obstack, temp);
  450.       if (strcmp (mname, "<init>") == 0)
  451.         mname = unqualified_name;

  452.       /* Check for an existing method with the same name.
  453.        * This makes building the fn_fieldslists an O(nmethods**2)
  454.        * operation.  That could be using hashing, but I doubt it
  455.        * is worth it.  Note that we do maintain the order of methods
  456.        * in the inferior's Method table (as long as that is grouped
  457.        * by method name), which I think is desirable.  --PB */
  458.       for (k = 0, j = TYPE_NFN_FIELDS (type);;)
  459.         {
  460.           if (--j < 0)
  461.             {                        /* No match - new method name.  */
  462.               j = TYPE_NFN_FIELDS (type)++;
  463.               fn_fieldlists[j].name = mname;
  464.               fn_fieldlists[j].length = 1;
  465.               fn_fieldlists[j].fn_fields = &fn_fields[i];
  466.               k = i;
  467.               break;
  468.             }
  469.           if (strcmp (mname, fn_fieldlists[j].name) == 0)
  470.             {                /* Found an existing method with the same name.  */
  471.               int l;

  472.               if (mname != unqualified_name)
  473.                 obstack_free (&objfile->objfile_obstack, mname);
  474.               mname = fn_fieldlists[j].name;
  475.               fn_fieldlists[j].length++;
  476.               k = i - k;        /* Index of new slot.  */
  477.               /* Shift intervening fn_fields (between k and i) down.  */
  478.               for (l = i; l > k; l--)
  479.                 fn_fields[l] = fn_fields[l - 1];
  480.               for (l = TYPE_NFN_FIELDS (type); --l > j;)
  481.                 fn_fieldlists[l].fn_fields++;
  482.               break;
  483.             }
  484.           k += fn_fieldlists[j].length;
  485.         }
  486.       fn_fields[k].physname = "";
  487.       fn_fields[k].is_stub = 1;
  488.       /* FIXME */
  489.       fn_fields[k].type = lookup_function_type
  490.                            (builtin_java_type (gdbarch)->builtin_void);
  491.       TYPE_CODE (fn_fields[k].type) = TYPE_CODE_METHOD;
  492.     }

  493.   j = TYPE_NFN_FIELDS (type) * sizeof (struct fn_fieldlist);
  494.   TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
  495.     obstack_alloc (&objfile->objfile_obstack, j);
  496.   memcpy (TYPE_FN_FIELDLISTS (type), fn_fieldlists, j);

  497.   return type;
  498. }

  499. struct type *
  500. get_java_object_type (void)
  501. {
  502.   struct symbol *sym;

  503.   sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN, NULL);
  504.   if (sym == NULL)
  505.     error (_("cannot find java.lang.Object"));
  506.   return SYMBOL_TYPE (sym);
  507. }

  508. int
  509. get_java_object_header_size (struct gdbarch *gdbarch)
  510. {
  511.   struct type *objtype = get_java_object_type ();

  512.   if (objtype == NULL)
  513.     return (2 * gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
  514.   else
  515.     return TYPE_LENGTH (objtype);
  516. }

  517. int
  518. is_object_type (struct type *type)
  519. {
  520.   CHECK_TYPEDEF (type);
  521.   if (TYPE_CODE (type) == TYPE_CODE_PTR)
  522.     {
  523.       struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type));
  524.       const char *name;
  525.       if (TYPE_CODE (ttype) != TYPE_CODE_STRUCT)
  526.         return 0;
  527.       while (TYPE_N_BASECLASSES (ttype) > 0)
  528.         ttype = TYPE_BASECLASS (ttype, 0);
  529.       name = TYPE_TAG_NAME (ttype);
  530.       if (name != NULL && strcmp (name, "java.lang.Object") == 0)
  531.         return 1;
  532.       name
  533.         = TYPE_NFIELDS (ttype) > 0 ? TYPE_FIELD_NAME (ttype, 0) : (char *) 0;
  534.       if (name != NULL && strcmp (name, "vtable") == 0)
  535.         return 1;
  536.     }
  537.   return 0;
  538. }

  539. struct type *
  540. java_primitive_type (struct gdbarch *gdbarch, int signature)
  541. {
  542.   const struct builtin_java_type *builtin = builtin_java_type (gdbarch);

  543.   switch (signature)
  544.     {
  545.     case 'B':
  546.       return builtin->builtin_byte;
  547.     case 'S':
  548.       return builtin->builtin_short;
  549.     case 'I':
  550.       return builtin->builtin_int;
  551.     case 'J':
  552.       return builtin->builtin_long;
  553.     case 'Z':
  554.       return builtin->builtin_boolean;
  555.     case 'C':
  556.       return builtin->builtin_char;
  557.     case 'F':
  558.       return builtin->builtin_float;
  559.     case 'D':
  560.       return builtin->builtin_double;
  561.     case 'V':
  562.       return builtin->builtin_void;
  563.     }
  564.   error (_("unknown signature '%c' for primitive type"), (char) signature);
  565. }

  566. /* If name[0 .. namelen-1] is the name of a primitive Java type,
  567.    return that type.  Otherwise, return NULL.  */

  568. struct type *
  569. java_primitive_type_from_name (struct gdbarch *gdbarch,
  570.                                const char *name, int namelen)
  571. {
  572.   const struct builtin_java_type *builtin = builtin_java_type (gdbarch);

  573.   switch (name[0])
  574.     {
  575.     case 'b':
  576.       if (namelen == 4 && memcmp (name, "byte", 4) == 0)
  577.         return builtin->builtin_byte;
  578.       if (namelen == 7 && memcmp (name, "boolean", 7) == 0)
  579.         return builtin->builtin_boolean;
  580.       break;
  581.     case 'c':
  582.       if (namelen == 4 && memcmp (name, "char", 4) == 0)
  583.         return builtin->builtin_char;
  584.       break;
  585.     case 'd':
  586.       if (namelen == 6 && memcmp (name, "double", 6) == 0)
  587.         return builtin->builtin_double;
  588.       break;
  589.     case 'f':
  590.       if (namelen == 5 && memcmp (name, "float", 5) == 0)
  591.         return builtin->builtin_float;
  592.       break;
  593.     case 'i':
  594.       if (namelen == 3 && memcmp (name, "int", 3) == 0)
  595.         return builtin->builtin_int;
  596.       break;
  597.     case 'l':
  598.       if (namelen == 4 && memcmp (name, "long", 4) == 0)
  599.         return builtin->builtin_long;
  600.       break;
  601.     case 's':
  602.       if (namelen == 5 && memcmp (name, "short", 5) == 0)
  603.         return builtin->builtin_short;
  604.       break;
  605.     case 'v':
  606.       if (namelen == 4 && memcmp (name, "void", 4) == 0)
  607.         return builtin->builtin_void;
  608.       break;
  609.     }
  610.   return NULL;
  611. }

  612. static char *
  613. java_primitive_type_name (int signature)
  614. {
  615.   switch (signature)
  616.     {
  617.     case 'B':
  618.       return "byte";
  619.     case 'S':
  620.       return "short";
  621.     case 'I':
  622.       return "int";
  623.     case 'J':
  624.       return "long";
  625.     case 'Z':
  626.       return "boolean";
  627.     case 'C':
  628.       return "char";
  629.     case 'F':
  630.       return "float";
  631.     case 'D':
  632.       return "double";
  633.     case 'V':
  634.       return "void";
  635.     }
  636.   error (_("unknown signature '%c' for primitive type"), (char) signature);
  637. }

  638. /* Return the length (in bytes) of demangled name of the Java type
  639.    signature string SIGNATURE.  */

  640. static int
  641. java_demangled_signature_length (const char *signature)
  642. {
  643.   int array = 0;

  644.   for (; *signature == '['; signature++)
  645.     array += 2;                        /* Two chars for "[]".  */
  646.   switch (signature[0])
  647.     {
  648.     case 'L':
  649.       /* Subtract 2 for 'L' and ';'.  */
  650.       return strlen (signature) - 2 + array;
  651.     default:
  652.       return strlen (java_primitive_type_name (signature[0])) + array;
  653.     }
  654. }

  655. /* Demangle the Java type signature SIGNATURE, leaving the result in
  656.    RESULT.  */

  657. static void
  658. java_demangled_signature_copy (char *result, const char *signature)
  659. {
  660.   int array = 0;
  661.   char *ptr;
  662.   int i;

  663.   while (*signature == '[')
  664.     {
  665.       array++;
  666.       signature++;
  667.     }
  668.   switch (signature[0])
  669.     {
  670.     case 'L':
  671.       /* Subtract 2 for 'L' and ';', but add 1 for final nul.  */
  672.       signature++;
  673.       ptr = result;
  674.       for (; *signature != ';' && *signature != '\0'; signature++)
  675.         {
  676.           if (*signature == '/')
  677.             *ptr++ = '.';
  678.           else
  679.             *ptr++ = *signature;
  680.         }
  681.       break;
  682.     default:
  683.       ptr = java_primitive_type_name (signature[0]);
  684.       i = strlen (ptr);
  685.       strcpy (result, ptr);
  686.       ptr = result + i;
  687.       break;
  688.     }
  689.   while (--array >= 0)
  690.     {
  691.       *ptr++ = '[';
  692.       *ptr++ = ']';
  693.     }
  694. }

  695. /* Return the demangled name of the Java type signature string SIGNATURE,
  696.    as a freshly allocated copy.  */

  697. char *
  698. java_demangle_type_signature (const char *signature)
  699. {
  700.   int length = java_demangled_signature_length (signature);
  701.   char *result = xmalloc (length + 1);

  702.   java_demangled_signature_copy (result, signature);
  703.   result[length] = '\0';
  704.   return result;
  705. }

  706. /* Return the type of TYPE followed by DIMS pairs of [ ].
  707.    If DIMS == 0, TYPE is returned.  */

  708. struct type *
  709. java_array_type (struct type *type, int dims)
  710. {
  711.   while (dims-- > 0)
  712.     {
  713.       /* FIXME  This is bogus!  Java arrays are not gdb arrays!  */
  714.       type = lookup_array_range_type (type, 0, 0);
  715.     }

  716.   return type;
  717. }

  718. /* Create a Java string in the inferior from a (Utf8) literal.  */

  719. static struct value *
  720. java_value_string (char *ptr, int len)
  721. {
  722.   error (_("not implemented - java_value_string"));        /* FIXME */
  723. }

  724. /* Return the encoding that should be used for the character type
  725.    TYPE.  */

  726. static const char *
  727. java_get_encoding (struct type *type)
  728. {
  729.   struct gdbarch *arch = get_type_arch (type);
  730.   const char *encoding;

  731.   if (type == builtin_java_type (arch)->builtin_char)
  732.     {
  733.       if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
  734.         encoding = "UTF-16BE";
  735.       else
  736.         encoding = "UTF-16LE";
  737.     }
  738.   else
  739.     encoding = target_charset (arch);

  740.   return encoding;
  741. }

  742. /* Print the character C on STREAM as part of the contents of a literal
  743.    string whose delimiter is QUOTER.  Note that that format for printing
  744.    characters and strings is language specific.  */

  745. static void
  746. java_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
  747. {
  748.   const char *encoding = java_get_encoding (type);

  749.   generic_emit_char (c, type, stream, quoter, encoding);
  750. }

  751. /* Implementation of la_printchar method.  */

  752. static void
  753. java_printchar (int c, struct type *type, struct ui_file *stream)
  754. {
  755.   fputs_filtered ("'", stream);
  756.   LA_EMIT_CHAR (c, type, stream, '\'');
  757.   fputs_filtered ("'", stream);
  758. }

  759. /* Implementation of la_printstr method.  */

  760. static void
  761. java_printstr (struct ui_file *stream, struct type *type,
  762.                const gdb_byte *string,
  763.                unsigned int length, const char *encoding, int force_ellipses,
  764.                const struct value_print_options *options)
  765. {
  766.   const char *type_encoding = java_get_encoding (type);

  767.   if (!encoding || !*encoding)
  768.     encoding = type_encoding;

  769.   generic_printstr (stream, type, string, length, encoding,
  770.                     force_ellipses, '"', 0, options);
  771. }

  772. static struct value *
  773. evaluate_subexp_java (struct type *expect_type, struct expression *exp,
  774.                       int *pos, enum noside noside)
  775. {
  776.   int pc = *pos;
  777.   int i;
  778.   const char *name;
  779.   enum exp_opcode op = exp->elts[*pos].opcode;
  780.   struct value *arg1;
  781.   struct value *arg2;
  782.   struct type *type;

  783.   switch (op)
  784.     {
  785.     case UNOP_IND:
  786.       if (noside == EVAL_SKIP)
  787.         goto standard;
  788.       (*pos)++;
  789.       arg1 = evaluate_subexp_java (NULL_TYPE, exp, pos, EVAL_NORMAL);
  790.       if (is_object_type (value_type (arg1)))
  791.         {
  792.           struct type *type;

  793.           type = type_from_class (exp->gdbarch, java_class_from_object (arg1));
  794.           arg1 = value_cast (lookup_pointer_type (type), arg1);
  795.         }
  796.       return value_ind (arg1);

  797.     case BINOP_SUBSCRIPT:
  798.       (*pos)++;
  799.       arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
  800.       arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
  801.       if (noside == EVAL_SKIP)
  802.         goto nosideret;
  803.       /* If the user attempts to subscript something that is not an
  804.          array or pointer type (like a plain int variable for example),
  805.          then report this as an error.  */

  806.       arg1 = coerce_ref (arg1);
  807.       type = check_typedef (value_type (arg1));
  808.       if (TYPE_CODE (type) == TYPE_CODE_PTR)
  809.         type = check_typedef (TYPE_TARGET_TYPE (type));
  810.       name = TYPE_NAME (type);
  811.       if (name == NULL)
  812.         name = TYPE_TAG_NAME (type);
  813.       i = name == NULL ? 0 : strlen (name);
  814.       if (TYPE_CODE (type) == TYPE_CODE_STRUCT
  815.           && i > 2 && name[i - 1] == ']')
  816.         {
  817.           enum bfd_endian byte_order = gdbarch_byte_order (exp->gdbarch);
  818.           CORE_ADDR address;
  819.           long length, index;
  820.           struct type *el_type;
  821.           gdb_byte buf4[4];

  822.           struct value *clas = java_class_from_object (arg1);
  823.           struct value *temp = clas;
  824.           /* Get CLASS_ELEMENT_TYPE of the array type.  */
  825.           temp = value_struct_elt (&temp, NULL, "methods",
  826.                                    NULL, "structure");
  827.           deprecated_set_value_type (temp, value_type (clas));
  828.           el_type = type_from_class (exp->gdbarch, temp);
  829.           if (TYPE_CODE (el_type) == TYPE_CODE_STRUCT)
  830.             el_type = lookup_pointer_type (el_type);

  831.           if (noside == EVAL_AVOID_SIDE_EFFECTS)
  832.             return value_zero (el_type, VALUE_LVAL (arg1));
  833.           address = value_as_address (arg1);
  834.           address += get_java_object_header_size (exp->gdbarch);
  835.           read_memory (address, buf4, 4);
  836.           length = (long) extract_signed_integer (buf4, 4, byte_order);
  837.           index = (long) value_as_long (arg2);
  838.           if (index >= length || index < 0)
  839.             error (_("array index (%ld) out of bounds (length: %ld)"),
  840.                    index, length);
  841.           address = (address + 4) + index * TYPE_LENGTH (el_type);
  842.           return value_at (el_type, address);
  843.         }
  844.       else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
  845.         {
  846.           if (noside == EVAL_AVOID_SIDE_EFFECTS)
  847.             return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
  848.           else
  849.             return value_subscript (arg1, value_as_long (arg2));
  850.         }
  851.       if (name)
  852.         error (_("cannot subscript something of type `%s'"), name);
  853.       else
  854.         error (_("cannot subscript requested type"));

  855.     case OP_STRING:
  856.       (*pos)++;
  857.       i = longest_to_int (exp->elts[pc + 1].longconst);
  858.       (*pos) += 3 + BYTES_TO_EXP_ELEM (i + 1);
  859.       if (noside == EVAL_SKIP)
  860.         goto nosideret;
  861.       return java_value_string (&exp->elts[pc + 2].string, i);

  862.     case STRUCTOP_PTR:
  863.       arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
  864.       /* Convert object field (such as TYPE.class) to reference.  */
  865.       if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT)
  866.         arg1 = value_addr (arg1);
  867.       return arg1;
  868.     default:
  869.       break;
  870.     }
  871. standard:
  872.   return evaluate_subexp_standard (expect_type, exp, pos, noside);
  873. nosideret:
  874.   return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
  875. }

  876. static char *java_demangle (const char *mangled, int options)
  877. {
  878.   return gdb_demangle (mangled, options | DMGL_JAVA);
  879. }

  880. /* Find the member function name of the demangled name NAMENAME
  881.    must be a method name including arguments, in order to correctly
  882.    locate the last component.

  883.    This function return a pointer to the first dot before the
  884.    member function name, or NULL if the name was not of the
  885.    expected form.  */

  886. static const char *
  887. java_find_last_component (const char *name)
  888. {
  889.   const char *p;

  890.   /* Find argument list.  */
  891.   p = strchr (name, '(');

  892.   if (p == NULL)
  893.     return NULL;

  894.   /* Back up and find first dot prior to argument list.  */
  895.   while (p > name && *p != '.')
  896.     p--;

  897.   if (p == name)
  898.     return NULL;

  899.   return p;
  900. }

  901. /* Return the name of the class containing method PHYSNAME.  */

  902. static char *
  903. java_class_name_from_physname (const char *physname)
  904. {
  905.   char *ret = NULL;
  906.   const char *end;
  907.   char *demangled_name = java_demangle (physname, DMGL_PARAMS | DMGL_ANSI);

  908.   if (demangled_name == NULL)
  909.     return NULL;

  910.   end = java_find_last_component (demangled_name);
  911.   if (end != NULL)
  912.     {
  913.       ret = xmalloc (end - demangled_name + 1);
  914.       memcpy (ret, demangled_name, end - demangled_name);
  915.       ret[end - demangled_name] = '\0';
  916.     }

  917.   xfree (demangled_name);
  918.   return ret;
  919. }

  920. /* Table mapping opcodes into strings for printing operators
  921.    and precedences of the operators.  */

  922. const struct op_print java_op_print_tab[] =
  923. {
  924.   {",", BINOP_COMMA, PREC_COMMA, 0},
  925.   {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
  926.   {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
  927.   {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
  928.   {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
  929.   {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
  930.   {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
  931.   {"==", BINOP_EQUAL, PREC_EQUAL, 0},
  932.   {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
  933.   {"<=", BINOP_LEQ, PREC_ORDER, 0},
  934.   {">=", BINOP_GEQ, PREC_ORDER, 0},
  935.   {">", BINOP_GTR, PREC_ORDER, 0},
  936.   {"<", BINOP_LESS, PREC_ORDER, 0},
  937.   {">>", BINOP_RSH, PREC_SHIFT, 0},
  938.   {"<<", BINOP_LSH, PREC_SHIFT, 0},
  939.   {"+", BINOP_ADD, PREC_ADD, 0},
  940.   {"-", BINOP_SUB, PREC_ADD, 0},
  941.   {"*", BINOP_MUL, PREC_MUL, 0},
  942.   {"/", BINOP_DIV, PREC_MUL, 0},
  943.   {"%", BINOP_REM, PREC_MUL, 0},
  944.   {"-", UNOP_NEG, PREC_PREFIX, 0},
  945.   {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
  946.   {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
  947.   {"*", UNOP_IND, PREC_PREFIX, 0},
  948.   {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
  949.   {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
  950.   {NULL, 0, 0, 0}
  951. };

  952. enum java_primitive_types
  953. {
  954.   java_primitive_type_int,
  955.   java_primitive_type_short,
  956.   java_primitive_type_long,
  957.   java_primitive_type_byte,
  958.   java_primitive_type_boolean,
  959.   java_primitive_type_char,
  960.   java_primitive_type_float,
  961.   java_primitive_type_double,
  962.   java_primitive_type_void,
  963.   nr_java_primitive_types
  964. };

  965. static void
  966. java_language_arch_info (struct gdbarch *gdbarch,
  967.                          struct language_arch_info *lai)
  968. {
  969.   const struct builtin_java_type *builtin = builtin_java_type (gdbarch);

  970.   lai->string_char_type = builtin->builtin_char;
  971.   lai->primitive_type_vector
  972.     = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_java_primitive_types + 1,
  973.                               struct type *);
  974.   lai->primitive_type_vector [java_primitive_type_int]
  975.     = builtin->builtin_int;
  976.   lai->primitive_type_vector [java_primitive_type_short]
  977.     = builtin->builtin_short;
  978.   lai->primitive_type_vector [java_primitive_type_long]
  979.     = builtin->builtin_long;
  980.   lai->primitive_type_vector [java_primitive_type_byte]
  981.     = builtin->builtin_byte;
  982.   lai->primitive_type_vector [java_primitive_type_boolean]
  983.     = builtin->builtin_boolean;
  984.   lai->primitive_type_vector [java_primitive_type_char]
  985.     = builtin->builtin_char;
  986.   lai->primitive_type_vector [java_primitive_type_float]
  987.     = builtin->builtin_float;
  988.   lai->primitive_type_vector [java_primitive_type_double]
  989.     = builtin->builtin_double;
  990.   lai->primitive_type_vector [java_primitive_type_void]
  991.     = builtin->builtin_void;

  992.   lai->bool_type_symbol = "boolean";
  993.   lai->bool_type_default = builtin->builtin_boolean;
  994. }

  995. const struct exp_descriptor exp_descriptor_java =
  996. {
  997.   print_subexp_standard,
  998.   operator_length_standard,
  999.   operator_check_standard,
  1000.   op_name_standard,
  1001.   dump_subexp_body_standard,
  1002.   evaluate_subexp_java
  1003. };

  1004. const struct language_defn java_language_defn =
  1005. {
  1006.   "java",                        /* Language name */
  1007.   "Java",
  1008.   language_java,
  1009.   range_check_off,
  1010.   case_sensitive_on,
  1011.   array_row_major,
  1012.   macro_expansion_no,
  1013.   &exp_descriptor_java,
  1014.   java_parse,
  1015.   java_error,
  1016.   null_post_parser,
  1017.   java_printchar,                /* Print a character constant */
  1018.   java_printstr,                /* Function to print string constant */
  1019.   java_emit_char,                /* Function to print a single character */
  1020.   java_print_type,                /* Print a type using appropriate syntax */
  1021.   default_print_typedef,        /* Print a typedef using appropriate syntax */
  1022.   java_val_print,                /* Print a value using appropriate syntax */
  1023.   java_value_print,                /* Print a top-level value */
  1024.   default_read_var_value,        /* la_read_var_value */
  1025.   NULL,                                /* Language specific skip_trampoline */
  1026.   "this",                        /* name_of_this */
  1027.   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
  1028.   basic_lookup_transparent_type,/* lookup_transparent_type */
  1029.   java_demangle,                /* Language specific symbol demangler */
  1030.   java_class_name_from_physname,/* Language specific class name */
  1031.   java_op_print_tab,                /* expression operators for printing */
  1032.   0,                                /* not c-style arrays */
  1033.   0,                                /* String lower bound */
  1034.   default_word_break_characters,
  1035.   default_make_symbol_completion_list,
  1036.   java_language_arch_info,
  1037.   default_print_array_index,
  1038.   default_pass_by_reference,
  1039.   default_get_string,
  1040.   NULL,                                /* la_get_symbol_name_cmp */
  1041.   iterate_over_symbols,
  1042.   &java_varobj_ops,
  1043.   NULL,
  1044.   NULL,
  1045.   LANG_MAGIC
  1046. };

  1047. static void *
  1048. build_java_types (struct gdbarch *gdbarch)
  1049. {
  1050.   struct builtin_java_type *builtin_java_type
  1051.     = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_java_type);

  1052.   builtin_java_type->builtin_int
  1053.     = arch_integer_type (gdbarch, 32, 0, "int");
  1054.   builtin_java_type->builtin_short
  1055.     = arch_integer_type (gdbarch, 16, 0, "short");
  1056.   builtin_java_type->builtin_long
  1057.     = arch_integer_type (gdbarch, 64, 0, "long");
  1058.   builtin_java_type->builtin_byte
  1059.     = arch_integer_type (gdbarch, 8, 0, "byte");
  1060.   builtin_java_type->builtin_boolean
  1061.     = arch_boolean_type (gdbarch, 8, 0, "boolean");
  1062.   builtin_java_type->builtin_char
  1063.     = arch_character_type (gdbarch, 16, 1, "char");
  1064.   builtin_java_type->builtin_float
  1065.     = arch_float_type (gdbarch, 32, "float", NULL);
  1066.   builtin_java_type->builtin_double
  1067.     = arch_float_type (gdbarch, 64, "double", NULL);
  1068.   builtin_java_type->builtin_void
  1069.     = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");

  1070.   return builtin_java_type;
  1071. }

  1072. static struct gdbarch_data *java_type_data;

  1073. const struct builtin_java_type *
  1074. builtin_java_type (struct gdbarch *gdbarch)
  1075. {
  1076.   return gdbarch_data (gdbarch, java_type_data);
  1077. }

  1078. void
  1079. _initialize_java_language (void)
  1080. {
  1081.   jv_dynamics_objfile_data_key
  1082.     = register_objfile_data_with_cleanup (NULL, jv_per_objfile_free);
  1083.   jv_dynamics_progspace_key = register_program_space_data ();

  1084.   java_type_data = gdbarch_data_register_post_init (build_java_types);

  1085.   add_language (&java_language_defn);
  1086. }