Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [RFA] Fix PR python/18984
Date: Thu, 02 Jun 2016 19:24:00 -0000	[thread overview]
Message-ID: <87vb1rgzsm.fsf@tromey.com> (raw)
In-Reply-To: <20160602182215.GB3769@adacore.com> (Joel Brobecker's message of	"Thu, 2 Jun 2016 11:22:15 -0700")

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 <tom@tromey.com>
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  <tom@tromey.com>
    
    	PR python/18984:
    	* python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG.
    
    2016-06-02  Tom Tromey  <tom@tromey.com>
    
    	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  <tom@tromey.com>
+
+	PR python/18984:
+	* python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG.
+
 2016-06-01  Pedro Alves  <palves@redhat.com>
 
 	* 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  <tom@tromey.com>
+
+	PR python/18984:
+	* gdb.python/py-shared.exp: Add solib_name test.
+
 2016-06-02  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* 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"
+}


      reply	other threads:[~2016-06-02 19:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 23:37 Tom Tromey
2016-05-20 19:48 ` Tom Tromey
2016-06-02 18:05 ` Tom Tromey
2016-06-02 18:22   ` Joel Brobecker
2016-06-02 19:24     ` Tom Tromey [this message]

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=87vb1rgzsm.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=brobecker@adacore.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