From patchwork Thu Jun 2 19:23:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12725 Received: (qmail 113694 invoked by alias); 2 Jun 2016 19:24:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 113671 invoked by uid 89); 2 Jun 2016 19:24:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=adjusting, UD:sl, Hx-languages-length:2741 X-HELO: gproxy5-pub.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5-pub.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 02 Jun 2016 19:24:06 +0000 Received: (qmail 3733 invoked by uid 0); 2 Jun 2016 19:24:01 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy5.mail.unifiedlayer.com with SMTP; 2 Jun 2016 19:24:01 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id 1vPx1t00s2f2jeq01vQ0cu; Thu, 02 Jun 2016 13:24:01 -0600 X-Authority-Analysis: v=2.1 cv=KpLehwmN 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=-N9Dh3nx2ZYA:10 a=pD_ry4oyNxEA:10 a=zstS-IiYAAAA:8 a=20KFwNOVAAAA:8 a=0FD05c-RAAAA:8 a=CPZ4lf3HtGjuGuPKob0A:9 a=bPrJuY3N8Hm5hgkB:21 a=S7pYwPOyFmYVplVg:21 a=4G6NA9xxw8l3yy4pmD5M:22 a=e_O65bzb51kRm2y5VmPK:22 a=l1rpMCqCXRGZwUSuRcM3:22 Received: from [65.128.48.199] (port=50080 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1b8YDl-0007k3-H7; Thu, 02 Jun 2016 13:23:57 -0600 From: Tom Tromey To: Joel Brobecker Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Fix PR python/18984 References: <1463614581-18216-1-git-send-email-tom@tromey.com> <87shwvwjoq.fsf@tromey.com> <20160602182215.GB3769@adacore.com> Date: Thu, 02 Jun 2016 13:23:53 -0600 In-Reply-To: <20160602182215.GB3769@adacore.com> (Joel Brobecker's message of "Thu, 2 Jun 2016 11:22:15 -0700") Message-ID: <87vb1rgzsm.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux) MIME-Version: 1.0 X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 65.128.48.199 authed with tom+tromey.com} X-Exim-ID: 1b8YDl-0007k3-H7 X-Source-Sender: (bapiya) [65.128.48.199]:50080 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== Joel> Sorry about the delay. The code patch looks good to me. For the Joel> testcase patch, you said you'd be adjusting it for Python 3 as Joel> well? Yes. Here's the final patch. The difference is just adding the parens needed by the Python 3 'print'. I tested this against both Python 3 and Python 2.7. Tom commit 1b40ec0559f4b24ccdf6b073610c526c4aa33c4d Author: Tom Tromey Date: Sat Sep 19 17:45:47 2015 -0600 Fix PR python/18984 This fixes PR python/18984. The bug is that gdbpy_solib_name uses GDB_PY_LL_ARG, whereas it should use GDB_PY_LLU_ARG to avoid overflow. Built and tested on x86-64 Fedora 23. 2016-06-02 Tom Tromey PR python/18984: * python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG. 2016-06-02 Tom Tromey PR python/18984: * gdb.python/py-shared.exp: Add solib_name test. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 18261a7..82d14b3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-06-02 Tom Tromey + + PR python/18984: + * python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG. + 2016-06-01 Pedro Alves * remote-fileio.c (remote_fio_ctrl_c_flag, remote_fio_sa) diff --git a/gdb/python/python.c b/gdb/python/python.c index c706644..1f1fece 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -696,9 +696,9 @@ gdbpy_solib_name (PyObject *self, PyObject *args) { char *soname; PyObject *str_obj; - gdb_py_longest pc; + gdb_py_ulongest pc; - if (!PyArg_ParseTuple (args, GDB_PY_LL_ARG, &pc)) + if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc)) return NULL; soname = solib_name_from_address (current_program_space, pc); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 733dd3c..3b305a6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-02 Tom Tromey + + PR python/18984: + * gdb.python/py-shared.exp: Add solib_name test. + 2016-06-02 Simon Marchi * gdb.mi/mi-memory-changed.exp: Fix filename passed to untested. diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp index 8673e54..4a0c738 100644 --- a/gdb/testsuite/gdb.python/py-shared.exp +++ b/gdb/testsuite/gdb.python/py-shared.exp @@ -66,3 +66,7 @@ gdb_test "python print (gdb.solib_name(long(func1)))" "py-shared-sl.sl" "test fu gdb_test "p &main" "" "main address" gdb_py_test_silent_cmd "python main = gdb.history(0)" "Aquire main address" 1 gdb_test "python print (gdb.solib_name(long(main)))" "None" "test main solib location" + +if {[is_lp64_target]} { + gdb_test "python print (len(\[gdb.solib_name(0xffffffffffffffff)\]))" "1" +}