Fix PR python/18984
authorTom Tromey <tom@tromey.com>
Sat, 19 Sep 2015 23:45:47 +0000 (17:45 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 2 Jun 2016 19:18:42 +0000 (13:18 -0600)
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.

gdb/ChangeLog
gdb/python/python.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-shared.exp

index 18261a785b9ea25427ae07c40867d79fde85f482..82d14b3e3c540a34cbe44dc283a991e6efc70c2a 100644 (file)
@@ -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)
index c7066442453a5f1ddbe61d03fd6c5b110b514595..1f1fece2ff74b621c8cb250a79304f026d748125 100644 (file)
@@ -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);
index 733dd3ca9866a32918dcbacb02740203516ba6fb..3b305a602b3e69857158990433515c845e133439 100644 (file)
@@ -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.
index 8673e542b46c71b6dcc4843af82d8f18f0f08e8f..4a0c73829df6c01675ab80926e602e5cbdca6691 100644 (file)
@@ -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"
+}
This page took 0.031464 seconds and 4 git commands to generate.