/* Get a printable name for the function at the address. The symbol name is demangled if demangling is turned on. Returns a pointer to a static area holding the result. */ static char* tui_get_function_from_frame (struct frame_info *fi) { static char name[256]; string_file stream; print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi), &stream, demangle, ""); /* Use simple heuristics to isolate the function name. The symbol can be demangled and we can have function parameters. Remove them because the status line is too short to display them. */ const char *d = stream.c_str (); if (*d == '<') d++; strncpy (name, d, sizeof (name) - 1); name[sizeof (name) - 1] = 0; char *p = strchr (name, '('); if (!p) p = strchr (name, '>'); if (p) *p = 0; p = strchr (name, '+'); if (p) *p = 0; return name; }
/* Get a printable name for the function at the address. The symbol name is demangled if demangling is turned on. Returns a pointer to a static area holding the result. */ static char* tui_get_function_from_frame (struct frame_info *fi) { static char name[256]; struct ui_file *stream = tui_sfileopen (256); char *p; print_address_symbolic (get_frame_pc (fi), stream, demangle, ""); p = tui_file_get_strbuf (stream); /* Use simple heuristics to isolate the function name. The symbol can be demangled and we can have function parameters. Remove them because the status line is too short to display them. */ if (*p == '<') p++; strncpy (name, p, sizeof (name)); p = strchr (name, '('); if (!p) p = strchr (name, '>'); if (p) *p = 0; p = strchr (name, '+'); if (p) *p = 0; ui_file_delete (stream); return name; }