]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Use pretty printers for struct member stubs
authorHannes Domani <ssbssa@yahoo.de>
Fri, 8 Dec 2023 17:19:42 +0000 (18:19 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 8 Dec 2023 17:21:25 +0000 (18:21 +0100)
commit7543c960b00ddea23f6105eff4358ec214a7f93c
treee0c98671bfe860eb8009b1864db9982c91469f3c
parentee1e9bbb5139d766d70cfa036979cec73a1223b7
Use pretty printers for struct member stubs

PR29079 shows that pretty printers can be used for an incomplete
type (stub), but only when printing it directly, not if it's
part of another struct:
```
(gdb) p s
$1 = {pp m_i = 5}
(gdb) p s2
$2 = {m_s = <incomplete type>, m_l = 20}
```

The reason is simply that in common_val_print the check for stubs
is before any pretty printer is tried.
It works if the pretty printer is tried before the stub check:
```
(gdb) p s
$1 = {pp m_i = 5}
(gdb) p s2
$2 = {m_s = {pp m_i = 10}, m_l = 20}
```

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29079
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc [new file with mode: 0644]
gdb/testsuite/gdb.python/py-prettyprint-stub.cc [new file with mode: 0644]
gdb/testsuite/gdb.python/py-prettyprint-stub.exp [new file with mode: 0644]
gdb/testsuite/gdb.python/py-prettyprint-stub.h [new file with mode: 0644]
gdb/testsuite/gdb.python/py-prettyprint-stub.py [new file with mode: 0644]
gdb/valprint.c