bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MySQL sql_query gets Seg fault in GNU Prolog v1.2.8


From: David Bennett
Subject: MySQL sql_query gets Seg fault in GNU Prolog v1.2.8
Date: Wed, 26 Dec 2001 09:42:41 -0700

The following is a thread describing the problem that does not occur in v 1.2.1, with some debugging provided by Vic Bancroft - apparently the Beta 1.2.9 version also seg faults.
 
On Thu, 15 Nov 2001, David Bennett wrote:

> Does anyone use the MySql Interface?

Using a relational database from gprolog has been a recent interest. 
Thank you for attaching the file, since I have been unable to get it
directly from the link on the web site. 

> It is seg faulting when the Mk_Proper_List function is called. 

Humm, I would suspect the Mk_Proper_List fnction is innocent.  After
dropping No_More_Choice() into a function and setting an appropriate
breakpoint,

  Breakpoint 1, no_more_choice () at mysql-cg.c:200
  200   No_More_Choice();
  (gdb) disassemble
  Dump of assembler code for function no_more_choice:
  0x804ac00 <no_more_choice>: mov    0x404(%ebx),%eax
  0x804ac06 <no_more_choice+6>: add    $0xffffffec,%eax
  0x804ac09 <no_more_choice+9>: mov    (%eax),%edx
  0x804ac0b <no_more_choice+11>: mov    %edx,0x404(%ebx)
  0x804ac11 <no_more_choice+17>: mov    $0x1,%eax
  0x804ac16 <no_more_choice+22>: jmp    0x804ac18 <no_more_choice+24>
  0x804ac18 <no_more_choice+24>: ret   
  End of assembler dump.
  (gdb) s

  Program received signal SIGSEGV, Segmentation fault.
  0x804ac09 in no_more_choice () at mysql-cg.c:200
  200   No_More_Choice();

Part of the problem debugging this is the chain of macro substitutions.
As defined in gprolog.h:

  #define No_More_Choice()       Delete_Last_Choice_Point()

This is really another macro in gprolog.h and wam_inst.h that uses several
others,
 
  #define Delete_Last_Choice_Point()  Assign_B(BB(B))

Now Assign_B is also in both gprolog.h and wam_inst.h

  #define Assign_B(newB)              (B = (newB), HB1 = HB(B))

Of course now we are into the virtual machine registers, where

  #define BB(b)                      ((WamWord *) (b[-5]))
  #define HB(b)                      ((WamWord *) (b[-6]))

and HB1 is defined in gprolog.h and wam_archi.h as

  #define HB1                   (((WamWordP *) reg_bank)[NB_OF_X_REGS+1])

> This code works fine under version 1.2.1.
 
There doesn't seem to be any use of HB1 from, gprolog 1.2.1's wam_inst.h

  #define Delete_Last_Choice_Point()         B=BB(B)

Perhaps Daniel could shed some light in this difference.

more,
l8r,
v

--
Does anyone use the MySql Interface?  It is seg faulting when the Mk_Proper_List function is called. 
 
This code works fine under version 1.2.1.
 
The attached file is the C/MySql interface with the pl foreign directives at the top for *documentation purposes*.
 
The trace below is of what happens if we enter a simple query (Prior to this we did properly connect to the server).
 
Any thoughts or assistance would be greatly appreciated!
David Bennett
 
----------------------------------------------

| ?- atom_codes('select EventType from events', C), sql_query(C, R).
MYSQL-First call!
MYSQL-Fetching a record
MYSQL-Field #0 building
list[0] before: 0
MYSQL-Row: initialize
list[0] after: 209163653
MYSQL-Unifying result
MYSQL-LIST contains 1 fields
 
Fatal Error: Segmentation Violation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]