1999-04-16 09:35:26 +08:00
|
|
|
/* Java language support routines for GDB, the GNU debugger.
|
2005-02-07 23:04:43 +08:00
|
|
|
|
2005-12-18 06:34:03 +08:00
|
|
|
Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005 Free Software
|
2005-02-07 23:04:43 +08:00
|
|
|
Foundation, Inc.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
This file is part of GDB.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
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
|
|
|
|
(at your option) any later version.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
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.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-12-18 06:34:03 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "expression.h"
|
|
|
|
#include "parser-defs.h"
|
|
|
|
#include "language.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "symfile.h"
|
|
|
|
#include "objfiles.h"
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include "value.h"
|
|
|
|
#include "c-lang.h"
|
|
|
|
#include "jv-lang.h"
|
|
|
|
#include "gdbcore.h"
|
2003-02-19 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add block.c.
(block_h): New.
(COMMON_OBS): Add block.o.
(block.o): New.
(x86-64-tdep.o): Add $(block_h).
(values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o)
(stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o)
(objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o)
(m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o)
(f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o)
(c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o)
(alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto.
* value.h: Add opaque declaration for struct block.
* parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto.
* ada-lang.h: Ditto.
* x86-64-tdep.c: #include "block.h"
* values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto.
* symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto.
* objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto.
* mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto.
* jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto.
* findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto.
* buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto.
* alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto.
* blockframe.c (blockvector_for_pc_sect): Move to "block.c".
(blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto.
* symtab.c (block_function): Ditto.
(contained_in): Ditto.
* frame.h: Move block_for_pc and block_for_pc_sect declarations to
block.h. Add opaque declaration for struct block.
* symtab.h: Move block_function and contained_in declarations to
block.h. Add opaque declarations for struct block, struct
blockvector.
(struct block): Move to block.h.
(struct blockvector): Ditto.
(BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK)
(BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM)
(BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE)
(ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS)
(BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK):
Ditto.
* block.c: New file.
* block.h: New file.
2003-02-19 David Carlton <carlton@math.stanford.edu>
* mi-cmd-stack.c: #include "block.h"
2003-02-20 08:01:07 +08:00
|
|
|
#include "block.h"
|
2003-04-02 11:02:46 +08:00
|
|
|
#include "demangle.h"
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
#include "dictionary.h"
|
1999-04-16 09:35:26 +08:00
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
struct type *java_int_type;
|
|
|
|
struct type *java_byte_type;
|
|
|
|
struct type *java_short_type;
|
|
|
|
struct type *java_long_type;
|
|
|
|
struct type *java_boolean_type;
|
|
|
|
struct type *java_char_type;
|
|
|
|
struct type *java_float_type;
|
|
|
|
struct type *java_double_type;
|
|
|
|
struct type *java_void_type;
|
|
|
|
|
1999-05-26 02:09:09 +08:00
|
|
|
/* Local functions */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
extern void _initialize_java_language (void);
|
1999-05-26 02:09:09 +08:00
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static int java_demangled_signature_length (char *);
|
|
|
|
static void java_demangled_signature_copy (char *, char *);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static struct symtab *get_java_class_symtab (void);
|
2001-10-21 09:57:42 +08:00
|
|
|
static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
|
|
|
|
static int java_class_is_primitive (struct value *clas);
|
|
|
|
static struct value *java_value_string (char *ptr, int len);
|
1999-05-26 02:09:09 +08:00
|
|
|
|
2000-02-02 08:21:19 +08:00
|
|
|
static void java_emit_char (int c, struct ui_file * stream, int quoter);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2004-07-07 03:29:31 +08:00
|
|
|
static char *java_class_name_from_physname (const char *physname);
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
/* This objfile contains symtabs that have been dynamically created
|
|
|
|
to record dynamically loaded Java classes and dynamically
|
|
|
|
compiled java methods. */
|
|
|
|
|
|
|
|
static struct objfile *dynamics_objfile = NULL;
|
|
|
|
|
2001-10-21 09:57:42 +08:00
|
|
|
static struct type *java_link_class_type (struct type *, struct value *);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2003-02-05 05:55:26 +08:00
|
|
|
/* FIXME: carlton/2003-02-04: This is the main or only caller of
|
|
|
|
allocate_objfile with first argument NULL; as a result, this code
|
|
|
|
breaks every so often. Somebody should write a test case that
|
|
|
|
exercises GDB in various ways (e.g. something involving loading a
|
|
|
|
dynamic library) after this code has been called. */
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
static struct objfile *
|
2000-07-30 09:48:28 +08:00
|
|
|
get_dynamics_objfile (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (dynamics_objfile == NULL)
|
|
|
|
{
|
1999-10-12 12:37:53 +08:00
|
|
|
dynamics_objfile = allocate_objfile (NULL, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return dynamics_objfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
/* symtab contains classes read from the inferior. */
|
|
|
|
|
|
|
|
static struct symtab *class_symtab = NULL;
|
|
|
|
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
static void free_class_block (struct symtab *symtab);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-05-26 02:09:09 +08:00
|
|
|
static struct symtab *
|
2000-07-30 09:48:28 +08:00
|
|
|
get_java_class_symtab (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (class_symtab == NULL)
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
struct objfile *objfile = get_dynamics_objfile ();
|
1999-04-16 09:35:26 +08:00
|
|
|
struct blockvector *bv;
|
|
|
|
struct block *bl;
|
|
|
|
class_symtab = allocate_symtab ("<java-classes>", objfile);
|
|
|
|
class_symtab->language = language_java;
|
|
|
|
bv = (struct blockvector *)
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
obstack_alloc (&objfile->objfile_obstack,
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
sizeof (struct blockvector) + sizeof (struct block *));
|
1999-04-16 09:35:26 +08:00
|
|
|
BLOCKVECTOR_NBLOCKS (bv) = 1;
|
|
|
|
BLOCKVECTOR (class_symtab) = bv;
|
|
|
|
|
|
|
|
/* Allocate dummy STATIC_BLOCK. */
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
bl = allocate_block (&objfile->objfile_obstack);
|
|
|
|
BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack,
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
NULL);
|
1999-04-16 09:35:26 +08:00
|
|
|
BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl;
|
|
|
|
|
2003-09-11 David Carlton <carlton@kealia.com>
* gdbtypes.h: Add TYPE_CODE_NAMESPACE.
* gdbtypes.c (init_type): Handle TYPE_CODE_NAMESPACE.
(recursive_dump_type): Ditto.
* printcmd.c (print_formatted): Ditto.
* typeprint.c (print_type_scalar): Ditto.
* c-typeprint.c (c_type_print_varspec_prefix): Ditto.
(c_type_print_varspec_suffix, c_type_print_base): Ditto.
* cp-support.h: Declare cp_check_possible_namespace_symbols,
maint_cplus_cmd_list.
* cp-support.c: Make maint_cplus_cmd_list extern.
* cp-namespace.c: Include objfiles.h, gdbtypes.h, dictionary.h,
command.h.
(lookup_symbol_file): Look in possible namespace blocks when
appropriate.
(initialize_namespace_symtab): New.
(get_possible_namespace_block, free_namespace_block)
(check_possible_namespace_symbols)
(check_possible_namespace_symbols_loop)
(check_one_possible_namespace_symbol)
(lookup_possible_namespace_symbol, maintenance_cplus_namespace)
(_initialize_cp_namespace): Ditto.
* block.h: Declare allocate_block.
* block.c (allocate_block): New.
* jv-lang.c (get_java_class_symtab): Allocate blocks via
allocate_block.
* symfile.h: Update declaration of add_psymbol_to_list.
* symfile.c (add_psymbol_to_list): Return the partial symbol in
question.
* dwarf2read.c (dwarf2_build_psymtabs_hard): Add argument to
scan_partial_symbols_call.
(scan_partial_symbols): Add NAMESPACE argument; update calls to
helper functions.
(add_partial_symbol): If necessary, scan mangled names for names
of namespaces.
(add_partial_namespace): Add NAMESPACE argument; generate partial
symbols associated to namespaces.
(add_partial_enumeration): Add NAMESPACE argument.
(new_symbol): Allow namespace syms.
(read_namespace): Generate namespace syms.
* objfiles.h: Add opaque declaration of struct symtab.
(struct objfile): Add cp_namespace_symtab member.
* objfiles.c (allocate_objfile): Set
objfile->cp_namespace_symtab.
* Makefile.in (cp-namespace.o): Depend on objfiles_h, gdbtypes_h,
dictionary_h, command_h.
2003-09-11 David Carlton <carlton@kealia.com>
* gdb.c++/namespace.exp: Add tests for namespace types.
* gdb.c++/maint.exp (test_help): Test 'help maint cp namespace'.
(test_namespace): New.
2003-09-12 03:49:20 +08:00
|
|
|
/* Allocate GLOBAL_BLOCK. */
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
bl = allocate_block (&objfile->objfile_obstack);
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
BLOCK_DICT (bl) = dict_create_hashed_expandable ();
|
1999-04-16 09:35:26 +08:00
|
|
|
BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
class_symtab->free_func = free_class_block;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return class_symtab;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
add_class_symtab_symbol (struct symbol *sym)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct symtab *symtab = get_java_class_symtab ();
|
|
|
|
struct blockvector *bv = BLOCKVECTOR (symtab);
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static struct symbol *add_class_symbol (struct type *type, CORE_ADDR addr);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static struct symbol *
|
2000-07-30 09:48:28 +08:00
|
|
|
add_class_symbol (struct type *type, CORE_ADDR addr)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct symbol *sym;
|
|
|
|
sym = (struct symbol *)
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol));
|
1999-04-16 09:35:26 +08:00
|
|
|
memset (sym, 0, sizeof (struct symbol));
|
|
|
|
SYMBOL_LANGUAGE (sym) = language_java;
|
2003-02-25 David Carlton <carlton@math.stanford.edu>
* symtab.h (SYMBOL_NATURAL_NAME): New macro.
(SYMBOL_LINKAGE_NAME): Ditto.
(SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and
SYMBOL_LINKAGE_NAME.
(struct general_symbol_info): Expand comment.
(DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME.
(SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME.
(SYMBOL_MATCHES_REGEXP): Ditto.
* symtab.c (symbol_natural_name): New function.
* objfiles.h: Replace all uses of SYMBOL_NAME by
DEPRECATED_SYMBOL_NAME.
* xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto.
* symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto.
* somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto.
* printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto.
* minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto.
* i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto.
* gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto.
* dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto.
* cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto.
* blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto.
* ada-exp.y: Ditto.
* ada-exp.y: Update copyright.
* sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto.
* cp-valprint.c: Ditto.
2003-02-25 David Carlton <carlton@math.stanford.edu>
* generic/gdbtk.h: Replace all instances of SYMBOL_NAME by
DEPRECATED_SYMBOL_NAME.
* generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto.
* generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright.
2003-02-25 David Carlton <carlton@math.stanford.edu>
* mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with
DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-26 05:36:23 +08:00
|
|
|
DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type);
|
1999-04-16 09:35:26 +08:00
|
|
|
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
1999-07-08 04:19:36 +08:00
|
|
|
/* SYMBOL_VALUE (sym) = valu; */
|
1999-04-16 09:35:26 +08:00
|
|
|
SYMBOL_TYPE (sym) = type;
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-15 01:43:20 +08:00
|
|
|
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
|
1999-04-16 09:35:26 +08:00
|
|
|
SYMBOL_VALUE_ADDRESS (sym) = addr;
|
|
|
|
return sym;
|
|
|
|
}
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
|
|
|
|
/* Free the dynamic symbols block. */
|
|
|
|
static void
|
|
|
|
free_class_block (struct symtab *symtab)
|
|
|
|
{
|
|
|
|
struct blockvector *bv = BLOCKVECTOR (symtab);
|
|
|
|
struct block *bl = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
|
|
|
|
|
|
|
dict_free (BLOCK_DICT (bl));
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_lookup_class (char *name)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct symbol *sym;
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-15 01:43:20 +08:00
|
|
|
sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN,
|
1999-04-16 09:35:26 +08:00
|
|
|
(int *) 0, (struct symtab **) NULL);
|
|
|
|
if (sym != NULL)
|
|
|
|
return SYMBOL_TYPE (sym);
|
|
|
|
#if 0
|
|
|
|
CORE_ADDR addr;
|
|
|
|
if (called from parser)
|
|
|
|
{
|
|
|
|
call lookup_class (or similar) in inferior;
|
1999-07-08 04:19:36 +08:00
|
|
|
if not
|
|
|
|
found:
|
1999-04-16 09:35:26 +08:00
|
|
|
return NULL;
|
|
|
|
addr = found in inferior;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
addr = 0;
|
|
|
|
struct type *type;
|
|
|
|
type = alloc_type (objfile);
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_STRUCT;
|
|
|
|
INIT_CPLUS_SPECIFIC (type);
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
|
1999-04-16 09:35:26 +08:00
|
|
|
TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
|
|
|
|
TYPE ? = addr;
|
|
|
|
return type;
|
|
|
|
#else
|
|
|
|
/* FIXME - should search inferior's symbol table. */
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a nul-terminated string (allocated on OBSTACK) for
|
|
|
|
a name given by NAME (which has type Utf8Const*). */
|
|
|
|
|
|
|
|
char *
|
2001-10-21 09:57:42 +08:00
|
|
|
get_java_utf8_name (struct obstack *obstack, struct value *name)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char *chrs;
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *temp = name;
|
1999-04-16 09:35:26 +08:00
|
|
|
int name_length;
|
|
|
|
CORE_ADDR data_addr;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
|
|
|
|
name_length = (int) value_as_long (temp);
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
data_addr = VALUE_ADDRESS (temp) + value_offset (temp)
|
|
|
|
+ TYPE_LENGTH (value_type (temp));
|
1999-07-08 04:19:36 +08:00
|
|
|
chrs = obstack_alloc (obstack, name_length + 1);
|
|
|
|
chrs[name_length] = '\0';
|
2005-05-27 12:39:33 +08:00
|
|
|
read_memory (data_addr, (gdb_byte *) chrs, name_length);
|
1999-04-16 09:35:26 +08:00
|
|
|
return chrs;
|
|
|
|
}
|
|
|
|
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *
|
|
|
|
java_class_from_object (struct value *obj_val)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* This is all rather inefficient, since the offsets of vtable and
|
|
|
|
class are fixed. FIXME */
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *vtable_val;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
if (TYPE_CODE (value_type (obj_val)) == TYPE_CODE_PTR
|
|
|
|
&& TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (obj_val))) == 0)
|
1999-04-16 09:35:26 +08:00
|
|
|
obj_val = value_at (get_java_object_type (),
|
2004-11-09 Andrew Cagney <cagney@gnu.org>
* value.h (struct value): Delete field bfd_section.
(VALUE_BFD_SECTION): Delete macro.
(COERCE_REF): Update.
(value_at, value_at_lazy): Delete asection parameter.
* printcmd.c (print_formatted, x_command): Update.
(do_examine): Delete asection parameter.
(next_section): Delete variable.
* valops.c (value_cast, value_at, value_at_lazy)
(value_coerce_function, value_addr, value_ind, value_string)
(find_rt_vbase_offset, value_full_object): Update.
* hpacc-abi.c (hpacc_virtual_fn_field)
(hpacc_value_rtti_type): Update.
* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_virtual_fn_field)
(gnuv3_baseclass_offset): Update.
* f-valprint.c (f_val_print): Update.
* c-valprint.c (c_val_print): Update.
* p-valprint.c (pascal_val_print): Update.
* jv-valprint.c (java_value_print): Update.
* jv-lang.c (java_class_from_object, evaluate_subexp_java): Update.
* ada-lang.c (ada_value_primitive_packed_val)
(ada_evaluate_subexp): Update.
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Update.
* expprint.c (print_subexp_standard): Update.
* infcall.c (call_function_by_hand): Update.
* valarith.c (value_add): Update.
* eval.c (evaluate_subexp_standard): Update.
* values.c (allocate_value, value_copy, value_static_field): Update.
* findvar.c (read_var_value, locate_var_value): Update.
2004-11-09 22:43:27 +08:00
|
|
|
value_as_address (obj_val));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
|
|
|
|
return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if CLASS_IS_PRIMITIVE(value of clas): */
|
1999-05-26 02:09:09 +08:00
|
|
|
static int
|
2001-10-21 09:57:42 +08:00
|
|
|
java_class_is_primitive (struct value *clas)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
|
* value.h (value_as_address): Rename value_as_pointer.
* eval.c, findvar.c, gnu-v2-abi.c, gnu-v3-abi.c, jv-lang.c,
jv-valprint.c, printcmd.c, stack.c, top.c, valarith.c, valops.c,
values.c: Update.
2001-10-16 09:58:07 +08:00
|
|
|
CORE_ADDR i = value_as_address (vtable);
|
1999-04-16 09:35:26 +08:00
|
|
|
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
|
|
|
|
|
|
|
|
struct type *
|
2001-10-21 09:57:42 +08:00
|
|
|
type_from_class (struct value *clas)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
char *name;
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *temp;
|
1999-04-16 09:35:26 +08:00
|
|
|
struct objfile *objfile;
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *utf8_name;
|
1999-04-16 09:35:26 +08:00
|
|
|
char *nptr;
|
|
|
|
CORE_ADDR addr;
|
|
|
|
struct block *bl;
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
struct dict_iterator iter;
|
1999-04-16 09:35:26 +08:00
|
|
|
int is_array = 0;
|
|
|
|
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
type = check_typedef (value_type (clas));
|
1999-04-16 09:35:26 +08:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
|
|
{
|
|
|
|
if (value_logical_not (clas))
|
|
|
|
return NULL;
|
|
|
|
clas = value_ind (clas);
|
|
|
|
}
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
addr = VALUE_ADDRESS (clas) + value_offset (clas);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
get_java_class_symtab ();
|
|
|
|
bl = BLOCKVECTOR_BLOCK (BLOCKVECTOR (class_symtab), GLOBAL_BLOCK);
|
2003-06-11 David Carlton <carlton@bactrian.org>
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 07:29:49 +08:00
|
|
|
ALL_BLOCK_SYMBOLS (block, iter, sym)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (SYMBOL_VALUE_ADDRESS (sym) == addr)
|
|
|
|
return SYMBOL_TYPE (sym);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
objfile = get_dynamics_objfile ();
|
1999-04-16 09:35:26 +08:00
|
|
|
if (java_class_is_primitive (clas))
|
|
|
|
{
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *sig;
|
1999-04-16 09:35:26 +08:00
|
|
|
temp = clas;
|
|
|
|
sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
|
|
|
|
return java_primitive_type (value_as_long (sig));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get Class name. */
|
|
|
|
/* if clasloader non-null, prepend loader address. FIXME */
|
|
|
|
temp = clas;
|
|
|
|
utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure");
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
name = get_java_utf8_name (&objfile->objfile_obstack, utf8_name);
|
1999-07-08 04:19:36 +08:00
|
|
|
for (nptr = name; *nptr != 0; nptr++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (*nptr == '/')
|
|
|
|
*nptr = '.';
|
|
|
|
}
|
|
|
|
|
|
|
|
type = java_lookup_class (name);
|
|
|
|
if (type != NULL)
|
|
|
|
return type;
|
|
|
|
|
|
|
|
type = alloc_type (objfile);
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_STRUCT;
|
|
|
|
INIT_CPLUS_SPECIFIC (type);
|
|
|
|
|
|
|
|
if (name[0] == '[')
|
|
|
|
{
|
|
|
|
char *signature = name;
|
|
|
|
int namelen = java_demangled_signature_length (signature);
|
|
|
|
if (namelen > strlen (name))
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
java_demangled_signature_copy (name, signature);
|
|
|
|
name[namelen] = '\0';
|
|
|
|
is_array = 1;
|
|
|
|
temp = clas;
|
|
|
|
/* Set array element type. */
|
|
|
|
temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure");
|
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.h (deprecated_set_value_type): Declare.
* value.c (deprecated_set_value_type): Define.
* hpacc-abi.c, gnu-v2-abi.c, cp-valprint.c: Update.
* c-valprint.c, jv-lang.c, objc-lang.c, ada-lang.c: Update.
* infcall.c, printcmd.c, valops.c, eval.c, p-exp.y: Update.
* ax-gdb.c, tracepoint.c: Update.
2005-02-08 07:51:03 +08:00
|
|
|
deprecated_set_value_type (temp, lookup_pointer_type (value_type (clas)));
|
1999-04-16 09:35:26 +08:00
|
|
|
TYPE_TARGET_TYPE (type) = type_from_class (temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALLOCATE_CPLUS_STRUCT_TYPE (type);
|
|
|
|
TYPE_TAG_NAME (type) = name;
|
|
|
|
|
|
|
|
add_class_symtab_symbol (add_class_symbol (type, addr));
|
|
|
|
return java_link_class_type (type, clas);
|
|
|
|
}
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
/* Fill in class TYPE with data from the CLAS value. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
struct type *
|
2001-10-21 09:57:42 +08:00
|
|
|
java_link_class_type (struct type *type, struct value *clas)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *temp;
|
1999-04-16 09:35:26 +08:00
|
|
|
char *unqualified_name;
|
|
|
|
char *name = TYPE_TAG_NAME (type);
|
|
|
|
int ninterfaces, nfields, nmethods;
|
|
|
|
int type_is_object = 0;
|
|
|
|
struct fn_field *fn_fields;
|
|
|
|
struct fn_fieldlist *fn_fieldlists;
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *fields;
|
|
|
|
struct value *methods;
|
2001-03-24 06:48:44 +08:00
|
|
|
struct value *method = NULL;
|
|
|
|
struct value *field = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
int i, j;
|
1999-07-08 04:19:36 +08:00
|
|
|
struct objfile *objfile = get_dynamics_objfile ();
|
1999-04-16 09:35:26 +08:00
|
|
|
struct type *tsuper;
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
tsuper = get_java_object_type ();
|
|
|
|
if (tsuper && TYPE_CODE (tsuper) == TYPE_CODE_PTR)
|
|
|
|
tsuper = TYPE_TARGET_TYPE (tsuper);
|
|
|
|
type_is_object = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
tsuper = type_from_class (temp);
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
ninterfaces = 0;
|
|
|
|
#else
|
|
|
|
temp = clas;
|
|
|
|
ninterfaces = value_as_long (value_struct_elt (&temp, NULL, "interface_len", NULL, "structure"));
|
|
|
|
#endif
|
|
|
|
TYPE_N_BASECLASSES (type) = (tsuper == NULL ? 0 : 1) + ninterfaces;
|
|
|
|
temp = clas;
|
|
|
|
nfields = value_as_long (value_struct_elt (&temp, NULL, "field_count", NULL, "structure"));
|
|
|
|
nfields += TYPE_N_BASECLASSES (type);
|
1999-07-08 04:19:36 +08:00
|
|
|
nfields++; /* Add one for dummy "class" field. */
|
1999-04-16 09:35:26 +08:00
|
|
|
TYPE_NFIELDS (type) = nfields;
|
|
|
|
TYPE_FIELDS (type) = (struct field *)
|
|
|
|
TYPE_ALLOC (type, sizeof (struct field) * nfields);
|
|
|
|
|
|
|
|
memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);
|
|
|
|
|
|
|
|
TYPE_FIELD_PRIVATE_BITS (type) =
|
|
|
|
(B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
|
|
|
|
B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields);
|
|
|
|
|
|
|
|
TYPE_FIELD_PROTECTED_BITS (type) =
|
|
|
|
(B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
|
|
|
|
B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields);
|
|
|
|
|
|
|
|
TYPE_FIELD_IGNORE_BITS (type) =
|
|
|
|
(B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
|
|
|
|
B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields);
|
|
|
|
|
|
|
|
TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *)
|
|
|
|
TYPE_ALLOC (type, B_BYTES (TYPE_N_BASECLASSES (type)));
|
|
|
|
B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type));
|
|
|
|
|
|
|
|
if (tsuper != NULL)
|
|
|
|
{
|
|
|
|
TYPE_BASECLASS (type, 0) = tsuper;
|
|
|
|
if (type_is_object)
|
|
|
|
SET_TYPE_FIELD_PRIVATE (type, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
i = strlen (name);
|
1999-07-08 04:19:36 +08:00
|
|
|
if (i > 2 && name[i - 1] == ']' && tsuper != NULL)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* FIXME */
|
1999-07-08 04:19:36 +08:00
|
|
|
TYPE_LENGTH (type) = TYPE_LENGTH (tsuper) + 4; /* size with "length" */
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
temp = clas;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "size_in_bytes", NULL, "structure");
|
|
|
|
TYPE_LENGTH (type) = value_as_long (temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
fields = NULL;
|
1999-07-08 04:19:36 +08:00
|
|
|
nfields--; /* First set up dummy "class" field. */
|
1999-04-16 09:35:26 +08:00
|
|
|
SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields),
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
VALUE_ADDRESS (clas) + value_offset (clas));
|
1999-04-16 09:35:26 +08:00
|
|
|
TYPE_FIELD_NAME (type, nfields) = "class";
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
|
1999-04-16 09:35:26 +08:00
|
|
|
SET_TYPE_FIELD_PRIVATE (type, nfields);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
|
|
for (i = TYPE_N_BASECLASSES (type); i < nfields; i++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int accflags;
|
|
|
|
int boffset;
|
|
|
|
if (fields == NULL)
|
|
|
|
{
|
|
|
|
temp = clas;
|
|
|
|
fields = value_struct_elt (&temp, NULL, "fields", NULL, "structure");
|
|
|
|
field = value_ind (fields);
|
|
|
|
}
|
|
|
|
else
|
1999-07-08 04:19:36 +08:00
|
|
|
{ /* Re-use field value for next field. */
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
VALUE_ADDRESS (field) += TYPE_LENGTH (value_type (field));
|
2005-02-07 23:04:43 +08:00
|
|
|
set_value_lazy (field, 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
temp = field;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
|
|
|
|
TYPE_FIELD_NAME (type, i) =
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
get_java_utf8_name (&objfile->objfile_obstack, temp);
|
1999-04-16 09:35:26 +08:00
|
|
|
temp = field;
|
|
|
|
accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags",
|
|
|
|
NULL, "structure"));
|
|
|
|
temp = field;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "info", NULL, "structure");
|
|
|
|
boffset = value_as_long (value_struct_elt (&temp, NULL, "boffset",
|
1999-07-08 04:19:36 +08:00
|
|
|
NULL, "structure"));
|
|
|
|
if (accflags & 0x0001) /* public access */
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* ??? */
|
|
|
|
}
|
1999-07-08 04:19:36 +08:00
|
|
|
if (accflags & 0x0002) /* private access */
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
SET_TYPE_FIELD_PRIVATE (type, i);
|
|
|
|
}
|
1999-07-08 04:19:36 +08:00
|
|
|
if (accflags & 0x0004) /* protected access */
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
SET_TYPE_FIELD_PROTECTED (type, i);
|
|
|
|
}
|
1999-07-08 04:19:36 +08:00
|
|
|
if (accflags & 0x0008) /* ACC_STATIC */
|
|
|
|
SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
|
1999-04-16 09:35:26 +08:00
|
|
|
else
|
|
|
|
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
|
1999-07-08 04:19:36 +08:00
|
|
|
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
TYPE_FIELD_TYPE (type, i) = get_java_object_type (); /* FIXME */
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct type *ftype;
|
|
|
|
temp = field;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "type", NULL, "structure");
|
|
|
|
ftype = type_from_class (temp);
|
|
|
|
if (TYPE_CODE (ftype) == TYPE_CODE_STRUCT)
|
|
|
|
ftype = lookup_pointer_type (ftype);
|
|
|
|
TYPE_FIELD_TYPE (type, i) = ftype;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
temp = clas;
|
|
|
|
nmethods = value_as_long (value_struct_elt (&temp, NULL, "method_count",
|
|
|
|
NULL, "structure"));
|
|
|
|
TYPE_NFN_FIELDS_TOTAL (type) = nmethods;
|
|
|
|
j = nmethods * sizeof (struct fn_field);
|
1999-07-08 04:19:36 +08:00
|
|
|
fn_fields = (struct fn_field *)
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
obstack_alloc (&dynamics_objfile->objfile_obstack, j);
|
1999-04-16 09:35:26 +08:00
|
|
|
memset (fn_fields, 0, j);
|
1999-07-08 04:19:36 +08:00
|
|
|
fn_fieldlists = (struct fn_fieldlist *)
|
1999-04-16 09:35:26 +08:00
|
|
|
alloca (nmethods * sizeof (struct fn_fieldlist));
|
|
|
|
|
|
|
|
methods = NULL;
|
1999-07-08 04:19:36 +08:00
|
|
|
for (i = 0; i < nmethods; i++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char *mname;
|
|
|
|
int k;
|
|
|
|
if (methods == NULL)
|
|
|
|
{
|
|
|
|
temp = clas;
|
|
|
|
methods = value_struct_elt (&temp, NULL, "methods", NULL, "structure");
|
|
|
|
method = value_ind (methods);
|
|
|
|
}
|
|
|
|
else
|
1999-07-08 04:19:36 +08:00
|
|
|
{ /* Re-use method value for next method. */
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
VALUE_ADDRESS (method) += TYPE_LENGTH (value_type (method));
|
2005-02-07 23:04:43 +08:00
|
|
|
set_value_lazy (method, 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get method name. */
|
|
|
|
temp = method;
|
|
|
|
temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
mname = get_java_utf8_name (&objfile->objfile_obstack, temp);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (strcmp (mname, "<init>") == 0)
|
|
|
|
mname = unqualified_name;
|
|
|
|
|
|
|
|
/* Check for an existing method with the same name.
|
|
|
|
* This makes building the fn_fieldslists an O(nmethods**2)
|
|
|
|
* operation. That could be using hashing, but I doubt it
|
|
|
|
* is worth it. Note that we do maintain the order of methods
|
|
|
|
* in the inferior's Method table (as long as that is grouped
|
|
|
|
* by method name), which I think is desirable. --PB */
|
1999-07-08 04:19:36 +08:00
|
|
|
for (k = 0, j = TYPE_NFN_FIELDS (type);;)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (--j < 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
{ /* No match - new method name. */
|
|
|
|
j = TYPE_NFN_FIELDS (type)++;
|
1999-04-16 09:35:26 +08:00
|
|
|
fn_fieldlists[j].name = mname;
|
|
|
|
fn_fieldlists[j].length = 1;
|
|
|
|
fn_fieldlists[j].fn_fields = &fn_fields[i];
|
|
|
|
k = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (strcmp (mname, fn_fieldlists[j].name) == 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
{ /* Found an existing method with the same name. */
|
1999-04-16 09:35:26 +08:00
|
|
|
int l;
|
|
|
|
if (mname != unqualified_name)
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-08 00:57:55 +08:00
|
|
|
obstack_free (&objfile->objfile_obstack, mname);
|
1999-04-16 09:35:26 +08:00
|
|
|
mname = fn_fieldlists[j].name;
|
|
|
|
fn_fieldlists[j].length++;
|
1999-07-08 04:19:36 +08:00
|
|
|
k = i - k; /* Index of new slot. */
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Shift intervening fn_fields (between k and i) down. */
|
1999-07-08 04:19:36 +08:00
|
|
|
for (l = i; l > k; l--)
|
|
|
|
fn_fields[l] = fn_fields[l - 1];
|
|
|
|
for (l = TYPE_NFN_FIELDS (type); --l > j;)
|
1999-04-16 09:35:26 +08:00
|
|
|
fn_fieldlists[l].fn_fields++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
k += fn_fieldlists[j].length;
|
|
|
|
}
|
|
|
|
fn_fields[k].physname = "";
|
|
|
|
fn_fields[k].is_stub = 1;
|
1999-07-08 04:19:36 +08:00
|
|
|
fn_fields[k].type = make_function_type (java_void_type, NULL); /* FIXME */
|
1999-04-16 09:35:26 +08:00
|
|
|
TYPE_CODE (fn_fields[k].type) = TYPE_CODE_METHOD;
|
|
|
|
}
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
j = TYPE_NFN_FIELDS (type) * sizeof (struct fn_fieldlist);
|
|
|
|
TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
|
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* buildsym.c (free_pending_blocks, finish_block)
(record_pending_block, make_blockvector, end_symtab): Replace
symbol_obstack with objfile_obstack.
* coffread.c (process_coff_symbol, coff_read_struct_type)
(coff_read_enum_type): Ditto.
* cp-namespace.c (initialize_namespace_symtab)
(check_one_possible_namespace_symbol): Ditto.
* dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file)
(dwarf2_symbol_mark_computed): Ditto.
* dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* hpread.c (hpread_symfile_init, hpread_symfile_init)
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_process_one_debug_symbol):
Ditto.
* jv-lang.c (get_java_class_symtab, add_class_symbol)
(java_link_class_type): Ditto.
* mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab)
(new_symbol): Ditto.
* minsyms.c (install_minimal_symbols): Ditto.
* objfiles.c (allocate_objfile): Remove init of symbol_obstack.
(terminate_minimal_symbol_table): Replace symbol_obstack with
objfile_obstack.
(free_objfile): Remove freeing of symbol_obstack.
* objfiles.h: Remove symbol_obstack field.
* pa64solib.c (add_to_solist): Replace symbol_obstack with
objfile_obstack.
* solib-sunos.c (allocate_rt_common_objfile): Remove init of
symbol_obstack.
(solib_add_common_symbols): Replace symbol_obstack with
objfile_obstack.
* somsolib.c (som_solib_add): Ditto.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_start, common_block_end): Ditto.
* symfile.c (reread_symbols): Remove freeing and init of
symbol_obstack.
(allocate_symtab): Rename symbol_obstack to objfile_obstack.
* symfile.h: Update comment.
* symmisc.c (print_objfile_statistics): Remove symbol_obstack
stats printing.
* symtab.c (symbol_set_names): Replace symbol_obstack with
objfile_obstack.
* symtab.h (struct general_symbol_info, struct minimal_symbol):
Update comments.
* xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC)
(init_stringtab, xcoff_initial_scan): Replace symbol_obstack with
objfile_obstack.
2004-02-08 07:13:47 +08:00
|
|
|
obstack_alloc (&dynamics_objfile->objfile_obstack, j);
|
1999-04-16 09:35:26 +08:00
|
|
|
memcpy (TYPE_FN_FIELDLISTS (type), fn_fieldlists, j);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct type *java_object_type;
|
|
|
|
|
|
|
|
struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
get_java_object_type (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (java_object_type == NULL)
|
|
|
|
{
|
|
|
|
struct symbol *sym;
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-15 01:43:20 +08:00
|
|
|
sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN,
|
1999-04-16 09:35:26 +08:00
|
|
|
(int *) 0, (struct symtab **) NULL);
|
|
|
|
if (sym == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("cannot find java.lang.Object"));
|
1999-04-16 09:35:26 +08:00
|
|
|
java_object_type = SYMBOL_TYPE (sym);
|
|
|
|
}
|
|
|
|
return java_object_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-07-30 09:48:28 +08:00
|
|
|
get_java_object_header_size (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct type *objtype = get_java_object_type ();
|
|
|
|
if (objtype == NULL)
|
|
|
|
return (2 * TARGET_PTR_BIT / TARGET_CHAR_BIT);
|
|
|
|
else
|
|
|
|
return TYPE_LENGTH (objtype);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-07-30 09:48:28 +08:00
|
|
|
is_object_type (struct type *type)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
CHECK_TYPEDEF (type);
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
|
|
{
|
|
|
|
struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
char *name;
|
|
|
|
if (TYPE_CODE (ttype) != TYPE_CODE_STRUCT)
|
|
|
|
return 0;
|
|
|
|
while (TYPE_N_BASECLASSES (ttype) > 0)
|
|
|
|
ttype = TYPE_BASECLASS (ttype, 0);
|
|
|
|
name = TYPE_TAG_NAME (ttype);
|
|
|
|
if (name != NULL && strcmp (name, "java.lang.Object") == 0)
|
|
|
|
return 1;
|
1999-07-08 04:19:36 +08:00
|
|
|
name = TYPE_NFIELDS (ttype) > 0 ? TYPE_FIELD_NAME (ttype, 0) : (char *) 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
if (name != NULL && strcmp (name, "vtable") == 0)
|
|
|
|
{
|
|
|
|
if (java_object_type == NULL)
|
|
|
|
java_object_type = type;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_primitive_type (int signature)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
switch (signature)
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
case 'B':
|
|
|
|
return java_byte_type;
|
|
|
|
case 'S':
|
|
|
|
return java_short_type;
|
|
|
|
case 'I':
|
|
|
|
return java_int_type;
|
|
|
|
case 'J':
|
|
|
|
return java_long_type;
|
|
|
|
case 'Z':
|
|
|
|
return java_boolean_type;
|
|
|
|
case 'C':
|
|
|
|
return java_char_type;
|
|
|
|
case 'F':
|
|
|
|
return java_float_type;
|
|
|
|
case 'D':
|
|
|
|
return java_double_type;
|
|
|
|
case 'V':
|
|
|
|
return java_void_type;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("unknown signature '%c' for primitive type"), (char) signature);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If name[0 .. namelen-1] is the name of a primitive Java type,
|
|
|
|
return that type. Otherwise, return NULL. */
|
|
|
|
|
|
|
|
struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_primitive_type_from_name (char *name, int namelen)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
switch (name[0])
|
|
|
|
{
|
|
|
|
case 'b':
|
|
|
|
if (namelen == 4 && memcmp (name, "byte", 4) == 0)
|
|
|
|
return java_byte_type;
|
|
|
|
if (namelen == 7 && memcmp (name, "boolean", 7) == 0)
|
|
|
|
return java_boolean_type;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
if (namelen == 4 && memcmp (name, "char", 4) == 0)
|
|
|
|
return java_char_type;
|
|
|
|
case 'd':
|
|
|
|
if (namelen == 6 && memcmp (name, "double", 6) == 0)
|
|
|
|
return java_double_type;
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
if (namelen == 5 && memcmp (name, "float", 5) == 0)
|
|
|
|
return java_float_type;
|
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
if (namelen == 3 && memcmp (name, "int", 3) == 0)
|
|
|
|
return java_int_type;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
if (namelen == 4 && memcmp (name, "long", 4) == 0)
|
|
|
|
return java_long_type;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
if (namelen == 5 && memcmp (name, "short", 5) == 0)
|
|
|
|
return java_short_type;
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
if (namelen == 4 && memcmp (name, "void", 4) == 0)
|
|
|
|
return java_void_type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the length (in bytes) of demangled name of the Java type
|
|
|
|
signature string SIGNATURE. */
|
|
|
|
|
|
|
|
static int
|
2000-07-30 09:48:28 +08:00
|
|
|
java_demangled_signature_length (char *signature)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int array = 0;
|
1999-07-08 04:19:36 +08:00
|
|
|
for (; *signature == '['; signature++)
|
|
|
|
array += 2; /* Two chars for "[]". */
|
1999-04-16 09:35:26 +08:00
|
|
|
switch (signature[0])
|
|
|
|
{
|
|
|
|
case 'L':
|
|
|
|
/* Subtract 2 for 'L' and ';'. */
|
|
|
|
return strlen (signature) - 2 + array;
|
|
|
|
default:
|
|
|
|
return strlen (TYPE_NAME (java_primitive_type (signature[0]))) + array;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Demangle the Java type signature SIGNATURE, leaving the result in RESULT. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
java_demangled_signature_copy (char *result, char *signature)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int array = 0;
|
|
|
|
char *ptr;
|
|
|
|
int i;
|
|
|
|
while (*signature == '[')
|
|
|
|
{
|
|
|
|
array++;
|
|
|
|
signature++;
|
|
|
|
}
|
|
|
|
switch (signature[0])
|
|
|
|
{
|
|
|
|
case 'L':
|
|
|
|
/* Subtract 2 for 'L' and ';', but add 1 for final nul. */
|
|
|
|
signature++;
|
|
|
|
ptr = result;
|
1999-07-08 04:19:36 +08:00
|
|
|
for (; *signature != ';' && *signature != '\0'; signature++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (*signature == '/')
|
|
|
|
*ptr++ = '.';
|
|
|
|
else
|
|
|
|
*ptr++ = *signature;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ptr = TYPE_NAME (java_primitive_type (signature[0]));
|
|
|
|
i = strlen (ptr);
|
|
|
|
strcpy (result, ptr);
|
|
|
|
ptr = result + i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
while (--array >= 0)
|
|
|
|
{
|
|
|
|
*ptr++ = '[';
|
|
|
|
*ptr++ = ']';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the demangled name of the Java type signature string SIGNATURE,
|
|
|
|
as a freshly allocated copy. */
|
|
|
|
|
|
|
|
char *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_demangle_type_signature (char *signature)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int length = java_demangled_signature_length (signature);
|
|
|
|
char *result = xmalloc (length + 1);
|
|
|
|
java_demangled_signature_copy (result, signature);
|
|
|
|
result[length] = '\0';
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the type of TYPE followed by DIMS pairs of [ ].
|
|
|
|
If DIMS == 0, TYPE is returned. */
|
|
|
|
|
|
|
|
struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_array_type (struct type *type, int dims)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct type *range_type;
|
|
|
|
|
|
|
|
while (dims-- > 0)
|
|
|
|
{
|
|
|
|
range_type = create_range_type (NULL, builtin_type_int, 0, 0);
|
|
|
|
/* FIXME This is bogus! Java arrays are not gdb arrays! */
|
|
|
|
type = create_array_type (NULL, type, range_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a Java string in the inferior from a (Utf8) literal. */
|
|
|
|
|
2001-10-21 09:57:42 +08:00
|
|
|
static struct value *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_value_string (char *ptr, int len)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("not implemented - java_value_string")); /* FIXME */
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Print the character C on STREAM as part of the contents of a literal
|
|
|
|
string whose delimiter is QUOTER. Note that that format for printing
|
|
|
|
characters and strings is language specific. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
java_emit_char (int c, struct ui_file *stream, int quoter)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\\':
|
|
|
|
case '\'':
|
|
|
|
fprintf_filtered (stream, "\\%c", c);
|
|
|
|
break;
|
|
|
|
case '\b':
|
|
|
|
fputs_filtered ("\\b", stream);
|
|
|
|
break;
|
|
|
|
case '\t':
|
|
|
|
fputs_filtered ("\\t", stream);
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
fputs_filtered ("\\n", stream);
|
|
|
|
break;
|
|
|
|
case '\f':
|
|
|
|
fputs_filtered ("\\f", stream);
|
|
|
|
break;
|
|
|
|
case '\r':
|
|
|
|
fputs_filtered ("\\r", stream);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (isprint (c))
|
|
|
|
fputc_filtered (c, stream);
|
|
|
|
else
|
|
|
|
fprintf_filtered (stream, "\\u%.4x", (unsigned int) c);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-21 09:57:42 +08:00
|
|
|
static struct value *
|
2003-09-09 16:05:43 +08:00
|
|
|
evaluate_subexp_java (struct type *expect_type, struct expression *exp,
|
|
|
|
int *pos, enum noside noside)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int pc = *pos;
|
|
|
|
int i;
|
|
|
|
char *name;
|
|
|
|
enum exp_opcode op = exp->elts[*pos].opcode;
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *arg1;
|
|
|
|
struct value *arg2;
|
1999-04-16 09:35:26 +08:00
|
|
|
struct type *type;
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case UNOP_IND:
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
goto standard;
|
|
|
|
(*pos)++;
|
|
|
|
arg1 = evaluate_subexp_java (NULL_TYPE, exp, pos, EVAL_NORMAL);
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
if (is_object_type (value_type (arg1)))
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
|
|
|
|
type = type_from_class (java_class_from_object (arg1));
|
|
|
|
arg1 = value_cast (lookup_pointer_type (type), arg1);
|
|
|
|
}
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
goto nosideret;
|
|
|
|
return value_ind (arg1);
|
|
|
|
|
|
|
|
case BINOP_SUBSCRIPT:
|
|
|
|
(*pos)++;
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
goto nosideret;
|
|
|
|
/* If the user attempts to subscript something that is not an
|
1999-07-08 04:19:36 +08:00
|
|
|
array or pointer type (like a plain int variable for example),
|
|
|
|
then report this as an error. */
|
|
|
|
|
2004-11-10 Andrew Cagney <cagney@gnu.org>
* value.h (COERCE_REF, COERCE_ARRAY, COERCE_NUMBER, COERCE_ENUM)
(coerce_ref, coerce_array, coerce_number, coerce_enum): Replace
macros with function declarations.
* value.c (coerce_ref, coerce_array, coerce_number)
(coerce_enum): New functions.
(value_as_long, value_as_address): Update.
* ada-lang.c (ada_coerce_ref, ada_value_binop)
(ada_evaluate_subexp, ada_value_assign, ada_value_struct_elt): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* valarith.c (value_less, value_neg, value_complement)
(value_binop, value_add, value_subscript, value_x_binop)
(value_logical_not, value_sub): Update.
* valops.c (check_field, value_struct_elt, value_ind)
(value_find_oload_method_list, value_cast, value_assign): Update.
* eval.c (evaluate_subexp_standard): Update.
2004-11-11 02:52:25 +08:00
|
|
|
arg1 = coerce_ref (arg1);
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
type = check_typedef (value_type (arg1));
|
1999-04-16 09:35:26 +08:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
|
|
type = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
name = TYPE_NAME (type);
|
|
|
|
if (name == NULL)
|
|
|
|
name = TYPE_TAG_NAME (type);
|
|
|
|
i = name == NULL ? 0 : strlen (name);
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
1999-07-08 04:19:36 +08:00
|
|
|
&& i > 2 && name[i - 1] == ']')
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
CORE_ADDR address;
|
|
|
|
long length, index;
|
|
|
|
struct type *el_type;
|
2005-05-27 12:39:33 +08:00
|
|
|
gdb_byte buf4[4];
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2001-10-21 09:57:42 +08:00
|
|
|
struct value *clas = java_class_from_object (arg1);
|
|
|
|
struct value *temp = clas;
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Get CLASS_ELEMENT_TYPE of the array type. */
|
|
|
|
temp = value_struct_elt (&temp, NULL, "methods",
|
1999-07-08 04:19:36 +08:00
|
|
|
NULL, "structure");
|
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.h (deprecated_set_value_type): Declare.
* value.c (deprecated_set_value_type): Define.
* hpacc-abi.c, gnu-v2-abi.c, cp-valprint.c: Update.
* c-valprint.c, jv-lang.c, objc-lang.c, ada-lang.c: Update.
* infcall.c, printcmd.c, valops.c, eval.c, p-exp.y: Update.
* ax-gdb.c, tracepoint.c: Update.
2005-02-08 07:51:03 +08:00
|
|
|
deprecated_set_value_type (temp, value_type (clas));
|
1999-04-16 09:35:26 +08:00
|
|
|
el_type = type_from_class (temp);
|
|
|
|
if (TYPE_CODE (el_type) == TYPE_CODE_STRUCT)
|
|
|
|
el_type = lookup_pointer_type (el_type);
|
|
|
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
return value_zero (el_type, VALUE_LVAL (arg1));
|
* value.h (value_as_address): Rename value_as_pointer.
* eval.c, findvar.c, gnu-v2-abi.c, gnu-v3-abi.c, jv-lang.c,
jv-valprint.c, printcmd.c, stack.c, top.c, valarith.c, valops.c,
values.c: Update.
2001-10-16 09:58:07 +08:00
|
|
|
address = value_as_address (arg1);
|
1999-04-16 09:35:26 +08:00
|
|
|
address += JAVA_OBJECT_SIZE;
|
|
|
|
read_memory (address, buf4, 4);
|
|
|
|
length = (long) extract_signed_integer (buf4, 4);
|
|
|
|
index = (long) value_as_long (arg2);
|
|
|
|
if (index >= length || index < 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("array index (%ld) out of bounds (length: %ld)"),
|
1999-04-16 09:35:26 +08:00
|
|
|
index, length);
|
|
|
|
address = (address + 4) + index * TYPE_LENGTH (el_type);
|
2004-11-09 Andrew Cagney <cagney@gnu.org>
* value.h (struct value): Delete field bfd_section.
(VALUE_BFD_SECTION): Delete macro.
(COERCE_REF): Update.
(value_at, value_at_lazy): Delete asection parameter.
* printcmd.c (print_formatted, x_command): Update.
(do_examine): Delete asection parameter.
(next_section): Delete variable.
* valops.c (value_cast, value_at, value_at_lazy)
(value_coerce_function, value_addr, value_ind, value_string)
(find_rt_vbase_offset, value_full_object): Update.
* hpacc-abi.c (hpacc_virtual_fn_field)
(hpacc_value_rtti_type): Update.
* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_virtual_fn_field)
(gnuv3_baseclass_offset): Update.
* f-valprint.c (f_val_print): Update.
* c-valprint.c (c_val_print): Update.
* p-valprint.c (pascal_val_print): Update.
* jv-valprint.c (java_value_print): Update.
* jv-lang.c (java_class_from_object, evaluate_subexp_java): Update.
* ada-lang.c (ada_value_primitive_packed_val)
(ada_evaluate_subexp): Update.
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Update.
* expprint.c (print_subexp_standard): Update.
* infcall.c (call_function_by_hand): Update.
* valarith.c (value_add): Update.
* eval.c (evaluate_subexp_standard): Update.
* values.c (allocate_value, value_copy, value_static_field): Update.
* findvar.c (read_var_value, locate_var_value): Update.
2004-11-09 22:43:27 +08:00
|
|
|
return value_at (el_type, address);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
|
|
|
|
{
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
|
|
|
|
else
|
|
|
|
return value_subscript (arg1, arg2);
|
|
|
|
}
|
|
|
|
if (name)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("cannot subscript something of type `%s'"), name);
|
1999-04-16 09:35:26 +08:00
|
|
|
else
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("cannot subscript requested type"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
case OP_STRING:
|
|
|
|
(*pos)++;
|
|
|
|
i = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (i + 1);
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
goto nosideret;
|
|
|
|
return java_value_string (&exp->elts[pc + 2].string, i);
|
|
|
|
|
|
|
|
case STRUCTOP_STRUCT:
|
|
|
|
arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
|
|
|
|
/* Convert object field (such as TYPE.class) to reference. */
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-13 05:45:08 +08:00
|
|
|
if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT)
|
1999-04-16 09:35:26 +08:00
|
|
|
arg1 = value_addr (arg1);
|
|
|
|
return arg1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
standard:
|
|
|
|
return evaluate_subexp_standard (expect_type, exp, pos, noside);
|
1999-07-08 04:19:36 +08:00
|
|
|
nosideret:
|
1999-04-16 09:35:26 +08:00
|
|
|
return value_from_longest (builtin_type_long, (LONGEST) 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct type *
|
2000-07-30 09:48:28 +08:00
|
|
|
java_create_fundamental_type (struct objfile *objfile, int typeid)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
switch (typeid)
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
case FT_VOID:
|
|
|
|
return java_void_type;
|
|
|
|
case FT_BOOLEAN:
|
|
|
|
return java_boolean_type;
|
|
|
|
case FT_CHAR:
|
|
|
|
return java_char_type;
|
|
|
|
case FT_FLOAT:
|
|
|
|
return java_float_type;
|
|
|
|
case FT_DBL_PREC_FLOAT:
|
|
|
|
return java_double_type;
|
|
|
|
case FT_BYTE:
|
|
|
|
case FT_SIGNED_CHAR:
|
|
|
|
return java_byte_type;
|
|
|
|
case FT_SHORT:
|
|
|
|
case FT_SIGNED_SHORT:
|
|
|
|
return java_short_type;
|
|
|
|
case FT_INTEGER:
|
|
|
|
case FT_SIGNED_INTEGER:
|
|
|
|
return java_int_type;
|
|
|
|
case FT_LONG:
|
|
|
|
case FT_SIGNED_LONG:
|
|
|
|
return java_long_type;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return c_create_fundamental_type (objfile, typeid);
|
|
|
|
}
|
|
|
|
|
2003-04-02 11:02:46 +08:00
|
|
|
static char *java_demangle (const char *mangled, int options)
|
|
|
|
{
|
|
|
|
return cplus_demangle (mangled, options | DMGL_JAVA);
|
|
|
|
}
|
|
|
|
|
2004-07-07 03:29:31 +08:00
|
|
|
/* Find the member function name of the demangled name NAME. NAME
|
|
|
|
must be a method name including arguments, in order to correctly
|
|
|
|
locate the last component.
|
|
|
|
|
|
|
|
This function return a pointer to the first dot before the
|
|
|
|
member function name, or NULL if the name was not of the
|
|
|
|
expected form. */
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
java_find_last_component (const char *name)
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
|
|
|
|
/* Find argument list. */
|
|
|
|
p = strchr (name, '(');
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Back up and find first dot prior to argument list. */
|
|
|
|
while (p > name && *p != '.')
|
|
|
|
p--;
|
|
|
|
|
|
|
|
if (p == name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the name of the class containing method PHYSNAME. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
java_class_name_from_physname (const char *physname)
|
|
|
|
{
|
|
|
|
char *ret = NULL;
|
|
|
|
const char *end;
|
|
|
|
int depth = 0;
|
|
|
|
char *demangled_name = java_demangle (physname, DMGL_PARAMS | DMGL_ANSI);
|
|
|
|
|
|
|
|
if (demangled_name == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
end = java_find_last_component (demangled_name);
|
|
|
|
if (end != NULL)
|
|
|
|
{
|
|
|
|
ret = xmalloc (end - demangled_name + 1);
|
|
|
|
memcpy (ret, demangled_name, end - demangled_name);
|
|
|
|
ret[end - demangled_name] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
xfree (demangled_name);
|
|
|
|
return ret;
|
|
|
|
}
|
2003-04-02 11:02:46 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Table mapping opcodes into strings for printing operators
|
|
|
|
and precedences of the operators. */
|
|
|
|
|
|
|
|
const struct op_print java_op_print_tab[] =
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
|
|
|
{",", BINOP_COMMA, PREC_COMMA, 0},
|
|
|
|
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
|
|
|
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
|
|
|
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
|
|
|
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
|
|
|
|
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
|
|
|
|
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
|
|
|
|
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
|
|
|
|
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
|
|
|
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
|
|
|
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
|
|
|
{">", BINOP_GTR, PREC_ORDER, 0},
|
|
|
|
{"<", BINOP_LESS, PREC_ORDER, 0},
|
|
|
|
{">>", BINOP_RSH, PREC_SHIFT, 0},
|
|
|
|
{"<<", BINOP_LSH, PREC_SHIFT, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
#if 0
|
1999-07-08 04:19:36 +08:00
|
|
|
{">>>", BINOP_ ? ? ?, PREC_SHIFT, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
#endif
|
1999-07-08 04:19:36 +08:00
|
|
|
{"+", BINOP_ADD, PREC_ADD, 0},
|
|
|
|
{"-", BINOP_SUB, PREC_ADD, 0},
|
|
|
|
{"*", BINOP_MUL, PREC_MUL, 0},
|
|
|
|
{"/", BINOP_DIV, PREC_MUL, 0},
|
|
|
|
{"%", BINOP_REM, PREC_MUL, 0},
|
|
|
|
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
|
|
|
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
|
|
|
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
|
|
|
|
{"*", UNOP_IND, PREC_PREFIX, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
#if 0
|
1999-07-08 04:19:36 +08:00
|
|
|
{"instanceof", ? ? ?, ? ? ?, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
#endif
|
1999-07-08 04:19:36 +08:00
|
|
|
{"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
|
|
|
|
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
|
|
|
|
{NULL, 0, 0, 0}
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
|
* parser-defs.h (struct exp_descriptor): New definition, containing
language-specific info for printing, prefixifying, dumping, and
evaluating expressions.
(exp_descriptor_standard): Declare new variable.
(print_subexp): Make global and declare here (from expprint.c).
(dump_subexp): Ditto.
(dump_subexp_body_standard): Declare.
(operator_length_standard): Declare.
(op_name_standard): Declare.
(print_subexp): Declare.
(print_subexp_standard): Declare.
* language.h (struct language_defn): Add la_exp_desc field to hold
pointer to table for language-specific operators.
Remove evaluate_exp field, which is now in struct exp_descriptor.
* parse.c (operator_length): Move most code to new
operator_length_standard function. Use language-specific information.
(operator_length_standard): New function taking most code from
operator_length.
(exp_descriptor_standard): New constant.
* expression.h (enum exp_opcode): Add definitions of OP_EXTENDED0
and OP_EXTENDED_LAST.
* expprint.c (print_subexp): Use language-specific print_subexp.
Make global; remove static declaration.
Move most code to print_subexp_standard.
(print_subexp_standard): New function, containing code formerly in
print_subexp.
(op_name): Add expression to argument signature.
Use langauge-specific op_name.
Move most code to op_name_standard.
(op_name_standard): New function, containing code formerly in op_name.
(dump_subexp): Use new version of op_name function.
Use language-specific dump_subexp_body, and move most existing code to
dump_subexp_body_standard.
(dump_raw_expression): Use new op_name interface.
(dump_subexp_body): Move most code to dump_subexp_body_standard.
(dump_subexp_body_standard): New function, containing code formerly
in dump_subexp_body.
* language.c (unknown_language): Add default la_exp_desc field and
remove evaluate_exp field.
(auto_language): Ditto.
(local_language): Ditto.
* f-lang.c (f_language_defn): Ditto.
* c-lang.c (c_language_defn): Ditto.
(cplus_language_defn): Ditto.
(asm_language_defn): Ditto.
(minimal_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* jv-lang.c (exp_descriptor_java): New variable, containing
Java-specific expression evaluator.
(java_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* scm-lang.c (exp_descriptor_scm): New variable, containing
Scheme-specific expression evaluator.
(scm_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* objc-lang.c (print_object_command): Take evaluate_exp from the
la_exp_desc field.
* Makefile.in (eval.o): Add dependency on parser-defs.h.
* eval.c: Include parser-defs.h for the full declaration of
la_exp_desc's type.
(evaluate_subexp): Get evaluate_exp out of la_exp_desc field.
2003-09-25 16:40:45 +08:00
|
|
|
const struct exp_descriptor exp_descriptor_java =
|
|
|
|
{
|
|
|
|
print_subexp_standard,
|
|
|
|
operator_length_standard,
|
|
|
|
op_name_standard,
|
|
|
|
dump_subexp_body_standard,
|
|
|
|
evaluate_subexp_java
|
|
|
|
};
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
const struct language_defn java_language_defn =
|
|
|
|
{
|
|
|
|
"java", /* Language name */
|
1999-04-16 09:35:26 +08:00
|
|
|
language_java,
|
2004-07-28 23:18:08 +08:00
|
|
|
NULL,
|
1999-04-16 09:35:26 +08:00
|
|
|
range_check_off,
|
|
|
|
type_check_off,
|
2000-08-10 Jimmy Guo <guo@cup.hp.com>
* c-lang.c: Set case sensitivity on for c_language_defn,
cplus_language_defn, and asm_language_defn.
* ch-lang.c: Set case sensitivity on for chill_language_defn.
* f-lang.c: Set case sensivitity off for f_language_defn.
* jv-lang.c: Set case sensitivity on for java_language_defn.
* language.h: Add enum case_mode, case_sensitivity.
* language.c: Define case_mode, case_sensitivity. Set case
sensitivity on for unknown_language_defn, auto_language_defn,
and local_language_defn.
(show_case_command,set_case_command,set_case_str): New static func.
(set_type_range_case): New static func, replaces set_type_range ().
(set_language_command,set_type_command,set_range_command,set_language):
Call set_type_range_case ().
(language_info): Print case sensitivity setting.
(_initialize_language): Add set/show commands for 'case-sensitive'.
Set default case mode 'auto'. Set default language 'auto'.
* m2-lang.c: Set case sensitivity on for m2_language_defn.
* p-lang.c: Set case sensitivity on for pascal_language_defn.
* scm-lang.c: Set case sensitivity off for scm_language_defn.
* symtab.c (lookup_symbol): Downcase symbol name if case sensivitity
is off.
2000-08-11 09:02:35 +08:00
|
|
|
case_sensitive_on,
|
2004-08-29 18:12:24 +08:00
|
|
|
array_row_major,
|
* parser-defs.h (struct exp_descriptor): New definition, containing
language-specific info for printing, prefixifying, dumping, and
evaluating expressions.
(exp_descriptor_standard): Declare new variable.
(print_subexp): Make global and declare here (from expprint.c).
(dump_subexp): Ditto.
(dump_subexp_body_standard): Declare.
(operator_length_standard): Declare.
(op_name_standard): Declare.
(print_subexp): Declare.
(print_subexp_standard): Declare.
* language.h (struct language_defn): Add la_exp_desc field to hold
pointer to table for language-specific operators.
Remove evaluate_exp field, which is now in struct exp_descriptor.
* parse.c (operator_length): Move most code to new
operator_length_standard function. Use language-specific information.
(operator_length_standard): New function taking most code from
operator_length.
(exp_descriptor_standard): New constant.
* expression.h (enum exp_opcode): Add definitions of OP_EXTENDED0
and OP_EXTENDED_LAST.
* expprint.c (print_subexp): Use language-specific print_subexp.
Make global; remove static declaration.
Move most code to print_subexp_standard.
(print_subexp_standard): New function, containing code formerly in
print_subexp.
(op_name): Add expression to argument signature.
Use langauge-specific op_name.
Move most code to op_name_standard.
(op_name_standard): New function, containing code formerly in op_name.
(dump_subexp): Use new version of op_name function.
Use language-specific dump_subexp_body, and move most existing code to
dump_subexp_body_standard.
(dump_raw_expression): Use new op_name interface.
(dump_subexp_body): Move most code to dump_subexp_body_standard.
(dump_subexp_body_standard): New function, containing code formerly
in dump_subexp_body.
* language.c (unknown_language): Add default la_exp_desc field and
remove evaluate_exp field.
(auto_language): Ditto.
(local_language): Ditto.
* f-lang.c (f_language_defn): Ditto.
* c-lang.c (c_language_defn): Ditto.
(cplus_language_defn): Ditto.
(asm_language_defn): Ditto.
(minimal_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* jv-lang.c (exp_descriptor_java): New variable, containing
Java-specific expression evaluator.
(java_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* scm-lang.c (exp_descriptor_scm): New variable, containing
Scheme-specific expression evaluator.
(scm_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* objc-lang.c (print_object_command): Take evaluate_exp from the
la_exp_desc field.
* Makefile.in (eval.o): Add dependency on parser-defs.h.
* eval.c: Include parser-defs.h for the full declaration of
la_exp_desc's type.
(evaluate_subexp): Get evaluate_exp out of la_exp_desc field.
2003-09-25 16:40:45 +08:00
|
|
|
&exp_descriptor_java,
|
1999-04-16 09:35:26 +08:00
|
|
|
java_parse,
|
|
|
|
java_error,
|
2004-04-11 06:10:01 +08:00
|
|
|
null_post_parser,
|
1999-04-16 09:35:26 +08:00
|
|
|
c_printchar, /* Print a character constant */
|
|
|
|
c_printstr, /* Function to print string constant */
|
|
|
|
java_emit_char, /* Function to print a single character */
|
|
|
|
java_create_fundamental_type, /* Create fundamental type in this language */
|
|
|
|
java_print_type, /* Print a type using appropriate syntax */
|
|
|
|
java_val_print, /* Print a value using appropriate syntax */
|
|
|
|
java_value_print, /* Print a top-level value */
|
2003-03-26 11:39:44 +08:00
|
|
|
NULL, /* Language specific skip_trampoline */
|
2003-05-20 09:55:18 +08:00
|
|
|
value_of_this, /* value_of_this */
|
|
|
|
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
|
2004-01-24 07:03:31 +08:00
|
|
|
basic_lookup_transparent_type,/* lookup_transparent_type */
|
2003-04-02 11:02:46 +08:00
|
|
|
java_demangle, /* Language specific symbol demangler */
|
2004-07-07 03:29:31 +08:00
|
|
|
java_class_name_from_physname,/* Language specific class name */
|
1999-04-16 09:35:26 +08:00
|
|
|
java_op_print_tab, /* expression operators for printing */
|
|
|
|
0, /* not c-style arrays */
|
|
|
|
0, /* String lower bound */
|
2004-07-28 23:18:08 +08:00
|
|
|
NULL,
|
2003-10-07 06:38:03 +08:00
|
|
|
default_word_break_characters,
|
2004-07-28 23:18:08 +08:00
|
|
|
c_language_arch_info,
|
2005-10-04 05:21:20 +08:00
|
|
|
default_print_array_index,
|
1999-04-16 09:35:26 +08:00
|
|
|
LANG_MAGIC
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
_initialize_java_language (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
java_int_type = init_type (TYPE_CODE_INT, 4, 0, "int", NULL);
|
|
|
|
java_short_type = init_type (TYPE_CODE_INT, 2, 0, "short", NULL);
|
|
|
|
java_long_type = init_type (TYPE_CODE_INT, 8, 0, "long", NULL);
|
|
|
|
java_byte_type = init_type (TYPE_CODE_INT, 1, 0, "byte", NULL);
|
|
|
|
java_boolean_type = init_type (TYPE_CODE_BOOL, 1, 0, "boolean", NULL);
|
|
|
|
java_char_type = init_type (TYPE_CODE_CHAR, 2, TYPE_FLAG_UNSIGNED, "char", NULL);
|
|
|
|
java_float_type = init_type (TYPE_CODE_FLT, 4, 0, "float", NULL);
|
|
|
|
java_double_type = init_type (TYPE_CODE_FLT, 8, 0, "double", NULL);
|
|
|
|
java_void_type = init_type (TYPE_CODE_VOID, 1, 0, "void", NULL);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
add_language (&java_language_defn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Cleanup code that should be run on every "run".
|
|
|
|
We should use make_run_cleanup to have this be called.
|
|
|
|
But will that mess up values in value histry? FIXME */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
extern void java_rerun_cleanup (void);
|
1999-05-26 02:09:09 +08:00
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
java_rerun_cleanup (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (class_symtab != NULL)
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
free_symtab (class_symtab); /* ??? */
|
1999-04-16 09:35:26 +08:00
|
|
|
class_symtab = NULL;
|
|
|
|
}
|
|
|
|
if (dynamics_objfile != NULL)
|
|
|
|
{
|
|
|
|
free_objfile (dynamics_objfile);
|
|
|
|
dynamics_objfile = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
java_object_type = NULL;
|
|
|
|
}
|