"README.md" did not exist on "935b304ff48361b3a5b23acb400e74894362666d"
Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
(setf *breakpoints* (remove bp-info *breakpoints*))
(format t "Breakpoint ~S removed.~%" index))
(index (format t "Breakpoint doesn't exist."))
(t
(dolist (ele *breakpoints*)
(di:delete-breakpoint (breakpoint-info-breakpoint ele)))
(setf *breakpoints* nil)
(format t "All breakpoints deleted.~%")))))
(def-debug-command-alias "DBP" "DELETE-BREAKPOINT")
;;;
;;; Miscellaneous commands.
;;;
(def-debug-command "FLUSH-ERRORS" ()
(if (setf *flush-debug-errors* (not *flush-debug-errors*))
(write-line "Errors now flushed.")
(write-line "Errors now create nested debug levels.")))
(def-debug-command "DESCRIBE" ()
(let* ((curloc (di:frame-code-location *current-frame*))
(debug-fun (di:code-location-debug-function curloc))
(function (di:debug-function-function debug-fun)))
(if function
(describe function)
(format t "Can't figure out the function for this frame."))))
;;;
;;; Editor commands.
;;;
(def-debug-command "EDIT-SOURCE" ()
(unless (typep *terminal-io* 'ed::ts-stream)
(error "The debugger's EDIT-SOURCE command only works in slave Lisps ~
connected to a Hemlock editor."))
(let* ((wire (ed::ts-stream-wire *terminal-io*))
(location (maybe-block-start-location
(di:frame-code-location *current-frame*)))
(d-source (di:code-location-debug-source location))
(name (di:debug-source-name d-source)))
(ecase (di:debug-source-from d-source)
(:file
(let* ((tlf-offset (di:code-location-top-level-form-offset location))
(local-tlf-offset (- tlf-offset
(di:debug-source-root-number d-source)))
(char-offset (aref (or (di:debug-source-start-positions d-source)
(error "No start positions map."))
local-tlf-offset)))
(wire:remote wire
(ed::edit-source-location (namestring name)
(di:debug-source-created d-source)
tlf-offset local-tlf-offset char-offset
(di:code-location-form-number location)))
(wire:wire-force-output wire)))
((:lisp :stream)
(wire:remote wire
(ed::cannot-edit-source-location))
(wire:wire-force-output wire)))))
;;;; Debug loop command utilities.
(defun read-prompting-maybe (prompt &optional (in *standard-input*)
(out *standard-output*))
(unless (ext:listen-skip-whitespace in)
(princ prompt out)
(force-output out))
(read in))
(defun read-if-available (default &optional (stream *standard-input*))
(if (ext:listen-skip-whitespace stream)
(read stream)
default))