Re: [PATCH 6/6] gdb/dwarf: use dwarf2_per_cu::ref_addr_size in one spot

Andrew Burgess
2025-11-19T14:45:34Z

Simon Marchi <simon.marchi@efficios.com> writes:

> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> I noticed this spot that could use dwarf2_per_cu::ref_addr_size, instead
> of implementing the same logic.

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

>
> Change-Id: I894ef1dcaa687c659e49bc1eb433e42818038cf2
> ---
> gdb/dwarf2/read.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index a8b9798c4e8e..c355cc2bb5cb 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -3866,12 +3866,7 @@ cutu_reader::skip_one_attribute (dwarf_form form, const gdb_byte *info_ptr)
> switch (form)
> {
> case DW_FORM_ref_addr:
> - /* In DWARF 2, DW_FORM_ref_addr is address sized; in DWARF 3
> - and later it is offset sized. */
> - if (m_cu->header.version == 2)
> - return info_ptr + m_cu->header.addr_size;
> - else
> - return info_ptr + m_cu->header.offset_size;
> + return info_ptr + m_cu->per_cu->ref_addr_size ();
>
> case DW_FORM_GNU_ref_alt:
> return info_ptr + m_cu->header.offset_size;
> --
> 2.51.2