On Thu, 22 Feb 2024 14:40:36 GMT, Julian Waters <jwat...@openjdk.org> wrote:

>> Windows:
>> Attach Visual Studio,
>> in the Immediate Window, type (funny VS syntax I do not claim to understand):
>> 
>> {,,JVM}universe()
>> 
>> ...and on the JVM's console window I see:
>> 
>> "Executing universe"
>> Heap
>>  garbage-first heap   total reserved 8343552K,...etc...
>> 
>> (It actually did nothing on the first invocation for me, I have typed it 5 
>> times, only got 4 sets of output.  But the symbol is working...)
>> 
>> In that working (JNIEXPORT) case, the map file jdk/bin/server/jvm.dll.map 
>> shows:
>> 
>>  0001:0027ff50       universe                   0000000180280f50 f   
>> debug.obj
>> 
>> (I do like that we call it jvm.dll.map now, not just "jvm.map"!)
>> 
>> Test removing JNIEXPORT:
>>  
>> Without JNIEXPORT, on Windows, the symbol universe is just not there.  
>> Nothing in the map file.  In Visual Studio:
>> 
>> {,,JVM}universe()
>> identifier "universe" is undefined
>> 
>> That confirms the expected Windows behaviour: we still need JNIEXPORT to 
>> make debug.cpp utils callable by a debugger.
>
>> (I do like that we call it jvm.dll.map now, not just "jvm.map"!)
> 
> You can thank @fthevenet for that! :)

> Removing JNIEXPORT here on Linux and rebuilding: still works.
> 
> readelf shows: existing build (using JNIEXPORT): 32252: 0000000000698160 249 
> FUNC LOCAL DEFAULT 11 universe
> 
> without JNIEXPORT: 32252: 0000000000698160 249 FUNC LOCAL HIDDEN 11 universe
> 
> So gdb on Linux can call a HIDDEN function, i.e. without the JNIEXPORT. It 
> seems happy either way, not affected by visibility.

@kevinjwalls Thank you for testing this for me!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17955#discussion_r1499434437

Reply via email to