From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98797 invoked by alias); 19 May 2016 22:06:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 98562 invoked by uid 89); 19 May 2016 22:06:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,FSL_HELO_HOME,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=tracepoints, H*m:tromey, Break, H*m:tom X-HELO: gproxy8-pub.mail.unifiedlayer.com Received: from gproxy8-pub.mail.unifiedlayer.com (HELO gproxy8-pub.mail.unifiedlayer.com) (67.222.33.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 19 May 2016 22:06:28 +0000 Received: (qmail 5993 invoked by uid 0); 19 May 2016 22:06:27 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy8.mail.unifiedlayer.com with SMTP; 19 May 2016 22:06:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id wN6B1s00p2f2jeq01N6ESr; Thu, 19 May 2016 16:06:27 -0600 X-Authority-Analysis: v=2.1 cv=cYhB8BzM c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=_v2sUkyEFrwA:10 a=yrkiwgmsf1kA:10 a=zstS-IiYAAAA:8 a=0FD05c-RAAAA:8 a=JMgEbp_2c4Qd0wC6CdwA:9 a=RSUBiSs01mFrplPT:21 a=D-iXch6RMYwbo0bA:21 a=4G6NA9xxw8l3yy4pmD5M:22 a=l1rpMCqCXRGZwUSuRcM3:22 Received: from [71.215.116.141] (port=49672 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1b3W55-0005Pc-Hv; Thu, 19 May 2016 16:06:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/3] PR python/17698 - add Breakpoint.pending Date: Thu, 19 May 2016 22:06:00 -0000 Message-Id: <1463695563-4130-4-git-send-email-tom@tromey.com> In-Reply-To: <1463695563-4130-1-git-send-email-tom@tromey.com> References: <1463695563-4130-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 71.215.116.141 authed with tom+tromey.com} X-SW-Source: 2016-05/txt/msg00344.txt.bz2 This patch adds a "pending" attribute to gdb.Breakpoint. Built and regtested on x86-64 Fedora 23. 2016-05-19 Tom Tromey PR python/17698: * NEWS: Update. * python/py-breakpoint.c (bppy_get_pending): New function. (breakpoint_object_getset): Add entry for "pending". * breakpoint.h (pending_breakpoint_p): Declare. * breakpoint.c (pending_breakpoint_p): New function. 2016-05-19 Tom Tromey PR python/17698: * python.texi (Breakpoints In Python): Document Breakpoint.pending. 2016-05-19 Tom Tromey PR python/17698: * gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending" test. (test_watchpoints): Likewise. (test_bkpt_pending): New proc. --- gdb/ChangeLog | 9 +++++++++ gdb/NEWS | 5 +++++ gdb/breakpoint.c | 8 ++++++++ gdb/breakpoint.h | 3 +++ gdb/doc/ChangeLog | 6 ++++++ gdb/doc/python.texi | 6 ++++++ gdb/python/py-breakpoint.c | 20 ++++++++++++++++++++ gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.python/py-breakpoint.exp | 11 +++++++++++ 9 files changed, 76 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a03d290..c8b54b4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2016-05-19 Tom Tromey + PR python/17698: + * NEWS: Update. + * python/py-breakpoint.c (bppy_get_pending): New function. + (breakpoint_object_getset): Add entry for "pending". + * breakpoint.h (pending_breakpoint_p): Declare. + * breakpoint.c (pending_breakpoint_p): New function. + +2016-05-19 Tom Tromey + * python/py-breakpoint.c (bppy_get_visibility) (gdbpy_breakpoint_created): Use user_breakpoint_p. diff --git a/gdb/NEWS b/gdb/NEWS index 3e8e7a1..4ca8fdd 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -48,6 +48,11 @@ maint info line-table REGEXP maint selftest Run any GDB unit tests that were compiled in. +* Python Scripting + + ** gdb.Breakpoint objects have a new attribute "pending", which + indicates whether the breakpoint is pending. + * Support for tracepoints and fast tracepoints on s390-linux and s390x-linux was added in GDBserver, including JIT compiling fast tracepoint's conditional expression bytecode into native code. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index d2dafef..6328b44 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6791,6 +6791,14 @@ user_breakpoint_p (struct breakpoint *b) return b->number > 0; } +/* See breakpoint.h. */ + +int +pending_breakpoint_p (struct breakpoint *b) +{ + return b->loc == NULL; +} + /* Print information on user settable breakpoint (watchpoint, etc) number BNUM. If BNUM is -1 print all user-settable breakpoints. If ALLFLAG is non-zero, include non-user-settable breakpoints. If diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 054eab4..5f06772 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1618,6 +1618,9 @@ extern int pc_at_non_inline_function (struct address_space *aspace, extern int user_breakpoint_p (struct breakpoint *); +/* Return true if this breakpoint is pending, false if not. */ +extern int pending_breakpoint_p (struct breakpoint *); + /* Attempt to determine architecture of location identified by SAL. */ extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3e9c35a..c9c4244 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,5 +1,11 @@ 2016-05-19 Tom Tromey + PR python/17698: + * python.texi (Breakpoints In Python): Document + Breakpoint.pending. + +2016-05-19 Tom Tromey + * python.texi (Breakpoints In Python): Move table of types and table of watchpoint types earlier in node. diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 4847a14..0791a06 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -4673,6 +4673,12 @@ first command is @code{silent}. This is not reported by the @code{silent} attribute. @end defvar +@defvar Breakpoint.pending +This attribute is @code{True} if the breakpoint is pending, and +@code{False} otherwise. @xref{Set Breaks}. This attribute is +read-only. +@end defvar + @anchor{python_breakpoint_thread} @defvar Breakpoint.thread If the breakpoint is thread-specific, this attribute holds the diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index f86da8d..d925bdc 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -563,6 +563,24 @@ bppy_get_temporary (PyObject *self, void *closure) Py_RETURN_FALSE; } +/* Python function to determine if the breakpoint is a pending + breakpoint. */ + +static PyObject * +bppy_get_pending (PyObject *self, void *closure) +{ + gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; + + BPPY_REQUIRE_VALID (self_bp); + + if (is_watchpoint (self_bp->bp)) + Py_RETURN_FALSE; + if (pending_breakpoint_p (self_bp->bp)) + Py_RETURN_TRUE; + + Py_RETURN_FALSE; +} + /* Python function to get the breakpoint's number. */ static PyObject * bppy_get_number (PyObject *self, void *closure) @@ -1053,6 +1071,8 @@ or None if no condition set."}, "Whether the breakpoint is visible to the user."}, { "temporary", bppy_get_temporary, NULL, "Whether this breakpoint is a temporary breakpoint."}, + { "pending", bppy_get_pending, NULL, + "Whether this breakpoint is a pending breakpoint."}, { NULL } /* Sentinel. */ }; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a773c63..4242525 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-05-19 Tom Tromey + + PR python/17698: + * gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending" + test. + (test_watchpoints): Likewise. + (test_bkpt_pending): New proc. + 2016-05-18 Simon Marchi * gdb.mi/mi-threads-interrupt.c: New file. diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp index d1d1b22..4729733 100644 --- a/gdb/testsuite/gdb.python/py-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp @@ -46,6 +46,8 @@ proc test_bkpt_basic { } { "" "Check obj exists @main" gdb_test "python print (blist\[0\].location)" \ "main." "Check breakpoint location @main" + gdb_test "python print (blist\[0\].pending)" "False" \ + "Check pending status of main breakpoint" set mult_line [gdb_get_line_number "Break at multiply."] gdb_breakpoint ${mult_line} @@ -264,6 +266,7 @@ proc test_watchpoints { } { gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE )" \ "Set watchpoint" 0 + gdb_test "python print wp1.pending" "False" gdb_test "continue" \ ".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*main.*" \ "Test watchpoint write" @@ -494,6 +497,13 @@ proc test_bkpt_address {} { ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\." } +proc test_bkpt_pending {} { + delete_breakpoints + gdb_breakpoint "nosuchfunction" allow-pending + gdb_test "python print (gdb.breakpoints()\[0\].pending)" "True" \ + "Check pending status of pending breakpoint" +} + test_bkpt_basic test_bkpt_deletion test_bkpt_cond_and_cmds @@ -503,3 +513,4 @@ test_bkpt_internal test_bkpt_eval_funcs test_bkpt_temporary test_bkpt_address +test_bkpt_pending -- 2.5.5