I build gdb with clang and ran into a build breaker:
...
gdb/python/py-breakpoint.c:1074:52: error: cannot pass object of non-trivial \
type 'const std::string' (aka 'const basic_string<char>') through variadic \
function; call will abort at runtime [-Wnon-pod-varargs]
1074 | return PyUnicode_FromFormat ("<%s (invalid)>", tp_name);
| ^
...
This looks like fallout from commit
dafd73bcda6 ("gdb/python: fix memory leak
in gdb_py_tp_name"), which changed the return type of gdbpy_py_obj_tp_name
from const char * to std::string.
We could fix this using tp_name.c_str (), but instead fix this by simplifying
the code using gdb_py_invalid_object_repr.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
const auto bp = (struct gdbpy_breakpoint_object*) self;
if (bp->bp == nullptr)
- return PyUnicode_FromFormat ("<%s (invalid)>", tp_name);
+ return gdb_py_invalid_object_repr (self);
std::string str = " ";
if (bp->bp->thread != -1)