* [PATCH] [gdb/build] Fix Wnon-pod-varargs in bppy_repr
@ 2026-06-05 10:02 Tom de Vries
2026-06-05 20:55 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2026-06-05 10:02 UTC (permalink / raw)
To: gdb-patches
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.
---
gdb/python/py-breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 30d5ea471c2..ecb42cee5f9 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1071,7 +1071,7 @@ bppy_repr (PyObject *self)
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)
base-commit: 9c8d2849382cca1cb24dc99a8b3da35cb2a334a6
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [gdb/build] Fix Wnon-pod-varargs in bppy_repr
2026-06-05 10:02 [PATCH] [gdb/build] Fix Wnon-pod-varargs in bppy_repr Tom de Vries
@ 2026-06-05 20:55 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-06-05 20:55 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> We could fix this using tp_name.c_str (), but instead fix this by simplifying
Tom> the code using gdb_py_invalid_object_repr.
Ok.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-05 20:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 10:02 [PATCH] [gdb/build] Fix Wnon-pod-varargs in bppy_repr Tom de Vries
2026-06-05 20:55 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox