[PATCH] gdb: Support DW_LLE_start_end

Simon Marchi simon.marchi@polymtl.ca
Mon Jun 21 17:02:05 GMT 2021


On 2021-06-21 5:50 a.m., Andreas Schwab wrote:
> Without that it is impossible to debug on riscv64.
> 
> gdb/
> 	PR symtab/27999
> 	* dwarf2/loc.c (decode_debug_loclists_addresses): Support
> 	DW_LLE_start_end.
> ---
>  gdb/dwarf2/loc.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
> index b7e30e3cb4a..d57cdc165ba 100644
> --- a/gdb/dwarf2/loc.c
> +++ b/gdb/dwarf2/loc.c
> @@ -255,9 +255,27 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
>        *new_ptr = loc_ptr;
>        return DEBUG_LOC_OFFSET_PAIR;
>  
> +    case DW_LLE_start_end:
> +      if (loc_ptr + 2 * addr_size > buf_end)
> +	return DEBUG_LOC_BUFFER_OVERFLOW;
> +
> +      if (signed_addr_p)
> +	*low = extract_signed_integer (loc_ptr, addr_size, byte_order);
> +      else
> +	*low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
> +
> +      loc_ptr += addr_size;
> +      if (signed_addr_p)
> +	*high = extract_signed_integer (loc_ptr, addr_size, byte_order);
> +      else
> +	*high = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
> +
> +      loc_ptr += addr_size;
> +      *new_ptr = loc_ptr;
> +      return DEBUG_LOC_START_END;
> +
>      /* Following cases are not supported yet.  */
>      case DW_LLE_startx_endx:
> -    case DW_LLE_start_end:
>      case DW_LLE_default_location:
>      default:
>        return DEBUG_LOC_INVALID_ENTRY;
> 

Could you please try adding a gdb.dwarf2 test case?  Support for
building loclists already exists, so there should be little new
infrastructure needed, just add support for DW_LLE_start_end (see where
DW_LLE_start_length is handled).

I'm thinking of a test case where we would test all the DW_LLE_*
operations we support.

Simon


More information about the Gdb-patches mailing list