Hi all!
I'm currently experiencing a problem regarding thread debugging in some compiled code. I have a thread which seems to die for some unknown reasons (which I'd like to find out) but since it is compiled code, I don't have access to gambit's debugging facilities such as a backtrace of the execution. Is there a way to get that info even with compiled code?
I cannot use 'gsi' with my code because it uses gambit's FFI (and gsi does not support the FFI)...
Thank you!
David
Afficher les réponses par date
Hello,
You could compile the FFI into a module which you can load in the interpreter. Then you can debug other code.
As for accessing the debugging commands programmatically, look at the this email and its replies:
https://webmail.iro.umontreal.ca/pipermail/gambit-list/2007-August/001661.ht...
On 9/5/07, David St-Hilaire sthilaid@iro.umontreal.ca wrote:
Hi all!
I'm currently experiencing a problem regarding thread debugging in some compiled code. I have a thread which seems to die for some unknown reasons (which I'd like to find out) but since it is compiled code, I don't have access to gambit's debugging facilities such as a backtrace of the execution. Is there a way to get that info even with compiled code?
I cannot use 'gsi' with my code because it uses gambit's FFI (and gsi does not support the FFI)...
Thank you!
David
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
James Long wrote:
Hello,
You could compile the FFI into a module which you can load in the interpreter. Then you can debug other code.
Loading the program as a module in gsi would sure be of great help! I'm currently trying to compile my program (a tetris game) in a shared library so that it can get loaded by gsi (is this what you meant by compile my FFI into a module?), but I get an error which I don't understand... :(
Here is how it goes...
[dave@localhost tetris]$ make clean; make gsi-tetris.o1 rm -rf *.c *.o* gsc -c board.scm gsc -c blocks.scm gsc -c block-list.scm gsc -c matrix.scm gsc -c lib.scm gsc -c colors.scm gsc -c ui.scm gsc -c ui-sdl.scm gsc -c tetris.scm gsc -link -flat -o gsi-tetris.o1.c board.scm blocks.scm block-list.scm matrix.scm lib.scm colors.scm ui.scm ui-sdl.scm tetris.scm board.scm: blocks.scm: block-list.scm: matrix.scm: lib.scm: colors.scm: ui.scm: ui-sdl.scm: tetris.scm: *** WARNING -- "##direct-structure-ref" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##direct-structure-set!" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##make-uninterned-symbol" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##quasi-cons" is not defined, *** referenced in: ("board.c") *** WARNING -- "##quasi-list" is not defined, *** referenced in: ("board.c") *** WARNING -- "##structure" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##type-type" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "*" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c") *** WARNING -- "+" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c" "blocks.c" "board.c") *** WARNING -- "-" is not defined, *** referenced in: ("ui.c" "lib.c" "blocks.c" "board.c") *** WARNING -- "/" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c") *** WARNING -- "<" is not defined, *** referenced in: ("matrix.c" "board.c") *** WARNING -- "=" is not defined, *** referenced in: ("tetris.c" "ui.c" "board.c") *** WARNING -- ">=" is not defined, *** referenced in: ("tetris.c" "board.c") *** WARNING -- "apply" is not defined, *** referenced in: ("ui-sdl.c" "lib.c") *** WARNING -- "arithmetic-shift" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "assoc" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "bitwise-ior" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "car" is not defined, *** referenced in: ("lib.c" "matrix.c" "blocks.c") *** WARNING -- "cdr" is not defined, *** referenced in: ("ui-sdl.c" "lib.c" "matrix.c") *** WARNING -- "ceiling" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "cons" is not defined, *** referenced in: ("tetris.c" "lib.c" "block-list.c" "blocks.c") *** WARNING -- "display" is not defined, *** referenced in: ("board.c") *** WARNING -- "end-game!" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "eq?" is not defined, *** referenced in: ("ui.c" "board.c") *** WARNING -- "equal?" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "error" is not defined, *** referenced in: ("ui-sdl.c" "ui.c") *** WARNING -- "for-each" is not defined, *** referenced in: ("board.c") *** WARNING -- "inexact->exact" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "integer->char" is not defined, *** referenced in: ("board.c") *** WARNING -- "length" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "list" is not defined, *** referenced in: ("block-list.c" "blocks.c" "board.c") *** WARNING -- "list-ref" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "make-mutex" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "make-thread" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "make-vector" is not defined, *** referenced in: ("ui.c" "matrix.c" "board.c") *** WARNING -- "map" is not defined, *** referenced in: ("tetris.c" "blocks.c" "board.c") *** WARNING -- "modulo" is not defined, *** referenced in: ("blocks.c" "board.c") *** WARNING -- "mutex-lock!" is not defined, *** referenced in: ("board.c") *** WARNING -- "mutex-unlock!" is not defined, *** referenced in: ("board.c") *** WARNING -- "newline" is not defined, *** referenced in: ("board.c") *** WARNING -- "not" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c" "ui.c" "lib.c" "board.c") *** WARNING -- "null?" is not defined, *** referenced in: ("lib.c") *** WARNING -- "pair?" is not defined, *** referenced in: ("lib.c") *** WARNING -- "pp" is not defined, *** referenced in: ("board.c") *** WARNING -- "random-integer" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "reverse" is not defined, *** referenced in: ("board.c") *** WARNING -- "string->symbol" is not defined, *** referenced in: ("ui-sdl.c" "lib.c") *** WARNING -- "string-append" is not defined, *** referenced in: ("ui.c" "lib.c") *** WARNING -- "string?" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "symbol->string" is not defined, *** referenced in: ("lib.c") *** WARNING -- "symbol?" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "thread-sleep!" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c") *** WARNING -- "thread-start!" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "tk" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-end" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-event-loop" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-start" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/bind" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/message-box" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/pack" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/wm" is not defined, *** referenced in: ("ui.c") *** WARNING -- "vector" is not defined, *** referenced in: ("matrix.c") *** WARNING -- "vector->list" is not defined, *** referenced in: ("board.c") *** WARNING -- "vector-length" is not defined, *** referenced in: ("matrix.c" "board.c") *** WARNING -- "vector-ref" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c" "blocks.c" "board.c") *** WARNING -- "vector-set!" is not defined, *** referenced in: ("ui.c" "matrix.c" "board.c") g++ -shared -D___DYNAMIC -rdynamic -I/opt/g4/current/include -I/usr/X11R6/include -D___SINGLE_HOST -O3 -ffast-math -o gsi-tetris.o1 board.c blocks.c block-list.c matrix.c lib.c colors.c ui.c ui-sdl.c tetris.c gsi-tetris.o1.c -L/usr/X11R6/lib -L/opt/g4/current/lib/ -lgambc -lGL -lGLU -lXxf86vm -lXext -lX11 -lutil -ldl -lSDL -lSDL_image -lSDL_gfx ui-sdl.c:219:31: warning: extra tokens at end of #include directive [dave@localhost tetris]$ gsi gsi-tetris.o1 *** ERROR IN ##main -- /home/dave/projet/mgdt/tetris/gsi-tetris.o1: cannot restore segment prot after reloc: Permission denied (load "gsi-tetris.o1")
Is there something wrong with the way I compiled my compiled module?
Thank you very much for your help! ^_^Y
David
Are you running SELinux? It looks like it's a problem with fine-grained security, somewhat common from what I see with a google search:
So it's not a problem with gambit or gcc at all. Also, as long as you make sure you load your modules in the correct order, you can ignore those warnings, it's just saying that those symbols don't exist yet.
I also didn't mean to compile your whole program as a module. What FFI are you relying on? Your game logic should be perfectly fine in a interpreter. I meant to just compile your FFI as a module, load it in, and run all your other code interactively.
If you are in a windowed environment (and that is your FFI), then you'll need to install your own exception handler and recreate a debugging environment. Or you could make your logic independent of the windowing system so that you can debug it in the REPL, and then slap a window on top of it.
On 9/5/07, David St-Hilaire sthilaid@iro.umontreal.ca wrote:
James Long wrote:
Hello,
You could compile the FFI into a module which you can load in the interpreter. Then you can debug other code.
Loading the program as a module in gsi would sure be of great help! I'm currently trying to compile my program (a tetris game) in a shared library so that it can get loaded by gsi (is this what you meant by compile my FFI into a module?), but I get an error which I don't understand... :(
Here is how it goes...
[dave@localhost tetris]$ make clean; make gsi-tetris.o1 rm -rf *.c *.o* gsc -c board.scm gsc -c blocks.scm gsc -c block-list.scm gsc -c matrix.scm gsc -c lib.scm gsc -c colors.scm gsc -c ui.scm gsc -c ui-sdl.scm gsc -c tetris.scm gsc -link -flat -o gsi-tetris.o1.c board.scm blocks.scm block-list.scm matrix.scm lib.scm colors.scm ui.scm ui-sdl.scm tetris.scm board.scm: blocks.scm: block-list.scm: matrix.scm: lib.scm: colors.scm: ui.scm: ui-sdl.scm: tetris.scm: *** WARNING -- "##direct-structure-ref" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##direct-structure-set!" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##make-uninterned-symbol" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##quasi-cons" is not defined, *** referenced in: ("board.c") *** WARNING -- "##quasi-list" is not defined, *** referenced in: ("board.c") *** WARNING -- "##structure" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "##type-type" is not defined, *** referenced in: ("blocks.c") *** WARNING -- "*" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c") *** WARNING -- "+" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c" "blocks.c" "board.c") *** WARNING -- "-" is not defined, *** referenced in: ("ui.c" "lib.c" "blocks.c" "board.c") *** WARNING -- "/" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c") *** WARNING -- "<" is not defined, *** referenced in: ("matrix.c" "board.c") *** WARNING -- "=" is not defined, *** referenced in: ("tetris.c" "ui.c" "board.c") *** WARNING -- ">=" is not defined, *** referenced in: ("tetris.c" "board.c") *** WARNING -- "apply" is not defined, *** referenced in: ("ui-sdl.c" "lib.c") *** WARNING -- "arithmetic-shift" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "assoc" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "bitwise-ior" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "car" is not defined, *** referenced in: ("lib.c" "matrix.c" "blocks.c") *** WARNING -- "cdr" is not defined, *** referenced in: ("ui-sdl.c" "lib.c" "matrix.c") *** WARNING -- "ceiling" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "cons" is not defined, *** referenced in: ("tetris.c" "lib.c" "block-list.c" "blocks.c") *** WARNING -- "display" is not defined, *** referenced in: ("board.c") *** WARNING -- "end-game!" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "eq?" is not defined, *** referenced in: ("ui.c" "board.c") *** WARNING -- "equal?" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "error" is not defined, *** referenced in: ("ui-sdl.c" "ui.c") *** WARNING -- "for-each" is not defined, *** referenced in: ("board.c") *** WARNING -- "inexact->exact" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "integer->char" is not defined, *** referenced in: ("board.c") *** WARNING -- "length" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "list" is not defined, *** referenced in: ("block-list.c" "blocks.c" "board.c") *** WARNING -- "list-ref" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "make-mutex" is not defined, *** referenced in: ("tetris.c") *** WARNING -- "make-thread" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "make-vector" is not defined, *** referenced in: ("ui.c" "matrix.c" "board.c") *** WARNING -- "map" is not defined, *** referenced in: ("tetris.c" "blocks.c" "board.c") *** WARNING -- "modulo" is not defined, *** referenced in: ("blocks.c" "board.c") *** WARNING -- "mutex-lock!" is not defined, *** referenced in: ("board.c") *** WARNING -- "mutex-unlock!" is not defined, *** referenced in: ("board.c") *** WARNING -- "newline" is not defined, *** referenced in: ("board.c") *** WARNING -- "not" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c" "ui.c" "lib.c" "board.c") *** WARNING -- "null?" is not defined, *** referenced in: ("lib.c") *** WARNING -- "pair?" is not defined, *** referenced in: ("lib.c") *** WARNING -- "pp" is not defined, *** referenced in: ("board.c") *** WARNING -- "random-integer" is not defined, *** referenced in: ("lib.c" "blocks.c") *** WARNING -- "reverse" is not defined, *** referenced in: ("board.c") *** WARNING -- "string->symbol" is not defined, *** referenced in: ("ui-sdl.c" "lib.c") *** WARNING -- "string-append" is not defined, *** referenced in: ("ui.c" "lib.c") *** WARNING -- "string?" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "symbol->string" is not defined, *** referenced in: ("lib.c") *** WARNING -- "symbol?" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "thread-sleep!" is not defined, *** referenced in: ("tetris.c" "ui-sdl.c") *** WARNING -- "thread-start!" is not defined, *** referenced in: ("ui-sdl.c") *** WARNING -- "tk" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-end" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-event-loop" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk-start" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/bind" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/message-box" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/pack" is not defined, *** referenced in: ("ui.c") *** WARNING -- "tk/wm" is not defined, *** referenced in: ("ui.c") *** WARNING -- "vector" is not defined, *** referenced in: ("matrix.c") *** WARNING -- "vector->list" is not defined, *** referenced in: ("board.c") *** WARNING -- "vector-length" is not defined, *** referenced in: ("matrix.c" "board.c") *** WARNING -- "vector-ref" is not defined, *** referenced in: ("tetris.c" "ui.c" "matrix.c" "blocks.c" "board.c") *** WARNING -- "vector-set!" is not defined, *** referenced in: ("ui.c" "matrix.c" "board.c") g++ -shared -D___DYNAMIC -rdynamic -I/opt/g4/current/include -I/usr/X11R6/include -D___SINGLE_HOST -O3 -ffast-math -o gsi-tetris.o1 board.c blocks.c block-list.c matrix.c lib.c colors.c ui.c ui-sdl.c tetris.c gsi-tetris.o1.c -L/usr/X11R6/lib -L/opt/g4/current/lib/ -lgambc -lGL -lGLU -lXxf86vm -lXext -lX11 -lutil -ldl -lSDL -lSDL_image -lSDL_gfx ui-sdl.c:219:31: warning: extra tokens at end of #include directive [dave@localhost tetris]$ gsi gsi-tetris.o1 *** ERROR IN ##main -- /home/dave/projet/mgdt/tetris/gsi-tetris.o1: cannot restore segment prot after reloc: Permission denied (load "gsi-tetris.o1")
Is there something wrong with the way I compiled my compiled module?
Thank you very much for your help! ^_^Y
David
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
James Long wrote:
Are you running SELinux? It looks like it's a problem with fine-grained security
Wow thanks! It was exaclty an SELinux problem. After having loosened the security policy, it now works just great! I didn't even googled the error because I was sure I was wrongly compiling my program...
Thank you very much for your help, it sure is helping me alot!
David