+2020-04-24 Tom Tromey <tromey@adacore.com>
+
+ * dwarf2/loc.c (dwarf2_locexpr_baton_eval): Add
+ "push_initial_value" parameter.
+ (dwarf2_evaluate_property): Likewise.
+ * dwarf2/loc.h (dwarf2_evaluate_property): Update.
+
2020-04-24 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (is_dynamic_type_internal): Check for variant parts.
that the dwarf expression only produces a single CORE_ADDR. FRAME is the
frame in which the expression is evaluated. ADDR is a context (location of
a variable) and might be needed to evaluate the location expression.
- Returns 1 on success, 0 otherwise. */
+ PUSH_INITIAL_VALUE is true if ADDR should be pushed on the stack
+ before evaluating the expression; this is required by certain
+ forms of DWARF expression. Returns 1 on success, 0 otherwise. */
static int
dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
struct frame_info *frame,
CORE_ADDR addr,
- CORE_ADDR *valp)
+ CORE_ADDR *valp,
+ bool push_initial_value)
{
struct objfile *objfile;
ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size ();
ctx.offset = dlbaton->per_cu->text_offset ();
+ if (push_initial_value)
+ ctx.push_address (addr, false);
+
try
{
ctx.eval (dlbaton->data, dlbaton->size);
dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct frame_info *frame,
const struct property_addr_info *addr_stack,
- CORE_ADDR *value)
+ CORE_ADDR *value,
+ bool push_initial_value)
{
if (prop == NULL)
return false;
if (dwarf2_locexpr_baton_eval (&baton->locexpr, frame,
addr_stack ? addr_stack->addr : 0,
- value))
+ value, push_initial_value))
{
if (baton->locexpr.is_reference)
{
be NULL.
Returns true if PROP could be converted and the static value is passed
- back into VALUE, otherwise returns false. */
+ back into VALUE, otherwise returns false.
+
+ If PUSH_INITIAL_VALUE is true, then the top value of ADDR_STACK
+ will be pushed before evaluating a location expression. */
bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct frame_info *frame,
const struct property_addr_info *addr_stack,
- CORE_ADDR *value);
+ CORE_ADDR *value,
+ bool push_initial_value = false);
/* A helper for the compiler interface that compiles a single dynamic
property to C code.