/* 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;
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",
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",
/* 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;
if (type == 'L') /* collecting Locals */
{
count++;
- collect_symbol (collect, sym);
+ collect_symbol (collect, sym, frame_regno, frame_offset);
}
break;
case LOC_ARG:
if (type == 'A') /* collecting Arguments */
{
count++;
- collect_symbol (collect, sym);
+ collect_symbol (collect, sym, frame_regno, frame_offset);
}
}
}
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)
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);
*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 */
}
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
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 */