for (j = 0; j < len2; j++)
{
- const char *mangled_name;
gdb::unique_xmalloc_ptr<char> mangled_name_holder;
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
gdb_puts (" ", stream);
}
- if (TYPE_FN_FIELD_STUB (f, j))
- {
- /* Build something we can demangle. */
- mangled_name_holder.reset (gdb_mangle_name (type, i, j));
- mangled_name = mangled_name_holder.get ();
- }
- else
- mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
+
+ const char *mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
gdb::unique_xmalloc_ptr<char> demangled_name
= gdb_demangle (mangled_name,
arguments, the demangling will fail.
Let's try to reconstruct the function
signature from the symbol information. */
- if (!TYPE_FN_FIELD_STUB (f, j))
- {
- int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
- struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
-
- cp_type_print_method_args (mtype,
- "",
- method_name,
- staticp,
- stream, language,
- &local_flags);
- }
- else
- fprintf_styled (stream, metadata_style.style (),
- _("<badly mangled name '%s'>"),
- mangled_name);
+ int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
+ struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
+
+ cp_type_print_method_args (mtype,
+ "",
+ method_name,
+ staticp,
+ stream, language,
+ &local_flags);
}
else
{
return type;
}
-/* Parse a type expression in the string [P..P+LENGTH). If an error
- occurs, silently return a void type. */
-
-static struct type *
-safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
-{
- struct type *type = NULL; /* Initialize to keep gcc happy. */
-
- /* Suppress error messages. */
- scoped_restore saved_gdb_stderr = make_scoped_restore (&gdb_stderr,
- &null_stream);
-
- /* Call parse_and_eval_type() without fear of longjmp()s. */
- try
- {
- type = parse_and_eval_type (p, length);
- }
- catch (const gdb_exception_error &except)
- {
- type = builtin_type (gdbarch)->builtin_void;
- }
-
- return type;
-}
-
-/* Ugly hack to convert method stubs into method types.
-
- He ain't kiddin'. This demangles the name of the method into a
- string including argument types, parses out each argument type,
- generates a string casting a zero to that type, evaluates the
- string, and stuffs the resulting type into an argtype vector!!!
- Then it knows the type of the whole function (including argument
- types for overloading), which info used to be in the stab's but was
- removed to hack back the space required for them. */
-
-static void
-check_stub_method (struct type *type, int method_id, int signature_id)
-{
- struct gdbarch *gdbarch = type->arch ();
- struct fn_field *f;
- char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
- gdb::unique_xmalloc_ptr<char> demangled_name
- = gdb_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI);
- char *argtypetext, *p;
- int depth = 0, argcount = 1;
- struct field *argtypes;
- struct type *mtype;
-
- /* Make sure we got back a function string that we can use. */
- if (demangled_name)
- p = strchr (demangled_name.get (), '(');
- else
- p = NULL;
-
- if (demangled_name == NULL || p == NULL)
- error (_("Internal: Cannot demangle mangled name `%s'."),
- mangled_name);
-
- /* Now, read in the parameters that define this type. */
- p += 1;
- argtypetext = p;
- while (*p)
- {
- if (*p == '(' || *p == '<')
- {
- depth += 1;
- }
- else if (*p == ')' || *p == '>')
- {
- depth -= 1;
- }
- else if (*p == ',' && depth == 0)
- {
- argcount += 1;
- }
-
- p += 1;
- }
-
- /* If we read one argument and it was ``void'', don't count it. */
- if (startswith (argtypetext, "(void)"))
- argcount -= 1;
-
- /* We need one extra slot, for the THIS pointer. */
-
- argtypes = (struct field *)
- TYPE_ZALLOC (type, (argcount + 1) * sizeof (struct field));
- p = argtypetext;
-
- /* Add THIS pointer for non-static methods. */
- f = TYPE_FN_FIELDLIST1 (type, method_id);
- if (TYPE_FN_FIELD_STATIC_P (f, signature_id))
- argcount = 0;
- else
- {
- argtypes[0].set_type (lookup_pointer_type (type));
- argcount = 1;
- }
-
- if (*p != ')') /* () means no args, skip while. */
- {
- depth = 0;
- while (*p)
- {
- if (depth <= 0 && (*p == ',' || *p == ')'))
- {
- /* Avoid parsing of ellipsis, they will be handled below.
- Also avoid ``void'' as above. */
- if (strncmp (argtypetext, "...", p - argtypetext) != 0
- && strncmp (argtypetext, "void", p - argtypetext) != 0)
- {
- argtypes[argcount].set_type
- (safe_parse_type (gdbarch, argtypetext, p - argtypetext));
- argcount += 1;
- }
- argtypetext = p + 1;
- }
-
- if (*p == '(' || *p == '<')
- {
- depth += 1;
- }
- else if (*p == ')' || *p == '>')
- {
- depth -= 1;
- }
-
- p += 1;
- }
- }
-
- TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name;
-
- /* Now update the old "stub" type into a real type. */
- mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
- /* MTYPE may currently be a function (TYPE_CODE_FUNC).
- We want a method (TYPE_CODE_METHOD). */
- smash_to_method_type (mtype, type, mtype->target_type (),
- gdb::make_array_view (argtypes, argcount),
- p[-2] == '.');
- mtype->set_is_stub (false);
- TYPE_FN_FIELD_STUB (f, signature_id) = 0;
-}
-
-/* This is the external interface to check_stub_method, above. This
- function unstubs all of the signatures for TYPE's METHOD_ID method
- name. After calling this function TYPE_FN_FIELD_STUB will be
- cleared for each signature and TYPE_FN_FIELDLIST_NAME will be
- correct.
-
- This function unfortunately can not die until stabs do. */
-
-void
-check_stub_method_group (struct type *type, int method_id)
-{
- int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id);
- struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
-
- for (int j = 0; j < len; j++)
- {
- if (TYPE_FN_FIELD_STUB (f, j))
- check_stub_method (type, method_id, j);
- }
-}
-
/* Ensure it is in .rodata (if available) by working around GCC PR 44690. */
const struct cplus_struct_type cplus_struct_default = { };
TYPE_FN_FIELD_PRIVATE (f, overload_idx));
gdb_printf ("%*sis_protected %d\n", spaces + 8, "",
TYPE_FN_FIELD_PROTECTED (f, overload_idx));
- gdb_printf ("%*sis_stub %d\n", spaces + 8, "",
- TYPE_FN_FIELD_STUB (f, overload_idx));
gdb_printf ("%*sdefaulted %d\n", spaces + 8, "",
TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
gdb_printf ("%*sis_deleted %d\n", spaces + 8, "",
struct fn_field
{
- /* * If is_stub is clear, this is the mangled name which we can look
- up to find the address of the method (FIXME: it would be cleaner
- to have a pointer to the struct symbol here instead).
-
- If is_stub is set, this is the portion of the mangled name which
- specifies the arguments. For example, "ii", if there are two int
- arguments, or "" if there are no arguments. See gdb_mangle_name
- for the conversion from this format to the one used if is_stub is
- clear. */
+ /* * This is the mangled name which we can look up to find the
+ address of the method (FIXME: it would be cleaner to have a
+ pointer to the struct symbol here instead). */
const char *physname;
unsigned int is_volatile:1;
unsigned int is_artificial:1;
- /* * A stub method only has some fields valid (but they are enough
- to reconstruct the rest of the fields). */
-
- unsigned int is_stub:1;
-
/* * True if this function is a constructor, false otherwise. */
unsigned int is_constructor : 1;
#define TYPE_FN_FIELD_PROTECTED(thisfn, n) \
((thisfn)[n].accessibility == accessibility::PROTECTED)
#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
-#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
extern struct type *check_typedef (struct type *);
-extern void check_stub_method_group (struct type *, int);
-
extern char *gdb_mangle_name (struct type *, int, int);
/* Lookup a typedef or primitive type named NAME, visible in lexical block