From: Vadim Zeitlin Date: Sun, 4 Jan 2009 21:15:19 +0000 (+0000) Subject: add a custom printer for wxString to use with Python-enabled gdb X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3b9aa4e82a8d0d7c58d9eba082402d6e4c4e5ce7 add a custom printer for wxString to use with Python-enabled gdb git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/misc/gdb/print.py b/misc/gdb/print.py new file mode 100755 index 0000000000..46a71d0056 --- /dev/null +++ b/misc/gdb/print.py @@ -0,0 +1,21 @@ +############################################################################### +# Name: misc/gdb/print.py +# Purpose: pretty-printers for wx data structures: this file is meant to +# be sourced from gdb using "source -p" (or, better, autoloaded +# in the future...) +# Author: Vadim Zeitlin +# Created: 2009-01-04 +# RCS-Id: $Id:$ +# Copyright: (c) 2009 Vadim Zeitlin +# License: wxWindows licence +############################################################################### + +# shamelessly stolen from std::string example +class wxStringPrinter: + def __init__(self, val): + self.val = val + + def to_string(self): + return '"' + self.val['m_impl']['_M_dataplus']['_M_p'].string() + '"' + +gdb.pretty_printers['^wxString$'] = wxStringPrinter