Changeset 11385


Ignore:
Timestamp:
Nov 17, 2008, 1:25:42 PM (11 years ago)
Author:
gz
Message:

Different fix for problem addressed by r11378

Location:
trunk/source
Files:
2 edited

Legend:

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

    r11378 r11385  
    27302730         (pc (- addr entry)))
    27312731    (let ((source-note (find-source-note-at-pc function pc)))
    2732       (when source-note
    2733         (unless (eql (source-note-file-range source-note)
    2734                      (source-note-file-range *previous-source-note*))
    2735           (setf *previous-source-note* source-note)
    2736           (let* ((source-text (source-note-text source-note))
    2737                  (text (if source-text
    2738                          (string-sans-most-whitespace source-text 100)
    2739                          "#<no source text>")))
    2740             (format t "~&~%;;; ~A" text)))))
     2732      (unless (eql (source-note-file-range source-note)
     2733                   (source-note-file-range *previous-source-note*))
     2734        (setf *previous-source-note* source-note)
     2735        (let* ((source-text (source-note-text source-note))
     2736               (text (if source-text
     2737                       (string-sans-most-whitespace source-text 100)
     2738                       "#<no source text>")))
     2739          (format t "~&~%;;; ~A" text))))
    27412740    (when (x86-di-labeled instruction)
    27422741      (format t "~&L~d~%" pc)
  • trunk/source/level-1/l1-reader.lisp

    r11373 r11385  
    30553055
    30563056(defun source-note-text (source-note &optional start end)
    3057   (let* ((source (source-note-source source-note))
    3058          (start-pos (source-note-start-pos source-note))
    3059          (end-pos (source-note-end-pos source-note))
    3060          (start (or start start-pos))
    3061          (end (or end end-pos)))
    3062     (etypecase source
    3063       (source-note
     3057  (when source-note
     3058    (let* ((source (source-note-source source-note))
     3059           (start-pos (source-note-start-pos source-note))
     3060           (end-pos (source-note-end-pos source-note))
     3061           (start (or start start-pos))
     3062           (end (or end end-pos)))
     3063      (etypecase source
     3064        (source-note
    30643065         (assert (<= (source-note-start-pos source) start end (source-note-end-pos source)))
    30653066         (source-note-text source start end))
    3066       ((simple-array (unsigned-byte 8) (*))
     3067        ((simple-array (unsigned-byte 8) (*))
    30673068         (decf start start-pos)
    30683069         (decf end start-pos)
    30693070         (assert (and (<= 0 start end (length source))))
    30703071         (decode-string-from-octets source :start start :end end :external-format :utf-8))
    3071       (null source))))
     3072        (null source)))))
    30723073
    30733074(defvar *recording-source-streams* ())
     
    31773178  "Fetch source text from file if don't have it"
    31783179  (setq if-does-not-exist (require-type if-does-not-exist '(member :error nil)))
    3179   (let ((source (source-note-source source-note))
    3180         (filename (source-note-filename source-note)))
    3181     (etypecase source
    3182       (null
    3183          (with-open-file (stream filename :if-does-not-exist if-does-not-exist)
    3184            (when stream
    3185              (let ((start (source-note-start-pos source-note))
    3186                    (end (source-note-end-pos source-note))
    3187                    (len (file-length stream)))
    3188                (if (<= end len)
    3189                  (setf (source-note.source source-note)
    3190                        (fetch-octets-from-stream stream start end))
    3191                  (when if-does-not-exist
    3192                    (error 'simple-file-error :pathname filename
    3193                           :error-type "File ~s changed since source info recorded")))))))
    3194       (source-note
    3195          (ensure-source-note-text source))
    3196       ((simple-array (unsigned-byte 8) (*))
    3197          source))))
     3180  (if source-note
     3181    (let ((source (source-note-source source-note))
     3182          (filename (source-note-filename source-note)))
     3183      (etypecase source
     3184        (null
     3185         (with-open-file (stream filename :if-does-not-exist if-does-not-exist)
     3186           (when stream
     3187             (let ((start (source-note-start-pos source-note))
     3188                   (end (source-note-end-pos source-note))
     3189                   (len (file-length stream)))
     3190               (if (<= end len)
     3191                   (setf (source-note.source source-note)
     3192                         (fetch-octets-from-stream stream start end))
     3193                   (when if-does-not-exist
     3194                     (error 'simple-file-error :pathname filename
     3195                            :error-type "File ~s changed since source info recorded")))))))
     3196        (source-note
     3197         (ensure-source-note-text source))
     3198        ((simple-array (unsigned-byte 8) (*))
     3199         source)))
     3200    (when if-does-not-exist
     3201      (error "Missing source note"))))
    31983202
    31993203
Note: See TracChangeset for help on using the changeset viewer.