[PATCH v3 0/1] Fix block filter heuristic in linespec to preserve distinct code paths
Klaus Gerlicher <[email protected]> Wed, 22 Jul 2026 09:36:53 +0000
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
From: "Gerlicher, Klaus" <[email protected]> Hi all, hi Christina, this is V3 of the relax block filter patch. V2 is here: https://inbox.sourceware.org/gdb-patches/[email protected]/ aarch64 support: V3 adds full support for aarch64: aarch64_insn_is_jump, aarch64_insn_is_ret aarch64_insn_branch_target. Tested on aarch64 (raspi5). The NEWS entry is updated accordingly to mention x86 and aarch64 as supported platforms. I hope this shows that this is a general solution and not just a x86_64 hack. Add predicate functions for insn_is_ret, insn_is_jump, and insn_branch_target: extended_block_filter_supported helper in linespec.c uses all three predicates to determine whether the heuristic is effective on the current architecture. NOTE: "show linespec-extended-block-filter" reports architecture support using the predicates, so testing can use this to report unsupported. Exception safety: V3 wraps the process loop body in a try/catch that returns false on any memory read failure. Removed early break from de-duplication loop: V1/V2 kept the original break after filter[j] = 0, so the inner scan stopped at the first same-block SAL j regardless of whether the new heuristic had already preserved an earlier via continue, V3 removes the break and adds a filter[i] guard on the outer loop, ensuring every same-block pair is evaluated. Test updates: Adds a block_filter_arch_supported helper proc that queries the new show output, and uses unsupported instead of fail on architectures that do not implement the required gdbarch methods. I did not find any documentation on the original heuristic in GDB.texinfo and so I also did not try to add anything there. I'm also not sure where we would put such description. If anyone could point me where to put it, I would love to add some documentation there since things are getting more complicated now. Thanks, Klaus Gerlicher, Klaus (1): gdb/linespec: relax block filter to preserve distinct code paths gdb/NEWS | 11 + gdb/aarch64-tdep.c | 91 ++++++ gdb/amd64-tdep.c | 57 ++++ gdb/arch-utils.c | 10 + gdb/arch-utils.h | 1 + gdb/arch/aarch64-insn.c | 23 ++ gdb/arch/aarch64-insn.h | 2 + gdb/gdbarch-gen.c | 59 +++- gdb/gdbarch-gen.h | 16 + gdb/gdbarch_components.py | 18 ++ gdb/linespec.c | 148 ++++++++- .../gdb.linespec/block-filter-cases.c | 126 ++++++++ .../gdb.linespec/block-filter-cases.exp | 291 ++++++++++++++++++ 13 files changed, 848 insertions(+), 5 deletions(-) create mode 100644 gdb/testsuite/gdb.linespec/block-filter-cases.c create mode 100644 gdb/testsuite/gdb.linespec/block-filter-cases.exp -- 2.34.1 Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht Muenchen HRB 186928