}
else
{
- char *kind = "function";
- if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
- kind = "method";
/* Allow functions to be nameless (such as artificial ones). */
if (DECL_NAME (current_function_decl))
name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
else
name = "";
- printable_name = (*decl_printable_name) (current_function_decl, &kind);
+ printable_name = (*decl_printable_name) (current_function_decl, 2);
}
declare_hidden_char_array ("__FUNCTION__", name);
}
}
+/* The DWARF2 pubname for a nested thingy looks like "A::f". The output
+ of decl_printable_name for C++ looks like "A::f(int)". Let's drop the
+ argument list, and maybe the scope. */
+
+static char*
+dwarf2_name (decl, scope)
+ tree decl;
+ int scope;
+{
+ return (*decl_printable_name) (decl, scope ? 1 : 0);
+}
+
/* Add a new entry to .debug_pubnames if appropriate. */
static void
add_pubname (decl, die)
}
p = &pubname_table[pubname_table_in_use++];
p->die = die;
- p->name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+ p->name = xstrdup (dwarf2_name (decl, 1));
}
/* Output the public names table used to speed up access to externally
if (a->die_tag == DW_TAG_subprogram)
ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (a));
else
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_string (a, DW_AT_name));
+ {
+ char *name = get_AT_string (a, DW_AT_MIPS_linkage_name);
+ if (! name)
+ name = get_AT_string (a, DW_AT_name);
+ ASM_OUTPUT_DWARF_ADDR (asm_out_file, name);
+ }
if (flag_verbose_asm)
{
fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
register tree decl;
{
register tree decl_name;
- if (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
- decl_name = DECL_ASSEMBLER_NAME (decl);
- else
- decl_name = DECL_NAME (decl);
-
+ decl_name = DECL_NAME (decl);
if (decl_name && IDENTIFIER_POINTER (decl_name))
{
- add_name_attribute (die, IDENTIFIER_POINTER (decl_name));
+ add_name_attribute (die, dwarf2_name (decl, 0));
add_src_coords_attributes (die, decl);
+ if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+ && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+ add_AT_string (die, DW_AT_MIPS_linkage_name,
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
}
}
of the function name. */
if (profile_block_flag)
{
- char *junk = "function";
bb_func_label_num =
- add_bb_string ((*decl_printable_name) (current_function_decl, &junk), FALSE);
+ add_bb_string ((*decl_printable_name) (current_function_decl, 2), FALSE);
}
}
char *filename;
int line;
{
- char *junk;
-
if (output_bytecode)
{
this_function_decl = subr;
init_const_rtx_hash_table ();
- current_function_name = (*decl_printable_name) (subr, &junk);
+ current_function_name = (*decl_printable_name) (subr, 2);
/* Nonzero if this is a nested function that uses a static chain. */
/* Flag to output bytecode instead of native assembler */
int output_bytecode = 0;
-/* Pointer to function to compute the name to use to print a declaration. */
+/* Pointer to function to compute the name to use to print a declaration.
+ DECL is the declaration in question.
+ VERBOSITY determines what information will be printed:
+ 0: DECL_NAME, demangled as necessary.
+ 1: and scope information.
+ 2: and any other information that might be interesting, such as function
+ parameter types in C++. */
-char *(*decl_printable_name) ();
+char *(*decl_printable_name) (/* tree decl, int verbosity */);
/* Pointer to function to compute rtl for a language-specific tree code. */
/* This is the default decl_printable_name function. */
static char *
-decl_name (decl, kind)
+decl_name (decl, verbosity)
tree decl;
- char **kind;
+ int verbosity;
{
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
{
if (! quiet_flag)
{
- char *junk;
if (rtl_dump_and_exit)
fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
else
- fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
+ fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
fflush (stderr);
need_error_newline = 1;
last_error_function = current_function_decl;
fprintf (stderr, "At top level:\n");
else
{
- char *name = (*decl_printable_name) (current_function_decl, &kind);
+ char *name = (*decl_printable_name) (current_function_decl, 2);
fprintf (stderr, "In %s `%s':\n", kind, name);
}
char *s;
va_list ap;
{
- char *n, *p, *junk;
+ char *n, *p;
fprintf (stderr, "%s:%d: ",
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
if (*p == '%') /* Print the name. */
{
char *n = (DECL_NAME (decl)
- ? (*decl_printable_name) (decl, &junk)
+ ? (*decl_printable_name) (decl, 2)
: "((anonymous))");
fputs (n, stderr);
while (*p)
extern int all_types_permanent;
-/* Pointer to function to compute the name to use to print a declaration. */
-
-extern char *(*decl_printable_name) ();
+/* Pointer to function to compute the name to use to print a declaration.
+ DECL is the declaration in question.
+ VERBOSITY determines what information will be printed:
+ 0: DECL_NAME, demangled as necessary.
+ 1: and scope information.
+ 2: and any other information that might be interesting, such as function
+ parameter types in C++. */
+
+extern char *(*decl_printable_name) (/* tree decl, int verbosity */);
/* Pointer to function to finish handling an incomplete decl at the
end of compilation. */