[PATCH] libstdc++: Improve ostream output for std::stacktrace
Nathan Myers
ncm@cantrip.org
Thu Oct 16 05:47:31 GMT 2025
On 10/15/25 9:54 PM, Nathan Myers wrote:
> On 10/15/25 5:02 PM, Jonathan Wakely wrote:
...
>> --- a/libstdc++-v3/include/std/stacktrace
>> +++ b/libstdc++-v3/include/std/stacktrace
>> @@ -134,6 +134,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>> friend ostream&
>> operator<<(ostream&, const stacktrace_entry&);
>> + struct _Print_pc
>> + {
>> + native_handle_type _M_pc;
>> +
>> + friend ostream&
>> + operator<<(ostream& __os, _Print_pc __pc)
>> + {
>> + if (__pc._M_pc != (native_handle_type)-1) [[likely]]
>> + __os << "[0x" << std::hex << __pc._M_pc << std::dec << ']';
>
> Maybe save the output radix, and restore it.
Like
auto __flags = __os.setf(__os.hex, __os.basefield);
__os << "[0x" << __pc._M_pc << ']';
__os.flags(__flags);
More information about the Libstdc++
mailing list