Code Monkey home page Code Monkey logo

Comments (8)

kovisoft avatar kovisoft commented on July 2, 2024

Strange, it works for me, but it may be lisp implementation dependent. I tried with sbcl and evaluated the form (+ SB-DEBUG::ARG-2 1) in frame 11 (where this local variable was defined) and it just displayed the correct result. Is is possible that your swank server simply did not implement swank:inspect-in-frame? What swank server do you use with what lisp implementation?

from slimv.

phmarek avatar phmarek commented on July 2, 2024

SBCL 1.3.14 on Debian amd64.

And when I got asked about the expression to evaluate I didn't use SB-DEBUG::ARG, but the variable name within a form.
Perhaps slimv should embed the user-provided form into a

(macrolet
  ((data sb-debug::arg-1)
   (var2 sb-debug::arg-2))
   <expression>)

to be safe against all and every transformations that might happen (including macros etc.)

from slimv.

kovisoft avatar kovisoft commented on July 2, 2024

How the swank debugger handles local variables depends on the lisp implementation and the optimize settings. In sbcl normally you see variables referenced as SB-DEBUG::ARG-n (or may not see at all). But if you use this optimize setting (and recompile your code) then you'll see and be able to use your variable names:

(declaim (optimize (debug 3)))

from slimv.

phmarek avatar phmarek commented on July 2, 2024

Yeah, I've got that in my ~/.sbclrc.

from slimv.

kovisoft avatar kovisoft commented on July 2, 2024

And does it work that way? If not, did you try to add this line directly to your source code?

Even if it does not work with sbcl, I think it's more a swank/lisp implementation issue, slimv cannot possibly do much when the swank server hides variables/variable names.

from slimv.

phmarek avatar phmarek commented on July 2, 2024

Well, I tested right now.
FILTER I can inspect, but (IDENTITY FILTER) gives me this error (Yeah, still another problem. Brrr.):

Inspect in frame 0 (evaluated): (identity FILTER)Fehler beim Ausführen von "function SlimvInspect[28]..SlimvRefreshReplBuffer[12]..SlimvSwankResponse[3]..provider#python3#Call":
Zeile   18:                                                                                                                                                                                              
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/marek/.config/nvim//bundle/slimv/ftplugin/swank.py", line 1352, in swank_output
    append_repl(result, 0)
  File "/home/marek/.config/nvim//bundle/slimv/ftplugin/swank.py", line 1311, in append_repl
    buf.append(lines[1:])
  File "/usr/local/lib/python3.5/dist-packages/neovim/api/buffer.py", line 90, in append
    return self.request('nvim_buf_set_lines', index, index, True, lines)
  File "/usr/local/lib/python3.5/dist-packages/neovim/api/common.py", line 44, in request
    return self._session.request(name, self, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/neovim/api/nvim.py", line 131, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/neovim/msgpack_rpc/session.py", line 98, in request
    raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim:E315: ml_get: unzul\xc3\xa4ssige lnum: 28'

followed by the normal swank debugger window saying

The variable FILTER is unbound.
  [Condition of type UNBOUND-VARIABLE]

...

Backtrace:
  0: ((LAMBDA (#:G836)) #<unused argument>)
  1: (SWANK/BACKEND:EVAL-IN-FRAME (IDENTITY FILTER) 0)
  2: ((LAMBDA NIL :IN SWANK:INSPECT-IN-FRAME))
  3: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME inspection request." #<CLOSURE (LAMBDA NIL :IN SWANK:INSPECT-IN-FRAME) {100833DA9B}>)
  4: ((LAMBDA NIL :IN SWANK:INSPECT-IN-FRAME))
  5: (SWANK/BACKEND:CALL-WITH-SYNTAX-HOOKS #<CLOSURE (LAMBDA NIL :IN SWANK:INSPECT-IN-FRAME) {100833DA7B}>)
  6: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK:INSPECT-IN-FRAME) {100833DA7B}>)
  7: (SWANK:INSPECT-IN-FRAME "(identity FILTER)" 0)
  8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:INSPECT-IN-FRAME "(identity FILTER)" 0) #<NULL-LEXENV>)
  9: (EVAL (SWANK:INSPECT-IN-FRAME "(identity FILTER)" 0))
 10: (SWANK:EVAL-FOR-EMACS (SWANK:INSPECT-IN-FRAME "(identity FILTER)" 0) "COMMON-LISP-USER" 21)
 11: ((FLET #:FORM-FUN-6967 :IN SWANK::SLDB-LOOP))

This is slime-v2.18 from quicklisp, no newer version available.

from slimv.

kovisoft avatar kovisoft commented on July 2, 2024

Did you recompile your lisp code after adding the optimize option? Did you try to evaluate in the proper frame?

I did the below and it worked for me, using sbcl 1.3.1 and swank 2.19 (the one embedded in slimv).
This was my test.lisp code:

(declaim (optimize (debug 3)))

(defun test (x)
  (/ x 0))

(test 7)

I loaded it into vim, connected the swank server, then compiled and loaded the source test.lisp (by pressing ,L). It immediately dropped me into the debugger because of the division by zero. Here I located frame of the call (test 7) [it was frame 1], opened it by pressing Enter, then inspected (identity x) that dropped me into the inspect buffer displaying value 7, etc.

from slimv.

phmarek avatar phmarek commented on July 2, 2024

After updating to slime-2.19 (from QL) (which is a complete different adventure, again) trying (identity ...) I now get

The variable CVAR is unbound.
   [Condition of type UNBOUND-VARIABLE]

So something's amiss. Sorry for the noise...

from slimv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.