User:Pkmnfrk/Mystery SIGTRAPs in FreeBasic
Jump to navigation
Jump to search
Program received signal SIGTRAP, Trace/breakpoint trap. 0x7c901231 in _C__prg_code_bas_FreeBASIC_lib_win32_def____libmsvcrt_dll_a_iname()
Uh oh. Everything seems fine when you run your program, but when debugging in GDB, you get mystery "Trace/breakpoint trap" errors. Worse, they point to the bowels of the native runtime library, which doesn't have any symbols! And, if you grab a backtrace, the last line you wrote was something harmless, like:
return -1
What's going on here?!
Don't Panic
I've run in to these before, and now I am putting digital pen to paper and writing down my experiences for others to use. Read on, and we'll figure out what's going on!
/redim foo(ubound(foo) + 1)[edit]
Signs this is your problem:
- Your backtrace looks like this:
(gdb) bt #0 0x7c901231 in _C__prg_code_bas_FreeBASIC_lib_win32_def____libmsvcrt_dll_a_iname () ' snip #6 0x77c2c2de in _C__prg_code_bas_FreeBASIC_lib_win32_def____libmsvcrt_dll_a_iname () #7 0x00401582 in hRedim () #8 0x0040161c in fb_ArrayRedimEx () #9 0x004012f5 in DOSOMETHING (FOO= {data = 0x12ff80, ptr = 0x12ff80, size = 12, elen = 4, dims = 1, dim1_elemns = 3, dim1_lbound = 0, dim1_ubound = 2}) at crash1.bas:3 #10 0x004013b6 in main (__FB_ARGC__=1, __FB_ARGV__=0x323da8) at crash1.bas:11
- You get a warning just before the SIGTRAP:
warning: HEAP[crash1.exe]: warning: Invalid Address specified to RtlFreeHeap( 00320000, 0012FF80 )