"src/lisp/os-common.c" did not exist on "ae7e9d7b87b44f99b7609837a0d43764da47b4aa"
Newer
Older
(setup-function-start))
((or (eq index :end) (eq index :e))
(setup-function-end))
(t
(setup-code-location)))
(di:activate-breakpoint bp)
(let* ((new-bp-info (create-breakpoint-info place bp index
:break break
:print print-functions
:condition condition))
(when old-bp-info
(di:deactivate-breakpoint (breakpoint-info-breakpoint old-bp-info))
(setf *breakpoints* (remove old-bp-info *breakpoints*))
(format t "Note: previous breakpoint removed.~%"))
(push new-bp-info *breakpoints*))
(print-breakpoint-info (first *breakpoints*))
(format t "~&Added."))))
(def-debug-command-alias "BP" "BREAKPOINT")
;;; list all breakpoints set
(def-debug-command "LIST-BREAKPOINTS" ()
(setf *breakpoints*
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
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
(sort *breakpoints* #'< :key #'breakpoint-info-breakpoint-number))
(dolist (info *breakpoints*)
(print-breakpoint-info info)))
(def-debug-command-alias "LB" "LIST-BREAKPOINTS")
(def-debug-command-alias "LBP" "LIST-BREAKPOINTS")
;;; remove breakpoint n or all if none given
(def-debug-command "DELETE-BREAKPOINT" ()
(let* ((index (read-if-available nil))
(bp-info
(find index *breakpoints* :key #'breakpoint-info-breakpoint-number)))
(cond (bp-info
(di:delete-breakpoint (breakpoint-info-breakpoint bp-info))
(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))