[0/2] some amendments to rejecting inserting breakpoints between functions

Message ID 20241018102156.350310-1-klaus.gerlicher@intel.com
Headers
Series some amendments to rejecting inserting breakpoints between functions |

Message

Klaus Gerlicher Oct. 18, 2024, 10:21 a.m. UTC
  From: "Gerlicher, Klaus" <klaus.gerlicher@intel.com>

Hi Simon, Andrew, all,

a while back Andrew and Simon added a very useful patch to restrict how
breakpoints are propagated.

Author: Andrew Burgess <aburgess@redhat.com>
Date:   Wed May 1 10:47:47 2024 +0100

    gdb: reject inserting breakpoints between functions

I'd like to add some additional patches on top of this I had previously proposed
to Simon. He asked me to supply them again after above patch has landed. So
I'll gladly follow this suggestion.

Patch 1 avoids setting multiple locations for the same PC. This can happen under
some circumstances described in the patch commit msg. It is only somewhat
related to patch 2 but patch 2 testcase builds on it, so it would make sense
to keep them together.

Patch 2 is what Simon had asked me to supply again.  It's a bit of an esoteric
case and it is only encountered when source is laid out in a certain way but
source formatted to be very compact might hit this issue. Please refer to
the description in the commit msg as well as the comments in linespec.c.

Thanks
Klaus


Gerlicher, Klaus (2):
  gdb, linespec: avoid multiple locations with same PC
  gdb, linespec: reject inserting breakpoints for both entry and
    prologue end PC

 gdb/linespec.c                           | 47 +++++++++++++++++++--
 gdb/testsuite/gdb.linespec/bad-slide.c   | 41 ++++++++++++++++++
 gdb/testsuite/gdb.linespec/bad-slide.exp | 54 ++++++++++++++++++++++++
 gdb/testsuite/gdb.linespec/linespec.exp  |  6 +++
 gdb/testsuite/gdb.linespec/lspec.cc      |  2 +
 5 files changed, 147 insertions(+), 3 deletions(-)
 create mode 100644 gdb/testsuite/gdb.linespec/bad-slide.c
 create mode 100644 gdb/testsuite/gdb.linespec/bad-slide.exp