This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/18280] pointer values returned from pretty-printers are not printed
- From: "xdje42 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 19 Apr 2015 16:53:47 +0000
- Subject: [Bug python/18280] pointer values returned from pretty-printers are not printed
- Auto-submitted: auto-generated
- References: <bug-18280-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18280
--- Comment #1 from Doug Evans <xdje42 at gmail dot com> ---
For reference sake, here's the testcase:
struct Test
{
Test() { j = 10; i = &j; }
int *i;
int j;
};
int main()
{
Test x;
++*x.i;
return 0;
}
Here's the pretty-printer:
class TestPrinter(object):
def __init__(self, val):
self.val = val
def to_string(self):
return self.val['i']
def test_printer_hook(val):
return TestPrinter(val) if val.type.tag == 'Test' else None
for obj in gdb.objfiles():
obj.pretty_printers.append(test_printer_hook)
# (registration of the pretty-printer is overkill, but no matter)
And here's a sample session:
bash$ gdb a.out # Put pretty-printer in a.out-gdb.py
(gdb) start
(gdb) n
(gdb) n
(gdb) p x
$1 =
(gdb) p x.i
$2 = (int *) 0x7fffffffe198
--
You are receiving this mail because:
You are on the CC list for the bug.