Scrape a value from the inferior process, and try to represent it within the gdb process, whilst (hopefully) avoiding crashes when the remote data is corrupt. Derived classes will override this. For example, a PyLongObjectPtr* with long_value 42 in the infe
(self, visited)
| 266 | return 'unknown' |
| 267 | |
| 268 | def proxyval(self, visited): |
| 269 | ''' |
| 270 | Scrape a value from the inferior process, and try to represent it |
| 271 | within the gdb process, whilst (hopefully) avoiding crashes when |
| 272 | the remote data is corrupt. |
| 273 | |
| 274 | Derived classes will override this. |
| 275 | |
| 276 | For example, a PyLongObjectPtr* with long_value 42 in the inferior process |
| 277 | should result in an int(42) in this process. |
| 278 | |
| 279 | visited: a set of all gdb.Value pyobject pointers already visited |
| 280 | whilst generating this value (to guard against infinite recursion when |
| 281 | visiting object graphs with loops). Analogous to Py_ReprEnter and |
| 282 | Py_ReprLeave |
| 283 | ''' |
| 284 | |
| 285 | class FakeRepr(object): |
| 286 | """ |
| 287 | Class representing a non-descript PyObject* value in the inferior |
| 288 | process for when we don't have a custom scraper, intended to have |
| 289 | a sane repr(). |
| 290 | """ |
| 291 | |
| 292 | def __init__(self, tp_name, address): |
| 293 | self.tp_name = tp_name |
| 294 | self.address = address |
| 295 | |
| 296 | def __repr__(self): |
| 297 | # For the NULL pointer, we have no way of knowing a type, so |
| 298 | # special-case it as per |
| 299 | # http://bugs.python.org/issue8032#msg100882 |
| 300 | if self.address == 0: |
| 301 | return '0x0' |
| 302 | return '<%s at remote 0x%x>' % (self.tp_name, self.address) |
| 303 | |
| 304 | return FakeRepr(self.safe_tp_name(), |
| 305 | int(self._gdbval)) |
| 306 | |
| 307 | def write_repr(self, out, visited): |
| 308 | ''' |
no test coverage detected