Changeset 11053
- Timestamp:
- 01/23/06 14:11:02 (3 years ago)
- Location:
- trunk/src/code
- Files:
-
- 2 modified
-
debug-int.lisp (modified) (31 diffs)
-
ntrace.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/code/debug-int.lisp
r10648 r10799 84 84 ;;; routine that detects them and signals a condition. For example, 85 85 ;;; programmers call A which may fail to return successfully due to a lack of 86 ;;; debug information, and there is no B th ethey could have called to realize86 ;;; debug information, and there is no B that they could have called to realize 87 87 ;;; A would fail. It is not an error to have called A, but it is an error for 88 88 ;;; the program to then ignore the signal generated by A since it cannot … … 170 170 ;;; The debug-internals code tries to signal all programmer errors as subtypes 171 171 ;;; of debug-error. There are calls to ERROR signalling simple-errors, but 172 ;;; these dummy checks in the code andshouldn't come up.172 ;;; these dummy checks in the code shouldn't come up. 173 173 ;;; 174 174 ;;; While under development, this code also signals errors in code branches … … 852 852 (defun cstack-pointer-valid-p (x) 853 853 (declare (type system:system-area-pointer x)) 854 #- :x86854 #-(or :x86 :amd64) 855 855 (and (system:sap< x (kernel:current-sp)) 856 856 (system:sap<= #-gengc (alien:alien-sap … … 859 859 x) 860 860 (zerop (logand (system:sap-int x) #b11))) 861 #+ :x86;; stack grows to low address values861 #+(or :x86 :amd64) ;; stack grows to low address values 862 862 (and (system:sap>= x (kernel:current-sp)) 863 863 (system:sap> (alien:alien-sap … … 866 866 (zerop (logand (system:sap-int x) #b11)))) 867 867 868 #+(or gengc x86 )868 #+(or gengc x86 amd64) 869 869 (alien:def-alien-routine component-ptr-from-pc (system:system-area-pointer) 870 870 (pc system:system-area-pointer)) 871 871 872 #+(or gengc x86 )872 #+(or gengc x86 amd64) 873 873 (defun component-from-component-ptr (component-ptr) 874 874 (declare (type system:system-area-pointer component-ptr)) … … 933 933 (t 934 934 ;; Check the two possible frame pointers. 935 (let ((lisp-ocfp (sap-ref-sap fp (- (* (1+ vm::ocfp-save-offset) 4)))) 936 (lisp-ra (sap-ref-sap fp (- (* (1+ vm::return-pc-save-offset) 4)))) 935 (let ((lisp-ocfp (sap-ref-sap fp (- (* (1+ vm::ocfp-save-offset) 936 vm:word-bytes)))) 937 (lisp-ra (sap-ref-sap fp (- (* (1+ vm::return-pc-save-offset) 938 vm:word-bytes)))) 937 939 (c-ocfp (sap-ref-sap fp (* 0 vm:word-bytes))) 938 940 (c-ra (sap-ref-sap fp (* 1 vm:word-bytes)))) … … 986 988 nil)))))) 987 989 988 ) ; end progn x86 990 ) ; end progn x86 amd64 989 991 990 992 … … 1080 1082 ;;; main location. 1081 1083 ;;; 1082 #- x861084 #-(or x86 amd64) 1083 1085 (defun get-context-value (frame stack-slot loc) 1084 1086 (declare (type compiled-frame frame) (type unsigned-byte stack-slot) … … 1089 1091 (sub-access-debug-var-slot pointer loc escaped) 1090 1092 (kernel:stack-ref pointer stack-slot)))) 1091 #+ x861093 #+(or x86 amd64) 1092 1094 (defun get-context-value (frame stack-slot loc) 1093 1095 (declare (type compiled-frame frame) (type unsigned-byte stack-slot) … … 1101 1103 (kernel:stack-ref pointer stack-slot)) 1102 1104 (#.vm::lra-save-offset 1103 (sap-ref-sap pointer (- (* (1+ stack-slot) 4))))))))1104 1105 ;;; 1106 #- x861105 (sap-ref-sap pointer (- (* (1+ stack-slot) vm:word-bytes)))))))) 1106 1107 ;;; 1108 #-(or x86 amd64) 1107 1109 (defun (setf get-context-value) (value frame stack-slot loc) 1108 1110 (declare (type compiled-frame frame) (type unsigned-byte stack-slot) … … 1114 1116 (setf (kernel:stack-ref pointer stack-slot) value)))) 1115 1117 1116 #+ x861118 #+(or x86 amd64) 1117 1119 (defun (setf get-context-value) (value frame stack-slot loc) 1118 1120 (declare (type compiled-frame frame) (type unsigned-byte stack-slot) … … 1126 1128 (setf (kernel:stack-ref pointer stack-slot) value)) 1127 1129 (#.vm::lra-save-offset 1128 (setf (sap-ref-sap pointer (- (* (1+ stack-slot) 4))) value)))))) 1130 (setf (sap-ref-sap pointer (- (* (1+ stack-slot) vm:word-bytes))) 1131 value)))))) 1129 1132 1130 1133 … … 1177 1180 1178 1181 1179 #+(or sparc (and x86linux))1182 #+(or sparc (and (or x86 amd64) linux)) 1180 1183 (defun find-foreign-function-name (address) 1181 1184 "Return a string describing the foreign function near ADDRESS" … … 1200 1203 ))))))) 1201 1204 1202 #-(or sparc (and x86linux))1205 #-(or sparc (and (or x86 amd64) linux)) 1203 1206 (defun find-foreign-function-name (ra) 1204 1207 (declare (ignore ra)) … … 1249 1252 ;;; LRA, and the LRA is the word offset. 1250 1253 ;;; 1251 #-(or gengc x86 )1254 #-(or gengc x86 amd64) 1252 1255 (defun compute-calling-frame (caller lra up-frame) 1253 1256 (declare (type system:system-area-pointer caller)) … … 1300 1303 escaped)))))) 1301 1304 1302 #+ x861305 #+(or x86 amd64) 1303 1306 (defun compute-calling-frame (caller ra up-frame) 1304 1307 (declare (type system:system-area-pointer caller ra)) … … 1534 1537 ;;; - closure_tramp 1535 1538 ;;; - function_end_breakpoint 1536 ;;; ar n't ever actually in it, because we copy it into a bogus-lra1537 ;;; component before ever yactually using it.1539 ;;; aren't ever actually in it, because we copy it into a bogus-lra 1540 ;;; component before ever actually using it. 1538 1541 ;;; or someone jumped someplace strange, in which case we can't do anything. 1539 1542 ;;; - component w/ :ASSEMBLER-ROUTINE for debug-info: … … 1776 1779 (* vm:catch-block-current-cont-slot 1777 1780 vm:word-bytes)))) 1778 (let* (#-(or gengc x86 )1781 (let* (#-(or gengc x86 amd64) 1779 1782 (lra (kernel:stack-ref catch vm:catch-block-entry-pc-slot)) 1780 #+(or gengc x86 )1783 #+(or gengc x86 amd64) 1781 1784 (ra (system:sap-ref-sap 1782 1785 catch (* vm:catch-block-entry-pc-slot vm:word-bytes))) 1783 #- x861786 #-(or x86 amd64) 1784 1787 (component 1785 1788 (kernel:stack-ref catch vm:catch-block-current-code-slot)) 1786 #+ x861789 #+(or x86 amd64) 1787 1790 (component (component-from-component-ptr 1788 1791 (component-ptr-from-pc ra))) 1789 1792 (offset 1790 #-(or gengc x86 )1793 #-(or gengc x86 amd64) 1791 1794 (* (- (1+ (kernel:get-header-data lra)) 1792 1795 (kernel:get-header-data component)) … … 1797 1800 (kernel:get-header-data component)) 1798 1801 vm:other-pointer-type) 1799 #+ x861802 #+(or x86 amd64) 1800 1803 (- (system:sap-int ra) 1801 1804 (- (kernel:get-lisp-obj-address component) 1802 1805 vm:other-pointer-type) 1803 1806 (* (kernel:get-header-data component) vm:word-bytes)))) 1804 (push (cons #- x861807 (push (cons #-(or x86 amd64) 1805 1808 (kernel:stack-ref catch vm:catch-block-tag-slot) 1806 #+ x861809 #+(or x86 amd64) 1807 1810 (kernel:make-lisp-obj 1808 1811 (system:sap-ref-32 catch (* vm:catch-block-tag-slot … … 3734 3737 ;;; 3735 3738 ;;; The vector elements are in the same format as the compiler's 3736 ;;; NODE-SOU CE-PATH; that is, the first element is the form number and the last3739 ;;; NODE-SOURCE-PATH; that is, the first element is the form number and the last 3737 3740 ;;; is the top-level-form number. 3738 3741 ;;; … … 3963 3966 (%make-breakpoint hook-function what kind info)) 3964 3967 (:function-end 3965 (unless (eq (c::compiled-debug-function-returns 3966 (compiled-debug-function-compiler-debug-fun what)) 3967 :standard) 3968 (error ":FUNCTION-END breakpoints are currently unsupported ~ 3969 for the known return convention.")) 3970 3971 (let* ((bpt (%make-breakpoint hook-function what kind info)) 3972 (starter (compiled-debug-function-end-starter what))) 3973 (unless starter 3974 (setf starter (%make-breakpoint #'list what :function-start nil)) 3975 (setf (breakpoint-hook-function starter) 3976 (function-end-starter-hook starter what)) 3977 (setf (compiled-debug-function-end-starter what) starter)) 3978 (setf (breakpoint-start-helper bpt) starter) 3979 (push bpt (breakpoint-%info starter)) 3980 (setf (breakpoint-cookie-fun bpt) function-end-cookie) 3981 bpt)))) 3968 (multiple-value-bind (settable known-return) 3969 (can-set-function-end-breakpoint-p what) 3970 (cond (settable 3971 (let* ((bpt (%make-breakpoint hook-function what kind info)) 3972 (starter (compiled-debug-function-end-starter what))) 3973 (unless starter 3974 (setf starter (%make-breakpoint #'list what :function-start 3975 nil)) 3976 (setf (breakpoint-hook-function starter) 3977 (function-end-starter-hook starter what known-return)) 3978 (setf (compiled-debug-function-end-starter what) starter)) 3979 (setf (breakpoint-start-helper bpt) starter) 3980 (push bpt (breakpoint-%info starter)) 3981 (setf (breakpoint-cookie-fun bpt) function-end-cookie) 3982 bpt)) 3983 (t 3984 (error ":FUNCTION-END breakpoints are currently unsupported ~ 3985 for the known return convention."))))))) 3982 3986 (interpreted-debug-function 3983 3987 (error ":function-end breakpoints are currently unsupported ~ … … 3987 3991 (typecase what 3988 3992 (compiled-debug-function 3989 (eq (c::compiled-debug-function-returns 3990 (compiled-debug-function-compiler-debug-fun what)) 3991 :standard)))) 3993 (let ((returns (c::compiled-debug-function-returns 3994 (compiled-debug-function-compiler-debug-fun what)))) 3995 ;; First value says if we can set the function-end-breakpoint. 3996 ;; The second value indicates if this is the known return 3997 ;; convention. 3998 (values (or (eq returns :standard) 3999 (typep returns 'vector)) 4000 (not (eq returns :standard))))))) 3992 4001 3993 4002 ;;; These are unique objects created upon entry into a function by a … … 4022 4031 ;;; fun-end-bpt. 4023 4032 ;;; 4024 (defun function-end-starter-hook (starter-bpt debug-fun )4033 (defun function-end-starter-hook (starter-bpt debug-fun &optional known-return-p) 4025 4034 (declare (type breakpoint starter-bpt) 4026 4035 (type compiled-debug-function debug-fun)) … … 4036 4045 #-gengc vm::lra-save-offset 4037 4046 #+gengc vm::ra-save-offset 4038 lra-sc-offset)) 4047 lra-sc-offset) 4048 known-return-p) 4039 4049 (setf (get-context-value frame 4040 4050 #-gengc vm::lra-save-offset … … 4071 4081 ((not frame) nil) 4072 4082 (when (and (compiled-frame-p frame) 4073 (#- x86 eq #+x86sys:sap= lra4083 (#-(or x86 amd64) eq #+(or x86 amd64) sys:sap= lra 4074 4084 (get-context-value frame 4075 4085 #-gengc vm::lra-save-offset … … 4396 4406 (breakpoint-data-instruction data)) 4397 4407 ; Under HPUX we can't sigreturn so bp-do-disp-i has to return. 4398 #-(or hpux irix x86 )4408 #-(or hpux irix x86 amd64) 4399 4409 (error "BREAKPOINT-DO-DISPLACED-INST returned?")))) 4400 4410 … … 4446 4456 (remhash component *function-end-cookies*) 4447 4457 (dolist (bpt breakpoints) 4448 (funcall (breakpoint-hook-function bpt) 4449 frame bpt 4450 (get-function-end-breakpoint-values scp) 4451 cookie)))) 4452 4453 (defun get-function-end-breakpoint-values (scp) 4454 (let ((ocfp (system:int-sap (vm:sigcontext-register scp 4455 #-x86 vm::ocfp-offset 4456 #+x86 vm::ebx-offset))) 4458 (let ((values (get-function-end-breakpoint-values bpt scp))) 4459 (funcall (breakpoint-hook-function bpt) frame bpt values cookie))))) 4460 4461 ;;; Return a list of return values at the function end breakpoint 4462 ;;; BREAKPOINT. 4463 ;;; 4464 (defun get-function-end-breakpoint-values (breakpoint sigcontext) 4465 (let* ((what (breakpoint-what breakpoint)) 4466 (returns (c::compiled-debug-function-returns 4467 (compiled-debug-function-compiler-debug-fun what)))) 4468 (etypecase returns 4469 ((member :standard) 4470 (function-end-breakpoint-values/standard sigcontext)) 4471 (vector 4472 (function-end-breakpoint-values/known-return sigcontext returns))))) 4473 4474 ;;; Return a list of return values at a breakpoint with standard 4475 ;;; return convention. 4476 ;;; 4477 (defun function-end-breakpoint-values/standard (scp) 4478 (let ((ocfp (sigcontext-ocfp-sap scp)) 4457 4479 (nargs (kernel:make-lisp-obj 4458 4480 (vm:sigcontext-register scp vm::nargs-offset))) … … 4464 4486 (kernel:make-lisp-obj 4465 4487 (vm:sigcontext-register scp (pop reg-arg-offsets))) 4466 (kernel:stack-ref ocfp arg-num))4488 (kernel:stack-ref ocfp arg-num)) 4467 4489 results))) 4468 4490 (nreverse results))) 4469 4491 4492 ;;; Return a list of return values at a breakpoint with known-return 4493 ;;; convention. 4494 ;;; 4495 (defun function-end-breakpoint-values/known-return (sigcontext sc-offsets) 4496 (let ((ocfp (sigcontext-ocfp-sap sigcontext))) 4497 (loop for offset across sc-offsets 4498 collect (sub-access-debug-var-slot ocfp offset sigcontext)))) 4499 4500 ;;; Extract the old frame pointer from a sigcontext structure. The 4501 ;;; result is a SAP. 4502 ;;; 4503 (defun sigcontext-ocfp-sap (sigcontext) 4504 (system:int-sap 4505 (vm:sigcontext-register sigcontext 4506 #-(or x86 amd64) vm::ocfp-offset 4507 #+(or x86 amd64) vm::ebx-offset))) 4508 4470 4509 ;;; 4471 4510 ;;; MAKE-BOGUS-LRA (used for :function-end breakpoints) 4472 4511 ;;; 4473 4474 (defconstant bogus-lra-constants #-x86 2 #+x86 3) 4475 (defconstant known-return-p-slot (+ vm:code-constants-offset #-x86 1 #+x86 2)) 4512 ;;; (If you change these, look in breakpoint.c too!) 4513 4514 (defconstant bogus-lra-constants #-(or x86 amd64) 2 #+(or x86 amd64) 3) 4515 (defconstant known-return-p-slot (+ vm:code-constants-offset #-(or x86 amd64) 1 #+(or x86 amd64) 2)) 4476 4516 4477 4517 ;;; MAKE-BOGUS-LRA -- Interface. … … 4495 4535 (code-object 4496 4536 (system:%primitive 4497 #-(and x86gencgc) c:allocate-code-object4498 #+(and x86gencgc) c::allocate-dynamic-code-object4537 #-(and (or x86 amd64) gencgc) c:allocate-code-object 4538 #+(and (or x86 amd64) gencgc) c::allocate-dynamic-code-object 4499 4539 (1+ bogus-lra-constants) 4500 4540 length)) … … 4506 4546 (setf (kernel:code-header-ref code-object vm:code-trace-table-offset-slot) 4507 4547 length) 4508 #- x864548 #-(or x86 amd64) 4509 4549 (setf (kernel:code-header-ref code-object real-lra-slot) real-lra) 4510 #+ x864550 #+(or x86 amd64) 4511 4551 (multiple-value-bind (offset code) 4512 4552 (compute-lra-data-from-pc real-lra) … … 4517 4557 (kernel:system-area-copy src-start 0 dst-start 0 (* length vm:byte-bits)) 4518 4558 (vm:sanctify-for-execution code-object) 4519 #+ x864559 #+(or x86 amd64) 4520 4560 (values dst-start code-object (system:sap- trap-loc src-start)) 4521 #- x864561 #-(or x86 amd64) 4522 4562 (let ((new-lra (kernel:make-lisp-obj (+ (system:sap-int dst-start) 4523 4563 vm:other-pointer-type)))) -
trunk/src/code/ntrace.lisp
r10785 r11043 35 35 0.") 36 36 37 (defvar *trace-encapsulate-default* :default37 (defvar *trace-encapsulate-default* #-ppc :default #+ppc t 38 38 "The default value for the :ENCAPSULATE option to trace.") 39 39
