Changeset 14809


Ignore:
Timestamp:
Jun 3, 2011, 6:57:17 PM (8 years ago)
Author:
rme
Message:

New parameter ccl::*disassemble-verbose*.

In the x86 disassembler, print out the opcode bytes when
ccl::*disassemble-verbose* is non-nil.

Location:
trunk/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/x86-disassemble.lisp

    r14301 r14809  
    3232  op1
    3333  op2
     34  start                                 ;start of instruction in code-vector
     35  end                                   ;and its end
    3436  )
    3537
     
    26042606                      (x86-di-op1 instruction) (pop operands)
    26052607                      (x86-di-op2 instruction) (pop operands))))))))
     2608      (setf (x86-di-start instruction) (x86-ds-insn-start ds)
     2609            (x86-di-end instruction) (x86-ds-code-pointer ds))
    26062610      (values (x86-dis-analyze-operands ds instruction (x86-dis-flags dp))
    26072611              (or stop (eq (x86-dis-flags dp) :jump))))))
     
    27792783(defvar *previous-source-note*)
    27802784
     2785(defun x86-print-di-lap (ds instruction &optional tab-stop)
     2786  (dolist (p (x86-di-prefixes instruction))
     2787    (when tab-stop
     2788      (format t "~vt" tab-stop))
     2789    (format t "(~a)~%" p))
     2790  (when tab-stop
     2791    (format t "~vt" tab-stop))
     2792  (format t "(~a" (x86-di-mnemonic instruction))
     2793        (let* ((op0 (x86-di-op0 instruction))
     2794             (op1 (x86-di-op1 instruction))
     2795             (op2 (x86-di-op2 instruction)))
     2796        (when op0
     2797          (write-x86-lap-operand t op0 ds)
     2798          (when op1
     2799            (write-x86-lap-operand t op1 ds)
     2800            (when op2
     2801              (write-x86-lap-operand t op2 ds)))))
     2802      (format t ")~%"))
     2803
    27812804(defun x86-print-disassembled-instruction (ds instruction seq function)
    27822805  (let* ((addr (x86-di-address instruction))
     
    27952818      (format t "~&L~d~%" pc)
    27962819      (setq seq 0))
    2797     (format t "~&  [~D]~8T" pc)
    2798     (dolist (p (x86-di-prefixes instruction))
    2799       (format t "~&  (~a)~%" p))
    2800     (format t "  (~a" (x86-di-mnemonic instruction))
    2801     (let* ((op0 (x86-di-op0 instruction))
    2802            (op1 (x86-di-op1 instruction))
    2803            (op2 (x86-di-op2 instruction)))
    2804       (when op0
    2805         (write-x86-lap-operand t op0 ds)
    2806         (when op1
    2807           (write-x86-lap-operand t op1 ds)
    2808           (when op2
    2809             (write-x86-lap-operand t op2 ds)))))
    2810     (format t ")")
    2811     (format t "~%")
     2820    (format t "~&~8<[~D]~>" pc)
     2821    (let* ((istart (x86-di-start instruction))
     2822           (iend (x86-di-end instruction))
     2823           (nbytes (- iend istart))
     2824           (code-vector (x86-ds-code-vector ds))
     2825           (byteidx istart)
     2826           (tab-stop (if *disassemble-verbose* 22 9)))
     2827      (when *disassemble-verbose*
     2828        (dotimes (i (min nbytes 4))
     2829          (format t " ~(~2,'0x~)" (aref code-vector byteidx))
     2830          (incf byteidx))
     2831        (decf nbytes 4))
     2832      (x86-print-di-lap ds instruction tab-stop)
     2833      (when *disassemble-verbose*
     2834        (while (plusp nbytes)
     2835          (format t "~8t")
     2836          (dotimes (i (min nbytes 4))
     2837            (format t " ~(~2,'0x~)" (aref code-vector byteidx))
     2838            (incf byteidx))
     2839          (format t "~%")
     2840          (decf nbytes 4))))
    28122841    (1+ seq)))
    28132842
  • trunk/source/lib/misc.lisp

    r14796 r14809  
    800800    (funcall *overwrite-dialog-hook* filename prompt)
    801801    t))
     802
     803(defparameter *disassemble-verbose* nil)
    802804
    803805;;; Might want to have some other entry for, e.g., the inspector
Note: See TracChangeset for help on using the changeset viewer.