Andrew Burgess aef117b737 gdb/python: hoist common invalid object repr code into py-utils.c
Many object types now have a __repr__() function implementation.  A
common pattern is that, if an object is invalid, we print its
representation as: <TYPENAME (invalid)>.

I thought it might be a good idea to move the formatting of this
specific representation into a utility function, and then update all
of our existing code to call the new function.

The only place where I haven't made use of the new function is in
unwind_infopy_repr, where we currently return a different string.
This case is a little different as the UnwindInfo is invalid because
it references a frame, and it is the frame itself which is invalid.
That said, I think it would be fine to switch to using the standard
format; if the UnwindInfo references an invalid frame, then the
UnwindInfo is itself invalid.  But changing this would be an actual
change in behaviour, while all the other changes in this commit are
just refactoring.

Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12 11:21:25 +00:00
..
2023-10-16 09:27:28 -06:00
2023-09-26 09:29:14 -06:00
2023-10-10 10:44:35 -04:00
2023-12-30 12:21:44 -07:00