This is the second time I face this error:
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
So I am pretty sure this is something that I systematically do wrong. This
happens when I wrap some libraries.
My question is what is the right strategy to debug this sort of
* When you wrap C code, use c2nim.
* Use `.cdecl` as the calling convention, `.bycopy` for object/struct
wrapping.
* Use `cint` instead of `int` and in general the right types, especially
types of the right size for binary compatibility.
* On Linux/OSX you can run your program through `va
(Just for the record; I haven't checked if these are already known issues or if
they are actually issues or my misuse)
I am playing again with c2nim. I am not sure if this could be a problem:
typedef enum VSColorFamily {
cmGray = 100,
cmRGB= 200
} V
Thanks @Araq, that helped me fix the bug.
(most recent call last)
rewrite.nim(26) rewrite
strtabs.nim(133) getOrDefault
strtabs.nim(104) rawGet
strtabs.nim(85) myhash
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
I know this is old, but initializing all seq[] with a dummy variable then
wiping them before their intended use seems to work for me.
It looks like the second argument to getOrDefault is supposed to be a non-nil
string.
ISSUE RESOLVED.
I fixed the error by checking for attrsLen property like this:
import htmlparser
import xmltree
import strtabs
import strutils
let allhtml:File = open("allhtml.txt")
var line: string
var count = 0
while allhtml.readline(line):
nope. it did not make any difference.
import htmlparser
import xmltree
import strtabs
import strutils
let allhtml:File = open("allhtml.txt")
var line: string
var count = 0
while allhtml.readline(line):
echo "HTML file: ", count, line
v
In the new nim 19.0, nil and seq of length 0 are the same. So you should not
run into this as often.
These are now all valid and work:
var a: seq[int]
a.add 1
var b = newSeq[int]()
b.add 1
var c: seq[int] = @[]
c.add 1
Run
initializing al
example2.nim| the EXE runs and crash
all the crashes says
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed:
'C:\Users\USER\.nimble\pkgs\wxnim-0.8.0\examples\purewx\example2.exe '
Run
of cause,
Compile without -d:release and with `-d:useSysAssert -d:useGcAssert`, you have
a memory corruption, most likely because of a bug in your wrapping code. Don't
assume that it's "only" \--opt:size that makes your program crash, you are
simply "lucky" for the other optimization levels.
.nim
Run
says
Traceback (most recent call last)
example2.nim(7) example2
example2.nim(40) createFrame
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Run
where
line 07 let f = createFrame
this helped me before: import segfaults
it inserts a signal handler and outputs a stacktrace.
First things first, I'm able to run your program without `--opt:size` after
some minor modifications.
You're building a `wxListItem` incorrectly since you specify too few masks and
the width and format you specify are ignored: see
[here](https://github.com/wxWidgets/wxWidgets/blob/cc931612eec2e
15 matches
Mail list logo