(value, enc='utf-8')
| 157 | return get_byte_slice(value, value.type.strip_typedefs().range()[1] + 1, tuple) |
| 158 | |
| 159 | def std_string_value(value, enc='utf-8'): |
| 160 | p = value['_M_dataplus']['_M_p'] |
| 161 | t = value.type.strip_typedefs() |
| 162 | if t.name.find("::__cxx11::basic_string") != -1: |
| 163 | l = value['_M_string_length'] |
| 164 | p = p.cast(p.type.strip_typedefs()) |
| 165 | else: |
| 166 | if t.code == gdb.TYPE_CODE_REF: |
| 167 | t = t.target() |
| 168 | real = t.unqualified().strip_typedefs() |
| 169 | rep = gdb.lookup_type(str(real) + '::_Rep').pointer() |
| 170 | l = (ptr.cast(rep) - 1).dereference()['_M_length'] |
| 171 | string = get_byte_slice(p, l, bytes) |
| 172 | if enc is not None: |
| 173 | string = string.decode(enc) |
| 174 | return string |
| 175 | |
| 176 | |
| 177 | def _std_values(StdPrinter, value): |
no test coverage detected