Integrated: 7903627: Add an option to emit tracing calls to generated bindings
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Jan 15 18:36:48 UTC 2024
On Mon, 15 Jan 2024 17:52:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR tweaks the generated code to introduce a `TRACE_DOWNCALL` boolean flag in the generated code. This flag is initialized with the value of the runtime property `jextract.trace.downcalls`, and allows the generated code to print the value of arguments passed to downcalls. This can be useful when debugging.
>
> Note: while generally the output provided is similar to that of `strace`, we have decided not to print the result value for now. That is because to do that, we'd need to first print the argument values (before the native call takes place) and then come back and print the result value (after the native call has returned). But this idiom would lead to messy output when multiple threads are used.
>
> In `strace`, this is handled by buffering output, and only emitting something when the system call returns - but this is not an option here, as the tracing support is mostly intended to be used when diagnosing application crashes, in which case the native call never returns.
This pull request has now been integrated.
Changeset: 437458a4
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.org/jextract/commit/437458a4a25e418df63795cc3d286e3da5cd389f
Stats: 66 lines in 3 files changed: 60 ins; 3 del; 3 mod
7903627: Add an option to emit tracing calls to generated bindings
Reviewed-by: jvernee
-------------
PR: https://git.openjdk.org/jextract/pull/176
More information about the jextract-dev
mailing list