Subject: [clisp-list] Debugging clisp FFI calls into a newly created (c++) DLL

From: "Andreas Thiele" <[email-masked]>
Date: Tue Jun 1 07:49:09 2004

I wrote a (c++) DLL using msvc 6.0. So far clisp 'call-outs' and 'call-ins' work fine.

Now - since things get more complex - I'd like to be able to debug my DLL using msvc debugger. This is normally no problem, but when I try to start debugging the clisp process I run into an 

access violation 

exception. I can't start clisp (lisp.exe -M lispinit.mem ...) from within the debugger. If I don't specify the image, I don't run into any access violation (but obviously I can't work/debug :-)).

Any hints/help/alternatives are greatly appreciated.

Why does the debugger sense access violation while the program run standalone works fine?

---

From: Arseny Slobodjuck <[email-masked]>
Date: Tue Jun 1 15:20:01 2004

> Why does the debugger sense access violation while the program run standalone works fine?

Indeed. Never noticed that before.
BTW, what OS do you using ?
I see no easy solution. There's debug Makefile for MSVC 6.0, but
sources are not in MSVC compileable state. Debug version runs pretty
well in debugger on my computer. Nondebug is not, whether it's cygwin
or MSVC built.

-- 
Best regards,
 Arseny

---

From: "Andreas Thiele" <[email-masked]>
Date: Tue Jun 1 15:58:12 2004

-----Ursprungliche Nachricht-----
Von: [email-masked]
[mailto:[email-masked]]Im Auftrag von Arseny
Slobodjuck
Gesendet: Mittwoch, 2. Juni 2004 00:19
An: Andreas Thiele
Cc: [email-masked]
Betreff: Re: [clisp-list] Debugging clisp FFI calls into a newly created
(c++) DLL

> Now - since things get more complex - I'd like to be able to debug my DLL
using msvc debugger. This is normally no problem, but when I try to start
debugging the clisp process I run into an
> access violation
> exception. I can't start clisp (lisp.exe -M lispinit.mem ...) from within
the debugger. If I don't specify the image, I don't run into any access
violation (but obviously I can't work/debug :-)).

--
Best regards,
 Arseny

Thanks for your help. I tried the debug makefile. No success. Did I get you
right, there is a debug version of clisp? I don't want to debug clisp, just
the calls into and inside my DLL. I am no c++ expert, but I think I have to
attach to the clisp process or load clisp in the debugger. With another app,
this worked fine. I used WinXP, I'll try W2K. But a debug version clisp
would be helpful. Didn't find it yet. Can I? I use clisp 2.32 at the moment.
Thanks

---

From: Arseny Slobodjuk <[email-masked]>
Date: Tue Jun 1 21:46:01 2004

> Thanks for your help. I tried the debug makefile. No success. Did I get you
Have you built clisp with debug makefile ?
Current sources need some patching for this.

> would be helpful. Didn't find it yet. Can I? I use clisp 2.32 at the moment.
There is MSVC makefile for debugging (win32msvc/makefile.msvc5d).
Debug versions of clisp are not distributed of course.
The version I've built 6 months ago doesn't crash like others.
Moreother, the one I've just built with cygwin/mingw/with-debug
doesn't crash either. I have no experience with debugging of FFI
programs. Don't know whether source-level debugging is possible in
this case.

-- 
Best regards,
 Arseny                            mailto:[email-masked]

---

From: "Andreas Thiele" <[email-masked]>
Date: Wed Jun 2 01:26:06 2004

>... doesn't crash either. I have no experience with debugging of FFI

Thanks again,

Your answer is helpfull for me, although I think I am facing the tough way.
I will try the cygwin approach.

I'll also try to explain what I am doing a little more precise because I
believe everbody who tries to write a DLL using visual studio will run into
this problem case.

I wrote a DLL which will be called via FFI. Thus the DLL is visible from
within the clisp process and must be debugged in this context (at least I
think so ;-)). I also wrote FFI calls from the (outdated ?) Gold Hill Lisp.
Now I don't have the Gold Hill sources and I even don't need them. I am
using microsoft visual studio 6.0 (c++ SP4, on WinXP SP1) and only have my
DLL source on screen. I set a break point in my DLL and tell the debugger to
start Gold Hill Lisp. After loading my lisp program, when lisp trys to call
my DLL via FFI the break point is invoked and I can debug/step through my
code within visual studio.

So in this case, I don't want debug clisp - just my DLL. But something is
special about clisp. When I tell the ms debugger to start clisp, clisp
crashes with an access violation even before I loaded my lisp program. (I
think this could be caused by the way clisp is compiled and linked, but I
have no real clue on this.)

Does anybody have a hint or solution? May be there is an easy way to debug
using cygwin?

Thanks.