Hi,
Please apply this diff. There are multiple problems with the existing code. * it seems to believe that DISASSEMBLE-CODE-COMPONENT only works on with non-null %code-debug-info. That's not true; it works on any code object. So depending on your standards, it's excessively wordy to just plain wrong.
* (ash (sb-kernel:%code-code-size o) sb-vm:word-shift) causes buffer overrun
* sb-disassem::align can not be called
See https://bugs.launchpad.net/sbcl/+bug/1748041 Thanks Doug
--- a/swank/sbcl.lisp +++ b/swank/sbcl.lisp @@ -1613,18 +1613,7 @@ stack." append (label-value-line i (sb-kernel:code-header-ref o i))) `("Code:" (:newline) , (with-output-to-string (s) - (cond ((sb-kernel:%code-debug-info o) - (sb-disassem:disassemble-code-component o :stream s)) - (t - (sb-disassem:disassemble-memory - (sb-disassem::align - (+ (logandc2 (sb-kernel:get-lisp-obj-address o) - sb-vm:lowtag-mask) - (* sb-vm:code-constants-offset - sb-vm:n-word-bytes)) - (ash 1 sb-vm:n-lowtag-bits)) - (ash (sb-kernel:%code-code-size o) sb-vm:word-shift) - :stream s))))))) + (sb-disassem:disassemble-code-component o :stream s)))))
Applied here: https://github.com/slime/slime/commit/81017fbc9e622d3f0f9fa4b35e35f9ab8c4d38...
Thanks! Luís
On Thu, Feb 8, 2018 at 4:22 AM Douglas Katzman dougk@google.com wrote:
Hi,
Please apply this diff. There are multiple problems with the existing code.
- it seems to believe that DISASSEMBLE-CODE-COMPONENT only works on with
non-null %code-debug-info. That's not true; it works on any code object. So depending on your standards, it's excessively wordy to just plain wrong.
- (ash (sb-kernel:%code-code-size o) sb-vm:word-shift) causes buffer
overrun
- sb-disassem::align can not be called
See https://bugs.launchpad.net/sbcl/+bug/1748041 Thanks Doug
--- a/swank/sbcl.lisp +++ b/swank/sbcl.lisp @@ -1613,18 +1613,7 @@ stack." append (label-value-line i (sb-kernel:code-header-ref o i))) `("Code:" (:newline) , (with-output-to-string (s)
(cond ((sb-kernel:%code-debug-info o)
(sb-disassem:disassemble-code-component o :stream
s))
(t
(sb-disassem:disassemble-memory
(sb-disassem::align
(+ (logandc2 (sb-kernel:get-lisp-obj-address o)
sb-vm:lowtag-mask)
(* sb-vm:code-constants-offset
sb-vm:n-word-bytes))
(ash 1 sb-vm:n-lowtag-bits))
(ash (sb-kernel:%code-code-size o)
sb-vm:word-shift)
:stream s)))))))
(sb-disassem:disassemble-code-component o :stream s)))))