[pushed] Make dwarf2_evaluate_property parameter const

Message ID 20200320190609.21331-1-tromey@adacore.com
State New
Headers show
Series
  • [pushed] Make dwarf2_evaluate_property parameter const
Related show

Commit Message

Tom Tromey March 20, 2020, 7:06 p.m.
dwarf2_evaluate_property should not modify its "addr_stack"
parameter's contents.  This patch makes this part of the API, by
marking it const.

gdb/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

	* dwarf2/loc.h (dwarf2_evaluate_property): Make "addr_stack"
	const.
	* dwarf2/loc.c (dwarf2_evaluate_property): Make "addr_stack"
	const.
---
 gdb/ChangeLog    | 7 +++++++
 gdb/dwarf2/loc.c | 4 ++--
 gdb/dwarf2/loc.h | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.21.1

Patch

diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 5155cff60d0..6440335ccbd 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -2453,7 +2453,7 @@  dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
 bool
 dwarf2_evaluate_property (const struct dynamic_prop *prop,
 			  struct frame_info *frame,
-			  struct property_addr_info *addr_stack,
+			  const struct property_addr_info *addr_stack,
 			  CORE_ADDR *value)
 {
   if (prop == NULL)
@@ -2542,7 +2542,7 @@  dwarf2_evaluate_property (const struct dynamic_prop *prop,
       {
 	struct dwarf2_property_baton *baton
 	  = (struct dwarf2_property_baton *) prop->data.baton;
-	struct property_addr_info *pinfo;
+	const struct property_addr_info *pinfo;
 	struct value *val;
 
 	for (pinfo = addr_stack; pinfo != NULL; pinfo = pinfo->next)
diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h
index 98a7d8a6069..a59d3f998fd 100644
--- a/gdb/dwarf2/loc.h
+++ b/gdb/dwarf2/loc.h
@@ -96,7 +96,7 @@  struct property_addr_info
 
 bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
 			       struct frame_info *frame,
-			       struct property_addr_info *addr_stack,
+			       const struct property_addr_info *addr_stack,
 			       CORE_ADDR *value);
 
 /* A helper for the compiler interface that compiles a single dynamic