Hi there,
what is the recommended way of running the Ciao Prolog shell under gdb? What I need to do is to find the cause of a segmentation fault that is happening in some foreign language module. In other words, here is what happens:
$ ciao Ciao-Prolog 1.8 #2: Tue Oct 29 22:49:43 CET 2002 ?- ensure_loaded(ppl_ciao).
yes ?- use_module(ppl_ciao).
yes ?- ppl_initialize.
yes ?- ppl_new_Polyhedron_from_dimension(c, 3, X). {ERROR: segmentation violation} { Execution aborted } ?-
To proceed with my investigation I need to catch that segmentation violation. Thanks a lot
Roberto
Roberto Bagnara writes:
Hi there,
what is the recommended way of running the Ciao Prolog shell under gdb? What I need to do is to find the cause of a segmentation fault that is happening in some foreign language module. In other words, here is what happens:
Hi, Roberto. The way to do this is by recompiling the engine with debugging information (and also, presuably, the library you want to debug), launch it inside gdb (or whatever debugger you are using) and starting the toplevel as ciaosh does (look at the first lines of ciaosh). Here is a (commented) sample, where I am using gbd in command line mode:
[boris(a)clip boris]$ cd ~clip/Systems/ciao # Go where the sources are
[boris(a)clip ciao]$ export CIAODEBUG=-debug # Tell make we are going to debug
[boris(a)clip ciao]$ make eng # Just redo the engine *** --------------------------------------------------------- *** Compiling ciao engine for LINUXi86... *** --------------------------------------------------------- [a lot of compilation messages]
# Now, start the debugger with the newly generated engine --- it has # *not* been installed, but it lives in the sources instead.
[boris(a)clip ciao]$ gdb /home/clip/Systems/ciao/bin/LINUXi86-debug/ciaoengine GNU gdb Red Hat Linux (5.2.1-4) [Copyright notices]
# Go to where your source code is (gdb) cd /tmp Working directory /tmp.
# Tell the bytecode interpreter to load the ciaosh bytecode; this # depends on where you have ciaosh. "-C -b" are passed to the interpreter. (gdb) run -C -b /home/clip/Systems/ciao/shell/ciaosh Starting program: /home/clip/Systems/ciao-1.9/bin/LINUXi86-debug/ciaoengine -C -b /home/clip/Systems/ciao/shell/ciaosh [New Thread 8192 (LWP 19942)] {Including /home/boris/.ciaorc } Ciao-Prolog 1.9 #18: Tue Nov 5 13:02:43 CET 2002 ?-
# The toplevel is now being executed by an emulator which is under the # control of gdb
Hope this helps.
MCL
__________________ Myspacebargotstuck ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------