Rebase to released FSF GDB 7.12.1.

This commit is contained in:
Jan Kratochvil 2017-01-21 19:27:42 +01:00
parent aa6d0cbf75
commit a4bff2f4eb
4 changed files with 8 additions and 142 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/gdb-libstdc++-v3-python-6.1.1-20160817.tar.xz
/v1.5.tar.gz
/gdb-7.12.0.20170111.tar.xz
/gdb-7.12.1.tar.xz

View File

@ -457,140 +457,3 @@ index 378eea0..7d9b198 100644
verbose -log "get_compiler_info: $compiler_info"
--IS0zKkzwUGydFO0o--
https://bugzilla.redhat.com/show_bug.cgi?id=1411094
http://sourceware.org/ml/gdb-patches/2016-11/msg00076.html
Subject: Re: [RFA 1/2] Fix some error-handling bugs in python frame filters
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> I've included a test case for the first issue.
I did a -m32 build here and have fixed up the test case.
Here's the new patch. This is ready to review now.
Tom
commit 981628a4af5f82a12351b9764437927d3a8c8169
Author: Tom Tromey <tom@tromey.com>
Date: Mon Oct 31 11:10:35 2016 -0600
Fix some error-handling bugs in python frame filters
While writing a Python frame filter, I found a few bugs in the current
frame filter code. In particular:
* One spot converts a Python long to a CORE_ADDR using PyLong_AsLong.
However, this can fail on overflow. I changed this to use
get_addr_from_python.
* Another spot is doing the same but with PyLong_AsUnsignedLongLong; I
changed this as well just for consistency.
* Converting line numbers can print "-1" if conversion from long
fails. This isn't fatal but just a bit ugly.
I've included a test case for the first issue. The line number one
didn't seem important enough to bother with.
2016-10-31 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_frame): Use
get_addr_from_python. Check for errors when getting line number.
2016-10-31 Tom Tromey <tom@tromey.com>
* gdb.python/py-framefilter.py (ElidingFrameDecorator.address):
New method.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1fd85ce..98fcd21 100644
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2016-10-31 Tom Tromey <tom@tromey.com>
+
+ * python/py-framefilter.c (py_print_frame): Use
+ get_addr_from_python. Check for errors when getting line number.
+
2016-11-03 Yao Qi <yao.qi@linaro.org>
* Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR.
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 6692ac5..4c7757c 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1116,7 +1116,13 @@ py_print_frame (PyObject *filter, int flags,
if (paddr != Py_None)
{
- address = PyLong_AsLong (paddr);
+ if (get_addr_from_python (paddr, &address) < 0)
+ {
+ Py_DECREF (paddr);
+ do_cleanups (cleanup_stack);
+ return EXT_LANG_BT_ERROR;
+ }
+
has_addr = 1;
}
Py_DECREF (paddr);
@@ -1213,10 +1219,10 @@ py_print_frame (PyObject *filter, int flags,
}
else if (PyLong_Check (py_func))
{
- CORE_ADDR addr = PyLong_AsUnsignedLongLong (py_func);
+ CORE_ADDR addr;
struct bound_minimal_symbol msymbol;
- if (PyErr_Occurred ())
+ if (get_addr_from_python (py_func, &addr) < 0)
{
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
@@ -1340,6 +1346,12 @@ py_print_frame (PyObject *filter, int flags,
if (py_line != Py_None)
{
line = PyLong_AsLong (py_line);
+ if (PyErr_Occurred ())
+ {
+ do_cleanups (cleanup_stack);
+ return EXT_LANG_BT_ERROR;
+ }
+
TRY
{
ui_out_text (out, ":");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 52038e3..d8466f1 100644
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,8 @@
+2016-10-31 Tom Tromey <tom@tromey.com>
+
+ * gdb.python/py-framefilter.py (ElidingFrameDecorator.address):
+ New method.
+
2016-10-28 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp <maint info line-table w/o a file name>: Use
diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py
index 8fdff84..2580911 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.py
+++ b/gdb/testsuite/gdb.python/py-framefilter.py
@@ -92,6 +92,12 @@ class ElidingFrameDecorator(FrameDecorator):
def elided(self):
return iter(self.elided_frames)
+ def address (self):
+ # Regression test for an overflow in the python layer.
+ bitsize = 8 * gdb.lookup_type('void').pointer().sizeof
+ mask = (1 << bitsize) - 1
+ return 0xffffffffffffffff & mask
+
class ElidingIterator:
def __init__(self, ii):
self.input_iterator = ii

View File

@ -21,12 +21,12 @@ Name: %{?scl_prefix}gdb
%global snapsrc 20160801
# See timestamp of source gnulib installed into gdb/gnulib/ .
%global snapgnulib 20150822
%global tarname gdb-7.12.0.20170111
Version: 7.12
%global tarname gdb-%{version}
Version: 7.12.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 40%{?dist}
Release: 41%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -1584,6 +1584,9 @@ then
fi
%changelog
* Sat Jan 21 2017 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12.1-41.fc25
- Rebase to released FSF GDB 7.12.1.
* Tue Jan 17 2017 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-40.fc25
- Enable libinproctrace.so on all archs except arm32.

View File

@ -1,3 +1,3 @@
SHA512 (gdb-libstdc++-v3-python-6.1.1-20160817.tar.xz) = 2f3030ec6cf379dbfbdb4e515cc47dcb47f25327c046759ad8f117e290e0300eed58969a432552203966cd6b02e5279c95309a4b2228ed98d8cd63f0a4f5cfc4
SHA512 (v1.5.tar.gz) = ea3e76291d5b077d5b42061898a1f70af6cbdbccb7d05c59904f322ca1c03f7596cac6a966b80b12d2c2d86212f17d6bde02b1daf92be62e49abcb234e2bacbd
SHA512 (gdb-7.12.0.20170111.tar.xz) = 8673b3614331306633939f3a744185e60405aa5382a06cc68ff189518d7b4d6adc761b63456d9a566a88d0a44174457882a603381d03175a353a65aa60d6db55
SHA512 (gdb-7.12.1.tar.xz) = 0ac8d0a495103611ef41167a08313a010dce6ca4c6d827cbe8558a0c1a1a8a6bfa53f1b7704251289cababbfaaf9e075550cdf741a54d6cd9ca3433d910efcd8