Re: Breakpoints not firing in CAPI callbacks?
On 12/22/06, Simon Katz <sk@nomistech.com> wrote:
>
> > From: owner-lisp-hug@lispworks.com
> > [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Simon Katz
> > Sent: 22 December 2006 11:38
> > To: 'Lisp HUG'
> > Subject: RE: Breakpoints not firing in CAPI callbacks?
> >
> >
> > > From: owner-lisp-hug@lispworks.com
> > > [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Bill Atkins
> > > Sent: 22 December 2006 06:31
> > > To: Lisp HUG
> > > Subject: Breakpoints not firing in CAPI callbacks?
> > >
> > >
> > > Lispworks 5.0.1 on OS X. Here is a trivial CAPI interface:
> > >
> > > ----
> > > (defpackage :foo (:use :cl :capi))
> > > (in-package :foo)
> > >
> > > (define-interface foo ()
> > > ()
> > > (:panes
> > > (foo
> > > text-input-pane
> > > :callback-type :interface-item
> > > :callback (lambda (interface item)
> > > (display-message "~A ~A" interface item))))
> > > (:layouts
> > > (main column-layout '(foo))))
> > >
> > > (capi:display (make-instance 'foo))
> > > -----
> > >
> > > If I toggle a breakpoint at the beginning of the display-message
> > form,
> > > I never get dropped into the stepper when I trigger the callback.
> > The
> > > DISPLAY-MESSAGE call does get evaluated, so I'm trying to figure
> out
> > > why the breakpoint seems to be ignored. In code that doesn't
> > involve
> > > CAPI, breakpoints fire without issue.
> > >
> > > --
> > > Bill Atkins
> >
> > I get the same behaviour if I compile the code and enter
> > something in the resulting TEXT-INPUT-PANE. But if I evaluate
> > the CAPI:DISPLAY form after compiling the rest of the code, all
> > is ok.
> > (LW 5.0.0 on Windows.)
> >
> > Simon
>
> Further to that, I only have the problem if I display the interface
> and then set the breakpoint. If I set the breakpoint and then
> display the interface all is ok. But after I've seen one stepper
> window, subsequently there is no problem -- I can toggle the
> breakpoint and display new interfaces in any order and the
> stepper window appears as expected.
>
> Simon
I don't get the Stepper in any of those cases. Incidentally, creating
a new function, setting a breakpoint in that, and calling it from the
DEFINE-INTERFACE callback doesn'
t seem to help.
I have a suspicion that the problem has to do with Cocoa not being
thread-safe. If I put the breakpoint in a non-CAPI thread, the
Stepper does come up:
(define-interface foo ()
()
(:panes
(foo
text-input-pane
:callback (lambda (interface item)
(mp:process-run-function "foo" '()
(lambda ()
(format t "~D" (+ 1 (* 2 3)))))))))
I can place a breakpoint on the format and step to my heart's content.
I hope that problems with Cocoa threading aren't the reason, though,
because then it's Cocoa's fault and not something I can work around.
:)
--
Bill Atkins