Changeset 14003 for branches


Ignore:
Timestamp:
Jul 21, 2010, 10:35:16 AM (9 years ago)
Author:
gb
Message:

Show source info (if any) in disassembly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/compiler/ARM/arm-disassemble.lisp

    r13995 r14003  
    351351
    352352(defun disassemble-arm-xfunction (xfunction &optional (stream *debug-io*))
    353   (let* ((adi-vector (process-adi-vector (make-adi-vector (uvref xfunction 1)))))
     353  (let* ((adi-vector (process-adi-vector (make-adi-vector (uvref xfunction 1))))
     354         (functionp (typep xfunction 'function)) ;not cross-compiling
     355         (previous-source-note nil))
    354356    (labels ((format-spname (name stream)
    355357               (let* ((string (string name))
     
    377379                                 (with-output-to-string (s)
    378380                                                        (format-spname (cadr (car (adi-operands info))) s))))))))
     381      (when functionp
     382        (let ((source-note (function-source-note xfunction)))
     383          (when source-note
     384            ;; Fetch text from file if don't already have it
     385            (ensure-source-note-text source-note)
     386            (if (source-note-filename source-note)
     387              (format t ";; Source: ~S:~D-~D"
     388                      (source-note-filename source-note)
     389                      (source-note-start-pos source-note)
     390                      (source-note-end-pos source-note))
     391              (let* ((source-text (source-note-text source-note)))
     392                (when source-text
     393                  (format t ";;; ~A" (string-sans-most-whitespace source-text 100))))))))
    379394      (dotimes (i (length adi-vector))
     395        (when functionp
     396          (let ((source-note (find-source-note-at-pc xfunction (* i 4))))
     397            (unless (eql (source-note-file-range source-note)
     398                         (source-note-file-range previous-source-note))
     399              (setf previous-source-note source-note)
     400              (let* ((source-text (source-note-text source-note))
     401                     (text (if source-text
     402                             (string-sans-most-whitespace source-text 100)
     403                             "#<no source text>")))
     404                (format stream "~&~%;;; ~A" text)))))
    380405        (let* ((info (svref adi-vector i))
    381406               (labeled (adi-labeled info)))
Note: See TracChangeset for help on using the changeset viewer.