]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/jv-lang.c
Switch the license of all .c files to GPLv3.
[thirdparty/binutils-gdb.git] / gdb / jv-lang.c
index c6700c9241568e6e1167d39f1e0b0e5edb9db930..3460184a3682442d27b422bc44b3780c57c003f2 100644 (file)
@@ -1,13 +1,13 @@
 /* Java language support routines for GDB, the GNU debugger.
 
-   Copyright 1997, 1998, 1999, 2000, 2003, 2004, 2005 Free Software
-   Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2007
+   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 2 of the License, or
+   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,
@@ -16,9 +16,7 @@
    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, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -39,6 +37,7 @@
 #include "demangle.h"
 #include "dictionary.h"
 #include <ctype.h>
+#include "gdb_assert.h"
 
 struct type *java_int_type;
 struct type *java_byte_type;
@@ -351,13 +350,14 @@ java_link_class_type (struct type *type, struct value *clas)
   struct objfile *objfile = get_dynamics_objfile ();
   struct type *tsuper;
 
+  gdb_assert (name != NULL);
   unqualified_name = strrchr (name, '.');
   if (unqualified_name == NULL)
     unqualified_name = name;
 
   temp = clas;
   temp = value_struct_elt (&temp, NULL, "superclass", NULL, "structure");
-  if (name != NULL && strcmp (name, "java.lang.Object") == 0)
+  if (strcmp (name, "java.lang.Object") == 0)
     {
       tsuper = get_java_object_type ();
       if (tsuper && TYPE_CODE (tsuper) == TYPE_CODE_PTR)
@@ -591,7 +591,7 @@ get_java_object_header_size (void)
 {
   struct type *objtype = get_java_object_type ();
   if (objtype == NULL)
-    return (2 * TARGET_PTR_BIT / TARGET_CHAR_BIT);
+    return (2 * gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
   else
     return TYPE_LENGTH (objtype);
 }
@@ -928,7 +928,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
        goto nosideret;
       return java_value_string (&exp->elts[pc + 2].string, i);
 
-    case STRUCTOP_STRUCT:
+    case STRUCTOP_PTR:
       arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
       /* Convert object field (such as TYPE.class) to reference. */
       if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT)
@@ -1114,6 +1114,7 @@ const struct language_defn java_language_defn =
   NULL,
   default_word_break_characters,
   c_language_arch_info,
+  default_print_array_index,
   LANG_MAGIC
 };