Mercurial > emacs
comparison lisp/gud.el @ 1902:6eb6b48f6bf1
* gud.el (gud-break): With a prefix argument, set a temporary
breakpoint.
(gud-apply-from-source): New argument ARGS, to pass to FUNC. Now
it's really like `apply'.
(gud-set-break): Add another argument to this method.
Document it in the section describing how the methods are supposed
to be used.
(gud-gdb-set-break): New argument TEMP; if non-nil, set a
temporary breakpoint.
(gud-sdb-set-break, gud-dbx-set-break): New argument TEMP. Ignore
it, since I don't know how to set a temporary breakpoint in these
debuggers.
* gud.el (gud-break): With a prefix argument, set a temporary
breakpoint.
(gud-apply-from-source): New argument ARGS, to pass to FUNC. Now
it's really like `apply'.
(gud-set-break): Add another argument to this method.
Document it in the section describing how the methods are supposed
to be used.
(gud-gdb-set-break): New argument TEMP; if non-nil, set a
temporary breakpoint.
(gud-sdb-set-break, gud-dbx-set-break): New argument TEMP. Ignore
it, since I don't know how to set a temporary breakpoint in these
debuggers.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Mon, 22 Feb 1993 14:15:34 +0000 |
parents | 68f025a5fdaa |
children | b626f5b9a0df |
comparison
equal
deleted
inserted
replaced
1901:3be68763709f | 1902:6eb6b48f6bf1 |
---|---|
63 (error "GUD not properly entered.")) | 63 (error "GUD not properly entered.")) |
64 | 64 |
65 (defun gud-visit-file (f) | 65 (defun gud-visit-file (f) |
66 (error "GUD not properly entered.")) | 66 (error "GUD not properly entered.")) |
67 | 67 |
68 (defun gud-set-break (proc f n) | 68 (defun gud-set-break (proc f n rest) |
69 (error "GUD not properly entered.")) | 69 (error "GUD not properly entered.")) |
70 | 70 |
71 ;; This macro is used below to define some basic debugger interface commands. | 71 ;; This macro is used below to define some basic debugger interface commands. |
72 ;; Of course you may use `gud-def' with any other debugger command, including | 72 ;; Of course you may use `gud-def' with any other debugger command, including |
73 ;; user defined ones. | 73 ;; user defined ones. |
119 ;; | 119 ;; |
120 ;; The job of the visit-file method is to visit and return the buffer indicated | 120 ;; The job of the visit-file method is to visit and return the buffer indicated |
121 ;; by the car of gud-tag-frame. This may be a file name, a tag name, or | 121 ;; by the car of gud-tag-frame. This may be a file name, a tag name, or |
122 ;; something else. | 122 ;; something else. |
123 ;; | 123 ;; |
124 ;; The job of the gud-set-break method is to send the commands necessary | 124 ;; The job of the gud-set-break method is to send the commands |
125 ;; to set a breakpoint at a given line in a given source file. | 125 ;; necessary to set a breakpoint at a given line in a given source |
126 ;; file. If its third argument TEMP is non-nil, the breakpoint set | |
127 ;; should be temporary - it should be deleted when it is reached. If | |
128 ;; the debugger doesn't support such breakpoints, it should set an | |
129 ;; ordinary breakpoint. | |
126 ;; | 130 ;; |
127 ;; Debugger-specific information begins here: | 131 ;; Debugger-specific information begins here: |
128 | 132 |
129 ;; ====================================================================== | 133 ;; ====================================================================== |
130 ;; gdb functions | 134 ;; gdb functions |
149 string)) | 153 string)) |
150 | 154 |
151 (defun gud-gdb-visit-file (f) | 155 (defun gud-gdb-visit-file (f) |
152 (find-file-noselect f)) | 156 (find-file-noselect f)) |
153 | 157 |
154 (defun gud-gdb-set-break (proc f n) | 158 (defun gud-gdb-set-break (proc f n temp) |
155 (gud-call "break %s:%d" f n)) | 159 (gud-call "%s %s:%d" (if temp "tbreak" "break") f n)) |
156 | 160 |
157 ;;;###autoload | 161 ;;;###autoload |
158 (defun gdb (path) | 162 (defun gdb (path) |
159 "Run gdb on program FILE in buffer *gud-FILE*. | 163 "Run gdb on program FILE in buffer *gud-FILE*. |
160 The directory containing FILE becomes the initial working directory | 164 The directory containing FILE becomes the initial working directory |
198 string) | 202 string) |
199 | 203 |
200 (defun gud-sdb-visit-file (f) | 204 (defun gud-sdb-visit-file (f) |
201 (find-tag-noselect f)) | 205 (find-tag-noselect f)) |
202 | 206 |
203 (defun gud-sdb-set-break (proc f n) | 207 ;;; We'll just ignore the TEMP argument for now; I don't know how to |
208 ;;; set temporary breakpoints in sdb. (See the description of the | |
209 ;;; gud-set-break method for details.) | |
210 (defun gud-sdb-set-break (proc f n temp) | |
204 (gud-queue-send (format "e %s" f) (format "%d b" n))) | 211 (gud-queue-send (format "e %s" f) (format "%d b" n))) |
205 | 212 |
206 ;;;###autoload | 213 ;;;###autoload |
207 (defun sdb (path) | 214 (defun sdb (path) |
208 "Run sdb on program FILE in buffer *gud-FILE*. | 215 "Run sdb on program FILE in buffer *gud-FILE*. |
244 string) | 251 string) |
245 | 252 |
246 (defun gud-dbx-visit-file (f) | 253 (defun gud-dbx-visit-file (f) |
247 (find-file-noselect f)) | 254 (find-file-noselect f)) |
248 | 255 |
249 (defun gud-dbx-set-break (proc f n) | 256 ;;; We'll just ignore the TEMP argument for now; I don't know how to |
257 ;;; set temporary breakpoints in dbx. (See the description of the | |
258 ;;; gud-set-break method for details.) | |
259 (defun gud-dbx-set-break (proc f n temp) | |
250 (gud-call "stop at \"%s\":%d" f n)) | 260 (gud-call "stop at \"%s\":%d" f n)) |
251 | 261 |
252 ;;;###autoload | 262 ;;;###autoload |
253 (defun dbx (path) | 263 (defun dbx (path) |
254 "Run dbx on program FILE in buffer *gud-FILE*. | 264 "Run dbx on program FILE in buffer *gud-FILE*. |
562 ;; send on subsequent prompts | 572 ;; send on subsequent prompts |
563 (interactive) | 573 (interactive) |
564 (gud-call (car cmdlist)) | 574 (gud-call (car cmdlist)) |
565 (setq gud-command-queue (append gud-command-queue (cdr cmdlist)))) | 575 (setq gud-command-queue (append gud-command-queue (cdr cmdlist)))) |
566 | 576 |
567 (defun gud-apply-from-source (func) | 577 (defun gud-apply-from-source (func &rest args) |
568 ;; Apply a method from the gud buffer environment, passing it file and line. | 578 ;; Apply a method from the gud buffer environment, passing it file |
569 ;; This is intended to be used for gud commands called from a source file. | 579 ;; and line, then ARGS. This is intended to be used for gud |
580 ;; commands called from a source file. | |
570 (if (not buffer-file-name) | 581 (if (not buffer-file-name) |
571 (error "There is no file associated with this buffer")) | 582 (error "There is no file associated with this buffer")) |
572 (let ((file (file-name-nondirectory buffer-file-name)) | 583 (let ((file (file-name-nondirectory buffer-file-name)) |
573 (line (save-restriction (widen) (1+ (count-lines 1 (point)))))) | 584 (line (save-restriction (widen) (1+ (count-lines 1 (point)))))) |
574 (save-excursion | 585 (save-excursion |
575 (gud-set-buffer) | 586 (gud-set-buffer) |
576 (funcall func | 587 (apply func |
577 (get-buffer-process current-gud-buffer) | 588 (get-buffer-process current-gud-buffer) |
578 file | 589 file |
579 line) | 590 line |
591 args) | |
580 ))) | 592 ))) |
581 | 593 |
582 (defun gud-break () | 594 (defun gud-break (arg) |
583 "Set breakpoint at this source line." | 595 "Set breakpoint at this source line. |
584 (interactive) | 596 With prefix argument, set a temporary breakpoint, if the debugger in |
585 (gud-apply-from-source 'gud-set-break)) | 597 use supports such things. (A temporary breakpoint is one which will |
598 be deleted when it is reached.)" | |
599 (interactive "P") | |
600 (gud-apply-from-source 'gud-set-break arg)) | |
586 | 601 |
587 (defun gud-read-address () | 602 (defun gud-read-address () |
588 "Return a string containing the core-address found in the buffer at point." | 603 "Return a string containing the core-address found in the buffer at point." |
589 (save-excursion | 604 (save-excursion |
590 (let ((pt (point)) found begin) | 605 (let ((pt (point)) found begin) |