aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>1998-11-24 23:50:20 +0000
committerMichael Snyder <msnyder@vmware.com>1998-11-24 23:50:20 +0000
commit4183a62a97c424ac777cdc2b72f7dc7c8e0f3e7a (patch)
tree1c10c4fee52378bf7664092e2782a8f1a9212fca /gdb
parent15af627cc04ef46b1ba61c77ec2cbc1c6dfe09ee (diff)
downloadgdb-4183a62a97c424ac777cdc2b72f7dc7c8e0f3e7a.zip
gdb-4183a62a97c424ac777cdc2b72f7dc7c8e0f3e7a.tar.gz
gdb-4183a62a97c424ac777cdc2b72f7dc7c8e0f3e7a.tar.bz2
Tue Nov 24 15:46:33 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
* config/mn10300/tm-mn10300.h (TARGET_VIRTUAL_FRAME_POINTER): new target macro. * mn10300-tdep.c (mn10300_virtual_frame_pointer): new function. * tracepoint.c (encode_actions): Use the new target macro to determine the virtual frame pointer, for collecting locals/args. (add_local_symbols, collect_symbol): add a register/offset pair of arguments so that the virtual frame pointer can be passed in.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/config/mn10300/tm-mn10300.h5
-rw-r--r--gdb/tracepoint.c53
2 files changed, 47 insertions, 11 deletions
diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h
index 4898df4..a2bc298 100644
--- a/gdb/config/mn10300/tm-mn10300.h
+++ b/gdb/config/mn10300/tm-mn10300.h
@@ -166,6 +166,11 @@ extern use_struct_convention_fn mn10300_use_struct_convention;
one that takes account of generic CALL_DUMMY frames */
#define GET_SAVED_REGISTER
+/* Cons up virtual frame pointer for trace */
+extern void mn10300_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *));
+#define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
+ mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP))
+
/* Define this for Wingdb */
#define TARGET_MN10300
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d6ebdb4..3b911a8 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1157,9 +1157,11 @@ add_memrange (memranges, type, base, len)
/* Add a symbol to a collection list */
static void
-collect_symbol (collect, sym)
+collect_symbol (collect, sym, frame_regno, frame_offset)
struct collection_list *collect;
struct symbol *sym;
+ long frame_regno;
+ long frame_offset;
{
unsigned long len;
unsigned long reg;
@@ -1200,8 +1202,8 @@ collect_symbol (collect, sym)
SYMBOL_NAME (sym));
break;
case LOC_ARG:
- offset = SYMBOL_VALUE (sym);
- reg = FP_REGNUM;
+ reg = frame_regno;
+ offset = frame_offset + SYMBOL_VALUE (sym);
if (info_verbose)
{
printf_filtered ("LOC_LOCAL %s: Collect %d bytes at offset",
@@ -1223,8 +1225,8 @@ collect_symbol (collect, sym)
break;
case LOC_LOCAL:
case LOC_LOCAL_ARG:
- offset = SYMBOL_VALUE (sym);
- reg = FP_REGNUM;
+ reg = frame_regno;
+ offset = frame_offset + SYMBOL_VALUE (sym);
if (info_verbose)
{
printf_filtered ("LOC_LOCAL %s: Collect %d bytes at offset",
@@ -1256,9 +1258,11 @@ collect_symbol (collect, sym)
/* Add all locals (or args) symbols to collection list */
static void
-add_local_symbols (collect, pc, type)
+add_local_symbols (collect, pc, frame_regno, frame_offset, type)
struct collection_list *collect;
CORE_ADDR pc;
+ long frame_regno;
+ long frame_offset;
int type;
{
struct symbol *sym;
@@ -1281,7 +1285,7 @@ add_local_symbols (collect, pc, type)
if (type == 'L') /* collecting Locals */
{
count++;
- collect_symbol (collect, sym);
+ collect_symbol (collect, sym, frame_regno, frame_offset);
}
break;
case LOC_ARG:
@@ -1293,7 +1297,7 @@ add_local_symbols (collect, pc, type)
if (type == 'A') /* collecting Arguments */
{
count++;
- collect_symbol (collect, sym);
+ collect_symbol (collect, sym, frame_regno, frame_offset);
}
}
}
@@ -1434,6 +1438,18 @@ free_actions_list(actions_list)
free(actions_list);
}
+#ifndef TARGET_VIRTUAL_FRAME_POINTER
+/* If anybody else ever uses this macro, then move this
+ default definition into some global header file such as defs.h.
+
+ FIXME: GDB's whole scheme for dealing with "frames" and
+ "frame pointers" needs a serious shakedown.
+ */
+
+#define TARGET_VIRTUAL_FRAME_POINTER(ADDR, REGP, OFFP) \
+ do { *(REGP) = FP_REGNUM; *(OFFP) = 0; } while (0)
+#endif
+
/* render all actions into gdb protocol */
static void
encode_actions (t, tdp_actions, stepping_actions)
@@ -1451,6 +1467,8 @@ encode_actions (t, tdp_actions, stepping_actions)
struct collection_list *collect;
struct cmd_list_element *cmd;
struct agent_expr *aexpr;
+ long frame_reg, frame_offset;
+
clear_collection_list (&tracepoint_list);
clear_collection_list (&stepping_list);
@@ -1459,6 +1477,8 @@ encode_actions (t, tdp_actions, stepping_actions)
*tdp_actions = NULL;
*stepping_actions = NULL;
+ TARGET_VIRTUAL_FRAME_POINTER (t->address, &frame_reg, &frame_offset);
+
for (action = t->actions; action; action = action->next)
{
QUIT; /* allow user to bail out with ^C */
@@ -1488,12 +1508,20 @@ encode_actions (t, tdp_actions, stepping_actions)
}
else if (0 == strncasecmp ("$arg", action_exp, 4))
{
- add_local_symbols (collect, t->address, 'A');
+ add_local_symbols (collect,
+ t->address,
+ frame_reg,
+ frame_offset,
+ 'A');
action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$loc", action_exp, 4))
{
- add_local_symbols (collect, t->address, 'L');
+ add_local_symbols (collect,
+ t->address,
+ frame_reg,
+ frame_offset,
+ 'L');
action_exp = strchr (action_exp, ','); /* more? */
}
else
@@ -1524,7 +1552,10 @@ encode_actions (t, tdp_actions, stepping_actions)
break;
case OP_VAR_VALUE:
- collect_symbol (collect, exp->elts[2].symbol);
+ collect_symbol (collect,
+ exp->elts[2].symbol,
+ frame_reg,
+ frame_offset);
break;
default: /* full-fledged expression */