[MediaWiki-commits] [Gerrit] Consolidate debugging-related configurations in hhvm::debug - change (operations/puppet)
Ori.livneh has submitted this change and it was merged. Change subject: Consolidate debugging-related configurations in hhvm::debug .. Consolidate debugging-related configurations in hhvm::debug The various tidbits designed to make debugging HHVM more pleasant were clogging up init.pp, which I'd like to be a concise description of the things that are absolutely essential to the setup (rather than peripheral to it, as the debugging helpers are). For that reason, introduce a separate hhvm::debug module, and move the debugging symbol package declarations there, too. Since this leaves hhvm::packages practically empty, move the hhvm package declarations back to init.pp. Add a fix to a libstdc++ pretty-printer and source HHVM's pretty printers in /etc/gdb/gdbinit. Change-Id: Ie3e5f6cb158e89dd4aaf0fe765bc39e2306ce8e3 --- A modules/hhvm/files/debug/gdbinit R modules/hhvm/files/debug/hhvm-dump-debug A modules/hhvm/files/debug/printers.py A modules/hhvm/manifests/debug.pp M modules/hhvm/manifests/init.pp D modules/hhvm/manifests/packages.pp M modules/mediawiki/manifests/hhvm.pp 7 files changed, 1,287 insertions(+), 84 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/hhvm/files/debug/gdbinit b/modules/hhvm/files/debug/gdbinit new file mode 100644 index 000..6e8c144 --- /dev/null +++ b/modules/hhvm/files/debug/gdbinit @@ -0,0 +1,16 @@ +# /etc/gdb/gdbinit: global gdb configuration +# This file was provisioned by Puppet. +set verbose off +set print pretty on +set prompt (\033[32mgdb\033[0m) + +# Don't pause output +set height 0 +set width 0 + +# Load pretty printers for libstdc++ +python import sys; sys.path.insert(0, '/usr/share/gcc-4.8/python') +add-auto-load-safe-path /usr/lib/x86_64-linux-gnu + +# Load utilities and pretty printers for HHVM +source /usr/local/src/hhvm/hphp/tools/gdb/hhvm.py diff --git a/modules/hhvm/files/hhvm-dump-debug b/modules/hhvm/files/debug/hhvm-dump-debug similarity index 100% rename from modules/hhvm/files/hhvm-dump-debug rename to modules/hhvm/files/debug/hhvm-dump-debug diff --git a/modules/hhvm/files/debug/printers.py b/modules/hhvm/files/debug/printers.py new file mode 100644 index 000..9f9f6fb --- /dev/null +++ b/modules/hhvm/files/debug/printers.py @@ -0,0 +1,1165 @@ +# Pretty-printers for libstdc++. + +# Copyright (C) 2008-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +import gdb +import itertools +import re +import sys + +# Python 2 + Python 3 compatibility code + +# Resources about compatibility: +# +# * http://pythonhosted.org/six/: Documentation of the six module + +# FIXME: The handling of e.g. std::basic_string (at least on char) +# probably needs updating to work with Python 3's new string rules. +# +# In particular, Python 3 has a separate type (called byte) for +# bytestrings, and a special b syntax for the byte literals; the old +# str() type has been redefined to always store Unicode text. +# +# We probably can't do much about this until this GDB PR is addressed: +# https://sourceware.org/bugzilla/show_bug.cgi?id=17138 + +if sys.version_info[0] 2: +# Python 3 stuff +Iterator = object +# Python 3 folds these into the normal functions. +imap = map +izip = zip +# Also, int subsumes long +long = int +else: +# Python 2 stuff +class Iterator: + +Compatibility mixin for iterators + +Instead of writing next() methods for iterators, write +__next__() methods and use this mixin to make them work in +Python 2 as well as Python 3. + +Idea stolen from the six documentation: +http://pythonhosted.org/six/#six.Iterator + + +def next(self): +return self.__next__() + +# In Python 2, we still need these from itertools +from itertools import imap, izip + +# Try to use the new-style pretty-printing if available. +_use_gdb_pp = True +try: +import gdb.printing +except ImportError: +_use_gdb_pp = False + +# Try to install type-printers. +_use_type_printing = False +try: +import gdb.types +if hasattr(gdb.types, 'TypePrinter'): +_use_type_printing = True +except ImportError: +pass + +# Starting with the type ORIG, search for the member type NAME. This +# handles searching
[MediaWiki-commits] [Gerrit] Consolidate debugging-related configurations in hhvm::debug - change (operations/puppet)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/170886 Change subject: Consolidate debugging-related configurations in hhvm::debug .. Consolidate debugging-related configurations in hhvm::debug The various tidbits designed to make debugging HHVM more pleasant were clogging up init.pp, which I'd like to be a concise description of the things that are absolutely essential to the setup (rather than peripheral to it, as the debugging helpers are). For that reason, introduce a separate hhvm::debug module, and move the debugging symbol package declarations there, too. Since this leaves hhvm::packages practically empty, move the hhvm package declarations back to init.pp. Add a fix to a libstdc++ pretty-printer and source HHVM's pretty printers in /etc/gdb/gdbinit. Change-Id: Ie3e5f6cb158e89dd4aaf0fe765bc39e2306ce8e3 --- A modules/hhvm/files/debug/gdbinit R modules/hhvm/files/debug/hhvm-dump-debug A modules/hhvm/files/debug/printers.py A modules/hhvm/manifests/debug.pp M modules/hhvm/manifests/init.pp D modules/hhvm/manifests/packages.pp M modules/mediawiki/manifests/hhvm.pp 7 files changed, 1,287 insertions(+), 84 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/86/170886/1 diff --git a/modules/hhvm/files/debug/gdbinit b/modules/hhvm/files/debug/gdbinit new file mode 100644 index 000..6e8c144 --- /dev/null +++ b/modules/hhvm/files/debug/gdbinit @@ -0,0 +1,16 @@ +# /etc/gdb/gdbinit: global gdb configuration +# This file was provisioned by Puppet. +set verbose off +set print pretty on +set prompt (\033[32mgdb\033[0m) + +# Don't pause output +set height 0 +set width 0 + +# Load pretty printers for libstdc++ +python import sys; sys.path.insert(0, '/usr/share/gcc-4.8/python') +add-auto-load-safe-path /usr/lib/x86_64-linux-gnu + +# Load utilities and pretty printers for HHVM +source /usr/local/src/hhvm/hphp/tools/gdb/hhvm.py diff --git a/modules/hhvm/files/hhvm-dump-debug b/modules/hhvm/files/debug/hhvm-dump-debug similarity index 100% rename from modules/hhvm/files/hhvm-dump-debug rename to modules/hhvm/files/debug/hhvm-dump-debug diff --git a/modules/hhvm/files/debug/printers.py b/modules/hhvm/files/debug/printers.py new file mode 100644 index 000..9f9f6fb --- /dev/null +++ b/modules/hhvm/files/debug/printers.py @@ -0,0 +1,1165 @@ +# Pretty-printers for libstdc++. + +# Copyright (C) 2008-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +import gdb +import itertools +import re +import sys + +# Python 2 + Python 3 compatibility code + +# Resources about compatibility: +# +# * http://pythonhosted.org/six/: Documentation of the six module + +# FIXME: The handling of e.g. std::basic_string (at least on char) +# probably needs updating to work with Python 3's new string rules. +# +# In particular, Python 3 has a separate type (called byte) for +# bytestrings, and a special b syntax for the byte literals; the old +# str() type has been redefined to always store Unicode text. +# +# We probably can't do much about this until this GDB PR is addressed: +# https://sourceware.org/bugzilla/show_bug.cgi?id=17138 + +if sys.version_info[0] 2: +# Python 3 stuff +Iterator = object +# Python 3 folds these into the normal functions. +imap = map +izip = zip +# Also, int subsumes long +long = int +else: +# Python 2 stuff +class Iterator: + +Compatibility mixin for iterators + +Instead of writing next() methods for iterators, write +__next__() methods and use this mixin to make them work in +Python 2 as well as Python 3. + +Idea stolen from the six documentation: +http://pythonhosted.org/six/#six.Iterator + + +def next(self): +return self.__next__() + +# In Python 2, we still need these from itertools +from itertools import imap, izip + +# Try to use the new-style pretty-printing if available. +_use_gdb_pp = True +try: +import gdb.printing +except ImportError: +_use_gdb_pp = False + +# Try to install type-printers. +_use_type_printing = False +try: +import gdb.types +if hasattr(gdb.types, 'TypePrinter'): +_use_type_printing = True +except ImportError: +pass + +# Starting with the type ORIG, search for the member