From 3c7c57cdc06412d9c81dcc2d89ff2ab4e4704708 Mon Sep 17 00:00:00 2001 From: Zoran Zaric Date: Tue, 15 Sep 2020 11:37:19 +0100 Subject: [PATCH] Move read_mem to dwarf_expr_context Following the idea of merging the evaluators, the read_mem method can be moved from dwarf_expr_executor and dwarf_evaluate_loc_desc classes to their base class dwarf_expr_context. gdb/ChangeLog: * dwarf2/expr.c (dwarf_expr_context::read_mem): Move from dwarf_evaluate_loc_desc. * dwarf2/frame.c (dwarf_expr_executor::read_mem): Remove method. * dwarf2/loc.c (dwarf_evaluate_loc_desc::read_mem): Move to dwarf_expr_context. --- gdb/dwarf2/expr.c | 9 +++++++++ gdb/dwarf2/expr.h | 2 +- gdb/dwarf2/frame.c | 5 ----- gdb/dwarf2/loc.c | 7 ------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index b13de987908..dac693d2026 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -249,6 +249,15 @@ dwarf_expr_context::dwarf_call (cu_offset die_cu_off) this->eval (block.data, block.size); } +/* See expr.h. */ + +void +dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr, + size_t length) +{ + read_memory (addr, buf, length); +} + /* Require that TYPE be an integral type; throw an exception if not. */ static void diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index d10bf9c78f3..3a085fd286e 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -192,7 +192,7 @@ struct dwarf_expr_context CORE_ADDR obj_address = 0; /* Read LENGTH bytes at ADDR into BUF. */ - virtual void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t length) = 0; + virtual void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t length); /* Push on DWARF stack an entry evaluated for DW_TAG_call_site's parameter matching KIND and KIND_U at the caller of specified BATON. diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 37d3a4056fb..76a546f0f5a 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -232,11 +232,6 @@ public: : dwarf_expr_context (per_objfile) {} - void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) override - { - read_memory (addr, buf, len); - } - void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind, union call_site_parameter_u kind_u, int deref_size) override diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 217d74c08ef..a23c6767728 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -728,13 +728,6 @@ public: this->eval (data_src, size); } - - /* Read memory at ADDR (length LEN) into BUF. */ - - void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) override - { - read_memory (addr, buf, len); - } }; /* See dwarf2loc.h. */ -- 2.30.2