This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
(patch) hpjyg11: hp-symtab-read.c & related
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: (patch) hpjyg11: hp-symtab-read.c & related
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Fri, 5 Nov 1999 12:57:57 -0800 (PST)
***
Patch dependencies: hpjyg10 (include/hp-symtab.h)
hpjyg06 (gdb/hpread.h)
hpjyg05 (gdb/objfiles.c)
hpjyg03 (gdb/buildsym.[ch])
***
This patch provides enhancements / fixes in hp-symtab-read.c.
ChangeLog:
1999-11-04 Jimmy Guo <guo@cup.hp.com>
* hp-symtab-read.c: Add include language.h, need
current_language declaration from it; use INDEX macro (defined
in hpread.h).
(static_analysis_warning,current_compilation_directory,
current_symtab_language): New static variables.
(hpread_has_name): DNTT_TYPE_COMMON has a name associated with it.
(hpread_expand_symtab): Set symtab language if known.
(hpread_ftn_string_type): New function.
(hpread_type_translate): Convert HP_TYPE_BOOLEAN_VAX_COMPAT to
more precies GDB internal types corresponding to Fortran
logical*2 *4 *8 types; add DNTT_TYPE_XREF DNTT_TYPE_SA handling
-- prints warning message and returns FT_VOID.
(hpread_language_type): New function.
(hpread_read_function_type): Add HP Fortran support; add
local_list to free_pendings if not creating new block.
(hpread_read_doc_function_type): Add HP Fortran support.
(hpread_read_struct_type): Fix field length test to handle
case like bitlength is 24, etc; update any const/volatile
variants of the type when copying the field list to symbol
table.
(hpread_read_array_type,hpread_read_subrange_type): Add HP
Fortran support.
(hpread_type_lookup): If hp type is HP_TYPE_FTN_STRING_SPEC,
return hpread_ftn_string_type(hp_type); Adjust member function
pointer to 3 words long for HP aCC.
(hpread_process_one_debug_symbol): prevent leak by using
get_symbol() instead of always allocating symbol from
symbol_obstack (and not using them); shared library / Fortran /
Fortran 90 related enhancements.
(get_symbol): New function.
(hpread_get_scope_depth): Added a check to see if we are looking
beyond the start of the globals in the LNTT so we can return
immediately in this case, to avoid long startup time.
* objfiles.c (find_import_entry): New function.
* gdbtypes.h (BOUND_BY_VARIABLE,TYPE_ARRAY_HIGH_BOUND_TYPE,
TYPE_ARRAY_LOW_BOUND_TYPE): Define.
* buildsym.h (processing_hp_compilation): Removed.
Index: gdb/hp-symtab-read.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/hp-symtab-read.c gdb/hp-symtab-read.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/hp-symtab-read.c Thu Nov 4 13:55:02 1999
--- gdb/hp-symtab-read.c Fri Nov 5 11:07:53 1999
***************
*** 27,39 ****
--- 27,48 ----
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
+ #include "language.h"
#include "hpread.h"
#include "demangle.h"
#include "complaints.h"
+
+ /* External declarations */
+ /* *INDENT-OFF* */
+ extern
+ boolean (*permanent_copy_exists) PARAMS ((struct objfile * objfile,
+ char *string));
+ /* *INDENT-ON* */
+
static struct complaint hpread_unhandled_end_common_complaint =
{
"unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0
***************
*** 83,89 ****
/* Forward procedure declarations */
! static unsigned long hpread_get_scope_start
PARAMS ((sltpointer, struct objfile *));
static unsigned long hpread_get_line
--- 92,98 ----
/* Forward procedure declarations */
! static CORE_ADDR hpread_get_scope_start
PARAMS ((sltpointer, struct objfile *));
static unsigned long hpread_get_line
***************
*** 147,153 ****
static void hpread_process_one_debug_symbol
PARAMS ((union dnttentry *, char *, struct section_offsets *,
! struct objfile *, CORE_ADDR, int, char *, int, int *));
static int hpread_get_scope_depth
PARAMS ((union dnttentry *, struct objfile *, int));
--- 156,162 ----
static void hpread_process_one_debug_symbol
PARAMS ((union dnttentry *, char *, struct section_offsets *,
! struct objfile *, CORE_ADDR, int, char *, int, int *, int));
static int hpread_get_scope_depth
PARAMS ((union dnttentry *, struct objfile *, int));
***************
*** 175,186 ****
/* Static used to indicate the method type that is to be
used to fix-up the type for fixup_class */
static struct type *fixup_method = NULL;
/* Get the nesting depth for the source line identified by INDEX. */
! static unsigned long
hpread_get_scope_start (index, objfile)
sltpointer index;
struct objfile *objfile;
--- 184,204 ----
/* Static used to indicate the method type that is to be
used to fix-up the type for fixup_class */
static struct type *fixup_method = NULL;
+
+ static int static_analysis_warning = 0;
+ /* RM: static holding the compilation directory for the current
+ * symtab. Currently only set by DOOM psymtabs
+ */
+ static void *current_compilation_directory = NULL;
+
+ /* static holding the language for the language for the current symtab */
+ static enum language current_symtab_language = language_unknown;
/* Get the nesting depth for the source line identified by INDEX. */
! static CORE_ADDR
hpread_get_scope_start (index, objfile)
sltpointer index;
struct objfile *objfile;
***************
*** 188,194 ****
union sltentry *sl_bufp;
sl_bufp = hpread_get_slt (index, objfile);
! return sl_bufp->sspec.backptr.dnttp.index;
}
/* Get the source line number the the line identified by INDEX. */
--- 206,212 ----
union sltentry *sl_bufp;
sl_bufp = hpread_get_slt (index, objfile);
! return INDEX (objfile, sl_bufp->sspec.backptr.dnttp);
}
/* Get the source line number the the line identified by INDEX. */
***************
*** 268,273 ****
--- 286,292 ----
case DNTT_TYPE_TAGDEF:
case DNTT_TYPE_MEMENUM:
case DNTT_TYPE_FIELD:
+ case DNTT_TYPE_COMMON:
case DNTT_TYPE_SA:
case DNTT_TYPE_BLOCKDATA:
case DNTT_TYPE_MEMFUNC:
***************
*** 287,293 ****
case DNTT_TYPE_FUNCTYPE:
case DNTT_TYPE_SUBRANGE:
case DNTT_TYPE_WITH:
- case DNTT_TYPE_COMMON:
case DNTT_TYPE_COBSTRUCT:
case DNTT_TYPE_XREF:
case DNTT_TYPE_MACRO:
--- 306,311 ----
***************
*** 402,407 ****
--- 420,428 ----
the processing_acc_compilation variable is declared in the
file buildsym.h, the HP_COMPILED_TARGET is defined to be equal
to 3 in the file tm_hppa.h */
+ /* guo: processing_hp_compilation was subsequently removed, and it
+ appears that we set processing_gcc_compilation to 0 to achieve the
+ same. */
processing_gcc_compilation = 0;
***************
*** 454,459 ****
--- 475,481 ----
unsigned max_symnum;
int at_module_boundary = 0;
/* 1 => at end, -1 => at beginning */
+ struct symtab *s;
int sym_index = sym_offset / sizeof (struct dntt_type_block);
***************
*** 461,466 ****
--- 483,489 ----
subfile_stack = 0;
last_source_file = 0;
+ current_symtab_language = language_unknown;
/* Demangling style -- if EDG style already set, don't change it,
as HP style causes some problems with the KAI EDG compiler */
***************
*** 514,521 ****
hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets,
objfile, text_offset, text_size,
filename, symnum + sym_index,
! &at_module_boundary
! );
/* OLD COMMENTS: This routine is only called for psts. All psts
* correspond to MODULES. If we ever do lazy-reading of globals
--- 537,543 ----
hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets,
objfile, text_offset, text_size,
filename, symnum + sym_index,
! &at_module_boundary, 0);
/* OLD COMMENTS: This routine is only called for psts. All psts
* correspond to MODULES. If we ever do lazy-reading of globals
***************
*** 543,553 ****
current_objfile = NULL;
hp_som_som_object_present = 1; /* Indicate we've processed an HP SOM SOM file */
! return end_symtab (text_offset + text_size, objfile, 0);
}
/* Convert basic types from HP debug format into GDB internal format. */
--- 565,592 ----
current_objfile = NULL;
hp_som_som_object_present = 1; /* Indicate we've processed an HP SOM SOM file */
! s = end_symtab (text_offset + text_size, objfile, 0);
! if (s && current_symtab_language != language_unknown)
! s->language = current_symtab_language;
! return s;
}
+ /* Convert a fortran string type into GDB internal format */
+ static struct type *
+ hpread_ftn_string_type (typep)
+ dnttpointer typep;
+ {
+ unsigned long len = typep.dntti.bitlength / 8;
+ int lowbound = current_language->string_lower_bound;
+ struct type *rangetype = create_range_type ((struct type *) NULL,
+ builtin_type_int,
+ lowbound, len + lowbound - 1);
+ struct type *stringtype
+ = create_string_type ((struct type *) NULL, rangetype);
+ return stringtype;
+ }
/* Convert basic types from HP debug format into GDB internal format. */
***************
*** 566,572 ****
case HP_TYPE_BOOLEAN:
case HP_TYPE_BOOLEAN_S300_COMPAT:
case HP_TYPE_BOOLEAN_VAX_COMPAT:
! return FT_BOOLEAN;
case HP_TYPE_CHAR: /* C signed char, C++ plain char */
case HP_TYPE_WIDE_CHAR:
--- 605,617 ----
case HP_TYPE_BOOLEAN:
case HP_TYPE_BOOLEAN_S300_COMPAT:
case HP_TYPE_BOOLEAN_VAX_COMPAT:
! if (typep.dntti.bitlength <= 8)
! return FT_BOOLEAN;
! if (typep.dntti.bitlength <= 16) /* Fortran logical*2 */
! return FT_UNSIGNED_SHORT;
! if (typep.dntti.bitlength <= 32) /* Fortran logical*4 */
! return FT_UNSIGNED_INTEGER;
! return FT_UNSIGNED_LONG_LONG; /* Fortran logical*8 */
case HP_TYPE_CHAR: /* C signed char, C++ plain char */
case HP_TYPE_WIDE_CHAR:
***************
*** 618,624 ****
return FT_VOID;
case HP_TYPE_STRING200:
case HP_TYPE_LONGSTRING200:
- case HP_TYPE_FTN_STRING_SPEC:
case HP_TYPE_MOD_STRING_SPEC:
case HP_TYPE_MOD_STRING_3000:
case HP_TYPE_FTN_STRING_S300_COMPAT:
--- 663,668 ----
***************
*** 626,631 ****
--- 670,683 ----
return FT_STRING;
case HP_TYPE_TEMPLATE_ARG:
return FT_TEMPLATE_ARG;
+ case DNTT_TYPE_XREF:
+ case DNTT_TYPE_SA:
+ if (!static_analysis_warning)
+ {
+ warning ("Static analysis is not supported");
+ static_analysis_warning = 1;
+ }
+ return FT_VOID;
case HP_TYPE_TEXT:
case HP_TYPE_FLABEL:
case HP_TYPE_PACKED_DECIMAL:
***************
*** 633,639 ****
case HP_TYPE_GLOBAL_ANYPOINTER:
case HP_TYPE_LOCAL_ANYPOINTER:
default:
! warning ("hpread_type_translate: unhandled type code.\n");
return FT_VOID;
}
}
--- 685,692 ----
case HP_TYPE_GLOBAL_ANYPOINTER:
case HP_TYPE_LOCAL_ANYPOINTER:
default:
! warning ("hpread_type_translate: unhandled type code %d.\n",
! typep.dntti.type);
return FT_VOID;
}
}
***************
*** 649,655 ****
struct objfile *objfile;
{
unsigned old_len;
! int index = hp_type.dnttp.index;
int size_changed = 0;
/* The immediate flag indicates this doesn't actually point to
--- 702,708 ----
struct objfile *objfile;
{
unsigned old_len;
! int index = INDEX (objfile, hp_type.dnttp);
int size_changed = 0;
/* The immediate flag indicates this doesn't actually point to
***************
*** 699,708 ****
sizeof (struct type *));
}
! /* See if we need to resize type-vector. With my change to
! * initially allocate a correct-size type-vector, this code
! * should no longer trigger.
! */
while (index >= TYPE_VECTOR_LENGTH (objfile))
{
TYPE_VECTOR_LENGTH (objfile) *= 2;
--- 752,759 ----
sizeof (struct type *));
}
! /* See if we need to resize type-vector. */
!
while (index >= TYPE_VECTOR_LENGTH (objfile))
{
TYPE_VECTOR_LENGTH (objfile) *= 2;
***************
*** 797,810 ****
mem = dn_bufp->denum.firstmem;
while (mem.word && mem.word != DNTTNIL)
{
! memp = hpread_get_lntt (mem.dnttp.index, objfile);
name = VT (objfile) + memp->dmember.name;
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
! SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
! &objfile->symbol_obstack);
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_VALUE (sym) = memp->dmember.value;
--- 848,860 ----
mem = dn_bufp->denum.firstmem;
while (mem.word && mem.word != DNTTNIL)
{
! memp = hpread_get_lntt (INDEX (objfile, mem.dnttp), objfile);
name = VT (objfile) + memp->dmember.name;
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
! SYMBOL_NAME (sym) = name; /* JAGaa80452 */
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_VALUE (sym) = memp->dmember.value;
***************
*** 848,853 ****
--- 898,927 ----
return type;
}
+ /* Determine gdb equivalent of hp language type */
+
+ static enum language
+ hpread_language_type (enum hp_language hp_lang)
+ {
+ switch (hp_lang)
+ {
+ case HP_LANGUAGE_UNKNOWN:
+ return language_unknown;
+
+ case HP_LANGUAGE_C:
+ return language_c;
+
+ case HP_LANGUAGE_FORTRAN:
+ return language_fortran;
+
+ case HP_LANGUAGE_CPLUSPLUS:
+ return language_cplus;
+
+ default:
+ return language_auto;
+ }
+ }
+
/* Read and internalize a native function debug symbol. */
static struct type *
***************
*** 867,872 ****
--- 941,948 ----
long n;
struct symbol *sym;
int record_args = 1;
+ enum language lang = hpread_language_type (dn_bufp->dfunc.language);
+ union dnttentry *dn_tmp;
/* See if we've already read in this type. */
type = hpread_alloc_type (hp_type, objfile);
***************
*** 878,886 ****
{
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTION ||
! dn_bufp->dblock.kind == DNTT_TYPE_MEMFUNC)
! type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc.retval,
! objfile));
else if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTYPE)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval,
objfile));
--- 954,970 ----
{
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTION ||
! dn_bufp->dblock.kind == DNTT_TYPE_MEMFUNC ||
! dn_bufp->dblock.kind == DNTT_TYPE_ENTRY)
! /* FORTRAN subroutines can have DNTTNIL return types so we need to
! special case them or else call to hpread_type_lookup will issue
! an "unhandled type code" warning for the return type
! */
! if (lang == language_fortran && dn_bufp->dfunc.retval.word == DNTTNIL)
! type1 = lookup_function_type (lookup_fundamental_type (objfile, FT_VOID));
! else
! type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc.retval,
! objfile));
else if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTYPE)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval,
objfile));
***************
*** 898,910 ****
if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_MEMFUNC)
param = dn_bufp->dfunc.firstparam;
else if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTYPE)
param = dn_bufp->dfunctype.firstparam;
else /* expect DNTT_TYPE_FUNC_TEMPLATE */
param = dn_bufp->dfunc_template.firstparam;
while (param.word && param.word != DNTTNIL)
{
! paramp = hpread_get_lntt (param.dnttp.index, objfile);
nsyms++;
param = paramp->dfparam.nextparam;
--- 982,997 ----
if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_MEMFUNC)
param = dn_bufp->dfunc.firstparam;
+ else if (dn_bufp->dblock.kind == DNTT_TYPE_ENTRY)
+ param = dn_bufp->dentry.firstparam;
else if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTYPE)
param = dn_bufp->dfunctype.firstparam;
else /* expect DNTT_TYPE_FUNC_TEMPLATE */
param = dn_bufp->dfunc_template.firstparam;
+
while (param.word && param.word != DNTTNIL)
{
! paramp = hpread_get_lntt (INDEX (objfile, param.dnttp), objfile);
nsyms++;
param = paramp->dfparam.nextparam;
***************
*** 913,920 ****
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
! SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
! &objfile->symbol_obstack);
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
--- 1000,1007 ----
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
! SYMBOL_NAME (sym) = name;
! SYMBOL_LANGUAGE (sym) = lang;
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
***************
*** 938,952 ****
to be highighted as a special case, but for now, just
allowing these to be LOC_ARGs seems to work fine.
*/
! #if 0
! SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
! #endif
}
else
SYMBOL_VALUE (sym) = paramp->dfparam.location;
/* Get its type. */
SYMBOL_TYPE (sym) = hpread_type_lookup (paramp->dfparam.type, objfile);
/* Add it to the symbol list. */
/* Note 1 (RT) At the moment, add_symbol_to_list() is also being
* called on FPARAM symbols from the process_one_debug_symbol()
--- 1025,1088 ----
to be highighted as a special case, but for now, just
allowing these to be LOC_ARGs seems to work fine.
*/
! /* coulter 08/13/99 - On PA64, FRAME_ARGS_ADDRESS is ((fi)->ap)
! as opposed to ((fi)->frame) which is used on PA32. Since the
! adjusted value is an offset from the frame pointer and not
! the args pointer, we need to change the symbol class to something
! that is relative to fp.
! */
! SYMBOL_CLASS (sym) = LOC_LOCAL_ARG;
}
else
SYMBOL_VALUE (sym) = paramp->dfparam.location;
/* Get its type. */
SYMBOL_TYPE (sym) = hpread_type_lookup (paramp->dfparam.type, objfile);
+
+ /* Fortran strings have their length passed on stack at
+ runtime. dfparam.misc gives the offset of this value relative
+ to the current frame, or a dntt pointer to the DVAR that has
+ the offset, depending on the dfparm.misc_kind value. Set this
+ offset into the UPPER_BOUND_VALUE for the type.
+ */
+ if (lang == language_fortran
+ && paramp->dfparam.misc)
+ {
+ struct type *tmp_type = SYMBOL_TYPE (sym);
+ /* it could be a array of strings so get the element type */
+ while (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
+ tmp_type = TYPE_TARGET_TYPE (tmp_type);
+ /* we should end up with a string */
+ if (TYPE_CODE (tmp_type) != TYPE_CODE_STRING)
+ {
+ warning ("unsupported parameter type for %s", SYMBOL_NAME (sym));
+ }
+ else
+ {
+ TYPE_ARRAY_UPPER_BOUND_TYPE (tmp_type) = BOUND_BY_VALUE_ON_STACK;
+ if (paramp->dfparam.misc_kind == 0)
+ {
+ TYPE_ARRAY_UPPER_BOUND_VALUE (tmp_type) = paramp->dfparam.misc;
+ }
+ else if (paramp->dfparam.misc_kind == 1)
+ {
+ dn_tmp = hpread_get_lntt (paramp->dfparam.misc, objfile);
+ TYPE_ARRAY_UPPER_BOUND_VALUE (tmp_type) = dn_tmp->ddvar.location;
+ TYPE_ARRAY_HIGH_BOUND_TYPE (tmp_type)
+ = hpread_type_lookup (dn_tmp->ddvar.type, objfile);
+ #ifdef HPREAD_ADJUST_STACK_ADDRESS
+ TYPE_ARRAY_UPPER_BOUND_VALUE (tmp_type)
+ += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
+ #endif
+ }
+ else
+ {
+ warning ("unsupported misc_kind (%d) in string %s ",
+ paramp->dfparam.misc_kind, SYMBOL_NAME (sym));
+ }
+ }
+ }
+
/* Add it to the symbol list. */
/* Note 1 (RT) At the moment, add_symbol_to_list() is also being
* called on FPARAM symbols from the process_one_debug_symbol()
***************
*** 983,988 ****
--- 1119,1126 ----
TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack,
sizeof (struct field) * nsyms);
+ /* Note: The param symbols were already allocated on the obstack; maybe this
+ allocation of type fields again on the obstack can be avoided? pai/1997-12-10 */
/* Find the symbols for the parameters and
use them to fill parameter-type information into the function-type.
***************
*** 1025,1030 ****
--- 1163,1171 ----
finish:
if (newblock)
param_symbols = local_list;
+ else
+ /* srikanth, 990310, JAGaa80452 : dam(n) the leak ! */
+ add_free_pendings (local_list);
return type;
}
***************
*** 1043,1049 ****
struct objfile *objfile;
int newblock;
{
! struct type *type, *type1;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
--- 1184,1190 ----
struct objfile *objfile;
int newblock;
{
! struct type *type, *type1 = NULL;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
***************
*** 1065,1072 ****
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
! type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
! objfile));
memcpy ((char *) type, (char *) type1, sizeof (struct type));
/* Mark it -- in the middle of processing */
--- 1206,1221 ----
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
! /* FORTRAN subroutines can have DNTTNIL return types so we need to
! * special case them or else call to hpread_type_lookup will issue
! * an "unhandled type code" warning for the return type
! */
! if (hpread_language_type (dn_bufp->dfunc.language) == language_fortran
! && dn_bufp->dfunc.retval.word == DNTTNIL)
! type1 = lookup_function_type (lookup_fundamental_type (objfile, FT_VOID));
! else
! type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
! objfile));
memcpy ((char *) type, (char *) type1, sizeof (struct type));
/* Mark it -- in the middle of processing */
***************
*** 1080,1086 ****
param = dn_bufp->ddocfunc.firstparam;
while (param.word && param.word != DNTTNIL)
{
! paramp = hpread_get_lntt (param.dnttp.index, objfile);
nsyms++;
param = paramp->dfparam.nextparam;
--- 1229,1235 ----
param = dn_bufp->ddocfunc.firstparam;
while (param.word && param.word != DNTTNIL)
{
! paramp = hpread_get_lntt (INDEX (objfile, param.dnttp), objfile);
nsyms++;
param = paramp->dfparam.nextparam;
***************
*** 1116,1121 ****
--- 1265,1277 ----
#if 0
SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
#endif
+ /* coulter 08/13/99 - On PA64, FRAME_ARGS_ADDRESS is ((fi)->ap)
+ as opposed to ((fi)->frame) which is used on PA32. Since the
+ adjusted value is an offset from the frame pointer and not
+ the args pointer, we need to change the symbol class to something
+ that is relative to fp.
+ */
+ SYMBOL_CLASS (sym) = LOC_LOCAL_ARG;
}
else
SYMBOL_VALUE (sym) = paramp->dfparam.location;
***************
*** 1270,1276 ****
struct type *t;
};
! struct type *type;
struct type *baseclass;
struct type *memtype;
struct nextfield *list = 0, *tmp_list = 0;
--- 1426,1432 ----
struct type *t;
};
! struct type *type, *vtype;
struct type *baseclass;
struct type *memtype;
struct nextfield *list = 0, *tmp_list = 0;
***************
*** 1356,1362 ****
parent = dn_bufp->dclass.parentlist;
while (parent.word && parent.word != DNTTNIL)
{
! parentp = hpread_get_lntt (parent.dnttp.index, objfile);
/* "parentp" should point to a DNTT_TYPE_INHERITANCE record */
--- 1512,1518 ----
parent = dn_bufp->dclass.parentlist;
while (parent.word && parent.word != DNTTNIL)
{
! parentp = hpread_get_lntt (INDEX (objfile, parent.dnttp), objfile);
/* "parentp" should point to a DNTT_TYPE_INHERITANCE record */
***************
*** 1429,1435 ****
while (field.word && field.word != DNTTNIL)
{
/* Get this template argument */
! fieldp = hpread_get_lntt (field.dnttp.index, objfile);
if (fieldp->dblock.kind != DNTT_TYPE_TEMPLATE_ARG)
{
warning ("Invalid debug info: Template argument entry is of wrong kind");
--- 1585,1591 ----
while (field.word && field.word != DNTTNIL)
{
/* Get this template argument */
! fieldp = hpread_get_lntt (INDEX (objfile, field.dnttp), objfile);
if (fieldp->dblock.kind != DNTT_TYPE_TEMPLATE_ARG)
{
warning ("Invalid debug info: Template argument entry is of wrong kind");
***************
*** 1474,1480 ****
while (field.word && field.word != DNTTNIL)
{
! fieldp = hpread_get_lntt (field.dnttp.index, objfile);
/* At this point "fieldp" may point to either a DNTT_TYPE_FIELD
* or a DNTT_TYPE_GENFIELD record.
--- 1630,1636 ----
while (field.word && field.word != DNTTNIL)
{
! fieldp = hpread_get_lntt (INDEX (objfile, field.dnttp), objfile);
/* At this point "fieldp" may point to either a DNTT_TYPE_FIELD
* or a DNTT_TYPE_GENFIELD record.
***************
*** 1493,1499 ****
/* Follow a link to get to the record for the field. */
fn_field = fieldp->dgenfield.field;
! fn_fieldp = hpread_get_lntt (fn_field.dnttp.index, objfile);
/* Virtual funcs are indicated by a VFUNC which points to the
* real entry
--- 1649,1656 ----
/* Follow a link to get to the record for the field. */
fn_field = fieldp->dgenfield.field;
! fn_fieldp = hpread_get_lntt (INDEX (objfile, fn_field.dnttp),
! objfile);
/* Virtual funcs are indicated by a VFUNC which points to the
* real entry
***************
*** 1502,1508 ****
{
vtbl_offset = fn_fieldp->dvfunc.vtbl_offset;
fn_field = fn_fieldp->dvfunc.funcptr;
! fn_fieldp = hpread_get_lntt (fn_field.dnttp.index, objfile);
}
/* A function's entry may be preceded by a modifier which
--- 1659,1666 ----
{
vtbl_offset = fn_fieldp->dvfunc.vtbl_offset;
fn_field = fn_fieldp->dvfunc.funcptr;
! fn_fieldp = hpread_get_lntt (INDEX (objfile, fn_field.dnttp),
! objfile);
}
/* A function's entry may be preceded by a modifier which
***************
*** 1514,1520 ****
const_member = fn_fieldp->dmodifier.m_const;
volatile_member = fn_fieldp->dmodifier.m_volatile;
fn_field = fn_fieldp->dmodifier.type;
! fn_fieldp = hpread_get_lntt (fn_field.dnttp.index, objfile);
}
/* Check whether we have a method */
--- 1672,1679 ----
const_member = fn_fieldp->dmodifier.m_const;
volatile_member = fn_fieldp->dmodifier.m_volatile;
fn_field = fn_fieldp->dmodifier.type;
! fn_fieldp = hpread_get_lntt (INDEX (objfile, fn_field.dnttp),
! objfile);
}
/* Check whether we have a method */
***************
*** 1562,1567 ****
--- 1721,1727 ----
char *op_string = strstr (tmp_name, "operator");
method_name = xmalloc (strlen (op_string) + 1); /* don't overwrite VT! */
strcpy (method_name, op_string);
+ free (tmp_name); /* srikanth, 990310, JAGaa80452 */
}
/* First check if a method of the same name has already been seen. */
***************
*** 1755,1768 ****
--- 1915,1952 ----
list->field.name = VT (objfile) + fn_fieldp->dfield.name;
FIELD_BITPOS (list->field) = fn_fieldp->dfield.bitoffset;
+
+ /* RM: The following test is okay if bitlength is 8, 16 or 32,
+ * but not if bitlength is 24. Replaced with test below.
+ */
+ #if 0
if (fn_fieldp->dfield.bitlength % 8)
list->field.bitsize = fn_fieldp->dfield.bitlength;
else
list->field.bitsize = 0;
+ #endif
memtype = hpread_type_lookup (fn_fieldp->dfield.type, objfile);
+
+ /* RM: Is the length of the field equal to the length of
+ * the underlying type?
+ */
+ if (is_integral_type (memtype) &&
+ (memtype->length * 8 != fn_fieldp->dfield.bitlength))
+ list->field.bitsize = fn_fieldp->dfield.bitlength;
+ else
+ list->field.bitsize = 0;
+
list->field.type = memtype;
list->attributes = 0;
+
+ /* coulter: a FIELD may still have staticMem set */
+ if (fn_fieldp->dfield.staticmem)
+ {
+ FIELD_BITSIZE (list->field) = -1; /* indicates static member */
+ SET_FIELD_PHYSNAME (list->field, 0); /* initialize to empty */
+ }
+
switch (fn_fieldp->dfield.visibility)
{
case 1:
***************
*** 1856,1872 ****
/* A FIELD by itself (without a GENFIELD) can also be a static member */
if (fieldp->dfield.staticmem)
{
! FIELD_BITPOS (list->field) = -1;
! FIELD_BITSIZE (list->field) = 0;
}
else
/* Non-static data member */
{
FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
if (fieldp->dfield.bitlength % 8)
FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
else
FIELD_BITSIZE (list->field) = 0;
}
memtype = hpread_type_lookup (fieldp->dfield.type, objfile);
--- 2040,2075 ----
/* A FIELD by itself (without a GENFIELD) can also be a static member */
if (fieldp->dfield.staticmem)
{
! FIELD_BITSIZE (list->field) = -1; /* indicates static member
! value defined by physname
! */
! SET_FIELD_PHYSNAME (list->field, 0); /* initialize to empty */
}
else
/* Non-static data member */
{
FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
+
+ /* RM: The following test is okay if bitlength is 8, 16 or 32,
+ * but not if bitlength is 24. Replaced with test below.
+ */
+ #if 0
if (fieldp->dfield.bitlength % 8)
FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
else
FIELD_BITSIZE (list->field) = 0;
+ #endif
+
+ memtype = hpread_type_lookup (fieldp->dfield.type, objfile);
+
+ /* RM: Is the length of the field equal to the length of
+ * the underlying type?
+ */
+ if (is_integral_type (memtype) &&
+ (memtype->length * 8 != fieldp->dfield.bitlength))
+ list->field.bitsize = fieldp->dfield.bitlength;
+ else
+ FIELD_BITSIZE (list->field) = 0;
}
memtype = hpread_type_lookup (fieldp->dfield.type, objfile);
***************
*** 1904,1911 ****
else
{
/* neither field nor genfield ?? is this possible?? */
! /* pai:: FIXME walk to the next -- how? */
! warning ("Internal error: unexpected DNTT kind %d encountered as field of struct");
warning ("Skipping remaining fields of struct");
break; /* get out of loop of fields */
}
--- 2107,2115 ----
else
{
/* neither field nor genfield ?? is this possible?? */
! /* FIXME Ideally, we should walk to the next field and re-sync, but how? */
! warning ("Internal error: unexpected DNTT kind %d encountered as field of struct",
! fieldp->dblock.kind);
warning ("Skipping remaining fields of struct");
break; /* get out of loop of fields */
}
***************
*** 1918,1924 ****
field = dn_bufp->dtemplate.expansions;
while (field.word && field.word != DNTTNIL)
{
! fieldp = hpread_get_lntt (field.dnttp.index, objfile);
/* The expansions or nextexp should point to a tagdef */
if (fieldp->dblock.kind != DNTT_TYPE_TAGDEF)
--- 2122,2128 ----
field = dn_bufp->dtemplate.expansions;
while (field.word && field.word != DNTTNIL)
{
! fieldp = hpread_get_lntt (INDEX (objfile, field.dnttp), objfile);
/* The expansions or nextexp should point to a tagdef */
if (fieldp->dblock.kind != DNTT_TYPE_TAGDEF)
***************
*** 1932,1938 ****
/* And the "type" field of that should point to a class */
field = fieldp->dtag.type;
! fieldp = hpread_get_lntt (field.dnttp.index, objfile);
if (fieldp->dblock.kind != DNTT_TYPE_CLASS)
break;
--- 2136,2142 ----
/* And the "type" field of that should point to a class */
field = fieldp->dtag.type;
! fieldp = hpread_get_lntt (INDEX (objfile, field.dnttp), objfile);
if (fieldp->dblock.kind != DNTT_TYPE_CLASS)
break;
***************
*** 1952,1966 ****
/* Copy the field-list to GDB's symbol table */
! TYPE_NFIELDS (type) = nfields;
! TYPE_N_BASECLASSES (type) = n_base_classes;
! TYPE_FIELDS (type) = (struct field *)
! obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields);
! /* Copy the saved-up fields into the field vector. */
! for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next)
! {
! n -= 1;
! TYPE_FIELD (type, n) = tmp_list->field;
}
/* Copy the "function-field-list" (i.e., the list of member
--- 2156,2178 ----
/* Copy the field-list to GDB's symbol table */
! /* RM: When setting up the fields of this type, we may have created
! const/volatile variants of this type. All these need to be
! updated */
! for (vtype = type->cv_type; 1; vtype = vtype->cv_type)
! {
! TYPE_NFIELDS (vtype) = nfields;
! TYPE_N_BASECLASSES (vtype) = n_base_classes;
! TYPE_FIELDS (vtype) = (struct field *)
! obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields);
! /* Copy the saved-up fields into the field vector. */
! for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next)
! {
! n -= 1;
! TYPE_FIELD (vtype, n) = tmp_list->field;
! }
! if (vtype == type)
! break;
}
/* Copy the "function-field-list" (i.e., the list of member
***************
*** 2256,2266 ****
warning ("error in hpread_array_type.\n");
return;
}
! else if (dn_bufp->darray.arraylength == 0x7fffffff)
{
/* The HP debug format represents char foo[]; as an array with
! * length 0x7fffffff. Internally GDB wants to represent this
! * as an array of length zero.
*/
TYPE_LENGTH (type) = 0;
}
--- 2468,2479 ----
warning ("error in hpread_array_type.\n");
return;
}
! else if (dn_bufp->darray.arraylength == 0x7fffffff ||
! dn_bufp->darray.arraylength == 0x0fffffff)
{
/* The HP debug format represents char foo[]; as an array with
! * length 0x7fffffff or 0x0fffffff in the case of f77. Internally
! * GDB wants to represent this as an array of length zero.
*/
TYPE_LENGTH (type) = 0;
}
***************
*** 2284,2289 ****
--- 2497,2539 ----
obstack_alloc (&objfile->type_obstack, sizeof (struct field));
TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype,
objfile);
+
+ if (TYPE_LENGTH (type) == 0 && TYPE_ARRAY_UPPER_BOUND_VALUE (type) == 0x7fffffff)
+ TYPE_ARRAY_UPPER_BOUND_TYPE (type) = BOUND_CANNOT_BE_DETERMINED;
+ else
+ {
+ if (dn_bufp->darray.dyn_low)
+ {
+ if (dn_bufp->darray.dyn_low == 1)
+ {
+ TYPE_ARRAY_LOWER_BOUND_TYPE (type) = BOUND_BY_VALUE_ON_STACK;
+ #ifdef HPREAD_ADJUST_STACK_ADDRESS
+ TYPE_ARRAY_LOWER_BOUND_VALUE (type)
+ += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
+ #endif
+ TYPE_ARRAY_LOW_BOUND_TYPE (type) = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
+ }
+ else /* dn_bufp->darray.dyn_low == 2 */
+ TYPE_ARRAY_LOWER_BOUND_TYPE (type) = BOUND_BY_VARIABLE;
+ }
+
+ if (dn_bufp->darray.dyn_high)
+ {
+ if (dn_bufp->darray.dyn_high == 1)
+ {
+ TYPE_ARRAY_UPPER_BOUND_TYPE (type) = BOUND_BY_VALUE_ON_STACK;
+ #ifdef HPREAD_ADJUST_STACK_ADDRESS
+ TYPE_ARRAY_UPPER_BOUND_VALUE (type)
+ += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
+ #endif
+ TYPE_ARRAY_HIGH_BOUND_TYPE (type) = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
+ }
+ else /* dn_bufp->darray.dyn_high == 2 */
+ TYPE_ARRAY_UPPER_BOUND_TYPE (type) = BOUND_BY_VARIABLE;
+
+ }
+ }
+
return type;
}
***************
*** 2309,2323 ****
= (struct field *) obstack_alloc (&objfile->type_obstack,
2 * sizeof (struct field));
! if (dn_bufp->dsubr.dyn_low)
! TYPE_FIELD_BITPOS (type, 0) = 0;
! else
! TYPE_FIELD_BITPOS (type, 0) = dn_bufp->dsubr.lowbound;
- if (dn_bufp->dsubr.dyn_high)
- TYPE_FIELD_BITPOS (type, 1) = -1;
- else
- TYPE_FIELD_BITPOS (type, 1) = dn_bufp->dsubr.highbound;
TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dsubr.subtype,
objfile);
return type;
--- 2559,2683 ----
= (struct field *) obstack_alloc (&objfile->type_obstack,
2 * sizeof (struct field));
! switch (dn_bufp->dsubr.dyn_low)
! {
! case 0:
! case 1:
! TYPE_FIELD_BITPOS (type, 0) = dn_bufp->dsubr.lowbound;
! break;
!
! case 2:
! {
! union dnttentry *var;
! struct symbol *sym;
!
! sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
! sizeof (struct symbol));
! (void) memset (sym, 0, sizeof (struct symbol));
! var = hpread_get_lntt (dn_bufp->dsubr.lowbound, objfile);
! SYMBOL_LANGUAGE (sym) = language_unknown;
!
! if (var->ddvar.kind == DNTT_TYPE_DVAR)
! {
! SYMBOL_NAME (sym) = VT (objfile) + var->ddvar.name;
! SYMBOL_VALUE (sym) = var->ddvar.location;
! #if defined(HPREAD_ADJUST_STACK_ADDRESS)
! SYMBOL_VALUE (sym)
! += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
! #endif
! SYMBOL_TYPE (sym)
! = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
!
! if (var->ddvar.regvar)
! SYMBOL_CLASS (sym) = LOC_REGISTER;
! else
! SYMBOL_CLASS (sym) = LOC_LOCAL;
! }
! else if (var->dsvar.kind == DNTT_TYPE_SVAR)
! {
! SYMBOL_NAME (sym) = VT (objfile) + var->dsvar.name;
! SYMBOL_VALUE (sym) = var->dsvar.location;
! #if defined(HPREAD_ADJUST_STACK_ADDRESS)
! SYMBOL_VALUE (sym)
! += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
! #endif
! SYMBOL_TYPE (sym)
! = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
! SYMBOL_CLASS (sym) = LOC_STATIC;
! }
! else
! warning ("unexpected kind of index variable in handling the low "
! "bound: %d!", var->dsvar.kind);
!
! TYPE_FIELD_BITPOS (type, 0) = (long) (struct type *) sym;
! break;
! }
!
! default:
! warning ("unexpected type in handling the low bound: %d!",
! dn_bufp->dsubr.dyn_low);
! break;
! }
!
! switch (dn_bufp->dsubr.dyn_high)
! {
! case 0:
! case 1:
! TYPE_FIELD_BITPOS (type, 1) = dn_bufp->dsubr.highbound;
! break;
!
! case 2:
! {
! union dnttentry *var;
! struct symbol *sym;
!
! sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
! sizeof (struct symbol));
! (void) memset (sym, 0, sizeof (struct symbol));
! var = hpread_get_lntt (dn_bufp->dsubr.highbound, objfile);
! SYMBOL_LANGUAGE (sym) = language_unknown;
!
! if (var->ddvar.kind == DNTT_TYPE_DVAR)
! {
! SYMBOL_NAME (sym) = VT (objfile) + var->ddvar.name;
! SYMBOL_VALUE (sym) = var->ddvar.location;
! #if defined(HPREAD_ADJUST_STACK_ADDRESS)
! SYMBOL_VALUE (sym)
! += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
! #endif
! SYMBOL_TYPE (sym)
! = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
!
! if (var->ddvar.regvar)
! SYMBOL_CLASS (sym) = LOC_REGISTER;
! else
! SYMBOL_CLASS (sym) = LOC_LOCAL;
! }
! else if (var->dsvar.kind == DNTT_TYPE_SVAR)
! {
! SYMBOL_NAME (sym) = VT (objfile) + var->dsvar.name;
! SYMBOL_VALUE (sym) = var->dsvar.location;
! #if defined(HPREAD_ADJUST_STACK_ADDRESS)
! SYMBOL_VALUE (sym)
! += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
! #endif
! SYMBOL_TYPE (sym)
! = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
! SYMBOL_CLASS (sym) = LOC_STATIC;
! }
! else
! warning ("unexpected kind of index variable in handling the high "
! "bound: %d!", var->dsvar.kind);
!
! TYPE_FIELD_BITPOS (type, 1) = (long) (struct type *) sym;
! break;
! }
! default:
! warning ("unexpected value in handling the upper bound: %d!",
! dn_bufp->dsubr.dyn_high);
! }
!
TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dsubr.subtype,
objfile);
return type;
***************
*** 2367,2378 ****
*/
if (hp_type.dntti.type == HP_TYPE_TEMPLATE_ARG)
return hpread_get_nth_template_arg (objfile, hp_type.dntti.bitlength);
else
return lookup_fundamental_type (objfile, hpread_type_translate (hp_type));
/* Not a builtin type. We'll have to read it in. */
! if (hp_type.dnttp.index < LNTT_SYMCOUNT (objfile))
! dn_bufp = hpread_get_lntt (hp_type.dnttp.index, objfile);
else
/* This is a fancy way of returning NULL */
return lookup_fundamental_type (objfile, FT_VOID);
--- 2727,2740 ----
*/
if (hp_type.dntti.type == HP_TYPE_TEMPLATE_ARG)
return hpread_get_nth_template_arg (objfile, hp_type.dntti.bitlength);
+ else if (hp_type.dntti.type == HP_TYPE_FTN_STRING_SPEC)
+ return hpread_ftn_string_type (hp_type);
else
return lookup_fundamental_type (objfile, hpread_type_translate (hp_type));
/* Not a builtin type. We'll have to read it in. */
! if (INDEX (objfile, hp_type.dnttp) < LNTT_SYMCOUNT (objfile))
! dn_bufp = hpread_get_lntt (INDEX (objfile, hp_type.dnttp), objfile);
else
/* This is a fancy way of returning NULL */
return lookup_fundamental_type (objfile, FT_VOID);
***************
*** 2479,2486 ****
* union, class, enum, or template type.
* We will need to attach that to our name.
*/
! if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
! dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
else
{
complain (&hpread_type_lookup_complaint);
--- 2841,2851 ----
* union, class, enum, or template type.
* We will need to attach that to our name.
*/
! if (INDEX (objfile, dn_bufp->dtype.type.dnttp) <
! LNTT_SYMCOUNT (objfile))
! dn_bufp =
! hpread_get_lntt (INDEX (objfile, dn_bufp->dtype.type.dnttp),
! objfile);
else
{
complain (&hpread_type_lookup_complaint);
***************
*** 2605,2610 ****
--- 2970,2976 ----
struct type *class_type;
struct type *functype;
struct type *retvaltype;
+ struct type *ntype;
int nargs;
int i;
struct type **args_type;
***************
*** 2614,2628 ****
objfile);
retvaltype = TYPE_TARGET_TYPE (functype);
nargs = TYPE_NFIELDS (functype);
! args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
! for (i = 0; i < nargs; i++)
{
! args_type[i] = TYPE_FIELD_TYPE (functype, i);
}
- args_type[nargs] = NULL;
ptrmemtype = alloc_type (objfile);
smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
! return make_pointer_type (ptrmemtype, NULL);
}
break;
--- 2980,3004 ----
objfile);
retvaltype = TYPE_TARGET_TYPE (functype);
nargs = TYPE_NFIELDS (functype);
! if (nargs > 0)
! {
! args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
! for (i = 0; i < nargs; i++)
! {
! args_type[i] = TYPE_FIELD_TYPE (functype, i);
! }
! args_type[nargs] = NULL;
! }
! else
{
! args_type = NULL;
}
ptrmemtype = alloc_type (objfile);
smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
! ntype = make_pointer_type (ptrmemtype, NULL);
! /* member function pointers are actually 3 words long in HP aCC */
! TYPE_LENGTH (ntype) = 3 * sizeof (CORE_ADDR);
! return ntype;
}
break;
***************
*** 2708,2713 ****
--- 3084,3091 ----
/* case DNTT_TYPE_ALIAS: */
default:
/* A fancy way of returning NULL */
+ warning ("hpread_type_lookup: unsupported type (%d)",
+ dn_bufp->dblock.kind);
return lookup_fundamental_type (objfile, FT_VOID);
}
}
***************
*** 2734,2740 ****
sl_bufp->snormoff.address + offset);
s_idx++;
}
! return e_idx;
}
/* Given a function "f" which is a member of a class, find
--- 3112,3118 ----
sl_bufp->snormoff.address + offset);
s_idx++;
}
! return (e_idx >= s_idx) ? e_idx : s_idx;
}
/* Given a function "f" which is a member of a class, find
***************
*** 2791,2796 ****
--- 3169,3176 ----
return class_name;
}
+ extern char default_fortran_main_string[];
+
/* Internalize one native debug symbol.
* Called in a loop from hpread_expand_symtab().
* Arguments:
***************
*** 2808,2814 ****
static void
hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
text_offset, text_size, filename,
! index, at_module_boundary_p
)
union dnttentry *dn_bufp;
char *name;
--- 3188,3195 ----
static void
hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
text_offset, text_size, filename,
! index, at_module_boundary_p,
! expanding_doom_psymtab
)
union dnttentry *dn_bufp;
char *name;
***************
*** 2819,2846 ****
char *filename;
int index;
int *at_module_boundary_p;
{
unsigned long desc;
int type;
! CORE_ADDR valu;
! int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
! int data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA);
union dnttentry *dn_temp;
dnttpointer hp_type;
! struct symbol *sym;
! struct context_stack *new;
char *class_scope_name;
! /* Allocate one GDB debug symbol and fill in some default values. */
! sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
! sizeof (struct symbol));
! memset (sym, 0, sizeof (struct symbol));
! SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
! SYMBOL_LANGUAGE (sym) = language_auto;
! SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
! SYMBOL_LINE (sym) = 0;
! SYMBOL_VALUE (sym) = 0;
! SYMBOL_CLASS (sym) = LOC_TYPEDEF;
/* Just a trick in case the SOM debug symbol is a type definition.
* There are routines that are set up to build a GDB type symbol, given
--- 3200,3250 ----
char *filename;
int index;
int *at_module_boundary_p;
+ int expanding_doom_psymtab;
{
unsigned long desc;
int type;
! CORE_ADDR valu = 0;
! CORE_ADDR texthigh = text_offset + text_size;
! CORE_ADDR offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
! CORE_ADDR data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA); /* CLLbs15725 */
union dnttentry *dn_temp;
dnttpointer hp_type;
! struct symbol *get_symbol (), *sym = NULL;
! struct context_stack *new = NULL;
char *class_scope_name;
+ extern ImportEntry *find_import_entry (); /* in somread.c */
+ ImportEntry *import_entry;
+ CORE_ADDR ptr_addr;
+ struct minimal_symbol *indirect_msym;
+ int sym_in_import_list;
+ int do_record;
+ sltpointer sl_index;
+ union sltentry *sl_bufp;
+ int nsym;
+ struct pending *local_symbols_copy, *next, *save_local_symbols;
! /*
! * srikanth, 990313, JAGaa80452, we used to allocate a `symbol' from
! * the symbol_obstack here and do some minimal decoration on it. Only
! * in less than half the number of calls to this function, we actually
! * need this `symbol'.
! *
! * For instance if the incoming dntt type is one of srcfile, module,
! * begin, end, pointer, enum, memenum, set, subrange, struct, union,
! * field, functype, with, common, blockdata, class_scope, reference,
! * ptrmem, ptrmemfunc, class, genfield, vfunc, memaccess, inheritance,
! * friend_class, friend_func, modifier, object_id, memfunc, doc_memfunc,
! * template, template_arg, func_template, link ... (out of breath here)
! * then we don't need the `symbol' and we simply leak it.
! *
! * What is worse since this symbol is allocated on an obstack, purify and
! * other such tools would be unable to report the leak. When debugging the
! * IA64 C compiler, on startup we leak > 15 Mb here. I have added a new
! * function get_symbol() that is called only on those cases we actually
! * need the symbol. Remember to call this function if you decide to change
! * one of the aforementioned cases so that it actually needs a symbol.
! */
/* Just a trick in case the SOM debug symbol is a type definition.
* There are routines that are set up to build a GDB type symbol, given
***************
*** 2893,2899 ****
* in the case that we're not using the quick look-up tables
* and have to use the old system as a fall-back.
*/
! start_symtab (name, NULL, valu);
record_debugformat ("HP");
SL_INDEX (objfile) = dn_bufp->dsfile.address;
}
--- 3297,3303 ----
* in the case that we're not using the quick look-up tables
* and have to use the old system as a fall-back.
*/
! start_symtab (name, current_compilation_directory, valu);
record_debugformat ("HP");
SL_INDEX (objfile) = dn_bufp->dsfile.address;
}
***************
*** 2907,2913 ****
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dsfile.address,
! objfile, offset);
}
/* A note on "start_subfile". This routine will check
--- 3311,3319 ----
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dsfile.address,
! objfile,
! offset
! );
}
/* A note on "start_subfile". This routine will check
***************
*** 2917,2923 ****
* fact that we'll see lots of SRCFILE entries for foo.c
* inside foo.c.
*/
! start_subfile (name, NULL);
break;
case DNTT_TYPE_MODULE:
--- 3323,3334 ----
* fact that we'll see lots of SRCFILE entries for foo.c
* inside foo.c.
*/
! start_subfile (name, current_compilation_directory);
! /* RM: If we don't know the language for the current symtab yet,
! set it now */
! if (current_symtab_language == language_unknown)
! current_symtab_language =
! hpread_language_type (dn_bufp->dsfile.language);
break;
case DNTT_TYPE_MODULE:
***************
*** 2927,3026 ****
* unit. We expect to start the psymtab-to-symtab expansion
* looking at a MODULE entry, and to end it at the corresponding
* END MODULE entry.
- *
- *--Begin outdated comments
- *
- * This record signifies the start of a new source module
- * In C/C++ there is no explicit "module" construct in the language,
- * but each compilation unit is implicitly a module and they
- * do emit the DNTT_TYPE_MODULE records.
- * The end of the module is marked by a matching DNTT_TYPE_END record.
- *
- * The reason GDB gets away with ignoring the DNTT_TYPE_MODULE record
- * is it notices the DNTT_TYPE_END record for the previous
- * module (see comments under DNTT_TYPE_END case), and then treats
- * the next DNTT_TYPE_SRCFILE record as if it were the module-start record.
- * (i.e., it makes a start_symtab() call).
- * This scheme seems a little convoluted, but I'll leave it
- * alone on the principle "if it ain't broke don't fix
- * it". (RT).
- *
- *-- End outdated comments
*/
! valu = text_offset;
! if (!last_source_file)
{
! /* Start of a new module. We know this because "last_source_file"
! * is NULL, which can only happen the first time or if we just
! * made a call to end_symtab() to close out the previous module.
! */
! start_symtab (name, NULL, valu);
! SL_INDEX (objfile) = dn_bufp->dmodule.address;
}
else
{
! /* This really shouldn't happen if we're using the quick
! * look-up tables, as it would mean we'd scanned past an
! * END MODULE entry. But if we're not using the tables,
! * we started the module on the SRCFILE entry, so it's ok.
! * For now, accept this.
! */
! /* warning( "Error expanding psymtab, missed module end, found entry for %s",
! * name );
! */
! *at_module_boundary_p = -1;
! }
! start_subfile (name, NULL);
break;
case DNTT_TYPE_FUNCTION:
case DNTT_TYPE_ENTRY:
/* A function or secondary entry point. */
! valu = dn_bufp->dfunc.lowaddr + offset;
/* Record lines up to this point. */
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dfunc.address,
! objfile, offset);
!
WITHIN_FUNCTION (objfile) = 1;
CURRENT_FUNCTION_VALUE (objfile) = valu;
! /* Stack must be empty now. */
! if (context_stack_depth != 0)
complain (&lbrac_unmatched_complaint, (char *) symnum);
new = push_context (0, valu);
/* Built a type for the function. This includes processing
* the symbol records for the function parameters.
*/
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile, 1);
/* The "SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
! if ((dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
! dn_bufp->dfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->dfunc.alias)) /* not a null string */
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
else
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
/* Special hack to get around HP compilers' insistence on
! * reporting "main" as "_MAIN_" for C/C++ */
! if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
! (strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") == 0))
! SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
/* The SYMBOL_CPLUS_DEMANGLED_NAME field is expected to
* be the demangled name.
*/
! if (dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS)
{
/* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
* calling the demangler in libiberty (cplus_demangle()) to
--- 3338,3466 ----
* unit. We expect to start the psymtab-to-symtab expansion
* looking at a MODULE entry, and to end it at the corresponding
* END MODULE entry.
*/
! /* We currently want to bypass f90 module entries that surround
! * functions other than the main function -- we can distinguish
! * these modules from others because they have "%%" postpended to
! * the function name.
! */
! if (strcmp (strchr (name, '%'), "%%") == 0)
{
! /* This is a currently just a place holder for f90 modules. */
}
else
{
! valu = text_offset;
! if (!last_source_file)
! {
! /* Start of a new module. We know this because "last_source_file"
! * is NULL, which can only happen the first time or if we just
! * made a call to end_symtab() to close out the previous module.
! */
! start_symtab (name, current_compilation_directory, valu);
! SL_INDEX (objfile) = dn_bufp->dmodule.address;
! }
! else
! {
! /* This really shouldn't happen if we're using the quick
! * look-up tables, as it would mean we'd scanned past an
! * END MODULE entry. But if we're not using the tables,
! * we started the module on the SRCFILE entry, so it's ok.
! * For now, accept this.
! */
! /* warning( "Error expanding psymtab, missed module end, found entry for %s",
! * name );
! */
! *at_module_boundary_p = -1;
! }
! start_subfile (name, current_compilation_directory);
! }
break;
case DNTT_TYPE_FUNCTION:
case DNTT_TYPE_ENTRY:
+ sym = get_symbol (objfile, name);
/* A function or secondary entry point. */
! valu = (type == DNTT_TYPE_FUNCTION)
! ? dn_bufp->dfunc.lowaddr + offset
! : dn_bufp->dfunc.entryaddr + offset;
!
! /* RM: Because of heuristics used to find the beginning and end
! * LNTT offsets for psymtabs in the presence of CTTI, we
! * sometimes include too many LNTT entries in a psymtab. This is
! * often harmless, but we don't want extra functions in the
! * expanded symtab. So if this function starts after the
! * psymtabs texthigh address, close the symtab
! */
! if (valu >= texthigh)
! {
! *at_module_boundary_p = -1;
! break;
! }
/* Record lines up to this point. */
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dfunc.address,
! objfile,
! offset
! );
WITHIN_FUNCTION (objfile) = 1;
CURRENT_FUNCTION_VALUE (objfile) = valu;
!
! /* Stack will not be empty if we've encountered a DNTT_TYPE_ENTRY. */
! if (context_stack_depth && type != DNTT_TYPE_ENTRY)
complain (&lbrac_unmatched_complaint, (char *) symnum);
+ /* push_context initializes the local_symbols list to null, so
+ * we need to save this information for entry points
+ */
+ save_local_symbols = local_symbols;
new = push_context (0, valu);
+ if (type == DNTT_TYPE_ENTRY)
+ local_symbols = save_local_symbols;
/* Built a type for the function. This includes processing
* the symbol records for the function parameters.
*/
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile, 1);
+ new->params = param_symbols;
+ SYMBOL_LANGUAGE (sym) = hpread_language_type (dn_bufp->dfunc.language);
/* The "SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
! if (dn_bufp->dfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->dfunc.alias)) /* not a null string */
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
else
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
/* Special hack to get around HP compilers' insistence on
! * reporting "main" as "_MAIN_" */
! if (STRCMP (SYMBOL_NAME (sym), "_MAIN_") == 0)
! {
! /* If this this a Fortran main, save dfunc.name as the string for
! the demangled name only if dfunc.name is not "main"; this situation
! occurs when Fortran sees the program keyword.
! */
! if (SYMBOL_LANGUAGE (sym) == language_fortran)
! {
! if (STRCMP (VT (objfile) + dn_bufp->dfunc.name, "main") != 0)
! SYMBOL_FORTRAN_DEMANGLED_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
! default_main = default_fortran_main_string;
! }
! SYMBOL_NAME (sym) = default_main;
! }
/* The SYMBOL_CPLUS_DEMANGLED_NAME field is expected to
* be the demangled name.
*/
! if (SYMBOL_LANGUAGE (sym) == language_cplus)
{
/* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
* calling the demangler in libiberty (cplus_demangle()) to
***************
*** 3059,3065 ****
strcat (dem_name, "::");
strcat (dem_name, basename);
SYMBOL_CPLUS_DEMANGLED_NAME (sym) = dem_name;
- SYMBOL_LANGUAGE (sym) = language_cplus;
}
}
}
--- 3499,3504 ----
***************
*** 3078,3085 ****
* may not be a BEGIN after the FUNCTION.
* So I made it C/C++ specific. - RT
*/
! if (dn_bufp->dfunc.language == HP_LANGUAGE_C ||
! dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS)
{
while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
{
--- 3517,3524 ----
* may not be a BEGIN after the FUNCTION.
* So I made it C/C++ specific. - RT
*/
! if (SYMBOL_LANGUAGE (sym) == language_c ||
! SYMBOL_LANGUAGE (sym) == language_cplus)
{
while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
{
***************
*** 3090,3109 ****
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile, offset);
SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
}
! record_line (current_subfile, SYMBOL_LINE (sym), valu);
break;
case DNTT_TYPE_DOC_FUNCTION:
valu = dn_bufp->ddocfunc.lowaddr + offset;
/* Record lines up to this point. */
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->ddocfunc.address,
! objfile, offset);
WITHIN_FUNCTION (objfile) = 1;
CURRENT_FUNCTION_VALUE (objfile) = valu;
--- 3529,3598 ----
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile,
! offset
! );
SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
+ record_line (current_subfile, SYMBOL_LINE (sym), valu);
}
! else
! {
! /* For cases where there is no DNTT_BEGIN, namely Fortran, use the
! * the line number associated with the function's SLT index.
! */
! SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dfunc.address, objfile);
! do_record = true;
! if (SYMBOL_LANGUAGE (sym) == language_fortran)
! {
! if (STRCMP (SYMBOL_NAME (sym), default_fortran_main_string) == 0)
! /* Don't record this line if this is the main program -- this
! * test is necessary so that setting a breakpoint specifying
! * the first line of a Fortran main program works correctly.
! */
! do_record = false;
! else if (context_stack_depth > 1)
! {
! /* We've encountered an entry point; don't record this line if
! * there is no code in the function prior to this entry point;
! * this is necessary so that we break in the proper location
! * when setting a breakpoint on a function which has entry points.
! */
! do_record = false;
! sl_index = dn_bufp->dfunc.address;
! sl_bufp = hpread_get_slt (--sl_index, objfile);
! while (sl_bufp->snorm.sltdesc != SLT_FUNCTION
! && sl_bufp->snorm.sltdesc != SLT_ENTRY)
! {
! if (sl_bufp->snorm.sltdesc == SLT_NORMAL)
! {
! do_record = true;
! break;
! }
! else
! sl_bufp = hpread_get_slt (--sl_index, objfile);
! }
! }
! }
! if (do_record)
! record_line (current_subfile, SYMBOL_LINE (sym), valu);
! }
! /* RM: If we don't know the language for the current symtab yet,
! set it now */
! if (current_symtab_language == language_unknown)
! current_symtab_language = SYMBOL_LANGUAGE (sym);
break;
case DNTT_TYPE_DOC_FUNCTION:
+ sym = get_symbol (objfile, name);
valu = dn_bufp->ddocfunc.lowaddr + offset;
/* Record lines up to this point. */
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->ddocfunc.address,
! objfile,
! offset
! );
WITHIN_FUNCTION (objfile) = 1;
CURRENT_FUNCTION_VALUE (objfile) = valu;
***************
*** 3117,3143 ****
*/
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_doc_function_type (hp_type, dn_bufp, objfile, 1);
/* The "SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
! if ((dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
! dn_bufp->ddocfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->ddocfunc.alias)) /* not a null string */
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
else
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
/* Special hack to get around HP compilers' insistence on
! * reporting "main" as "_MAIN_" for C/C++ */
! if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
! (strcmp (VT (objfile) + dn_bufp->ddocfunc.name, "main") == 0))
! SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
!
! if (dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS)
{
/* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
* calling the demangler in libiberty (cplus_demangle()) to
* do the job. This generally does the job, even though
--- 3606,3639 ----
*/
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_doc_function_type (hp_type, dn_bufp, objfile, 1);
+ SYMBOL_LANGUAGE (sym) = hpread_language_type (dn_bufp->dfunc.language);
/* The "SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
! if (dn_bufp->ddocfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->ddocfunc.alias)) /* not a null string */
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
else
SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
/* Special hack to get around HP compilers' insistence on
! * reporting "main" as "_MAIN_" */
! if (strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0)
{
+ if (SYMBOL_LANGUAGE (sym) == language_fortran)
+ {
+ if (strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") != 0)
+ SYMBOL_FORTRAN_DEMANGLED_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+ default_main = default_fortran_main_string;
+ }
+ SYMBOL_NAME (sym) = default_main;
+ }
+
+ if (SYMBOL_LANGUAGE (sym) == language_cplus)
+ {
/* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
* calling the demangler in libiberty (cplus_demangle()) to
* do the job. This generally does the job, even though
***************
*** 3176,3182 ****
strcat (dem_name, "::");
strcat (dem_name, basename);
SYMBOL_CPLUS_DEMANGLED_NAME (sym) = dem_name;
- SYMBOL_LANGUAGE (sym) = language_cplus;
}
}
}
--- 3672,3677 ----
***************
*** 3195,3202 ****
* may not be a BEGIN after the FUNCTION.
* So I made it C/C++ specific. - RT
*/
! if (dn_bufp->ddocfunc.language == HP_LANGUAGE_C ||
! dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS)
{
while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
{
--- 3690,3697 ----
* may not be a BEGIN after the FUNCTION.
* So I made it C/C++ specific. - RT
*/
! if (SYMBOL_LANGUAGE (sym) == language_c ||
! SYMBOL_LANGUAGE (sym) == language_cplus)
{
while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
{
***************
*** 3207,3216 ****
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile, offset);
SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
}
! record_line (current_subfile, SYMBOL_LINE (sym), valu);
break;
case DNTT_TYPE_BEGIN:
--- 3702,3727 ----
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile,
! offset
! );
SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
+ record_line (current_subfile, SYMBOL_LINE (sym), valu);
+ }
+ else
+ {
+ /* For cases where there is no DNTT_BEGIN use the function's SLT
+ index as the first line of the function
+ */
+ SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dfunc.address, objfile);
+ if (SYMBOL_LANGUAGE (sym) == language_fortran
+ && (STRCMP (SYMBOL_NAME (sym), default_fortran_main_string) != 0))
+ record_line (current_subfile, SYMBOL_LINE (sym), valu);
}
! /* RM: If we don't know the language for the current symtab yet,
! set it now */
! if (current_symtab_language == language_unknown)
! current_symtab_language = SYMBOL_LANGUAGE (sym);
break;
case DNTT_TYPE_BEGIN:
***************
*** 3254,3260 ****
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile, offset);
/* Calculate start address of new scope */
valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
valu += offset; /* Relocate for dynamic loading */
--- 3765,3773 ----
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dbegin.address,
! objfile,
! offset
! );
/* Calculate start address of new scope */
valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
valu += offset; /* Relocate for dynamic loading */
***************
*** 3279,3286 ****
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dend.address,
! objfile, offset);
! switch (dn_bufp->dend.endkind)
{
case DNTT_TYPE_MODULE:
/* Ending a module ends the symbol table for that module.
--- 3792,3809 ----
SL_INDEX (objfile) = hpread_record_lines (current_subfile,
SL_INDEX (objfile),
dn_bufp->dend.address,
! objfile,
! offset
! );
! /* RM: with aCC, pxdb seems to be fixing up the endkind field, so
! * we can't use it directly for DOOM. Do this the round about
! * way.
! */
! dn_temp =
! hpread_get_lntt (INDEX (objfile, dn_bufp->dend.beginscope.dnttp),
! objfile);
!
! switch (dn_temp->dblock.kind)
{
case DNTT_TYPE_MODULE:
/* Ending a module ends the symbol table for that module.
***************
*** 3303,3321 ****
break;
case DNTT_TYPE_FUNCTION:
/* Ending a function, well, ends the function's scope. */
! dn_temp = hpread_get_lntt (dn_bufp->dend.beginscope.dnttp.index,
objfile);
valu = dn_temp->dfunc.hiaddr + offset;
! /* Insert func params into local list */
! merge_symbol_lists (¶m_symbols, &local_symbols);
! new = pop_context ();
! /* Make a block for the local symbols within. */
! finish_block (new->name, &local_symbols, new->old_blocks,
! new->start_addr, valu, objfile);
! WITHIN_FUNCTION (objfile) = 0; /* This may have to change for Pascal */
local_symbols = new->locals;
! param_symbols = new->params;
break;
case DNTT_TYPE_BEGIN:
--- 3826,3877 ----
break;
case DNTT_TYPE_FUNCTION:
+ case DNTT_TYPE_DOC_FUNCTION:
+ /* RM: if we never pushed this function onton the context stack,
+ * don't try to pop it
+ * ??? What happens to all the symbols we processed in between?
+ */
+ if (context_stack_depth == 0)
+ break;
+
/* Ending a function, well, ends the function's scope. */
! dn_temp = hpread_get_lntt (INDEX (objfile, dn_bufp->dend.beginscope.dnttp),
objfile);
valu = dn_temp->dfunc.hiaddr + offset;
! while (context_stack_depth > 0)
! {
! new = pop_context ();
! param_symbols = new->params;
! /* Insert func params into local list */
! /* Note: finish_block will delete the symbol list, so make
! * a copy of local_symbols, but eliminate the symbols
! * that are the same as the parameters
! */
! local_symbols_copy = NULL;
! for (next = local_symbols; next; next = next->next)
! {
! nsym = 0;
! while (next && nsym < next->nsyms)
! {
! if (!find_symbol_in_list (param_symbols,
! SYMBOL_NAME (next->symbol[nsym]),
! strlen (SYMBOL_NAME (next->symbol[nsym]))))
! add_symbol_to_list (next->symbol[nsym],
! &local_symbols_copy);
! nsym++;
! }
! }
! merge_symbol_lists (¶m_symbols, &local_symbols_copy);
!
! /* Make a block for the local symbols within. */
! finish_block (new->name, &local_symbols_copy, new->old_blocks,
! new->start_addr, valu, objfile);
! }
! /* free local_symbols list */
! if (local_symbols)
! add_free_pendings (local_symbols);
local_symbols = new->locals;
! WITHIN_FUNCTION (objfile) = 0; /* This may have to change for Pascal */
break;
case DNTT_TYPE_BEGIN:
***************
*** 3335,3341 ****
/* Why in the hell is this needed? */
valu += offset + 9; /* Relocate for dynamic loading */
new = pop_context ();
! desc = dn_bufp->dend.beginscope.dnttp.index;
if (desc != new->depth)
complain (&lbrac_mismatch_complaint, (char *) symnum);
--- 3891,3897 ----
/* Why in the hell is this needed? */
valu += offset + 9; /* Relocate for dynamic loading */
new = pop_context ();
! desc = INDEX (objfile, dn_bufp->dend.beginscope.dnttp);
if (desc != new->depth)
complain (&lbrac_mismatch_complaint, (char *) symnum);
***************
*** 3354,3384 ****
break;
case DNTT_TYPE_COMMON:
! /* End a FORTRAN common block. We don't currently handle these */
! complain (&hpread_unhandled_end_common_complaint);
break;
case DNTT_TYPE_CLASS_SCOPE:
-
/* pai: FIXME Not handling nested classes for now -- must
* maintain a stack */
class_scope_name = NULL;
-
- #if 0
- /* End a class scope */
- valu = hpread_get_location (dn_bufp->dend.address, objfile);
- /* Why in the hell is this needed? */
- valu += offset + 9; /* Relocate for dynamic loading */
- new = pop_context ();
- desc = dn_bufp->dend.beginscope.dnttp.index;
- if (desc != new->depth)
- complain (&lbrac_mismatch_complaint, (char *) symnum);
- /* Make a block for the local symbols within. */
- finish_block (new->name, &local_symbols, new->old_blocks,
- new->start_addr, valu, objfile);
- local_symbols = new->locals;
- param_symbols = new->params;
- #endif
break;
default:
--- 3910,3923 ----
break;
case DNTT_TYPE_COMMON:
! /* End a FORTRAN common block. */
! common_block_end (objfile);
break;
case DNTT_TYPE_CLASS_SCOPE:
/* pai: FIXME Not handling nested classes for now -- must
* maintain a stack */
class_scope_name = NULL;
break;
default:
***************
*** 3390,3395 ****
--- 3929,3936 ----
/* DNTT_TYPE_IMPORT is not handled */
case DNTT_TYPE_LABEL:
+ /* srikanth, looks like a leak */
+ sym = get_symbol (objfile, name);
SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE;
break;
***************
*** 3418,3448 ****
break; /* do nothing; handled in hpread_read_function_type() */
- #if 0 /* Old code */
- if (dn_bufp->dfparam.regparam)
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- else if (dn_bufp->dfparam.indirect)
- SYMBOL_CLASS (sym) = LOC_REF_ARG;
- else
- SYMBOL_CLASS (sym) = LOC_ARG;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- if (dn_bufp->dfparam.copyparam)
- {
- SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
- #ifdef HPREAD_ADJUST_STACK_ADDRESS
- SYMBOL_VALUE (sym)
- += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
- #endif
- }
- else
- SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
- SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dfparam.type, objfile);
- add_symbol_to_list (sym, &fparam_symbols);
- break;
- #endif
-
case DNTT_TYPE_SVAR:
/* Static variables. */
SYMBOL_CLASS (sym) = LOC_STATIC;
/* Note: There is a case that arises with globals in shared
--- 3959,3968 ----
break; /* do nothing; handled in hpread_read_function_type() */
case DNTT_TYPE_SVAR:
/* Static variables. */
+ sym = get_symbol (objfile, name);
+ SYMBOL_LANGUAGE (sym) = current_symtab_language;
SYMBOL_CLASS (sym) = LOC_STATIC;
/* Note: There is a case that arises with globals in shared
***************
*** 3454,3463 ****
* in the symbol table contains a pointer to the real "g".
* We use the storage class LOC_INDIRECT to indicate this. RT
*/
! if (is_in_import_list (SYMBOL_NAME (sym), objfile))
! SYMBOL_CLASS (sym) = LOC_INDIRECT;
- SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location + data_offset;
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
if (dn_bufp->dsvar.global)
--- 3974,4007 ----
* in the symbol table contains a pointer to the real "g".
* We use the storage class LOC_INDIRECT to indicate this. RT
*/
! /* RM: Unfortunately, we can't rely on the address in the debug
! * information -- this may either be the address of the DLT slot
! * for the variable, or the address of the variable itself. It's
! * unintuitive, but a variable defined in a shared library may
! * still be in that shared libraries import list. So we must get
! * the DLT address directly, we figured out what it was when
! * initializing the import list (in somread.c).
! */
! if ((import_entry = find_import_entry (SYMBOL_NAME (sym), objfile)))
! {
! SYMBOL_CLASS (sym) = LOC_INDIRECT;
! SYMBOL_VALUE_ADDRESS (sym) = import_entry->dlt_addr;
! }
! else
! {
! /* Fortran common variables provide the base address of the
! common block in the location field. We need to add the
! offset field in the dsvar to get the correct address.
! */
! /* srikanth, CLLbs15725, 980909 data_offset has to be taken
! * into consideration or else variables from shlibs will be
! * accessed incorrectly ...
! */
! SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location +
! dn_bufp->dsvar.offset +
! data_offset;
! }
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
if (dn_bufp->dsvar.global)
***************
*** 3506,3511 ****
--- 4050,4056 ----
break;
case DNTT_TYPE_DVAR:
+ sym = get_symbol (objfile, name);
/* Dynamic variables. */
if (dn_bufp->ddvar.regvar)
SYMBOL_CLASS (sym) = LOC_REGISTER;
***************
*** 3517,3523 ****
SYMBOL_VALUE (sym)
+= HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
#endif
! SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
if (dn_bufp->ddvar.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
--- 4062,4072 ----
SYMBOL_VALUE (sym)
+= HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
#endif
! if (dn_bufp->ddvar.indirect)
! SYMBOL_TYPE (sym) = make_reference_type (
! hpread_type_lookup (dn_bufp->ddvar.type, objfile), NULL);
! else
! SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
if (dn_bufp->ddvar.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
***************
*** 3528,3548 ****
case DNTT_TYPE_CONST:
/* A constant (pascal?). */
! SYMBOL_CLASS (sym) = LOC_CONST;
! SYMBOL_VALUE (sym) = dn_bufp->dconst.location;
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile);
if (dn_bufp->dconst.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
add_symbol_to_list (sym, &local_symbols);
else
add_symbol_to_list (sym, &file_symbols);
break;
case DNTT_TYPE_TYPEDEF:
/* A typedef. We do want to process these, since a name is
* added to the namespace for the typedef'ed name.
*/
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
if (dn_bufp->dtype.global)
--- 4077,4126 ----
case DNTT_TYPE_CONST:
/* A constant (pascal?). */
! sym = get_symbol (objfile, name);
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile);
+
+ if (dn_bufp->dconst.location_type == LOCATION_IMMEDIATE)
+ {
+ SYMBOL_CLASS (sym) = LOC_CONST;
+ /* C++ and f77 put the value in the location field, but f90 puts
+ * it in the offset field; the value of one or the other is zero,
+ * so it shouldn't matter if we add these values
+ */
+ SYMBOL_VALUE (sym) = dn_bufp->dconst.location + dn_bufp->dconst.offset;
+ }
+ else if (dn_bufp->dconst.location_type == LOCATION_PTR)
+ {
+ SYMBOL_CLASS (sym) = LOC_STATIC;
+ /* treat these constants as variables and gdb will handle the rest */
+ SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dconst.location +
+ dn_bufp->dconst.offset;
+ }
+ else if (dn_bufp->dconst.location_type == LOCATION_VT)
+ {
+ SYMBOL_VALUE_BYTES (sym) = VT (objfile) + dn_bufp->dconst.location;
+ SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
+ }
+ else
+ {
+ warning ("unsupported constant type (%d) for %s",
+ dn_bufp->dconst.location_type, SYMBOL_NAME (sym));
+ }
+
if (dn_bufp->dconst.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
add_symbol_to_list (sym, &local_symbols);
else
add_symbol_to_list (sym, &file_symbols);
+
break;
case DNTT_TYPE_TYPEDEF:
/* A typedef. We do want to process these, since a name is
* added to the namespace for the typedef'ed name.
*/
+ sym = get_symbol (objfile, name);
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
if (dn_bufp->dtype.global)
***************
*** 3554,3559 ****
--- 4132,4138 ----
break;
case DNTT_TYPE_TAGDEF:
+ sym = get_symbol (objfile, name);
{
int global = dn_bufp->dtag.global;
/* Structure, union, enum, template, or class tag definition */
***************
*** 3569,3576 ****
* record that actually defines the type.
*/
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
! TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
! TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
if (dn_bufp->dtag.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
--- 4148,4161 ----
* record that actually defines the type.
*/
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
! if (TYPE_NAME (sym->type) == 0)
! {
! /* Do not overwrite the type name contructed by hpread_type_lookup
! routine. */
! TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
! TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
! }
!
if (dn_bufp->dtag.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
***************
*** 3578,3583 ****
--- 4163,4179 ----
else
add_symbol_to_list (sym, &file_symbols);
+ /* RM: We need to do this here too (it's also done in
+ * hpread_type_lookup). This is because there may be tagdefs
+ * that nobody points to, so they never get resolved in
+ * hpread_type_lookup
+ */
+ /* For classes/structs, we have to set the static member "physnames"
+ to point to strings like "Class::Member" */
+ if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT)
+ fix_static_member_physnames (SYMBOL_TYPE (sym), SYMBOL_NAME (sym),
+ objfile);
+
/* If this is a C++ class, then we additionally
* need to define a typedef for the
* class type. E.g., so that the name "c" becomes visible as
***************
*** 3600,3607 ****
* We also add the typename for TEMPLATE, so as to allow "ptype t"
* when "t" is a template name.
*/
! if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
! dn_bufp = hpread_get_lntt (dn_bufp->dtag.type.dnttp.index, objfile);
else
{
complain (&hpread_tagdef_complaint);
--- 4196,4203 ----
* We also add the typename for TEMPLATE, so as to allow "ptype t"
* when "t" is a template name.
*/
! if (INDEX (objfile, dn_bufp->dtype.type.dnttp) < LNTT_SYMCOUNT (objfile))
! dn_bufp = hpread_get_lntt (INDEX (objfile, dn_bufp->dtag.type.dnttp), objfile);
else
{
complain (&hpread_tagdef_complaint);
***************
*** 3711,3718 ****
break;
case DNTT_TYPE_COMMON:
! /* FORTRAN common. Not yet handled. */
! complain (&hpread_unhandled_common_complaint);
break;
/* DNTT_TYPE_COBSTRUCT is not handled by GDB. */
--- 4307,4313 ----
break;
case DNTT_TYPE_COMMON:
! common_block_start (name, objfile);
break;
/* DNTT_TYPE_COBSTRUCT is not handled by GDB. */
***************
*** 3728,3736 ****
break;
case DNTT_TYPE_CLASS_SCOPE:
-
-
-
/* The compiler brackets member functions with a CLASS_SCOPE/END
* pair of records, presumably to put them in a different scope
* from the module scope where they are normally defined.
--- 4323,4328 ----
***************
*** 3752,3776 ****
/* pai: FIXME Not handling nested classes for now -- need to
* maintain a stack */
! dn_temp = hpread_get_lntt (dn_bufp->dclass_scope.type.dnttp.index, objfile);
if (dn_temp->dblock.kind == DNTT_TYPE_TAGDEF)
class_scope_name = VT (objfile) + dn_temp->dtag.name;
else
class_scope_name = NULL;
- #if 0
-
- /* Begin a new scope. */
- SL_INDEX (objfile) = hpread_record_lines (current_subfile,
- SL_INDEX (objfile),
- dn_bufp->dclass_scope.address,
- objfile, offset);
- valu = hpread_get_location (dn_bufp->dclass_scope.address, objfile);
- valu += offset; /* Relocate for dynamic loading */
- desc = hpread_get_scope_start (dn_bufp->dclass_scope.address, objfile);
- /* We use the scope start DNTT index as the nesting depth identifier! */
- new = push_context (desc, valu);
- #endif
break;
case DNTT_TYPE_REFERENCE:
--- 4344,4355 ----
/* pai: FIXME Not handling nested classes for now -- need to
* maintain a stack */
! dn_temp = hpread_get_lntt (INDEX (objfile, dn_bufp->dclass_scope.type.dnttp), objfile);
if (dn_temp->dblock.kind == DNTT_TYPE_TAGDEF)
class_scope_name = VT (objfile) + dn_temp->dtag.name;
else
class_scope_name = NULL;
break;
case DNTT_TYPE_REFERENCE:
***************
*** 3908,3913 ****
--- 4487,4522 ----
}
}
+ struct symbol *
+ get_symbol (struct objfile *objfile, char *name)
+ {
+
+ struct symbol *sym;
+
+ /* Allocate one GDB debug symbol and fill in some default values. */
+ sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ sizeof (struct symbol));
+ memset (sym, 0, sizeof (struct symbol));
+
+ /* srikanth, 990310, JAGaa80452 : symbol names don't materialize
+ * out of nowhere. Most are pointers into the value table. The VT
+ * lives as long as the objfile lives. Thus there is little to be
+ * gained by duplicating, triplicating, quadruplicating if `name'
+ * came from the VT in the first place ...
+ */
+ if (permanent_copy_exists (objfile, name))
+ SYMBOL_NAME (sym) = name;
+ else
+ SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
+ SYMBOL_LANGUAGE (sym) = language_auto;
+ SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_LINE (sym) = 0;
+ SYMBOL_VALUE (sym) = 0;
+ SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+
+ return sym;
+ }
+
/* Get nesting depth for a DNTT entry.
* DN_BUFP points to a DNTT entry.
* OBJFILE is the object file.
***************
*** 3920,3931 ****
* block or function.
*/
!
! /* elz: ATTENTION: FIXME: NOTE: WARNING!!!!
! this function now returns 0 right away. It was taking too much time
! at start up. Now, though, the local types are not handled correctly.
! */
!
static int
hpread_get_scope_depth (dn_bufp, objfile, report_nested)
--- 4529,4539 ----
* block or function.
*/
! /* RM: The long startup time seemed to be because all globals were
! being analyzed at startup, and since they really do have a scope
! depth of zero, it took a scan of the entire LNTT to determine
! this. Added a check to see if we are looking beyond the start of
! the globals in the LNTT so we can return immediately in this case. */
static int
hpread_get_scope_depth (dn_bufp, objfile, report_nested)
***************
*** 3936,3947 ****
register int index;
register union dnttentry *dn_tmp;
register short depth = 0;
! /****************************/
! return 0;
! /****************************/
index = (((char *) dn_bufp) - LNTT (objfile)) / (sizeof (struct dntt_type_block));
while (--index >= 0)
{
dn_tmp = hpread_get_lntt (index, objfile);
--- 4544,4576 ----
register int index;
register union dnttentry *dn_tmp;
register short depth = 0;
! static int globals_start_index = 0;
! static struct objfile *last_objfile = 0;
! struct partial_symtab *pst;
!
! if (objfile != last_objfile)
! {
! pst = objfile->psymtabs;
! while (pst && strcmp (pst->filename, "globals"))
! {
! pst = pst->next;
! }
! if (pst)
! {
! globals_start_index = LDSYMOFF (pst) / (sizeof (struct dntt_type_block));
! last_objfile = objfile;
! }
! else
! {
! last_objfile = 0;
! }
! }
index = (((char *) dn_bufp) - LNTT (objfile)) / (sizeof (struct dntt_type_block));
+ if ((last_objfile != 0) && (index >= globals_start_index))
+ return 0;
+
while (--index >= 0)
{
dn_tmp = hpread_get_lntt (index, objfile);
***************
*** 3951,3957 ****
return depth;
case DNTT_TYPE_END:
/* index is signed int; dnttp.index is 29-bit unsigned int! */
! index = (int) dn_tmp->dend.beginscope.dnttp.index;
break;
case DNTT_TYPE_BEGIN:
case DNTT_TYPE_FUNCTION:
--- 4580,4586 ----
return depth;
case DNTT_TYPE_END:
/* index is signed int; dnttp.index is 29-bit unsigned int! */
! index = (int) INDEX (objfile, dn_tmp->dend.beginscope.dnttp);
break;
case DNTT_TYPE_BEGIN:
case DNTT_TYPE_FUNCTION:
***************
*** 4033,4039 ****
name = VT (objfile) + (*fieldp)->dfield.name;
/* First skip over one item to avoid stack death on recursion */
field = (*fieldp)->dfield.nextfield;
! *fieldp = hpread_get_lntt (field.dnttp.index, objfile);
/* Do we have another anonymous union? If so, adjust the bitoffsets
of its members and skip over its members. */
if ((TYPE_CODE (anon_type) == TYPE_CODE_UNION) &&
--- 4662,4668 ----
name = VT (objfile) + (*fieldp)->dfield.name;
/* First skip over one item to avoid stack death on recursion */
field = (*fieldp)->dfield.nextfield;
! *fieldp = hpread_get_lntt (INDEX (objfile, field.dnttp), objfile);
/* Do we have another anonymous union? If so, adjust the bitoffsets
of its members and skip over its members. */
if ((TYPE_CODE (anon_type) == TYPE_CODE_UNION) &&
Index: gdb/objfiles.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/objfiles.c gdb/objfiles.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/objfiles.c Tue Nov 2 16:03:57 1999
--- gdb/objfiles.c Thu Nov 4 15:12:03 1999
***************
*** 997,1002 ****
--- 997,1026 ----
return (retval);
}
+ /* RM: Return the import list entry for a given name. NULL if not found
+ This is used in hp_symtab_read.c to deal with static variables
+ that are defined in a shared library
+ */
+
+ ImportEntry *
+ find_import_entry (name, objfile)
+ char *name;
+ struct objfile *objfile;
+ {
+ register int i;
+
+ if (!objfile ||
+ !name ||
+ !*name)
+ return 0;
+
+ for (i = 0; i < objfile->import_list_size; i++)
+ if (objfile->import_list[i].name &&
+ (STREQ (name, objfile->import_list[i].name)))
+ return &objfile->import_list[i];
+ return 0;
+ }
+
/* Return nonzero if NAME is in the import list of OBJFILE. Else
return zero. */
Index: gdb/gdbtypes.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h gdb/gdbtypes.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h Thu Nov 4 14:57:54 1999
--- gdb/gdbtypes.h Thu Nov 4 15:00:42 1999
***************
*** 246,252 ****
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
! #define BOUND_CANNOT_BE_DETERMINED 5
#define BOUND_BY_REF_ON_STACK 4
#define BOUND_BY_VALUE_ON_STACK 3
#define BOUND_BY_REF_IN_REG 2
--- 246,253 ----
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
! #define BOUND_CANNOT_BE_DETERMINED 6
! #define BOUND_BY_VARIABLE 5
#define BOUND_BY_REF_ON_STACK 4
#define BOUND_BY_VALUE_ON_STACK 3
#define BOUND_BY_REF_IN_REG 2
***************
*** 704,709 ****
--- 705,716 ----
#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
(TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0))
+
+ #define TYPE_ARRAY_HIGH_BOUND_TYPE(arraytype) \
+ (TYPE_FIELD_TYPE((TYPE_FIELD_TYPE((arraytype),0)),1))
+
+ #define TYPE_ARRAY_LOW_BOUND_TYPE(arraytype) \
+ (TYPE_FIELD_TYPE((TYPE_FIELD_TYPE((arraytype),0)),0))
/* C++ */
Index: gdb/buildsym.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.h gdb/buildsym.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.h Mon Nov 1 11:30:02 1999
--- gdb/buildsym.h Thu Nov 4 13:55:19 1999
***************
*** 82,97 ****
EXTERN unsigned char processing_acc_compilation;
- /* elz: added this flag to know when a block is compiled with HP
- compilers (cc, aCC). This is necessary because of the macro
- COERCE_FLOAT_TO_DOUBLE defined in tm_hppa.h, which causes a
- coercion of float to double to always occur in parameter passing
- for a function called by gdb (see the function value_arg_coerce in
- valops.c). This is necessary only if the target was compiled with
- gcc, not with HP compilers or with g++ */
-
- EXTERN unsigned char processing_hp_compilation;
-
/* Count symbols as they are processed, for error messages. */
EXTERN unsigned int symnum;
--- 82,87 ----