[PATCH] gdb: do not add const sections to the section map

Andrew Burgess aburgess@redhat.com
Tue May 17 14:52:42 GMT 2022


Ilya Leoshkevich via Binutils <binutils@sourceware.org> writes:

Thanks for this.  GDB patches need to be sent to
gdb-patches@sourceware.org for review.

> From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
>
> build_objfile_section_table () creates four synthetic sections, which
> significantly slow down section map sorting.  This is especially
> noticeable when debugging JITs that report a lot of objfiles.  Since
> these sections are not useful for find_pc_section (), do not add them
> to the section map.
> ---
>  gdb/objfiles.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gdb/objfiles.c b/gdb/objfiles.c
> index 80f68fda1c1..259c19584a6 100644
> --- a/gdb/objfiles.c
> +++ b/gdb/objfiles.c
> @@ -1005,6 +1005,9 @@ insert_section_p (const struct bfd *abfd,
>    if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
>      /* This is a TLS section.  */
>      return 0;
> +  if (bfd_is_const_section (section))
> +    /* This is one of the global *ABS*, *UND*, *IND*, or *COM* sections.  */
> +    return 0;

You either need to a { ... } around the comment and the return, or move
the comment before the `if` here.

Thanks,
Andrew

>  
>    return 1;
>  }
> -- 
> 2.35.1



More information about the Binutils mailing list