Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
}
else
{
- /* The only match was a non-debuggable symbol. */
- values.sals[0].symtab = NULL;
- values.sals[0].line = 0;
- values.sals[0].end = 0;
- values.sals[0].pc = SYMBOL_VALUE_ADDRESS (sym_arr[0]);
+ /* The only match was a non-debuggable symbol, which might point
+ to a function descriptor; resolve it to the actual code address
+ instead. */
+ struct minimal_symbol *msymbol = (struct minimal_symbol *)sym_arr[0];
+ struct objfile *objfile = msymbol_objfile (msymbol);
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ CORE_ADDR pc = SYMBOL_VALUE_ADDRESS (msymbol);
+
+ pc = gdbarch_convert_from_func_ptr_addr (gdbarch, pc,
+ ¤t_target);
+
+ init_sal (&values.sals[0]);
+ values.sals[0].pc = pc;
}
return values;
}
{
char *p1;
char *copy;
+ struct symbol *sym;
/* Extract the class name. */
p1 = p;
/* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA",
argptr->"inA::fun" */
- return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0);
+ sym = lookup_symbol (copy, 0, STRUCT_DOMAIN, 0);
+ if (sym == NULL)
+ {
+ /* Typedefs are in VAR_DOMAIN so the above symbol lookup will
+ fail when the user attempts to lookup a method of a class
+ via a typedef'd name (NOT via the class's name, which is already
+ handled in symbol_matches_domain). So try the lookup again
+ using VAR_DOMAIN (where typedefs live) and double-check that we
+ found a struct/class type. */
+ struct symbol *s = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
+ if (s != NULL)
+ {
+ struct type *t = SYMBOL_TYPE (s);
+ CHECK_TYPEDEF (t);
+ if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
+ return s;
+ }
+ }
+
+ return sym;
}
/* This finds the method COPY in the class whose type is T and whose
init_sal (&val);
+ val.pspace = current_program_space;
+
/* This is where we need to make sure that we have good defaults.
We must guarantee that this section of code is never executed
when we are called with just a function name, since
if (val.symtab == 0)
val.symtab = file_symtab;
+ val.pspace = SYMTAB_PSPACE (val.symtab);
val.pc = 0;
values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
val.symtab = file_symtab ? file_symtab : default_symtab;
val.line = valx;
val.pc = 0;
+ val.pspace = current_program_space;
values.sals = (struct symtab_and_line *) xmalloc (sizeof val);
values.sals[0] = val;