Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v3 0/1] Fix block filter heuristic in linespec to preserve distinct code paths
@ 2026-07-22  9:36 Klaus Gerlicher
  2026-07-22  9:36 ` [PATCH v3 1/1] gdb/linespec: relax block filter " Klaus Gerlicher
  0 siblings, 1 reply; 3+ messages in thread
From: Klaus Gerlicher @ 2026-07-22  9:36 UTC (permalink / raw)
  To: gdb-patches, christina.joos

From: "Gerlicher, Klaus" <klaus.gerlicher@intel.com>

Hi all, hi Christina,

this is V3 of the relax block filter patch. 

V2 is here:

https://inbox.sourceware.org/gdb-patches/20260604132938.416526-1-klaus.gerlicher@intel.com/

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-25  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-22  9:36 [PATCH v3 0/1] Fix block filter heuristic in linespec to preserve distinct code paths Klaus Gerlicher
2026-07-22  9:36 ` [PATCH v3 1/1] gdb/linespec: relax block filter " Klaus Gerlicher
2026-07-25  7:54   ` Luis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox