This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix PR python/18984
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Wed, 18 May 2016 17:36:21 -0600
- Subject: [RFA] Fix PR python/18984
- Authentication-results: sourceware.org; auth=none
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-05-18 Tom Tromey <tom@tromey.com>
PR python/18984:
* python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG.
2016-05-18 Tom Tromey <tom@tromey.com>
PR python/18984:
* gdb.python/py-shared.exp: Add solib_name test.
---
gdb/ChangeLog | 5 +++++
gdb/python/python.c | 4 ++--
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.python/py-shared.exp | 4 ++++
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92024b6..57d9962 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-05-18 Tom Tromey <tom@tromey.com>
+ PR python/18984:
+ * python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG.
+
+2016-05-18 Tom Tromey <tom@tromey.com>
+
* rust-lang.c (rust_subscript): Initialize "high".
2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
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 a773c63..ac37598 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-18 Tom Tromey <tom@tromey.com>
+
+ PR python/18984:
+ * gdb.python/py-shared.exp: Add solib_name test.
+
2016-05-18 Simon Marchi <simon.marchi@ericsson.com>
* gdb.mi/mi-threads-interrupt.c: New file.
diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp
index 8673e54..4192354 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"
+}
--
2.5.5