aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2002-08-25 09:40:32 +0000
committerStephane Carrez <stcarrez@nerim.fr>2002-08-25 09:40:32 +0000
commit5564c76952a3968193fba003f2208b718c8eca06 (patch)
treee0b52b5d94aba2aa7c724f04a404f7c53eef4ec9 /gdb
parentbc77de56b690a880fc04d9ca99830fa69ae177e5 (diff)
downloadgdb-5564c76952a3968193fba003f2208b718c8eca06.zip
gdb-5564c76952a3968193fba003f2208b718c8eca06.tar.gz
gdb-5564c76952a3968193fba003f2208b718c8eca06.tar.bz2
* tuiStack.c (tui_get_function_from_frame): Rename from
_getFuncNameFromFrame; use print_address_symbolic to get symbolic name of address. (tuiUpdateLocatorInfoFromFrame): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/tui/ChangeLog7
-rw-r--r--gdb/tui/tuiStack.c67
2 files changed, 44 insertions, 30 deletions
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index 97c838f..9fea5ac 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,5 +1,12 @@
2002-08-25 Stephane Carrez <stcarrez@nerim.fr>
+ * tuiStack.c (tui_get_function_from_frame): Rename from
+ _getFuncNameFromFrame; use print_address_symbolic to get symbolic
+ name of address.
+ (tuiUpdateLocatorInfoFromFrame): Update.
+
+2002-08-25 Stephane Carrez <stcarrez@nerim.fr>
+
* tuiRegs.c (tuiDisplayRegistersFrom): Remove unused locals.
(_tuiRegisterFormat, _tuiSetSpecialRegsContent): Likewise.
(_tuiSetGeneralAndSpecialRegsContent): Likewise.
diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c
index d003fd7..22fb18a 100644
--- a/gdb/tui/tuiStack.c
+++ b/gdb/tui/tuiStack.c
@@ -52,19 +52,47 @@
#include "tuiGeneralWin.h"
#include "tuiSource.h"
#include "tuiSourceWin.h"
+#include "tui-file.h"
-/*****************************************
-** STATIC LOCAL FUNCTIONS FORWARD DECLS **
-******************************************/
+/* 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 *_getFuncNameFromFrame (struct frame_info *);
static void tui_update_command (char *, int);
-/*****************************************
-** PUBLIC FUNCTION **
-******************************************/
+/* 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 (fi->pc, 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;
+}
/*
** tuiClearLocatorDisplay()
@@ -230,13 +258,13 @@ tuiUpdateLocatorInfoFromFrame (struct frame_info *frameInfo,
!frame_in_dummy (frameInfo->next)));
if (symtabAndLine.symtab && symtabAndLine.symtab->filename)
tuiSetLocatorInfo (symtabAndLine.symtab->filename,
- _getFuncNameFromFrame (frameInfo),
+ tui_get_function_from_frame (frameInfo),
symtabAndLine.line,
frameInfo->pc,
element);
else
tuiSetLocatorInfo ((char *) NULL,
- _getFuncNameFromFrame (frameInfo),
+ tui_get_function_from_frame (frameInfo),
0,
frameInfo->pc,
element);
@@ -395,27 +423,6 @@ _initialize_tuiStack (void)
"execution point.\n");
}
-
-/*****************************************
-** STATIC LOCAL FUNCTIONS **
-******************************************/
-
-/*
- ** _getFuncNameFromFrame().
- */
-static char *
-_getFuncNameFromFrame (struct frame_info *frameInfo)
-{
- char *funcName = (char *) NULL;
-
- find_pc_partial_function (frameInfo->pc,
- &funcName,
- (CORE_ADDR *) NULL,
- (CORE_ADDR *) NULL);
- return funcName;
-} /* _getFuncNameFromFrame */
-
-
/* Command to update the display with the current execution point. */
static void
tui_update_command (char *arg, int from_tty)