Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Fix inheritance of finish_breakpoint_object
Date: Sat, 12 Sep 2026 08:21:15 -0600	[thread overview]
Message-ID: <20260912142115.3717539-1-tom@tromey.com> (raw)

I noticed that finish_breakpoint_object does not derive from PyObject,
but instead uses the older C-style inheritance.  This patch fixes
this.
---
 gdb/python/py-finishbreakpoint.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 49e12c00054..f5548636398 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -36,11 +36,8 @@ static const char outofscope_func[] = "out_of_scope";
 
 /* struct implementing the gdb.FinishBreakpoint object by extending
    the gdb.Breakpoint class.  */
-struct finish_breakpoint_object
+struct finish_breakpoint_object : public gdbpy_breakpoint_object
 {
-  /* gdb.Breakpoint base class.  */
-  gdbpy_breakpoint_object py_bp;
-
   /* gdb.Symbol object of the function finished by this breakpoint.
 
      nullptr if no debug information was available or return type was VOID.  */
@@ -301,7 +298,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
       self_bpfinish->function_value = nullptr;
     }
 
-  bppy_pending_object = &self_bpfinish->py_bp;
+  bppy_pending_object = self_bpfinish;
   bppy_pending_object->number = -1;
   bppy_pending_object->bp = NULL;
 
@@ -325,12 +322,12 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
       return gdbpy_handle_gdb_exception (-1, except);
     }
 
-  self_bpfinish->py_bp.bp->frame_id = frame_id;
-  self_bpfinish->py_bp.is_finish_bp = 1;
+  self_bpfinish->bp->frame_id = frame_id;
+  self_bpfinish->is_finish_bp = 1;
   self_bpfinish->initiating_frame = get_frame_id (frame);
 
   /* Bind the breakpoint with the current program space.  */
-  self_bpfinish->py_bp.bp->pspace = current_program_space;
+  self_bpfinish->bp->pspace = current_program_space;
 
   return 0;
 }
@@ -345,7 +342,7 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
   gdbpy_breakpoint_object *bp_obj = (gdbpy_breakpoint_object *) bpfinish_obj;
   PyObject *py_obj = (PyObject *) bp_obj;
 
-  if (bpfinish_obj->py_bp.bp->enable_state == bp_enabled
+  if (bpfinish_obj->bp->enable_state == bp_enabled
       && PyObject_HasAttrString (py_obj, outofscope_func))
     {
       gdbpy_ref<> meth_result = gdbpy_call_method (py_obj, outofscope_func);
@@ -388,7 +385,7 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b,
 		{
 		  bpfinishpy_out_of_scope (finish_bp);
 		  if (delete_bp)
-		    delete_breakpoint (finish_bp->py_bp.bp);
+		    delete_breakpoint (finish_bp->bp);
 		}
 	    }
 	  catch (const gdb_exception &except)
-- 
2.49.0


             reply	other threads:[~2026-09-12 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 14:21 Tom Tromey [this message]
2026-09-14 13:38 ` Simon Marchi
2026-09-14 14:12   ` Simon Marchi
2026-09-14 15:32     ` Tom Tromey
2026-09-14 15:33       ` Simon Marchi

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=20260912142115.3717539-1-tom@tromey.com \
    --to=tom@tromey.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