slime icon indicating copy to clipboard operation
slime copied to clipboard

Can't inspect strings on ABCL

Open gwbrown opened this issue 3 years ago • 0 comments

When you try to inspect a string on ABCL, you get a condition:

The function SWANK::LCONS* is undefined.
   [Condition of type UNDEFINED-FUNCTION]

Restarts:
 0: [*ABORT] Return to SLIME's top level.
 1: [ABORT] Abort thread.

Backtrace:
  0: (#<FUNCTION {310C2D23}> #<UNDEFINED-FUNCTION {3FCBD4AA}> #<FUNCTION {310C2D23}>)
  1: (APPLY #<FUNCTION {310C2D23}> (#<UNDEFINED-FUNCTION {3FCBD4AA}> #<FUNCTION {310C2D23}>))
  2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<UNDEFINED-FUNCTION {3FCBD4AA}> #<FUNCTION {310C2D23}>)
  3: (INVOKE-DEBUGGER #<UNDEFINED-FUNCTION {3FCBD4AA}>)
  4: org.armedbear.lisp.Lisp.error(Lisp.java:382)
  5: org.armedbear.lisp.MacroObject.execute(MacroObject.java:122)
  6: org.armedbear.lisp.Symbol.execute(Symbol.java:899)
  7: org.armedbear.lisp.LispThread.execute(LispThread.java:970)
  8: org.armedbear.lisp.abcl_135.execute(abcl.lisp:1084)
  9: org.armedbear.lisp.clos_310.execute(clos.lisp:2724)
 10: org.armedbear.lisp.clos_280.execute(clos.lisp:2306)
 11: org.armedbear.lisp.FuncallableStandardObject.execute(FuncallableStandardObject.java:102)
 12: org.armedbear.lisp.Symbol.execute(Symbol.java:803)
 13: org.armedbear.lisp.LispThread.execute(LispThread.java:814)
 14: org.armedbear.lisp.swank_959.execute(swank.lisp:3166)
 15: org.armedbear.lisp.LispThread.execute(LispThread.java:798)
 16: org.armedbear.lisp.swank_1.execute(swank.lisp:55)
 17: org.armedbear.lisp.Symbol.execute(Symbol.java:814)
 18: org.armedbear.lisp.LispThread.execute(LispThread.java:832)
 19: org.armedbear.lisp.swank_958.execute(swank.lisp:3166)
 20: org.armedbear.lisp.Symbol.execute(Symbol.java:803)
 21: org.armedbear.lisp.LispThread.execute(LispThread.java:814)
 22: org.armedbear.lisp.swank_957.execute(swank.lisp:3153)
 23: org.armedbear.lisp.Symbol.execute(Symbol.java:803)
 24: org.armedbear.lisp.LispThread.execute(LispThread.java:814)
 25: org.armedbear.lisp.swank_975.execute(swank.lisp:3248)
 26: org.armedbear.lisp.LispThread.execute(LispThread.java:798)
 27: org.armedbear.lisp.Primitives$pf_funcall.execute(Primitives.java:2690)
 28: (SWANK::LCONS* (:LABEL "Value: ") (:VALUE "public class com.code972.hebmorph.dictionary.impl.HebMorphDictionaryLoader extends java.lang.Object
     implements		com.code972.hebmorph.DictionaryLoader
     filenam..
 29: (SWANK/BACKEND:EMACS-INSPECT "public class com.code972.hebmorph.dictionary.impl.HebMorphDictionaryLoader extends java.lang.Object
     implements		com.code972.hebmorph.DictionaryLoader
     filename		com/code97..
 30: (#<FUNCTION {3533BFDA}>)
 31: (SWANK::CALL-WITH-BINDINGS ((*PRINT-LINES* . 1) (*PRINT-RIGHT-MARGIN* . 75) (*PRINT-PRETTY* . T) (*PRINT-READABLY*)) #<FUNCTION {3533BFDA}>)
 32: (SWANK::EMACS-INSPECT/ISTATE #S(SWANK::ISTATE :OBJECT "public class com.code972.hebmorph.dictionary.impl.HebMorphDictionaryLoader extends java.lang.Object
     implements		com.code972.hebmorph.DictionaryLo..
 33: (SWANK::INSPECT-OBJECT "public class com.code972.hebmorph.dictionary.impl.HebMorphDictionaryLoader extends java.lang.Object
     implements		com.code972.hebmorph.DictionaryLoader
     filename		com/code972/hebm..
 34: (#<FUNCTION {70312718}>)
 35: (FUNCALL #<FUNCTION {70312718}>)
 36: ((FLET SWANK/BACKEND:CALL-WITH-SYNTAX-HOOKS) #<FUNCTION {70312718}>)
 37: (APPLY #<(FLET CALL-WITH-SYNTAX-HOOKS) {3065E100}> #<FUNCTION {70312718}> NIL)
 38: (SWANK/BACKEND:CALL-WITH-SYNTAX-HOOKS #<FUNCTION {70312718}>)
 39: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<FUNCTION {70312718}>)
 40: (SWANK:INSPECT-NTH-PART 2)
 41: (SYSTEM::%EVAL (SWANK:INSPECT-NTH-PART 2))
 42: (EVAL (SWANK:INSPECT-NTH-PART 2))
 43: (SWANK:EVAL-FOR-EMACS (SWANK:INSPECT-NTH-PART 2) "PLUGIN-ANALYZER" 640)
 44: (APPLY #<EVAL-FOR-EMACS {11638D99}> ((SWANK:INSPECT-NTH-PART 2) "PLUGIN-ANALYZER" 640))
 45: (#<FUNCTION {113ED330}>)
 46: (FUNCALL #<FUNCTION {113ED330}>)
 47: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK) #<SWANK-DEBUGGER-HOOK {4517CFB2}> #<FUNCTION {113ED330}>)
 48: (APPLY #<(FLET CALL-WITH-DEBUGGER-HOOK) {63740422}> #<SWANK-DEBUGGER-HOOK {4517CFB2}> #<FUNCTION {113ED330}> NIL)
 49: (SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK #<SWANK-DEBUGGER-HOOK {4517CFB2}> #<FUNCTION {113ED330}>)
 50: (#<FUNCTION {418B9101}>)
 51: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #S(EXTENSIONS:SLIME-INPUT-STREAM)) (*STANDARD-OUTPUT* . #S(EXTENSIONS:SLIME-OUTPUT-STREAM)) (*TRACE-OUTPUT* . #S(EXTENSIONS:SLIME-OUTPUT-STREAM)) (*ERRO..
 52: (#<FUNCTION {101ED857}>)
 53: (SWANK::CALL-WITH-BINDINGS NIL #<FUNCTION {101ED857}>)
 54: (#<FUNCTION {77DE2E37}>)
 55: (FUNCALL #<FUNCTION {77DE2E37}>)
 56: (#<FUNCTION (LAMBDA ()) {6AC0BA54}>)
 57: (THREADS::THREAD-FUNCTION-WRAPPER #<FUNCTION (LAMBDA ()) {6AC0BA54}>)

And your inspector is now broken until you invoke it fresh.

This happens because ABCL's backend tries to call swank::lcons*: https://github.com/slime/slime/blob/9005cdaac4c0adaa8e26ee5285c7b155762c0ce5/swank/abcl.lisp#L1086 But swank::lcons* is a macro, not a function, and the macro isn't loaded when abcl.lisp is compiled, so we get an UNDEFINED-FUNCTION condition.

I'm not very familiar with the SLIME source and haven't had time to dig in to what lcons* does or how difficult this might be to fix.

For reference, I'm using SLIME from MELPA version timestamped 20211108.2224, but this bug is clearly still present on master and per the blame the last time the relevant lines were touched was 3 years ago, so I think this has been around for a while.

gwbrown avatar Dec 18 '21 00:12 gwbrown