]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/dwarf: pass an array of values to the dwarf evaluator
authorAndrew Burgess <aburgess@redhat.com>
Wed, 16 Mar 2022 17:32:25 +0000 (17:32 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Sun, 3 Apr 2022 16:18:20 +0000 (17:18 +0100)
commit1fb43cf75982f17c27ee0c72328de41750213689
tree9dbc96b03e4422beaa1f6b223e68e161d3ab9c2c
parent22480d7c3977df6a111a1c1ab56982372732f4e5
gdb/dwarf: pass an array of values to the dwarf evaluator

When we need to evaluate a DWARF expression in order to resolve some
dynamic property of a type we call the dwarf2_evaluate_property
function, which is declared in gdb/dwarf/loc.h and defined in
gdb/dwarf/loc.c.

Currently, this function takes (amongst other things) an argument of
type property_addr_info called addr_stack and a boolean called
push_initial_value.  When push_initial_value then the top value of
addr_stack is pushed onto the dwarf expression evaluation stack before
the expression is evaluated.

So far this has worked fine, as the only two cases we needed to handle
are the case the DWARF expression doesn't require the object
address (what the top of addr_stack represents), and the case where
the DWARF expression does require the address.

In the next commit this is going to change.  As we add support for
Fortran assumed rank arrays, we need to start resolving the dynamic
properties of arrays.  To do this, we need to push the array rank onto
the dwarf expression evaluation stack before the expression is
evaluated.

This commit is a refactoring commit aimed at making it easier to
support Fortran assumed rank arrays.  Instead of passing a boolean,
and using this to decide if we should push the object address or not,
we instead pass an array (view) of values that should be pushed to the
dwarf expression evaluation stack.

In the couple of places where we previously passed push_initial_value
as true (mostly this was defaulting to false), we now have to pass the
address from the addr_stack as an item in the array view.

In the next commit, when we want to handle passing the array rank,
this will easily be supported too.

There should be no user visible changes after this commit.
gdb/dwarf2/loc.c
gdb/dwarf2/loc.h
gdb/gdbtypes.c
gdb/gnu-v3-abi.c