]>
Commit | Line | Data |
---|---|---|
3b9aa4e8 VZ |
1 | ############################################################################### |
2 | # Name: misc/gdb/print.py | |
3 | # Purpose: pretty-printers for wx data structures: this file is meant to | |
4 | # be sourced from gdb using "source -p" (or, better, autoloaded | |
5 | # in the future...) | |
6 | # Author: Vadim Zeitlin | |
7 | # Created: 2009-01-04 | |
8 | # RCS-Id: $Id:$ | |
9 | # Copyright: (c) 2009 Vadim Zeitlin | |
10 | # License: wxWindows licence | |
11 | ############################################################################### | |
12 | ||
13 | # shamelessly stolen from std::string example | |
14 | class wxStringPrinter: | |
15 | def __init__(self, val): | |
16 | self.val = val | |
17 | ||
18 | def to_string(self): | |
19 | return '"' + self.val['m_impl']['_M_dataplus']['_M_p'].string() + '"' | |
20 | ||
753dc0f7 VZ |
21 | def display_hint(self): |
22 | return 'string' | |
23 | ||
24 | def wxLookupFunction(val): | |
25 | if val.type.tag == 'wxString': | |
26 | return wxStringPrinter(val) | |
27 | return None | |
28 | ||
29 | gdb.pretty_printers.append(wxLookupFunction) |