RFR: 8311542: Consolidate the native stack printing code [v5]
Julian Waters
jwaters at openjdk.org
Wed Dec 11 05:38:39 UTC 2024
On Tue, 10 Dec 2024 23:15:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> We now print native stacks in a number of contexts, not just VMError reporting, and we have to try `os::platform_print_native_stack` else fall back to `VMError::print_native stack`.
>>
>> The refactoring adds a new `NativeStackPrinter` (NSP) helper class which can be constructed with some of the context information for the printing that will follow. This avoids the need for the print functions to have a large number of parameters. We have to expose both the top-level printing functionality and the "lower-level" frame-based stack walk as the error reporter needs access to that directly. To maintain the exact same format of output the NSP has to be aware of some error reporter usage requirements.
>>
>> I also had to expose a direct `frame` taking print function for the Debug.cpp `pns` case.
>>
>> Testing:
>> - tiers 1 - 4
>>
>> Some frame management code was also moved from `VMError` to the `frame` class.
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>
> Update copyright notice to reflect file where code was copied from
src/hotspot/share/utilities/debug.cpp line 653:
> 651: NativeStackPrinter nsp(Thread::current_or_null());
> 652: nsp.print_stack_from_frame(tty, fr, buf, sizeof(buf),
> 653: false /* print_source_info */, -1 /* max stack */);
Should this be aligned with tty or is the current formatting preferred? Alternatively it seems like this could all fit on one line, but it's up to you
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22472#discussion_r1879374137
More information about the hotspot-dev
mailing list