aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-22 04:42:56 +0000
committerRichard M. Stallman1994-11-22 04:42:56 +0000
commitbed6a98d6fc7dd263c5e79978224f54c0484b96a (patch)
tree6cb10276ab9e7e0b8cc08d8bede0016ad229dd13
parent1f66361e086553204783f7088a8cf2d4e095e256 (diff)
downloademacs-bed6a98d6fc7dd263c5e79978224f54c0484b96a.tar.gz
emacs-bed6a98d6fc7dd263c5e79978224f54c0484b96a.zip
(gud-gdb-marker-filter, gud-irixdbx-marker-filter)
(gud-perldb-marker-filter, gud-mipsdbx-marker-filter): No need for save-match-data.
-rw-r--r--lisp/gud.el340
1 files changed, 168 insertions, 172 deletions
diff --git a/lisp/gud.el b/lisp/gud.el
index b8080e0ae72..8decc5e54bc 100644
--- a/lisp/gud.el
+++ b/lisp/gud.el
@@ -168,49 +168,48 @@ we're in the GUD buffer)."
168(make-variable-buffer-local 'gud-marker-acc) 168(make-variable-buffer-local 'gud-marker-acc)
169 169
170(defun gud-gdb-marker-filter (string) 170(defun gud-gdb-marker-filter (string)
171 (save-match-data 171 (setq gud-marker-acc (concat gud-marker-acc string))
172 (setq gud-marker-acc (concat gud-marker-acc string)) 172 (let ((output ""))
173 (let ((output "")) 173
174 174 ;; Process all the complete markers in this chunk.
175 ;; Process all the complete markers in this chunk. 175 (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
176 (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" 176 gud-marker-acc)
177 gud-marker-acc) 177 (setq
178 (setq 178
179 179 ;; Extract the frame position from the marker.
180 ;; Extract the frame position from the marker. 180 gud-last-frame
181 gud-last-frame 181 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
182 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) 182 (string-to-int (substring gud-marker-acc
183 (string-to-int (substring gud-marker-acc 183 (match-beginning 2)
184 (match-beginning 2) 184 (match-end 2))))
185 (match-end 2)))) 185
186 186 ;; Append any text before the marker to the output we're going
187 ;; Append any text before the marker to the output we're going 187 ;; to return - we don't include the marker in this text.
188 ;; to return - we don't include the marker in this text. 188 output (concat output
189 output (concat output 189 (substring gud-marker-acc 0 (match-beginning 0)))
190 (substring gud-marker-acc 0 (match-beginning 0))) 190
191 191 ;; Set the accumulator to the remaining text.
192 ;; Set the accumulator to the remaining text. 192 gud-marker-acc (substring gud-marker-acc (match-end 0))))
193 gud-marker-acc (substring gud-marker-acc (match-end 0)))) 193
194 194 ;; Does the remaining text look like it might end with the
195 ;; Does the remaining text look like it might end with the 195 ;; beginning of another marker? If it does, then keep it in
196 ;; beginning of another marker? If it does, then keep it in 196 ;; gud-marker-acc until we receive the rest of it. Since we
197 ;; gud-marker-acc until we receive the rest of it. Since we 197 ;; know the full marker regexp above failed, it's pretty simple to
198 ;; know the full marker regexp above failed, it's pretty simple to 198 ;; test for marker starts.
199 ;; test for marker starts. 199 (if (string-match "\032.*\\'" gud-marker-acc)
200 (if (string-match "\032.*\\'" gud-marker-acc) 200 (progn
201 (progn 201 ;; Everything before the potential marker start can be output.
202 ;; Everything before the potential marker start can be output. 202 (setq output (concat output (substring gud-marker-acc
203 (setq output (concat output (substring gud-marker-acc 203 0 (match-beginning 0))))
204 0 (match-beginning 0))))
205 204
206 ;; Everything after, we save, to combine with later input. 205 ;; Everything after, we save, to combine with later input.
207 (setq gud-marker-acc 206 (setq gud-marker-acc
208 (substring gud-marker-acc (match-beginning 0)))) 207 (substring gud-marker-acc (match-beginning 0))))
209 208
210 (setq output (concat output gud-marker-acc) 209 (setq output (concat output gud-marker-acc)
211 gud-marker-acc "")) 210 gud-marker-acc ""))
212 211
213 output))) 212 output))
214 213
215(defun gud-gdb-find-file (f) 214(defun gud-gdb-find-file (f)
216 (find-file-noselect f)) 215 (find-file-noselect f))
@@ -478,52 +477,51 @@ and source-file directory for your debugger."
478;; This is just like the gdb one except for the regexps since we need to cope 477;; This is just like the gdb one except for the regexps since we need to cope
479;; with an optional breakpoint number in [] before the ^Z^Z 478;; with an optional breakpoint number in [] before the ^Z^Z
480(defun gud-mipsdbx-marker-filter (string) 479(defun gud-mipsdbx-marker-filter (string)
481 (save-match-data 480 (setq gud-marker-acc (concat gud-marker-acc string))
482 (setq gud-marker-acc (concat gud-marker-acc string)) 481 (let ((output ""))
483 (let ((output "")) 482
484 483 ;; Process all the complete markers in this chunk.
485 ;; Process all the complete markers in this chunk. 484 (while (string-match
486 (while (string-match 485 ;; This is like th gdb marker but with an optional
487 ;; This is like th gdb marker but with an optional 486 ;; leading break point number like `[1] '
488 ;; leading break point number like `[1] ' 487 "[][ 0-9]*\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
489 "[][ 0-9]*\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" 488 gud-marker-acc)
490 gud-marker-acc) 489 (setq
491 (setq 490
492 491 ;; Extract the frame position from the marker.
493 ;; Extract the frame position from the marker. 492 gud-last-frame
494 gud-last-frame 493 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
495 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) 494 (string-to-int (substring gud-marker-acc
496 (string-to-int (substring gud-marker-acc 495 (match-beginning 2)
497 (match-beginning 2) 496 (match-end 2))))
498 (match-end 2)))) 497
499 498 ;; Append any text before the marker to the output we're going
500 ;; Append any text before the marker to the output we're going 499 ;; to return - we don't include the marker in this text.
501 ;; to return - we don't include the marker in this text. 500 output (concat output
502 output (concat output 501 (substring gud-marker-acc 0 (match-beginning 0)))
503 (substring gud-marker-acc 0 (match-beginning 0))) 502
504 503 ;; Set the accumulator to the remaining text.
505 ;; Set the accumulator to the remaining text. 504 gud-marker-acc (substring gud-marker-acc (match-end 0))))
506 gud-marker-acc (substring gud-marker-acc (match-end 0)))) 505
507 506 ;; Does the remaining text look like it might end with the
508 ;; Does the remaining text look like it might end with the 507 ;; beginning of another marker? If it does, then keep it in
509 ;; beginning of another marker? If it does, then keep it in 508 ;; gud-marker-acc until we receive the rest of it. Since we
510 ;; gud-marker-acc until we receive the rest of it. Since we 509 ;; know the full marker regexp above failed, it's pretty simple to
511 ;; know the full marker regexp above failed, it's pretty simple to 510 ;; test for marker starts.
512 ;; test for marker starts. 511 (if (string-match "[][ 0-9]*\032.*\\'" gud-marker-acc)
513 (if (string-match "[][ 0-9]*\032.*\\'" gud-marker-acc) 512 (progn
514 (progn 513 ;; Everything before the potential marker start can be output.
515 ;; Everything before the potential marker start can be output. 514 (setq output (concat output (substring gud-marker-acc
516 (setq output (concat output (substring gud-marker-acc 515 0 (match-beginning 0))))
517 0 (match-beginning 0))))
518 516
519 ;; Everything after, we save, to combine with later input. 517 ;; Everything after, we save, to combine with later input.
520 (setq gud-marker-acc 518 (setq gud-marker-acc
521 (substring gud-marker-acc (match-beginning 0)))) 519 (substring gud-marker-acc (match-beginning 0))))
522 520
523 (setq output (concat output gud-marker-acc) 521 (setq output (concat output gud-marker-acc)
524 gud-marker-acc "")) 522 gud-marker-acc ""))
525 523
526 output))) 524 output))
527 525
528;; The dbx in IRIX is a pain. It doesn't print the file name when 526;; The dbx in IRIX is a pain. It doesn't print the file name when
529;; stopping at a breakpoint (but you do get it from the `up' and 527;; stopping at a breakpoint (but you do get it from the `up' and
@@ -549,55 +547,54 @@ This works in IRIX 4 and probably IRIX 5.")
549 547
550;; this filter is influenced by the xdb one rather than the gdb one 548;; this filter is influenced by the xdb one rather than the gdb one
551(defun gud-irixdbx-marker-filter (string) 549(defun gud-irixdbx-marker-filter (string)
552 (save-match-data 550 (let (result (case-fold-search nil))
553 (let (result (case-fold-search nil)) 551 (if (or (string-match comint-prompt-regexp string)
554 (if (or (string-match comint-prompt-regexp string) 552 (string-match ".*\012" string))
555 (string-match ".*\012" string)) 553 (setq result (concat gud-marker-acc string)
556 (setq result (concat gud-marker-acc string) 554 gud-marker-acc "")
557 gud-marker-acc "") 555 (setq gud-marker-acc (concat gud-marker-acc string)))
558 (setq gud-marker-acc (concat gud-marker-acc string))) 556 (if result
559 (if result 557 (cond
560 (cond 558 ;; look for breakpoint or signal indication e.g.:
561 ;; look for breakpoint or signal indication e.g.: 559 ;; [2] Process 1267 (pplot) stopped at [params:338 ,0x400ec0]
562 ;; [2] Process 1267 (pplot) stopped at [params:338 ,0x400ec0] 560 ;; Process 1281 (pplot) stopped at [params:339 ,0x400ec8]
563 ;; Process 1281 (pplot) stopped at [params:339 ,0x400ec8] 561 ;; Process 1270 (pplot) Floating point exception [._read._read:16 ,0x452188]
564 ;; Process 1270 (pplot) Floating point exception [._read._read:16 ,0x452188] 562 ((string-match
565 ((string-match 563 "^\\(\\[[0-9]+] \\)?Process +[0-9]+ ([^)]*) [^[]+\\[[^]\n]*]\n"
566 "^\\(\\[[0-9]+] \\)?Process +[0-9]+ ([^)]*) [^[]+\\[[^]\n]*]\n" 564 result)
567 result) 565 ;; prod dbx into printing out the line number and file
568 ;; prod dbx into printing out the line number and file 566 ;; name in a form we can grok as below
569 ;; name in a form we can grok as below 567 (process-send-string (get-buffer-process gud-comint-buffer)
570 (process-send-string (get-buffer-process gud-comint-buffer) 568 "printf \"\032\032%1d:\",(int)$curline;file\n"))
571 "printf \"\032\032%1d:\",(int)$curline;file\n")) 569 ;; look for result of, say, "up" e.g.:
572 ;; look for result of, say, "up" e.g.: 570 ;; .pplot.pplot(0x800) ["src/pplot.f":261, 0x400c7c]
573 ;; .pplot.pplot(0x800) ["src/pplot.f":261, 0x400c7c] 571 ;; (this will also catch one of the lines printed by "where")
574 ;; (this will also catch one of the lines printed by "where") 572 ((string-match
575 ((string-match 573 "^[^ ][^[]*\\[\"\\([^\"]+\\)\":\\([0-9]+\\), [^]]+]\n"
576 "^[^ ][^[]*\\[\"\\([^\"]+\\)\":\\([0-9]+\\), [^]]+]\n" 574 result)
577 result) 575 (let ((file (substring result (match-beginning 1)
578 (let ((file (substring result (match-beginning 1) 576 (match-end 1))))
579 (match-end 1)))) 577 (if (file-exists-p file)
580 (if (file-exists-p file) 578 (setq gud-last-frame
581 (setq gud-last-frame 579 (cons
582 (cons 580 (substring
583 (substring 581 result (match-beginning 1) (match-end 1))
584 result (match-beginning 1) (match-end 1)) 582 (string-to-int
585 (string-to-int 583 (substring
586 (substring 584 result (match-beginning 2) (match-end 2)))))))
587 result (match-beginning 2) (match-end 2))))))) 585 result)
588 result) 586 ((string-match ; kluged-up marker as above
589 ((string-match ; kluged-up marker as above 587 "\032\032\\([0-9]*\\):\\(.*\\)\n" result)
590 "\032\032\\([0-9]*\\):\\(.*\\)\n" result) 588 (let ((file (substring result (match-beginning 2) (match-end 2))))
591 (let ((file (substring result (match-beginning 2) (match-end 2)))) 589 (if (file-exists-p file)
592 (if (file-exists-p file) 590 (setq gud-last-frame
593 (setq gud-last-frame 591 (cons
594 (cons 592 file
595 file 593 (string-to-int
596 (string-to-int 594 (substring
597 (substring 595 result (match-beginning 1) (match-end 1)))))))
598 result (match-beginning 1) (match-end 1))))))) 596 (setq result (substring result 0 (match-beginning 0))))))
599 (setq result (substring result 0 (match-beginning 0)))))) 597 (or result "")))
600 (or result ""))))
601 598
602(defun gud-dbx-find-file (f) 599(defun gud-dbx-find-file (f)
603 (find-file-noselect f)) 600 (find-file-noselect f))
@@ -770,49 +767,48 @@ directories if your program contains sources from more than one directory."
770(defvar gud-perldb-marker-acc "") 767(defvar gud-perldb-marker-acc "")
771 768
772(defun gud-perldb-marker-filter (string) 769(defun gud-perldb-marker-filter (string)
773 (save-match-data 770 (setq gud-marker-acc (concat gud-marker-acc string))
774 (setq gud-marker-acc (concat gud-marker-acc string)) 771 (let ((output ""))
775 (let ((output "")) 772
776 773 ;; Process all the complete markers in this chunk.
777 ;; Process all the complete markers in this chunk. 774 (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
778 (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" 775 gud-marker-acc)
779 gud-marker-acc) 776 (setq
780 (setq 777
781 778 ;; Extract the frame position from the marker.
782 ;; Extract the frame position from the marker. 779 gud-last-frame
783 gud-last-frame 780 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
784 (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) 781 (string-to-int (substring gud-marker-acc
785 (string-to-int (substring gud-marker-acc 782 (match-beginning 2)
786 (match-beginning 2) 783 (match-end 2))))
787 (match-end 2)))) 784
788 785 ;; Append any text before the marker to the output we're going
789 ;; Append any text before the marker to the output we're going 786 ;; to return - we don't include the marker in this text.
790 ;; to return - we don't include the marker in this text. 787 output (concat output
791 output (concat output 788 (substring gud-marker-acc 0 (match-beginning 0)))
792 (substring gud-marker-acc 0 (match-beginning 0))) 789
793 790 ;; Set the accumulator to the remaining text.
794 ;; Set the accumulator to the remaining text. 791 gud-marker-acc (substring gud-marker-acc (match-end 0))))
795 gud-marker-acc (substring gud-marker-acc (match-end 0)))) 792
796 793 ;; Does the remaining text look like it might end with the
797 ;; Does the remaining text look like it might end with the 794 ;; beginning of another marker? If it does, then keep it in
798 ;; beginning of another marker? If it does, then keep it in 795 ;; gud-marker-acc until we receive the rest of it. Since we
799 ;; gud-marker-acc until we receive the rest of it. Since we 796 ;; know the full marker regexp above failed, it's pretty simple to
800 ;; know the full marker regexp above failed, it's pretty simple to 797 ;; test for marker starts.
801 ;; test for marker starts. 798 (if (string-match "\032.*\\'" gud-marker-acc)
802 (if (string-match "\032.*\\'" gud-marker-acc) 799 (progn
803 (progn 800 ;; Everything before the potential marker start can be output.
804 ;; Everything before the potential marker start can be output. 801 (setq output (concat output (substring gud-marker-acc
805 (setq output (concat output (substring gud-marker-acc 802 0 (match-beginning 0))))
806 0 (match-beginning 0))))
807 803
808 ;; Everything after, we save, to combine with later input. 804 ;; Everything after, we save, to combine with later input.
809 (setq gud-marker-acc 805 (setq gud-marker-acc
810 (substring gud-marker-acc (match-beginning 0)))) 806 (substring gud-marker-acc (match-beginning 0))))
811 807
812 (setq output (concat output gud-marker-acc) 808 (setq output (concat output gud-marker-acc)
813 gud-marker-acc "")) 809 gud-marker-acc ""))
814 810
815 output))) 811 output))
816 812
817(defun gud-perldb-find-file (f) 813(defun gud-perldb-find-file (f)
818 (find-file-noselect f)) 814 (find-file-noselect f))