bc9f0ae4dcece795c62e8c39de715a0742fe1831
1 /* Support for printing Java values for GDB, the GNU debugger.
2 Copyright 1997 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 #include "expression.h"
28 #include "java-lang.h"
31 java_value_print (val
, stream
, format
, pretty
)
35 enum val_prettyprint pretty
;
37 struct type
*type
= VALUE_TYPE (val
);
38 if (TYPE_CODE (type
) == TYPE_CODE_PTR
)
40 fprintf_filtered (stream
, "(");
41 type_print (TYPE_TARGET_TYPE (type
), "", stream
, -1);
42 fprintf_filtered (stream
, ") ");
44 return (val_print (VALUE_TYPE (val
), VALUE_CONTENTS (val
),
45 VALUE_ADDRESS (val
) + VALUE_OFFSET (val
),
46 stream
, format
, 1, 0, pretty
));
50 java_val_print (type
, valaddr
, address
, stream
, format
, deref_ref
, recurse
,
59 enum val_prettyprint pretty
;
61 if (is_object_type (type
))
63 CORE_ADDR obj_addr
= unpack_pointer (type
, valaddr
);
67 = value_at (TYPE_TARGET_TYPE (type
), obj_addr
, NULL
);
68 type
= type_from_class (java_class_from_object (obj_val
));
69 type
= lookup_pointer_type (type
);
72 return c_val_print (type
, valaddr
, address
, stream
, format
,
73 deref_ref
, recurse
, pretty
);