Debugging a SIGSEGV

2021-10-20 Thread vsajip
Great, that worked! Thank you very much indeed. I will try asking on IRC next time something like this comes up.

Debugging a SIGSEGV

2021-10-20 Thread Yardanico
See for an example (I don't think it's 100% correct, but it shows one of the ways to use object variants in your code).

Debugging a SIGSEGV

2021-10-20 Thread vsajip
OK, thanks very much. I will switch to trying object variants.

Debugging a SIGSEGV

2021-10-20 Thread Yardanico
It would be better if you were in Discord or IRC so I can explain stuff in a real-time chat, but basically, your crashes come from the fact that you're using `{.union.}` pragma. It's mainly aimed at C FFI and is not really supposed to be used in pure Nim code, instead you should use object varia

Debugging a SIGSEGV

2021-10-20 Thread Stefan_Salewski
> Does your code contain use of ptr, cast or addr()? > TokenValue {.union.} = object I think union pragma can be dangerous too. Can you not use Nim's object variants instead?

Debugging a SIGSEGV

2021-10-20 Thread Stefan_Salewski
Does your code contain use of ptr, cast or addr()? Try compile on linux with --gc:arc -d:useMalloc and run with valgrind.

Debugging a SIGSEGV

2021-10-20 Thread vsajip
Tried with all of the `--gc:` options other than `--gc:go`. Same results :-( Fails also with `--gc:none`, except that I get lots of `uses GC'ed memory [GcMem]` messages from e.g. `unittest`. A `SIGSEGV` in all cases.

Debugging a SIGSEGV

2021-10-20 Thread vsajip
I'm working on a [project](https://github.com/vsajip/nim-cfg-lib) (early days) which crashes with a `SIGSEGV` in tests. It's pure Nim (no calls into C or anything like that) and it crashes at a point where that bit of code has been executed dozens of times. It's basically a tokenizer, and hits t

Debugging a SIGSEGV

2021-10-20 Thread Yardanico
Can you try running the code with --gc:orc just out of curiosity?