NirantarVidyarthee Posted December 25, 2012 Posted December 25, 2012 I have two autolisp programs as follows: (defun c:test1() (setq x 0) (setq y 0) (alert "test1") (load "C:\\Documents and Settings\\Administrator\\Desktop\\test2.lsp") ) (defun fnTest2() (setq x2 0) (sewtq y2 0) (alert "test2") ) (test2) Note that program test1 loads the program test2 and then test2 automatically executes the function fnTest2. This is an existing program and I can't make any changes to it. I open file test1.lsp in vlide and then lad it using Tools > Load text in editor. I then enable Debug > Stop once & Debug > break on error. Then I type test1 at the command prompt and then I am able to debug both the program step-by-step using F8 key. The program also highlights the line containing error in program test2. When I 'Rest to top level' and type test1 again at the command prompt, I am able to debug the test1 code but cursor does not stop in program Test2 and does not highlight any statement. What am I doing wrong? Also is there any statement equivalent to the 'stop' statement in VB, so that I cam hardcode a breakpoint in the code. Quote
BIGAL Posted December 25, 2012 Posted December 25, 2012 Why not like this below makes more sense you can have all sorts of problems loading a lisp from a lisp as a chain of events if you must, either load all defuns in one go via script or menu or autoload if use all the time. (defun c:test1() (setq x 0) (setq y 0) (alert "test1") ) (defun fnTest2() (setq x2 0) (sewtq y2 0) (alert "test2") ) fntest1 (fntest2) Re stop (exit) Quote
NirantarVidyarthee Posted December 26, 2012 Author Posted December 26, 2012 As I already mentioned, I can't make any modification to the code. I can only debug it. So the problem is how to debug the entire code. Also exit exits out of function and we can't resume execution from the next statement which is what 'Stop' does. Quote
togores Posted December 26, 2012 Posted December 26, 2012 The function test2 is not defined in this code, so trying to evaluate test2 will give an error: _$ (test2) ; error: no function definition: TEST2 _$ Not much debugging is necessary, it seems. If debugging something more serious you may use the "Toggle breakpoint" button in the Debug toolbar to set a breakpoint and the "Step Into" "Step Over" and "Step Out" buttons in the same toolbar to evaluate each expression after the breakpoint. Quote
NirantarVidyarthee Posted December 26, 2012 Author Posted December 26, 2012 OK. It was typo and the code should read as follows: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Test1.lsp (defun c:test1() (setq x 0) (setq y 0) (alert "test1") (load "C:\\Documents and Settings\\Administrator\\Desktop\\test2.lsp") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Test2.lsp (defun fnTest2() (setq x2 0) (setq y2 0) (alert "test2") ) (fnTest2) The question here is not if test2 requires debugging. The problem is you can't debug it even if you want to. Even when you set break-points, the code in Test2 executes without breaking at any of the breakpoint. I need why this happens and how to overcome this. Quote
SLW210 Posted December 26, 2012 Posted December 26, 2012 NirantarVidyarthee, Please read the CODE POSTING GUIDELINES and edit your posts to include Code Tags. Quote
hmsilva Posted December 26, 2012 Posted December 26, 2012 NirantarVidyarthee, try, debug==>Animate the second file will be load and you will see it running Henrique Quote
NirantarVidyarthee Posted December 26, 2012 Author Posted December 26, 2012 Sorry, with Debug > Animate, user has no control. It does not respect any breakpoints. Quote
hmsilva Posted December 26, 2012 Posted December 26, 2012 For debugging, I use Animate and Break On Error and it stops when there is error, and you can see the error... Quote
NirantarVidyarthee Posted December 26, 2012 Author Posted December 26, 2012 hmsilva, thanks! It works on the sample code. Now I hope that it works on the working code which is much larger and far more complex. Thanks again. By the way, has anybody used View > Symbol Service ...? How's it different from using Animate and stop on error method? Quote
hmsilva Posted December 26, 2012 Posted December 26, 2012 You're welcome and good luck, NirantarVidyarthee you have to have patience, while the code "more complex" is being animated sometimes we despaired while we wait ... Henrique Quote
Lee Mac Posted December 26, 2012 Posted December 26, 2012 This may also help: http://lee-mac.com/debugvlide.html Quote
NirantarVidyarthee Posted December 26, 2012 Author Posted December 26, 2012 I found that the window containing Test2 needs to be closed otherwise statements in Test 2 are not highlighted. This seems to be the problem in many case. Quote
togores Posted December 26, 2012 Posted December 26, 2012 The problem is you can't debug it even if you want to. Even when you set break-points, the code in Test2 executes without breaking at any of the breakpoint. I need why this happens and how to overcome this. If you open the test2.lsp in the IDE, set the breakpoint wherever you please and the evaluate (fnTest2) you can step through all the expressions. I don't understand what else do you want. Quote
togores Posted December 28, 2012 Posted December 28, 2012 I would also suggest using the View>Error Trace window (CTRL+SHIFT+R). It'll show you the error and using the contextual menu can highlight the offending expression in the editor. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.