usages.
+Thu Dec 26 19:52:01 1991 Fred Fish (fnf at cygnus.com)
+
+ * dbxread.c, symmisc.c: Move add_psymbol_to_plist() from
+ dbxread.c to symmisc and change name to add_psymbol_to_list.
+ Ditto for add_psymbol_addr_to_plist(). Also expand their
+ body to not use ADD_PSYMBOL_VT_TO_LIST.
+
+ * dwarfread.c: Remove add_psymbol_to_list() and convert usages
+ to the ADD_PSYMBOL_TO_LIST macro.
+
+ * ieee-float.c: Change "#ifdef DEBUG" to "#ifdef IEEE_DEBUG"
+ to avoid collision with the DEBUG for ADD_PSYMBOL_VT_TO_LIST.
+
+ * partial-stab.h, symfile.h: Move definitions of the macros
+ ADD_PSYMBOL_TO_LIST and ADD_PSYMBOL_ADDR_TO_LIST from
+ partial-stab.h to symfile.h. They aren't stab specific.
+ Change ADD_PSYMBOL_VT_TO_LIST to use memcpy rather than strncpy.
+
Tue Dec 24 11:38:08 1991 John Gilmore (gnu at cygnus.com)
* Makefile.in: Roll VERSION to 4.3.2.
bincls_allocated = 0;
}
-#ifdef DEBUG
-/* This is normally a macro defined in read_dbx_symtab, but this
- is a lot easier to debug. */
-
-void
-add_psymbol_to_plist(name, namelength, namespace, class, plist, value)
- char *name;
- int namelength;
- enum namespace namespace;
- enum address_class class;
- struct psymbol_allocation_list *plist;
- unsigned long value;
-{
- ADD_PSYMBOL_VT_TO_LIST(name, namelength, namespace,
- class, *plist, value, SYMBOL_VALUE);
-}
-
-void
-add_psymbol_addr_to_plist(name, namelength, namespace, class, plist, value)
- char *name;
- int namelength;
- enum namespace namespace;
- enum address_class class;
- struct psymbol_allocation_list *plist;
- CORE_ADDR value;
-{
- ADD_PSYMBOL_VT_TO_LIST(name, namelength, namespace,
- class, *plist, value, SYMBOL_VALUE_ADDRESS);
-}
-#endif /* DEBUG */
-
/* Given pointers to an a.out symbol table in core containing dbx
style data, setup partial_symtab's describing each source file for
which debugging information is available. NLISTLEN is the number
static void
EXFUN(add_partial_symbol, (struct dieinfo *dip));
-#ifdef DEBUG
-static void
-DEFUN(add_psymbol_to_list,
- (listp, name, space, class, value),
- struct psymbol_allocation_list *listp AND
- char *name AND
- enum namespace space AND
- enum address_class class AND
- CORE_ADDR value)
-{
- ADD_PSYMBOL_VT_TO_LIST(name, strlen(name), space, class,
- listp, value, SYMBOL_VALUE);
-}
-#else
-#define add_psymbol_to_list(listp, name, space, class, value) \
- ADD_PSYMBOL_VT_TO_LIST(name, strlen(name), space, class, \
- *(listp), value, SYMBOL_VALUE)
-#endif
-
static void
EXFUN(init_psymbol_list, (int total_symbols));
return result;
}
-#if 0
-/*
-
-LOCAL FUNCTION
-
- add_psymbol_to_list -- add a partial symbol to given list
-
-DESCRIPTION
-
- Add a partial symbol to one of the partial symbol vectors (pointed to
- by listp). The vector is grown as necessary.
-
- */
-
-static void
-DEFUN(add_psymbol_to_list,
- (listp, name, space, class, value),
- struct psymbol_allocation_list *listp AND
- char *name AND
- enum namespace space AND
- enum address_class class AND
- CORE_ADDR value)
-{
- struct partial_symbol *psym;
- int newsize;
-
- if (listp -> next >= listp -> list + listp -> size)
- {
- newsize = listp -> size * 2;
- listp -> list = (struct partial_symbol *)
- xrealloc (listp -> list, (newsize * sizeof (struct partial_symbol)));
- /* Next assumes we only went one over. Should be good if program works
- correctly */
- listp -> next = listp -> list + listp -> size;
- listp -> size = newsize;
- }
- psym = listp -> next++;
- SYMBOL_NAME (psym) = create_name (name, psymbol_obstack);
- SYMBOL_NAMESPACE (psym) = space;
- SYMBOL_CLASS (psym) = class;
- SYMBOL_VALUE (psym) = value;
-}
-#endif
-
/*
LOCAL FUNCTION
while (scan < listend)
{
scan += sizeof (long);
- add_psymbol_to_list (&static_psymbols, scan, VAR_NAMESPACE,
- LOC_CONST, 0);
+ ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
+ static_psymbols, 0);
scan += strlen (scan) + 1;
}
}
{
case TAG_global_subroutine:
record_misc_function (dip -> at_name, dip -> at_low_pc, mf_text);
- add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
- LOC_BLOCK, dip -> at_low_pc);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ VAR_NAMESPACE, LOC_BLOCK, global_psymbols,
+ dip -> at_low_pc);
break;
case TAG_global_variable:
record_misc_function (dip -> at_name, locval (dip -> at_location),
mf_data);
- add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
- LOC_STATIC, 0);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ VAR_NAMESPACE, LOC_STATIC, global_psymbols,
+ 0);
break;
case TAG_subroutine:
- add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
- LOC_BLOCK, dip -> at_low_pc);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ VAR_NAMESPACE, LOC_BLOCK, static_psymbols,
+ dip -> at_low_pc);
break;
case TAG_local_variable:
- add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
- LOC_STATIC, 0);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ VAR_NAMESPACE, LOC_STATIC, static_psymbols,
+ 0);
break;
case TAG_typedef:
- add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
- LOC_TYPEDEF, 0);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ VAR_NAMESPACE, LOC_TYPEDEF, static_psymbols,
+ 0);
break;
case TAG_structure_type:
case TAG_union_type:
- add_psymbol_to_list (&static_psymbols, dip -> at_name, STRUCT_NAMESPACE,
- LOC_TYPEDEF, 0);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ STRUCT_NAMESPACE, LOC_TYPEDEF, static_psymbols,
+ 0);
break;
case TAG_enumeration_type:
if (dip -> at_name)
{
- add_psymbol_to_list (&static_psymbols, dip -> at_name,
- STRUCT_NAMESPACE, LOC_TYPEDEF, 0);
+ ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+ STRUCT_NAMESPACE, LOC_TYPEDEF, static_psymbols,
+ 0);
}
add_enum_psymbol (dip);
break;
}
-#ifdef DEBUG
+#ifdef IEEE_DEBUG
/* Test some numbers to see that extended/double conversion works for them. */
CUR_SYMBOL_VALUE --Value field of current symbol. May be adjusted here.
*/
-#ifdef DEBUG
-/* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */
-#define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \
- add_psymbol_to_plist(NAME, NAMELENGTH, NAMESPACE, CLASS, &LIST, VALUE)
-#define ADD_PSYMBOL_ADDR_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \
- add_psymbol_to_plist(NAME, NAMELENGTH, NAMESPACE, CLASS, &LIST, VALUE)
-#else
-/* Add a symbol with an integer value to a psymtab. */
-#define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \
- ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, SYMBOL_VALUE)
-
-/* Add a symbol with a CORE_ADDR value to a psymtab. */
-#define ADD_PSYMBOL_ADDR_TO_LIST(NAME,NAMELENGTH, NAMESPACE,CLASS, LIST,VALUE)\
- ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, SYMBOL_VALUE_ADDRESS)
-#endif
-
/* End of macro definitions, now let's handle them symbols! */
switch (CUR_SYMBOL_TYPE)
listp->size = new_size;
}
+#ifdef DEBUG
+
+/* The work performed by this function is normally done by the macro
+ ADD_PSYMBOL_TO_LIST defined in symfile.h. When debugging gdb, this
+ function makes things easier. */
+
+void
+add_psymbol_to_list (name, namelength, namespace, class, listp, psymval)
+ char *name;
+ int namelength;
+ enum namespace namespace;
+ enum address_class class;
+ struct psymbol_allocation_list *listp;
+ unsigned long psymval;
+{
+ register struct partial_symbol *psym;
+
+ if (listp -> next >= listp -> list + listp -> size)
+ extend_psymbol_list (listp);
+ psym = listp -> next++;
+ SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack,
+ namelength + 1);
+ memcpy (SYMBOL_NAME (psym), name, namelength);
+ SYMBOL_NAME (psym)[namelength] = '\0';
+ SYMBOL_NAMESPACE (psym) = namespace;
+ SYMBOL_CLASS (psym) = class;
+ SYMBOL_VALUE (psym) = psymval;
+}
+
+/* The work performed by this function is normally done by the macro
+ ADD_PSYMBOL_ADDR_TO_LIST defined in symfile.h. When debugging gdb, this
+ function makes things easier. */
+
+void
+add_psymbol_addr_to_list (name, namelength, namespace, class, listp, psymval)
+ char *name;
+ int namelength;
+ enum namespace namespace;
+ enum address_class class;
+ struct psymbol_allocation_list *listp;
+ CORE_ADDR psymval;
+{
+ register struct partial_symbol *psym;
+
+ if (listp -> next >= listp -> list + listp -> size)
+ extend_psymbol_list (listp);
+ psym = listp -> next++;
+ SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack,
+ namelength + 1);
+ memcpy (SYMBOL_NAME (psym), name, namelength);
+ SYMBOL_NAME (psym)[namelength] = '\0';
+ SYMBOL_NAMESPACE (psym) = namespace;
+ SYMBOL_CLASS (psym) = class;
+ SYMBOL_VALUE_ADDRESS (psym) = psymval;
+}
+
+#endif /* DEBUG */
+
void
_initialize_symmisc ()
{