diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-14 16:55:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-14 16:56:28 +0200 |
commit | 55ad4e3cb7a0d705ff1c0f26feb644d8b06b71d8 (patch) | |
tree | d1cb72b07a0177512301e085991bb0e5f3ffcc0e /solenv/gdb | |
parent | 3a0ae2aae3f226e5e2e3785e578dee3ab4d2fa35 (diff) |
fix pretty printing of Fraction better
work-around gdb bug, and deal with different representations of
std::unique_ptr in different versions of libc++.
Change-Id: I02a1f49c07dbcd70e13ef6be48e20b510bf5e3fa
Diffstat (limited to 'solenv/gdb')
-rw-r--r-- | solenv/gdb/libreoffice/tl.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/solenv/gdb/libreoffice/tl.py b/solenv/gdb/libreoffice/tl.py index 670482027b7f..dec0ae2f0d53 100644 --- a/solenv/gdb/libreoffice/tl.py +++ b/solenv/gdb/libreoffice/tl.py @@ -62,7 +62,14 @@ class FractionPrinter(object): self.val = val def to_string(self): - impl = self.val['mpImpl']['_M_t']['_M_t']['_M_head_impl'].dereference().cast(gdb.lookup_type('Fraction::Impl')) + # Workaround gdb bug <https://sourceware.org/bugzilla/show_bug.cgi?id=22968> "ptype does not + # find inner C++ class type without -readnow" + gdb.lookup_type('Fraction') + # This would be simpler and more reliable if we could call the operator* on mpImpl to get the internal Impl. + # Different libc have different structures. Some have one _M_t, some have two nested. + tmp = self.val['mpImpl']['_M_t'] + if tmp.type.fields()[0].name == '_M_t': tmp = tmp['_M_t'] + impl = tmp['_M_head_impl'].dereference().cast(gdb.lookup_type('Fraction::Impl')) numerator = impl['value']['num'] denominator = impl['value']['den'] if impl['valid']: |