gcc/libstdc++-v3
Jonathan Wakely 08b2c542e4
libstdc++: Improve ostream output for std::stacktrace
With this change stacktrace entries always output the frame address, and
source file information no longer results in " at :0", e.g.

  16#  myfunc(int) at /tmp/bt.cc:48 [0x4008b7]
  17#  main at /tmp/bt.cc:61 [0x40091a]
  18#  __libc_start_call_main [0x7efc3d6d3574]
  19#  __libc_start_main@GLIBC_2.2.5 [0x7efc3d6d3627]
  20#  _start [0x400684]

This replaces the previous output:

  16# myfunc(int) at /tmp/bt.cc:48
  17# main at /tmp/bt.cc:61
  18# __libc_start_call_main at :0
  19# __libc_start_main@GLIBC_2.2.5 at :0
  20# _start at :0

A change that is not visible in the examples above is that for a
non-empty stacktrace_entry, we now print "<unknown>" for the function
name if description() returns an empty string.  For an empty (e.g.
default constructed) stacktrace_entry the entire string representation
is now "<unknown>" instead of an empty string.

Instead of printing "<unknown>" for the function name, we could set that
string in the stacktrace_entry::_Info object, so that description()
returns "<unknown>" and then operator<< wouldn't need to handle an empty
description() string. However, returning an empty string from that
function seems simpler for users to detect, rather than having to parse
"<unknown>".

We could also choose a different string for an empty stacktrace_entry,
maybe "<none>" or "<invalid>", but "<unknown>" seems good.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace
	(operator<<(ostream&, const stacktrace_entry&)): Improve output
	when description() or source_file() returns an empty string,
	or the stacktrace_entry is invalid. Append frame address to
	output.
	(operator<<(ostream&, const basic_stacktrace<A>&)): Use the
	size_type of the correct specialization.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Nathan Myers <nmyers@redhat.com>
2025-10-16 14:59:42 +01:00
..
config libstdc++: Remove unused config/cpu/i486/atomicity.h file 2025-10-08 17:06:21 +01:00
doc libstdc++: Update Autoconf manual link 2025-10-11 12:18:56 +02:00
include libstdc++: Improve ostream output for std::stacktrace 2025-10-16 14:59:42 +01:00
libsupc++ *: regenerate autotools 2025-10-05 17:14:49 +01:00
po *: regenerate autotools 2025-10-05 17:14:49 +01:00
python libstdc++: Add pretty printers for std::stacktrace 2025-10-15 21:57:59 +01:00
scripts libstdc++: Implement std::chrono::current_zone() for Windows [PR108409] 2025-07-15 16:49:43 +01:00
src libstdc++: Avoid overflow in timeout conversions [PR113327] 2025-10-14 17:26:42 +01:00
testsuite libstdc++: Add negative this_thread::sleep tests [PR116586] 2025-10-14 17:26:44 +01:00
.editorconfig libstdc++: editorconfig: Adjust wildcard patterns 2024-12-07 08:49:26 +00:00
ChangeLog Daily bump. 2025-10-16 00:21:56 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-2021
ChangeLog-2022 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2023 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2024 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
Makefile.am Update copyright years. 2025-01-02 11:59:57 +01:00
Makefile.in *: regenerate autotools 2025-10-05 17:14:49 +01:00
README
acinclude.m4 libstdc++: Implement P3107R5 optimizations for std::print [PR121790] 2025-10-10 09:00:22 +02:00
aclocal.m4 *: regenerate autotools 2025-10-05 17:14:49 +01:00
config.h.in libstdc++: Implement P3107R5 optimizations for std::print [PR121790] 2025-10-10 09:00:22 +02:00
configure libstdc++: Enable features for RTEMS (based on GCC 15) 2025-10-15 09:55:02 -05:00
configure.ac libstdc++: Enable features for RTEMS (based on GCC 15) 2025-10-15 09:55:02 -05:00
configure.host all: Fix "specifc", "costant" and "constat" typos in comments 2025-10-07 15:03:42 +01:00
crossconfig.m4
fragment.am
linkage.m4

README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.