Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging ? #438

Open
mmontone opened this issue Aug 22, 2022 · 6 comments
Open

Debugging ? #438

mmontone opened this issue Aug 22, 2022 · 6 comments

Comments

@mmontone
Copy link

Hi,

is there a way for me to debug things when something goes wrong ? Like, get a backtrace or something.

I'm trying this at JSCL repl:

CL-USER> (defun ilt-apropos (string) 
...   (let (found) 
...     (dolist (package (list-all-packages)) 
...       (do-external-symbols (sym package) 
... 	(when (search string (symbol-name sym) :test 'equalp) 
... 	  (push sym found)))) 
...     found))
ILT-APROPOS

But I get:

CL-USER> (ilt-apropos "list") 
... 
ERROR: this is undefined

It works in SBCL for example, so it is not that my function is buggy.

Thanks!

@mmontone
Copy link
Author

I realize there's no EQUALP in JSCL, so I'm trying with STRING=, but error still:

CL-USER> (defun ilt-apropos (string)  
... ...   (let (found)  
... ...     (dolist (package (list-all-packages))  
... ...       (do-external-symbols (sym package)  
... ... 	(when (search string (symbol-name sym) :test #'string=)  
... ... 	  (push sym found))))  
... ...     found))
ILT-APROPOS
CL-USER> (ilt-apropos "LIST") 
... 
ERROR: Variable ... is unbound.

So, it'd still be nice if there's a way for me to debug things.

@mmontone
Copy link
Author

mmontone commented Aug 22, 2022

My bad, that last version is working. I was getting those ... because of copying pasting at the REPL.

But still, any tips on debugging are welcomed.

@davazp
Copy link
Member

davazp commented Aug 25, 2022

I don't really have specific tips, other general recommendation like trying your code often to know what is most likely to have caused the issue or narrow down cases to the simplest code that gets you the error or adding some print calls 🙂

Improvements in this area would be great!

@davazp
Copy link
Member

davazp commented Aug 25, 2022

I think I found the reason for the bad error message. I'll create a pull request!

@davazp
Copy link
Member

davazp commented Aug 25, 2022

@mmontone I added a detailed description of how I went to fix the issue in the PR description at #439 .

It's not really any debugging tip but, hopefully it helps a bit! It would be great to have proper stacktraces.

I guess the natural step is trying to have sourcemap support in JSCL, but that might require some work.

@mmontone
Copy link
Author

Thank you!

I've tried by sending errors to console. I can visualize some error object and a stack there, but doesn't help much.

The easiest for now I think it is to make errors as informative as possible, as you've done with your fix. That's not always the case in JSCL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants