diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-12-02 11:57:40 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-12-03 16:55:27 +0100 |
commit | abfc1cf60def840204bcd7682665dd71e80baeff (patch) | |
tree | b09c85a0bd708e2ccf4a1ae14536ad78d27de7d9 /solenv | |
parent | d6b003da6d77471e5e17a9cb6a25172d6f52da2a (diff) |
gdb: BigPtrArrayPrinter gets confused by libstdc++ std::unique_ptr
It looks like this in libstdc++:
<BigPtrArray> = {
m_ppInf = {
_M_t = {
<std::__uniq_ptr_impl<BlockInfo*, std::default_delete<BlockInfo* []> >> = {
_M_t = {
<std::_Tuple_impl<0, BlockInfo**, std::default_delete<BlockInfo* []> >> = {
<std::_Tuple_impl<1, std::default_delete<BlockInfo* []> >> = {
<std::_Head_base<1, std::default_delete<BlockInfo* []>, true>> = {
_M_head_impl = {<No data fields>}
}, <No data fields>},
<std::_Head_base<0, BlockInfo**, false>> = {
_M_head_impl = 0x567fd20
}, <No data fields>}, <No data fields>}
}, <No data fields>}
},
Note there are 2 _M_head_impl members, and somehow gdb 11.1-2.fc34 picks
the wrong one.
A manual cast to std::_Head_base<0, BlockInfo**, false> seems to help.
Change-Id: I1332c2fc6eb2661d417fd92a73aed977bbb1dcea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126220
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit c9267ca4fa7fa94a1bf79320bec54428a6ad4804)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126288
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gdb/libreoffice/sw.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py index e170709fb79c..7a5ce193684b 100644 --- a/solenv/gdb/libreoffice/sw.py +++ b/solenv/gdb/libreoffice/sw.py @@ -8,6 +8,7 @@ # import six +import gdb from libreoffice.util import printing class SwPositionPrinter(object): @@ -194,7 +195,10 @@ class BigPtrArrayPrinter(object): class _iterator(six.Iterator): def __init__(self, array): - self.blocks = array['m_ppInf']['_M_t']['_M_t']['_M_head_impl'] + # libstdc++ unique_ptr is a std::tuple which contains multiple + # _M_head_impl members and gdb may pick the wrong one by default + # so have to manually cast it to the one that contains the array + self.blocks = array['m_ppInf']['_M_t']['_M_t'].cast(gdb.lookup_type("std::_Head_base<0, BlockInfo**, false>"))['_M_head_impl'] self.count = array['m_nSize'] self.pos = 0 self.block_count = array['m_nBlock'] |