[rhel6,rhel7] Keep pahole.py and make it Python2 compatible.

This commit is contained in:
Jan Kratochvil 2015-09-24 09:18:32 +02:00
parent a2e5681941
commit 213eccacf2
3 changed files with 24 additions and 32 deletions

View File

@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot:
commit c8a8413e160d935c12cbc6e484dd8b7ab80f5f62
commit f0ee78c5ccefe388a64273353ecd5c99dae62558
tromey/python
@ -304,7 +304,7 @@ index 0000000..6fa48ff
+IgnoreErrorsCommand ()
diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py
new file mode 100644
index 0000000..dee04f5
index 0000000..e08eaf5
--- /dev/null
+++ b/gdb/python/lib/gdb/command/pahole.py
@@ -0,0 +1,81 @@
@ -365,19 +365,19 @@ index 0000000..dee04f5
+ fieldsize = 8 * ftype.sizeof
+
+ # TARGET_CHAR_BIT
+ print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)))
+ print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), end = "")
+ bitpos = bitpos + fieldsize
+
+ if ftype.code == gdb.TYPE_CODE_STRUCT:
+ self.pahole (ftype, level + 1, field.name)
+ else:
+ print (' ' * (2 + 2 * level))
+ print (' ' * (2 + 2 * level), end = "")
+ print ('%s %s' % (str (ftype), field.name))
+
+ if level == 0:
+ self.maybe_print_hole(bitpos, 8 * type.sizeof)
+
+ print (' ' * (14 + 2 * level))
+ print (' ' * (14 + 2 * level), end = "")
+ print ('} %s' % name)
+
+ def invoke (self, arg, from_tty):
@ -385,7 +385,7 @@ index 0000000..dee04f5
+ type = type.strip_typedefs ()
+ if type.code != gdb.TYPE_CODE_STRUCT:
+ raise (TypeError, '%s is not a struct type' % arg)
+ print (' ' * 14)
+ print (' ' * 14, end = "")
+ self.pahole (type, 0, '')
+
+Pahole()

View File

@ -1,34 +1,27 @@
commit f0ee78c5ccefe388a64273353ecd5c99dae62558
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri Sep 18 20:54:22 2015 +0200
pahole.py: Fix the Python3 port.
- https://bugzilla.redhat.com/show_bug.cgi?id=1264532
diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py
index dee04f5..e08eaf5 100644
index e08eaf5..56c1737 100644
--- a/gdb/python/lib/gdb/command/pahole.py
+++ b/gdb/python/lib/gdb/command/pahole.py
@@ -55,19 +55,19 @@ It prints the type and displays comments showing where holes are."""
fieldsize = 8 * ftype.sizeof
# TARGET_CHAR_BIT
- print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)))
+ print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), end = "")
- print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), end = "")
+ print (' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8))),
bitpos = bitpos + fieldsize
if ftype.code == gdb.TYPE_CODE_STRUCT:
self.pahole (ftype, level + 1, field.name)
else:
- print (' ' * (2 + 2 * level))
+ print (' ' * (2 + 2 * level), end = "")
- print (' ' * (2 + 2 * level), end = "")
+ print (' ' * (2 + 2 * level)),
print ('%s %s' % (str (ftype), field.name))
if level == 0:
self.maybe_print_hole(bitpos, 8 * type.sizeof)
- print (' ' * (14 + 2 * level))
+ print (' ' * (14 + 2 * level), end = "")
- print (' ' * (14 + 2 * level), end = "")
+ print (' ' * (14 + 2 * level)),
print ('} %s' % name)
def invoke (self, arg, from_tty):
@ -36,8 +29,8 @@ index dee04f5..e08eaf5 100644
type = type.strip_typedefs ()
if type.code != gdb.TYPE_CODE_STRUCT:
raise (TypeError, '%s is not a struct type' % arg)
- print (' ' * 14)
+ print (' ' * 14, end = "")
- print (' ' * 14, end = "")
+ print (' ' * 14),
self.pahole (type, 0, '')
Pahole()

View File

@ -26,7 +26,7 @@ Version: 7.10
# 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: 26%{?dist}
Release: 27%{?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
@ -544,7 +544,7 @@ Patch1030: gdb-probes-based-interface-robust-2of2.patch
Patch1031: gdb-rhbz1260558-ppc64le-skip_trampoline_code.patch
# Fix the pahole command breakage due to its Python3 port (RH BZ 1264532).
Patch1044: gdb-pahole-python3fix.patch
Patch1044: gdb-pahole-python2.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
@ -844,7 +844,6 @@ find -name "*.info*"|xargs rm -f
%patch1029 -p1
%patch1030 -p1
%patch1031 -p1
%patch1044 -p1
%patch848 -p1
%if 0%{!?el6:1}
@ -866,6 +865,10 @@ find -name "*.info*"|xargs rm -f
%patch331 -p1 -R
%patch337 -p1 -R
%endif
%patch1044 -p1
%if 0%{!?rhel:1} || 0%{?rhel} > 7
%patch1044 -p1 -R
%endif
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
@ -1261,13 +1264,6 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/elinos.py
rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/wrs-linux.py
rmdir $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit
%if 0%{!?_without_python:1}
%if 0%{?rhel:1} && 0%{?rhel} <= 7
# python2? /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/pahole.py*
%endif
%endif
%clean
rm -rf $RPM_BUILD_ROOT
@ -1361,6 +1357,9 @@ then
fi
%changelog
* Thu Sep 24 2015 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.10-27.fc23
- [rhel6,rhel7] Keep pahole.py and make it Python2 compatible.
* Wed Sep 23 2015 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.10-26.fc23
- [rhel7] Provide libstdc++-v3-python with C++11 even on RHEL-7 (RH BZ 1239290).
- Do not provide libstdc++-v3-python lib64 files on 32-bit archs.