[PATCH] dwarf: Dump .debug_loclists only for DWARF-5

Jan Beulich jbeulich@suse.com
Fri Mar 21 07:28:09 GMT 2025


On 20.03.2025 21:27, H.J. Lu wrote:
> --- a/binutils/dwarf.c
> +++ b/binutils/dwarf.c
> @@ -7324,7 +7324,7 @@ display_debug_loc (struct dwarf_section *section, void *file)
>    unsigned int *array = NULL;
>    const char *suffix = strrchr (section->name, '.');
>    bool is_dwo = false;
> -  int is_loclists = strstr (section->name, "debug_loclists") != NULL;
> +  bool is_loclists = strstr (section->name, "debug_loclists") != NULL;
>    uint64_t next_header_offset = 0;
>  
>    if (suffix && strcmp (suffix, ".dwo") == 0)
> @@ -7450,6 +7450,11 @@ display_debug_loc (struct dwarf_section *section, void *file)
>        debug_info *debug_info_p = debug_information + i;
>        uint32_t offset_count;
>  
> +      /* Dump .debug_loclists only for DWARF-5 and dump .debug_loc only
> +	 for pre-DWARF-5.  */
> +      if ((debug_info_p->dwarf_version == 5) != is_loclists)
> +	continue;

Comment and code aren't quite in sync: What about versions above 5? Aren't our
chances better to stay correct if, until we know otherwise, we treat higher
versions like 5, not like 4 and earlier?

Jan


More information about the Binutils mailing list