Hi all,
Consider this small FFI that currently works only on GNU/Linux.
https://github.com/zyrolasting/xiden/blob/libcrypto/crypto.rkt
https://github.com/zyrolasting/xiden/blob/libcrypto/crypto/crypto.c
`raco test` intermittently fails this module with
"invalid memory reference. Some debugging context lost". I can
silence the error by commenting out all use of `valid?` in the
tests (starts on line 413), which allows me to blame one of the
verification functions. However, I do not understand the nature of
the problem well enough to know where exactly the problem
occurred, or what to do when I find it.
My current guess is that I passed a pointer to GC-managed memory,
and the pointer referenced an old location.
Besides continuing to throw prints around, how should I go about debugging this?
-- ~slg
Credit to @samth on the Discord for noticing that I did not use
`_bytes/nul-terminated` on Racket CS byte strings. Doing so fixed
the issue. Thanks, Sam!
-- ~slg