RFR: 8311541: JavaThread::print_jni_stack doesn't support native stacks on all platforms

David Holmes dholmes at openjdk.org
Tue Jul 18 21:53:43 UTC 2023


On Tue, 18 Jul 2023 18:50:42 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> [JDK-8295974](https://bugs.openjdk.org/browse/JDK-8295974) modified print_jni_stack to print the native stack when there are no Java frames. To do that it used VMError::print_native_stack, however that function is only for platforms that support stack-walking by following frames, on other platforms (i.e. Windows and AIX) we need to use os::platform_print_native_stack.
>> 
>> I'm not trying to consolidate the different versions of the stack printing code in this PR so that it is more easily backported to where [JDK-8295974](https://bugs.openjdk.org/browse/JDK-8295974) was.
>> 
>> The test has been updated to work on Windows (taking advantage of two other recent enhancements - see JBS for details).
>> 
>> Testing:
>> - tiers 1-3 (sanity)
>> -  TestNativeStack regression test
>> 
>> Thanks
>
> test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c line 75:
> 
>> 73: 
>> 74: #ifdef _WIN32
>> 75: unsigned __stdcall
> 
> `__stdcall` is only used for 32-bit windows. I'd probably skip it since we are about to remove 32-bit support anyway.

`__stdcall` is required for native/unmanaged code per:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/beginthread-beginthreadex?view=msvc-170

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14862#discussion_r1267336563



More information about the build-dev mailing list