summaryrefslogtreecommitdiff
path: root/module/system/vm/debug.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-06 17:33:43 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-06 17:33:43 +0100
commit963d95f1d92248d2689efc8b67a9de1f1c8204fb (patch)
treeb1faf5e9a51ac65ccf10ff6ee3f542d6f0315b0b /module/system/vm/debug.scm
parent111a305be88a318f65707d251051d3b95c46d647 (diff)
downloadguile-963d95f1d92248d2689efc8b67a9de1f1c8204fb.tar.gz
Fix first find-program-sources result
* module/system/vm/debug.scm (find-program-sources): Manually set the pc of the first result in a function.
Diffstat (limited to 'module/system/vm/debug.scm')
-rw-r--r--module/system/vm/debug.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
index a0f11223b..e5eb9bead 100644
--- a/module/system/vm/debug.scm
+++ b/module/system/vm/debug.scm
@@ -530,8 +530,16 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}."
(line-prog-advance prog)))
(lambda (pc file line col)
(if (and pc (< pc high-pc))
- (lp (cons (make-source/dwarf (+ pc base) file line col)
- sources))
+ ;; For the first source, it's probable that the
+ ;; address of the line program is before the
+ ;; low-pc, since the line program is for the
+ ;; entire compilation unit, and there are no
+ ;; redundant "rows" in the line program.
+ ;; Therefore in that case use the addr of low-pc
+ ;; instead of the one we got back.
+ (let ((addr (+ (if (null? sources) low-pc pc) base)))
+ (lp (cons (make-source/dwarf addr file line col)
+ sources)))
(reverse sources))))))
(else '())))))
(else '())))