Re: [cffi-devel] stdcall callbacks on ClozureCL/win32

On Sat, Jun 6, 2009 at 12:40 PM, Greg Santucci<thecodewitch@gmail.com> wrote:
When I run (rt:do-test 'cffi-tests::callbacks.stdcall.1), I get this printed:
CFFI-TESTS::CALLBACKS.STDCALL.1
and nothing more.
That's good, it means the test passed.
When I try:
(asdf:oos 'asdf:load-op :cffi-tests) (asdf:oos 'asdf:test-op :cffi-tests)
Clozure crashes to its kernel debugger.
Can you get a backtrace? Hopefully one of the tests is triggering the same bug you're experiencing with GLUT which I suspect is unrelated to stdcall. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/

On Sun, Jun 7, 2009 at 1:05 AM, Luís Oliveira <luismbo@gmail.com> wrote:
On Sat, Jun 6, 2009 at 12:40 PM, Greg Santucci<thecodewitch@gmail.com> wrote:
When I run (rt:do-test 'cffi-tests::callbacks.stdcall.1), I get this printed:
CFFI-TESTS::CALLBACKS.STDCALL.1
and nothing more.
That's good, it means the test passed.
When I try:
(asdf:oos 'asdf:load-op :cffi-tests) (asdf:oos 'asdf:test-op :cffi-tests)
Clozure crashes to its kernel debugger.
Can you get a backtrace? Hopefully one of the tests is triggering the same bug you're experiencing with GLUT which I suspect is unrelated to stdcall.
The transcript is in the attached file "latest-cffi-test.txt". Greg

On Sat, Jun 6, 2009 at 10:14 PM, Greg Santucci<thecodewitch@gmail.com> wrote:
The transcript is in the attached file "latest-cffi-test.txt".
So it seems like CCL crashes in the CALLBACKS.QSORT test (in cffi/tests/callbacks.lisp) somewhere within the call to qsort(). I would guess there is some bug related to callbacks. Try this: (ccl:defcallback qsort-callback (:address a :address b :signed-int) (let ((x (ccl:%get-signed-long a)) (y (ccl:%get-signed-long b))) (cond ((> x y) 1) ((< x y) -1) (t 0)))) (defun test-callbacks-with-qsort () (ccl:%stack-block ((array 40)) (loop for i from 0 and n in '(7 2 10 4 3 5 1 6 9 8) do (setf (ccl:%get-signed-long array (* i 4)) n)) (ccl:external-call "qsort" :address array :signed-int 10 :signed-int 4 :address qsort-callback :void) (loop for i from 0 below 10 collect (ccl:%get-signed-long array (* i 4))))) -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/

On Sun, Jun 7, 2009 at 9:22 AM, Luís Oliveira <luismbo@gmail.com> wrote:
On Sat, Jun 6, 2009 at 10:14 PM, Greg Santucci<thecodewitch@gmail.com> wrote:
The transcript is in the attached file "latest-cffi-test.txt".
So it seems like CCL crashes in the CALLBACKS.QSORT test (in cffi/tests/callbacks.lisp) somewhere within the call to qsort(). I would guess there is some bug related to callbacks. Try this:
(ccl:defcallback qsort-callback (:address a :address b :signed-int) (let ((x (ccl:%get-signed-long a)) (y (ccl:%get-signed-long b))) (cond ((> x y) 1) ((< x y) -1) (t 0))))
(defun test-callbacks-with-qsort () (ccl:%stack-block ((array 40)) (loop for i from 0 and n in '(7 2 10 4 3 5 1 6 9 8) do (setf (ccl:%get-signed-long array (* i 4)) n)) (ccl:external-call "qsort" :address array :signed-int 10 :signed-int 4 :address qsort-callback :void) (loop for i from 0 below 10 collect (ccl:%get-signed-long array (* i 4)))))
That seems to work! The output is in the attached file, good-cffi-results.txt Does this mean cffi can be patched again? Regards, Greg

On Sun, Jun 7, 2009 at 10:33 AM, Greg Santucci<thecodewitch@gmail.com> wrote:
That seems to work!
We figured out how to make the test trigger the bug. I've attached said test case to the Trac ticket started by Greg at <http://trac.clozure.com/ccl/ticket/527#comment:2>. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/

On Mon, Jun 8, 2009 at 10:33 AM, Luís Oliveira <luismbo@gmail.com> wrote:
On Sun, Jun 7, 2009 at 10:33 AM, Greg Santucci<thecodewitch@gmail.com> wrote:
That seems to work!
We figured out how to make the test trigger the bug. I've attached said test case to the Trac ticket started by Greg at <http://trac.clozure.com/ccl/ticket/527#comment:2>.
I've attached a transcript of the Trac ticket containing the backtrace and registers after the qsort loop call. http://trac.clozure.com/ccl/attachment/ticket/527/transcript.txt Greg

On Mon, Jun 8, 2009 at 12:00 PM, Greg Santucci <thecodewitch@gmail.com>wrote:
On Mon, Jun 8, 2009 at 10:33 AM, Luís Oliveira <luismbo@gmail.com> wrote:
On Sun, Jun 7, 2009 at 10:33 AM, Greg Santucci<thecodewitch@gmail.com> wrote:
That seems to work!
We figured out how to make the test trigger the bug. I've attached said test case to the Trac ticket started by Greg at <http://trac.clozure.com/ccl/ticket/527#comment:2>.
I've attached a transcript of the Trac ticket containing the backtrace and registers after the qsort loop call.
http://trac.clozure.com/ccl/attachment/ticket/527/transcript.txt
Greg
After picking up the 12226 win32 binary that was just checked in by Gary, the problem is resolved. The QSort callback test and (cl-glut-examples:gears) both work. Well done! And thank you! Regards, Greg
participants (2)
-
Greg Santucci
-
Luís Oliveira