GetLastError() (with and without debugger)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Aug 12 15:08:22 UTC 2022


On 12/08/2022 16:05, Pedro Lamarão wrote:
>
>
> Em sex., 12 de ago. de 2022 às 12:01, Maurizio Cimadamore 
> <maurizio.cimadamore at oracle.com> escreveu:
>
>     As I said, I believe this should be visible in JNI too - but
>     perhaps nobody would write code like this using JNI. E.g. with
>     JNI, since it's painful enough to write one native method,
>     developers tend to "lump" multiple functionalities, e.g. error
>     checking, in the same native method implementation. Which,
>     coincidentally, bypasses some issues that might be visible when
>     using debuggers (so it is possible that this is a problem that
>     debuggers never had to worry too much about).
>
>
> Something like this would happen in JNA and JNR based code.
> I am familiar with these; I'll port the original poster program and 
> push to Github.

Exactly - I believe something like that should probably be enough to 
reproduce.

I've been trying to look at similar issues for JNA/JNR, but couldn't 
find much - but again, this is a specific failure mode (debug only) that 
occurs in a specific context (native interop). So I'm not surprised if 
nobody stumbled into it (or maybe somebody did, but did not report it).

As far as I can tell, jnr/ffi doesn't have any special handling of 
LastError/errno.

Maurizio

>
> -- 
> Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220812/4afe2edb/attachment-0001.htm>


More information about the panama-dev mailing list