]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: make find_sal_for_pc_sect attempt to fill sal section
authorSébastien Darche <sdarche@efficios.com>
Fri, 3 Oct 2025 12:47:55 +0000 (08:47 -0400)
committerSébastien Darche <sdarche@efficios.com>
Tue, 28 Oct 2025 13:43:30 +0000 (09:43 -0400)
commit9e76f914f15b51ba5a7fa6e15eed51984ce35a81
tree3a5c6a2fc752fab50bfd8470ce657dbbe849f014
parent37563b8beb5df0a7358fa6780a63edf5d3c447a1
gdb: make find_sal_for_pc_sect attempt to fill sal section

The find_sal_for_pc_section function inconsistently fills the section
field from its output symtab_and_line, depending on whether a symtab is
present or not. In the case that we cannot find a symtab for the pc and
section, the function would construct a sal with a pc but no section,
even though it could be either forwarded from the arguments, or
computed from the pc.

With the proposed changes, the function attempts to set the section in
all code paths and performs a section lookup when it is not provided as
an argument. This change is part of a patch series to fix
inconsistencies in symtab_and_line constructions, making it the
responsibility of the sal creator to fill out the section field (when
possible).

This section may be passed from a minsym in an unmapped overlay section.
Leaving the section field empty would mean in most cases losing some
important context (e.g. which overlay section this pc corresponds to).

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I818a08c4f61803b6d2cadd32ec106fe416af4c66
gdb/symtab.c