aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2025-04-16 15:18:43 -0600
committerTom Tromey <tromey@adacore.com>2025-05-06 09:01:54 -0600
commitb4b312d152318e9d56066074d19d5029cb97914f (patch)
treeec4dbc755612e35348a98d62f31175e059b64a63
parentd771893cca824dbda1f88c747dc0868a771079de (diff)
downloadbinutils-b4b312d152318e9d56066074d19d5029cb97914f.zip
binutils-b4b312d152318e9d56066074d19d5029cb97914f.tar.gz
binutils-b4b312d152318e9d56066074d19d5029cb97914f.tar.bz2
Constify property_addr_info
This changes most places to use a const property_addr_info. This seems more correct to me because normally the user of a property_addr_info should not modify it. Furthermore, some functions already take a const object, and for a subsequent patch it is convenient if other functions do as well.
-rw-r--r--gdb/dwarf2/loc.h2
-rw-r--r--gdb/gdbtypes.c26
2 files changed, 14 insertions, 14 deletions
diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h
index 30c528b..0230412 100644
--- a/gdb/dwarf2/loc.h
+++ b/gdb/dwarf2/loc.h
@@ -99,7 +99,7 @@ struct property_addr_info
/* If not NULL, a pointer to the info for the object containing
the object described by this node. */
- struct property_addr_info *next;
+ const property_addr_info *next;
};
/* Converts a dynamic property into a static one. FRAME is the frame in which
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 5713eac..adb4e72 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2146,7 +2146,7 @@ is_dynamic_type (struct type *type)
}
static struct type *resolve_dynamic_type_internal
- (struct type *type, struct property_addr_info *addr_stack,
+ (struct type *type, const property_addr_info *addr_stack,
const frame_info_ptr &frame, bool top_level);
/* Given a dynamic range type (dyn_range_type) and a stack of
@@ -2167,7 +2167,7 @@ static struct type *resolve_dynamic_type_internal
static struct type *
resolve_dynamic_range (struct type *dyn_range_type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
int rank, bool resolve_p = true)
{
@@ -2269,7 +2269,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
static struct type *
resolve_dynamic_array_or_string_1 (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
int rank, bool resolve_p)
{
@@ -2397,7 +2397,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
static struct type *
resolve_dynamic_array_or_string (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
CORE_ADDR value;
@@ -2490,7 +2490,7 @@ resolve_dynamic_array_or_string (struct type *type,
static struct type *
resolve_dynamic_union (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
struct type *resolved_type;
@@ -2534,7 +2534,7 @@ variant::matches (ULONGEST value, bool is_unsigned) const
static void
compute_variant_fields_inner (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant_part &part,
std::vector<bool> &flags);
@@ -2549,7 +2549,7 @@ compute_variant_fields_inner (struct type *type,
static void
compute_variant_fields_recurse (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant &variant,
std::vector<bool> &flags,
bool enabled)
@@ -2581,7 +2581,7 @@ compute_variant_fields_recurse (struct type *type,
static void
compute_variant_fields_inner (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant_part &part,
std::vector<bool> &flags)
{
@@ -2650,7 +2650,7 @@ compute_variant_fields_inner (struct type *type,
static void
compute_variant_fields (struct type *type,
struct type *resolved_type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const gdb::array_view<variant_part> &parts)
{
/* Assume all fields are included by default. */
@@ -2682,7 +2682,7 @@ compute_variant_fields (struct type *type,
static struct type *
resolve_dynamic_struct (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
struct type *resolved_type;
@@ -2725,9 +2725,9 @@ resolve_dynamic_struct (struct type *type,
struct dynamic_prop prop;
prop.set_locexpr (&baton);
+ CORE_ADDR vals[1] = { addr_stack->addr };
CORE_ADDR addr;
- if (dwarf2_evaluate_property (&prop, frame, addr_stack, &addr,
- {addr_stack->addr}))
+ if (dwarf2_evaluate_property (&prop, frame, addr_stack, &addr, vals))
resolved_type->field (i).set_loc_bitpos
(TARGET_CHAR_BIT * (addr - addr_stack->addr));
}
@@ -2797,7 +2797,7 @@ resolve_dynamic_struct (struct type *type,
static struct type *
resolve_dynamic_type_internal (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
bool top_level)
{