GH-140643: Add <native> and <GC> frames to the sampling profiler (#141108)

- Introduce a new field in the GC state to store the frame that initiated garbage collection.
- Update RemoteUnwinder to include options for including "<native>" and "<GC>" frames in the stack trace.
- Modify the sampling profiler to accept parameters for controlling the inclusion of native and GC frames.
- Enhance the stack collector to properly format and append these frames during profiling.
- Add tests to verify the correct behavior of the profiler with respect to native and GC frames, including options to exclude them.

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
This commit is contained in:
Brandt Bucher 2025-11-17 05:39:00 -08:00 committed by GitHub
parent 89a914c58d
commit 336366fd7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 465 additions and 86 deletions

View file

@ -1321,10 +1321,12 @@ extern "C" {
INIT_STR(dot_locals, ".<locals>"), \
INIT_STR(empty, ""), \
INIT_STR(format, ".format"), \
INIT_STR(gc, "<GC>"), \
INIT_STR(generic_base, ".generic_base"), \
INIT_STR(json_decoder, "json.decoder"), \
INIT_STR(kwdefaults, ".kwdefaults"), \
INIT_STR(list_err, "list index out of range"), \
INIT_STR(native, "<native>"), \
INIT_STR(str_replace_inf, "1e309"), \
INIT_STR(type_params, ".type_params"), \
INIT_STR(utf_8, "utf-8"), \
@ -1761,6 +1763,7 @@ extern "C" {
INIT_ID(fullerror), \
INIT_ID(func), \
INIT_ID(future), \
INIT_ID(gc), \
INIT_ID(generation), \
INIT_ID(get), \
INIT_ID(get_debug), \
@ -1904,6 +1907,7 @@ extern "C" {
INIT_ID(name_from), \
INIT_ID(namespace_separator), \
INIT_ID(namespaces), \
INIT_ID(native), \
INIT_ID(ndigits), \
INIT_ID(nested), \
INIT_ID(new_file_name), \