[PATCH] fbsd-nat: Don't use '%jd' and '%ju' with printf_filtered.
Tom Tromey
tom@tromey.com
Fri Aug 27 20:23:46 GMT 2021
>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:
John> The code around this in
John> utils.c is a bit confusing to me.
Yeah, the gdb formatting code is not great, and the pager and wrapping
code work in an especially obscure way.
John> However, vprintf_filtered() does not set gdbfmt to true:
John> void
John> vprintf_filtered (const char *format, va_list args)
John> {
John> vfprintf_maybe_filtered (gdb_stdout, format, args, true, false);
John> }
John> This seems inconsistent. I wonder if printf_filtered should be
John> implemented in terms of vprintf_filtered, but that is probably a
John> bit of a behavior change now, and I wonder if gdbfmt should always
John> be true instead?
Changing vprintf_filtered to pass 'true' passes regression testing here.
So maybe we ought to make that change. It certainly seems less
confusing.
I don't recall why this is written the way it is. Perhaps there was a
reason and it was obsoleted by some other change.
Some of these functions are used by gdbsupport, so there's also some
possibility of an obscure code path that way, where compatibility is
required. But surely we could fix that in a better way, this seems very
obscure.
Tom
More information about the Gdb-patches
mailing list