debug_type type;
/* Slot if we make an indirect type. */
debug_type *pslot;
- /* Kind of variable (DEBUG_VAR_ILLEGAL if not a variable). */
- enum debug_var_kind variable;
+ /* Kind of variable or function. */
+ enum
+ {
+ IEEE_UNKNOWN,
+ IEEE_EXTERNAL,
+ IEEE_GLOBAL,
+ IEEE_STATIC,
+ IEEE_LOCAL,
+ IEEE_FUNCTION
+ } kind;
};
/* This structure holds all the variables. */
while (present);
pv = info->vars.vars + varindx;
+ pv->kind = IEEE_EXTERNAL;
if (pv->namlen > 0
&& debug_get_type_kind (dhandle, rtype) == DEBUG_KIND_POINTER)
{
|| ! ieee_read_optional_number (info, pp, &father, &present))
return false;
+ /* We can't distinguish between a global function and a static
+ function. */
+ pv->kind = IEEE_FUNCTION;
+
if (pv->namlen > 0
&& debug_get_type_kind (dhandle, rtype) == DEBUG_KIND_POINTER)
{
case 1:
case 2:
case 3:
+ case 5:
case 8:
case 10:
pvar->pslot = (debug_type *) xmalloc (sizeof *pvar->pslot);
if (type == NULL)
type = debug_make_void_type (dhandle);
if (pvar != NULL)
- pvar->variable = DEBUG_LOCAL;
+ pvar->kind = IEEE_LOCAL;
return debug_record_variable (dhandle, namcopy, type, DEBUG_LOCAL, v);
case 2:
if (type == NULL)
type = debug_make_void_type (dhandle);
if (pvar != NULL)
- pvar->variable = DEBUG_REGISTER;
+ pvar->kind = IEEE_LOCAL;
return debug_record_variable (dhandle, namcopy, type, DEBUG_REGISTER,
ieee_regno_to_genreg (info->abfd, v));
if (pvar != NULL)
{
if (blocktype == 4 || blocktype == 6)
- pvar->variable = DEBUG_LOCAL_STATIC;
+ pvar->kind = IEEE_LOCAL;
else
- pvar->variable = DEBUG_STATIC;
+ pvar->kind = IEEE_STATIC;
}
return debug_record_variable (dhandle, namcopy, type,
(blocktype == 4 || blocktype == 6
case 4:
/* External function. We don't currently record these. FIXME. */
+ if (pvar != NULL)
+ pvar->kind = IEEE_EXTERNAL;
return true;
case 5:
/* External variable. We don't currently record these. FIXME. */
+ if (pvar != NULL)
+ pvar->kind = IEEE_EXTERNAL;
return true;
case 7:
if (type == NULL)
type = debug_make_void_type (dhandle);
if (pvar != NULL)
- pvar->variable = DEBUG_GLOBAL;
+ pvar->kind = IEEE_GLOBAL;
return debug_record_variable (dhandle, namcopy, type, DEBUG_GLOBAL, v);
case 9:
if (type == NULL)
type = debug_make_void_type (dhandle);
if (pvar != NULL)
- pvar->variable = DEBUG_REGISTER;
+ pvar->kind = IEEE_LOCAL;
return debug_record_variable (dhandle, namcopy, type, DEBUG_REGISTER, v);
case 11:
if (staticp)
{
- /* We can only figure out the type here if mangledname
- happens to have already been defined, but that is
- not necessarily the case. In fact, it may never be
- defined. For now, we don't even try. FIXME. */
- pf = NULL;
- ftype = ieee_builtin_type (info, start,
- (unsigned int) builtin_void);
+ struct ieee_var *pv, *pvend;
+
+ /* See if we can find a definition for this variable. */
+ pv = info->vars.vars;
+ pvend = pv + info->vars.alloc;
+ for (; pv < pvend; pv++)
+ if (pv->namlen == mangledlen
+ && strncmp (pv->name, mangledname, mangledlen) == 0)
+ break;
+ if (pv < pvend)
+ ftype = pv->type;
+ else
+ {
+ /* This can happen if the variable is never used. */
+ ftype = ieee_builtin_type (info, start,
+ (unsigned int) builtin_void);
+ }
}
else
{
break;
}
- if ((flags & CXXFLAGS_STATIC) != 0)
+ if (staticp)
{
char *mangledcopy;
case 0:
/* Global variable or function. */
- if (pv->variable == DEBUG_GLOBAL)
- found = true;
- else if (pv->type != DEBUG_TYPE_NULL
- && (debug_get_type_kind (info->dhandle, pv->type)
- == DEBUG_KIND_FUNCTION))
+ if (pv->kind == IEEE_GLOBAL
+ || pv->kind == IEEE_EXTERNAL
+ || pv->kind == IEEE_FUNCTION)
found = true;
break;
case 1:
/* Global static variable or function. */
- if (pv->variable == DEBUG_STATIC)
- found = true;
- else if (pv->type != DEBUG_TYPE_NULL
- && (debug_get_type_kind (info->dhandle, pv->type)
- == DEBUG_KIND_FUNCTION))
+ if (pv->kind == IEEE_STATIC
+ || pv->kind == IEEE_FUNCTION)
found = true;
break;
case 2:
/* Local variable. */
- if (pv->variable == DEBUG_LOCAL_STATIC
- || pv->variable == DEBUG_LOCAL
- || pv->variable == DEBUG_REGISTER)
+ if (pv->kind == IEEE_LOCAL)
found = true;
break;
}