Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Klaus Gerlicher <klaus.gerlicher@intel.com>
To: gdb-patches@sourceware.org, christina.joos@intel.com
Subject: [PATCH v3 0/1] Fix block filter heuristic in linespec to preserve distinct code paths
Date: Wed, 22 Jul 2026 09:36:53 +0000	[thread overview]
Message-ID: <20260722093654.30044-1-klaus.gerlicher@intel.com> (raw)

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


             reply	other threads:[~2026-07-22  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  9:36 Klaus Gerlicher [this message]
2026-07-22  9:36 ` [PATCH v3 1/1] gdb/linespec: relax block filter " Klaus Gerlicher
2026-07-25  7:54   ` Luis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722093654.30044-1-klaus.gerlicher@intel.com \
    --to=klaus.gerlicher@intel.com \
    --cc=christina.joos@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox