summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-10-10 12:21:55 +0200
committerAndy Wingo <wingo@pobox.com>2013-10-10 12:22:20 +0200
commit6b71a7671355f22553f75e92b25e79d9bbca2154 (patch)
tree53159d64e273e252f17ebbd8a1ceaebdbd2ea741
parent4a6d35197939e64720e4467b41cfe8ac0a917ec8 (diff)
downloadguile-6b71a7671355f22553f75e92b25e79d9bbca2154.tar.gz
A couple of fixes when no source info is available
* module/system/vm/assembler.scm (link-debug): If there was no debugging info, reset the file register to 0 from its default value of 1 before adding the final row. * module/system/vm/dwarf.scm (line-prog-scan-to-pc): If we rescanned from the beginning and still found no source info for this pc, return #f instead of the default value of the file register (1).
-rw-r--r--module/system/vm/assembler.scm11
-rw-r--r--module/system/vm/dwarf.scm3
2 files changed, 11 insertions, 3 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 34abc7e03..6b0ac487d 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -1663,7 +1663,7 @@ it will be added to the GC roots at runtime."
;; Now write the statement program.
(let ()
(define (extended-op opcode payload-len)
- (put-u8 line-port 0) ; extended op
+ (put-u8 line-port 0) ; extended op
(put-uleb128 line-port (1+ payload-len)) ; payload-len + opcode
(put-uleb128 line-port opcode))
(define (set-address sym)
@@ -1685,7 +1685,7 @@ it will be added to the GC roots at runtime."
(put-u64 line-port 0))))
(define (end-sequence pc)
(let ((pc-inc (- (asm-pos asm) pc)))
- (put-u8 line-port 2) ; advance-pc
+ (put-u8 line-port 2) ; advance-pc
(put-uleb128 line-port pc-inc))
(extended-op 1 0))
(define (advance-pc pc-inc line-inc)
@@ -1718,7 +1718,12 @@ it will be added to the GC roots at runtime."
(let lp ((in out) (pc 0) (file 1) (line 1) (col 0))
(match in
- (() (end-sequence pc))
+ (()
+ (when (null? out)
+ ;; There was no source info in the first place. Set
+ ;; file register to 0 before adding final row.
+ (set-file 0))
+ (end-sequence pc))
(((pc* file* line* col*) . in*)
(cond
((and (eqv? file file*) (eqv? line line*) (eqv? col col*))
diff --git a/module/system/vm/dwarf.scm b/module/system/vm/dwarf.scm
index 352cb22a1..da730a692 100644
--- a/module/system/vm/dwarf.scm
+++ b/module/system/vm/dwarf.scm
@@ -1397,6 +1397,9 @@
(scan pos* pc* file* line* col*))
((= pc* target-pc)
(finish pos* pc* file* line* col*))
+ ((zero? pc)
+ ;; We scanned from the beginning didn't find any info.
+ (values #f #f #f #f))
(else
(finish pos pc file line col))))))
(let ((pos (lregs-pos regs))