From 0eb4279ffb12ccd0f70cb18c2aa3785184127b6b Mon Sep 17 00:00:00 2001
From: Nikodemus Siivola <nikodemus@random-state.net>
Date: Sun, 4 Jul 2004 02:12:44 +0000
Subject: [PATCH] 0.8.12.17: Fix TRACE :BREAK T in the presence of package    
        locks and grap credit for package locks.

---
 CREDITS                         |    4 +++-
 src/code/ntrace.lisp            |   12 +++++++-----
 tests/package-locks.impure.lisp |    4 ++++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/CREDITS b/CREDITS
index 16bc1fd..cef5117 100644
--- a/CREDITS
+++ b/CREDITS
@@ -668,7 +668,8 @@ Rudi Schlatte:
 
 Nikodemus Siivola:
   He provided build fixes, in particular to tame the SunOS toolchain,
-  and has fixed many (stream-related and other) bugs besides.
+  implemented package locks, and has fixed many (stream-related and 
+  other) bugs besides.
 
 Juho Snellman:
   He provided several performance enhancements, including a better hash
@@ -719,5 +720,6 @@ RAM  Robert MacLachlan
 PRM  Pierre Mai
 WHN  William ("Bill") Newman
 CSR  Christophe Rhodes
+NS   Nikodemus Siivola
 PVE  Peter Van Eynde
 PW   Paul Werkowski
diff --git a/src/code/ntrace.lisp b/src/code/ntrace.lisp
index 588b30e..c5928dc 100644
--- a/src/code/ntrace.lisp
+++ b/src/code/ntrace.lisp
@@ -162,11 +162,13 @@
 	  (let* ((bod (ecase loc
 			((nil) exp)
 			(:encapsulated
-			 `(flet ((sb-debug:arg (n)
-				   (declare (special arg-list))
-				   (elt arg-list n)))
-			    (declare (ignorable #'sb-debug:arg))
-			    ,exp))))
+			 `(locally (declare (disable-package-locks sb-debug:arg arg-list))
+                           (flet ((sb-debug:arg (n)
+                                    (declare (special arg-list))
+                                    (elt arg-list n)))
+                             (declare (ignorable #'sb-debug:arg)
+                                      (enable-package-locks sb-debug:arg arg-list))
+                             ,exp)))))
 		 (fun (coerce `(lambda () ,bod) 'function)))
 	    (cons exp
 		  (lambda (frame)
diff --git a/tests/package-locks.impure.lisp b/tests/package-locks.impure.lisp
index de47170..9a1b121 100644
--- a/tests/package-locks.impure.lisp
+++ b/tests/package-locks.impure.lisp
@@ -435,5 +435,9 @@
                        ,form)))
              package-lock-violation))))
 
+;;;; See that trace on functions in locked packages doesn't break
+;;;; anything.
+(assert (trace test:function :break t))
+
 ;;; WOOT! Done.
 (sb-ext:quit :unix-status 104)
-- 
1.7.10.4