public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Enze Li <lienze@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/testsuite: add a clear test to py-breakpoint.exp
Date: Sun, 24 Jul 2022 04:11:30 +0000 (GMT)	[thread overview]
Message-ID: <20220724041130.74D82385840A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ea892bdc4b6da5782c6ea6273aff499fb5fd5e6f

commit ea892bdc4b6da5782c6ea6273aff499fb5fd5e6f
Author: Enze Li <enze.li@hotmail.com>
Date:   Fri Jun 24 21:57:54 2022 +0800

    gdb/testsuite: add a clear test to py-breakpoint.exp
    
    This patch adds a test case to try to clear an internal python
    breakpoint using the clear command.
    
    This was suggested by Pedro during a code review of the following
    commit.
    
      commit a5c69b1e49bae4d0dcb20f324cebb310c63495c6
      Date:   Sun Apr 17 15:09:46 2022 +0800
    
        gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)
    
    Tested on x86_64 openSUSE Tumbleweed.

Diff:
---
 gdb/testsuite/gdb.python/py-breakpoint.exp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 58b1af3a0da..583408e10af 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -309,6 +309,26 @@ proc_with_prefix test_bkpt_internal { } {
     if ![runto_main] then {
 	return 0
     }
+    delete_breakpoints
+    gdb_py_test_silent_cmd  "python bp1 = gdb.Breakpoint (\"main\", type=gdb.BP_BREAKPOINT, wp_class=gdb.WP_WRITE, internal=True )" \
+	"Set internal breakpoint" 0
+
+    set bp_num [get_python_valueof bp1.number "*DEFAULT*"]
+    set bp_addr [gdb_get_bp_addr $bp_num]
+
+    gdb_test "maint info break $bp_num" \
+	"$bp_num.*$bp_addr.*" \
+	"maint info breakpoint \$bp_num"
+
+    gdb_test "python gdb.execute(\'clear *$bp_addr\')" \
+	".*No breakpoint at \\*$bp_addr.*" \
+	"clear internal breakpoint"
+
+    # Check again, make sure that GDB really didn't delete the internal breakpoint.
+    gdb_test "maint info break $bp_num" \
+	"$bp_num.*$bp_addr.*" \
+	"maint info breakpoint \$bp_num after clear"
+
     delete_breakpoints
     gdb_py_test_silent_cmd  "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE, internal=True )" \
 	"Set watchpoint" 0


                 reply	other threads:[~2022-07-24  4:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220724041130.74D82385840A@sourceware.org \
    --to=lienze@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).