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.
This commit is contained in:
Michael Snyder 1998-11-24 23:50:20 +00:00
parent 15af627cc0
commit 4183a62a97
2 changed files with 47 additions and 11 deletions

View file

@ -166,6 +166,11 @@ extern use_struct_convention_fn mn10300_use_struct_convention;
one that takes account of generic CALL_DUMMY frames */ one that takes account of generic CALL_DUMMY frames */
#define GET_SAVED_REGISTER #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 this for Wingdb */
#define TARGET_MN10300 #define TARGET_MN10300

View file

@ -1157,9 +1157,11 @@ add_memrange (memranges, type, base, len)
/* Add a symbol to a collection list */ /* Add a symbol to a collection list */
static void static void
collect_symbol (collect, sym) collect_symbol (collect, sym, frame_regno, frame_offset)
struct collection_list *collect; struct collection_list *collect;
struct symbol *sym; struct symbol *sym;
long frame_regno;
long frame_offset;
{ {
unsigned long len; unsigned long len;
unsigned long reg; unsigned long reg;
@ -1200,8 +1202,8 @@ collect_symbol (collect, sym)
SYMBOL_NAME (sym)); SYMBOL_NAME (sym));
break; break;
case LOC_ARG: case LOC_ARG:
offset = SYMBOL_VALUE (sym); reg = frame_regno;
reg = FP_REGNUM; offset = frame_offset + SYMBOL_VALUE (sym);
if (info_verbose) if (info_verbose)
{ {
printf_filtered ("LOC_LOCAL %s: Collect %d bytes at offset", printf_filtered ("LOC_LOCAL %s: Collect %d bytes at offset",
@ -1223,8 +1225,8 @@ collect_symbol (collect, sym)
break; break;
case LOC_LOCAL: case LOC_LOCAL:
case LOC_LOCAL_ARG: case LOC_LOCAL_ARG:
offset = SYMBOL_VALUE (sym); reg = frame_regno;
reg = FP_REGNUM; offset = frame_offset + SYMBOL_VALUE (sym);
if (info_verbose) if (info_verbose)
{ {
printf_filtered ("LOC_LOCAL %s: Collect %d bytes at offset", 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 */ /* Add all locals (or args) symbols to collection list */
static void static void
add_local_symbols (collect, pc, type) add_local_symbols (collect, pc, frame_regno, frame_offset, type)
struct collection_list *collect; struct collection_list *collect;
CORE_ADDR pc; CORE_ADDR pc;
long frame_regno;
long frame_offset;
int type; int type;
{ {
struct symbol *sym; struct symbol *sym;
@ -1281,7 +1285,7 @@ add_local_symbols (collect, pc, type)
if (type == 'L') /* collecting Locals */ if (type == 'L') /* collecting Locals */
{ {
count++; count++;
collect_symbol (collect, sym); collect_symbol (collect, sym, frame_regno, frame_offset);
} }
break; break;
case LOC_ARG: case LOC_ARG:
@ -1293,7 +1297,7 @@ add_local_symbols (collect, pc, type)
if (type == 'A') /* collecting Arguments */ if (type == 'A') /* collecting Arguments */
{ {
count++; 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); 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 */ /* render all actions into gdb protocol */
static void static void
encode_actions (t, tdp_actions, stepping_actions) encode_actions (t, tdp_actions, stepping_actions)
@ -1451,6 +1467,8 @@ encode_actions (t, tdp_actions, stepping_actions)
struct collection_list *collect; struct collection_list *collect;
struct cmd_list_element *cmd; struct cmd_list_element *cmd;
struct agent_expr *aexpr; struct agent_expr *aexpr;
long frame_reg, frame_offset;
clear_collection_list (&tracepoint_list); clear_collection_list (&tracepoint_list);
clear_collection_list (&stepping_list); clear_collection_list (&stepping_list);
@ -1459,6 +1477,8 @@ encode_actions (t, tdp_actions, stepping_actions)
*tdp_actions = NULL; *tdp_actions = NULL;
*stepping_actions = NULL; *stepping_actions = NULL;
TARGET_VIRTUAL_FRAME_POINTER (t->address, &frame_reg, &frame_offset);
for (action = t->actions; action; action = action->next) for (action = t->actions; action; action = action->next)
{ {
QUIT; /* allow user to bail out with ^C */ 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)) 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? */ action_exp = strchr (action_exp, ','); /* more? */
} }
else if (0 == strncasecmp ("$loc", action_exp, 4)) 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? */ action_exp = strchr (action_exp, ','); /* more? */
} }
else else
@ -1524,7 +1552,10 @@ encode_actions (t, tdp_actions, stepping_actions)
break; break;
case OP_VAR_VALUE: case OP_VAR_VALUE:
collect_symbol (collect, exp->elts[2].symbol); collect_symbol (collect,
exp->elts[2].symbol,
frame_reg,
frame_offset);
break; break;
default: /* full-fledged expression */ default: /* full-fledged expression */