From 61589832710d65f6d70b54dea673a756e4766528 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Tue, 29 May 1990 16:44:42 +0000
Subject: [PATCH] Fixed DEBUG-FUNCTION-FROM-PC to correctly deal with PCs in
 elsewhere code.

---
 code/debug-int.lisp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/code/debug-int.lisp b/code/debug-int.lisp
index f0b99301a..485cde3e5 100644
--- a/code/debug-int.lisp
+++ b/code/debug-int.lisp
@@ -784,12 +784,20 @@
       (declare (simple-vector function-map))
       (if (= len 1)
 	  (make-compiled-debug-function (svref function-map 0) component)
-	  (let ((i 1))
+	  (let ((i 1)
+		(elsewhere-p
+		 (>= pc (c::compiled-debug-function-elsewhere-pc
+			 (svref function-map 0)))))
 	    (declare (type c::index i))
 	    (loop
-	      (when (or (= i len) (< pc (svref function-map i)))
-		(return (make-compiled-debug-function (svref function-map (1- i))
-						      component)))
+	      (when (or (= i len)
+			(< pc (if elsewhere-p
+				  (c::compiled-debug-function-elsewhere-pc
+				   (svref function-map (1+ i)))
+				  (svref function-map i))))
+		(return (make-compiled-debug-function
+			 (svref function-map (1- i))
+			 component)))
 	      (incf i 2)))))))
 
 ;;; FUNCTION-CODE-HEADER -- Internal.
-- 
GitLab