RFR: 8296469: Instrument VMError::report with reentrant iteration step for register and stack printing [v4]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon Jan 23 14:29:09 UTC 2023
On Tue, 20 Dec 2022 14:59:55 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Add reentrant step logic to VMError::report with an inner loop which enable the logic to recover at every step of the iteration.
>>
>> Before this change, if printing one register/stack position crashes then no more registers/stack positions will be printed.
>>
>> After this change even if the VM is unstable and some registers print_location crashes the hs_err printing will recover and keep attempting to print the rest of the registers or stack values.
>>
>> Enables the following
>> ```C++
>> REENTRANT_STEP_IF("printing register info", _verbose && _context && _thread && Universe::is_fully_initialized())
>> os::print_register_info_header(st, _context);
>>
>> REENTRANT_LOOP_START(os::print_nth_register_info_max_index())
>> // decode register contents if possible
>> ResourceMark rm(_thread);
>> os::print_nth_register_info(st, REENTRANT_ITERATION_STEP, _context);
>> REENTRANT_LOOP_END
>>
>> st->cr();
>>
>>
>> Testing: tier 1 and compiled Linux-x64/aarch64, MacOS-x64/aarch64, Windows x64 and cross-compiled Linux-x86/riscv/arm/ppc/s390x (GHA and some local)
>
> Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>
> - Restructure os::print_register_info interface
> - Code syle and line length
> - Merge Fix
> - Merge remote-tracking branch 'upstream_jdk/master' into vmerror_report_register_stack_reentrant
> - Fix whitespace
> - Add reentrant reentry limits
> - Add os::print_register_info_header
> - VMError::report reentrant for register and stack print
Reimplemented the logic with separate `REATTEMPT` steps. Also added this logic to the call stack printing. I kept the stack depth logic to not reattempt steps if there is low headroom. And the print location (both stack and registers) are seen as one step with respect to timeout, that is reattempts will not `record_step_start_time`. But the call stack printing reattempt will (it was explicitly stated in JBS that if normal printing with source info times out it should still print without).
I remove the new test. Will rewrite tests for this using the `HsErrFileUtils`. But wanted to get your feedback @tstuefe on the new approach.
-------------
PR: https://git.openjdk.org/jdk/pull/11017
More information about the hotspot-dev
mailing list