diff options
| author | Richard M. Stallman | 1998-05-20 05:24:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-20 05:24:42 +0000 |
| commit | f4b643a15f008baaa072f526611d7d427611886e (patch) | |
| tree | 938481e13b0373b5dff49afb42ede84cbf73100b | |
| parent | dc47993c4965afadb7cee61c34945a8050066784 (diff) | |
| download | emacs-f4b643a15f008baaa072f526611d7d427611886e.tar.gz emacs-f4b643a15f008baaa072f526611d7d427611886e.zip | |
(gud-perldb-marker-acc): Variable deleted.
(gud defgroup): Doc fix.
| -rw-r--r-- | lisp/gud.el | 569 |
1 files changed, 284 insertions, 285 deletions
diff --git a/lisp/gud.el b/lisp/gud.el index eb71dabd2de..a88fb98b65c 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -26,14 +26,14 @@ | |||
| 26 | ;;; Commentary: | 26 | ;;; Commentary: |
| 27 | 27 | ||
| 28 | ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu> | 28 | ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu> |
| 29 | ;; It was later rewritten by rms. Some ideas were due to Masanobu. | 29 | ;; It was later rewritten by rms. Some ideas were due to Masanobu. |
| 30 | ;; Grand Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com> | 30 | ;; Grand Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com> |
| 31 | ;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>, | 31 | ;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>, |
| 32 | ;; who also hacked the mode to use comint.el. Shane Hartman <shane@spr.com> | 32 | ;; who also hacked the mode to use comint.el. Shane Hartman <shane@spr.com> |
| 33 | ;; added support for xdb (HPUX debugger). Rick Sladkey <jrs@world.std.com> | 33 | ;; added support for xdb (HPUX debugger). Rick Sladkey <jrs@world.std.com> |
| 34 | ;; wrote the GDB command completion code. Dave Love <d.love@dl.ac.uk> | 34 | ;; wrote the GDB command completion code. Dave Love <d.love@dl.ac.uk> |
| 35 | ;; added the IRIX kluge, re-implemented the Mips-ish variant and added | 35 | ;; added the IRIX kluge, re-implemented the Mips-ish variant and added |
| 36 | ;; a menu. Brian D. Carlstrom <bdc@ai.mit.edu> combined the IRIX kluge with | 36 | ;; a menu. Brian D. Carlstrom <bdc@ai.mit.edu> combined the IRIX kluge with |
| 37 | ;; the gud-xdb-directories hack producing gud-dbx-directories. Derek L. Davies | 37 | ;; the gud-xdb-directories hack producing gud-dbx-directories. Derek L. Davies |
| 38 | ;; <ddavies@world.std.com> added support for jdb (Java debugger.) | 38 | ;; <ddavies@world.std.com> added support for jdb (Java debugger.) |
| 39 | 39 | ||
| @@ -46,7 +46,8 @@ | |||
| 46 | ;; GUD commands must be visible in C buffers visited by GUD | 46 | ;; GUD commands must be visible in C buffers visited by GUD |
| 47 | 47 | ||
| 48 | (defgroup gud nil | 48 | (defgroup gud nil |
| 49 | "Grand Unified Debugger mode for gdb, sdb, dbx, xdb or perldb under Emacs." | 49 | "Grand Unified Debugger mode for gdb and other debuggers under Emacs. |
| 50 | Supported debuggers include gdb, sdb, dbx, xdb, perldb, and jdb." | ||
| 50 | :group 'unix | 51 | :group 'unix |
| 51 | :group 'tools) | 52 | :group 'tools) |
| 52 | 53 | ||
| @@ -108,8 +109,8 @@ | |||
| 108 | optional doc string DOC. Certain %-escapes in the string arguments | 109 | optional doc string DOC. Certain %-escapes in the string arguments |
| 109 | are interpreted specially if present. These are: | 110 | are interpreted specially if present. These are: |
| 110 | 111 | ||
| 111 | %f name (without directory) of current source file. | 112 | %f name (without directory) of current source file. |
| 112 | %d directory of current source file. | 113 | %d directory of current source file. |
| 113 | %l number of current source line | 114 | %l number of current source line |
| 114 | %e text of the C lvalue or function-call expression surrounding point. | 115 | %e text of the C lvalue or function-call expression surrounding point. |
| 115 | %a text of the hexadecimal address surrounding point | 116 | %a text of the hexadecimal address surrounding point |
| @@ -136,9 +137,9 @@ we're in the GUD buffer)." | |||
| 136 | (list 'concat 'gud-key-prefix key) | 137 | (list 'concat 'gud-key-prefix key) |
| 137 | (list 'quote func))))) | 138 | (list 'quote func))))) |
| 138 | 139 | ||
| 139 | ;; Where gud-display-frame should put the debugging arrow. This is | 140 | ;; Where gud-display-frame should put the debugging arrow; a cons of |
| 140 | ;; set by the marker-filter, which scans the debugger's output for | 141 | ;; (filename . line-number). This is set by the marker-filter, which scans |
| 141 | ;; indications of the current program counter. | 142 | ;; the debugger's output for indications of the current program counter. |
| 142 | (defvar gud-last-frame nil) | 143 | (defvar gud-last-frame nil) |
| 143 | 144 | ||
| 144 | ;; Used by gud-refresh, which should cause gud-display-frame to redisplay | 145 | ;; Used by gud-refresh, which should cause gud-display-frame to redisplay |
| @@ -438,7 +439,7 @@ available with older versions of GDB." | |||
| 438 | (setq gud-gdb-complete-list (list (concat str "'")))))) | 439 | (setq gud-gdb-complete-list (list (concat str "'")))))) |
| 439 | ;; Let comint handle the rest. | 440 | ;; Let comint handle the rest. |
| 440 | (comint-dynamic-simple-complete command-word gud-gdb-complete-list))) | 441 | (comint-dynamic-simple-complete command-word gud-gdb-complete-list))) |
| 441 | 442 | ||
| 442 | ;; The completion process filter is installed temporarily to slurp the | 443 | ;; The completion process filter is installed temporarily to slurp the |
| 443 | ;; output of GDB up to the next prompt and build the completion list. | 444 | ;; output of GDB up to the next prompt and build the completion list. |
| 444 | (defun gud-gdb-complete-filter (string) | 445 | (defun gud-gdb-complete-filter (string) |
| @@ -545,7 +546,7 @@ BUFFER is the GUD buffer in which to run the command." | |||
| 545 | (setq gud-gdb-fetched-stack-frame nil | 546 | (setq gud-gdb-fetched-stack-frame nil |
| 546 | gud-gdb-fetched-stack-frame-list | 547 | gud-gdb-fetched-stack-frame-list |
| 547 | (nreverse gud-gdb-fetched-stack-frame-list)))))) | 548 | (nreverse gud-gdb-fetched-stack-frame-list)))))) |
| 548 | 549 | ||
| 549 | (defun gud-gdb-speedbar-stack-filter (string) | 550 | (defun gud-gdb-speedbar-stack-filter (string) |
| 550 | ;; checkdoc-params: (string) | 551 | ;; checkdoc-params: (string) |
| 551 | "Filter used to read in the current GDB stack." | 552 | "Filter used to read in the current GDB stack." |
| @@ -582,27 +583,27 @@ BUFFER is the GUD buffer in which to run the command." | |||
| 582 | (if gud-marker-acc (concat gud-marker-acc string) string)) | 583 | (if gud-marker-acc (concat gud-marker-acc string) string)) |
| 583 | (let (start) | 584 | (let (start) |
| 584 | ;; Process all complete markers in this chunk | 585 | ;; Process all complete markers in this chunk |
| 585 | (while | 586 | (while |
| 586 | (cond | 587 | (cond |
| 587 | ;; System V Release 3.2 uses this format | 588 | ;; System V Release 3.2 uses this format |
| 588 | ((string-match "\\(^\\|\n\\)\\*?\\(0x\\w* in \\)?\\([^:\n]*\\):\\([0-9]*\\):.*\n" | 589 | ((string-match "\\(^\\|\n\\)\\*?\\(0x\\w* in \\)?\\([^:\n]*\\):\\([0-9]*\\):.*\n" |
| 589 | gud-marker-acc start) | 590 | gud-marker-acc start) |
| 590 | (setq gud-last-frame | 591 | (setq gud-last-frame |
| 591 | (cons | 592 | (cons |
| 592 | (substring gud-marker-acc (match-beginning 3) (match-end 3)) | 593 | (substring gud-marker-acc (match-beginning 3) (match-end 3)) |
| 593 | (string-to-int | 594 | (string-to-int |
| 594 | (substring gud-marker-acc (match-beginning 4) (match-end 4)))))) | 595 | (substring gud-marker-acc (match-beginning 4) (match-end 4)))))) |
| 595 | ;; System V Release 4.0 quite often clumps two lines together | 596 | ;; System V Release 4.0 quite often clumps two lines together |
| 596 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" | 597 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" |
| 597 | gud-marker-acc start) | 598 | gud-marker-acc start) |
| 598 | (setq gud-sdb-lastfile | 599 | (setq gud-sdb-lastfile |
| 599 | (substring gud-marker-acc (match-beginning 2) (match-end 2))) | 600 | (substring gud-marker-acc (match-beginning 2) (match-end 2))) |
| 600 | (setq gud-last-frame | 601 | (setq gud-last-frame |
| 601 | (cons | 602 | (cons |
| 602 | gud-sdb-lastfile | 603 | gud-sdb-lastfile |
| 603 | (string-to-int | 604 | (string-to-int |
| 604 | (substring gud-marker-acc (match-beginning 3) (match-end 3)))))) | 605 | (substring gud-marker-acc (match-beginning 3) (match-end 3)))))) |
| 605 | ;; System V Release 4.0 | 606 | ;; System V Release 4.0 |
| 606 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" | 607 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" |
| 607 | gud-marker-acc start) | 608 | gud-marker-acc start) |
| 608 | (setq gud-sdb-lastfile | 609 | (setq gud-sdb-lastfile |
| @@ -612,9 +613,9 @@ BUFFER is the GUD buffer in which to run the command." | |||
| 612 | (setq gud-last-frame | 613 | (setq gud-last-frame |
| 613 | (cons | 614 | (cons |
| 614 | gud-sdb-lastfile | 615 | gud-sdb-lastfile |
| 615 | (string-to-int | 616 | (string-to-int |
| 616 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))))) | 617 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))))) |
| 617 | (t | 618 | (t |
| 618 | (setq gud-sdb-lastfile nil))) | 619 | (setq gud-sdb-lastfile nil))) |
| 619 | (setq start (match-end 0))) | 620 | (setq start (match-end 0))) |
| 620 | 621 | ||
| @@ -728,7 +729,7 @@ containing the executable being debugged." | |||
| 728 | (setq gud-last-frame | 729 | (setq gud-last-frame |
| 729 | (cons | 730 | (cons |
| 730 | (substring gud-marker-acc (match-beginning 2) (match-end 2)) | 731 | (substring gud-marker-acc (match-beginning 2) (match-end 2)) |
| 731 | (string-to-int | 732 | (string-to-int |
| 732 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))) | 733 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))) |
| 733 | start (match-end 0))) | 734 | start (match-end 0))) |
| 734 | 735 | ||
| @@ -739,7 +740,7 @@ containing the executable being debugged." | |||
| 739 | ;; If the incomplete line APPEARS to begin with another marker, keep it | 740 | ;; If the incomplete line APPEARS to begin with another marker, keep it |
| 740 | ;; in the accumulator. Otherwise, clear the accumulator to avoid an | 741 | ;; in the accumulator. Otherwise, clear the accumulator to avoid an |
| 741 | ;; unnecessary concat during the next call. | 742 | ;; unnecessary concat during the next call. |
| 742 | (setq gud-marker-acc | 743 | (setq gud-marker-acc |
| 743 | (if (string-match "\\(stopped\\|signal\\)" gud-marker-acc start) | 744 | (if (string-match "\\(stopped\\|signal\\)" gud-marker-acc start) |
| 744 | (substring gud-marker-acc (match-beginning 0)) | 745 | (substring gud-marker-acc (match-beginning 0)) |
| 745 | nil))) | 746 | nil))) |
| @@ -870,7 +871,7 @@ a better solution in 6.1 upwards.") | |||
| 870 | ;; Process 1281 (pplot) stopped at [params:339 ,0x400ec8] | 871 | ;; Process 1281 (pplot) stopped at [params:339 ,0x400ec8] |
| 871 | ;; Process 1270 (pplot) Floating point exception [._read._read:16 ,0x452188] | 872 | ;; Process 1270 (pplot) Floating point exception [._read._read:16 ,0x452188] |
| 872 | ((string-match | 873 | ((string-match |
| 873 | "^\\(\\[[0-9]+] \\)?Process +[0-9]+ ([^)]*) [^[]+\\[[^]\n]*]\n" | 874 | "^\\(\\[[0-9]+] \\)?Process +[0-9]+ ([^)]*) [^[]+\\[[^]\n]*]\n" |
| 874 | result) | 875 | result) |
| 875 | ;; prod dbx into printing out the line number and file | 876 | ;; prod dbx into printing out the line number and file |
| 876 | ;; name in a form we can grok as below | 877 | ;; name in a form we can grok as below |
| @@ -889,7 +890,7 @@ a better solution in 6.1 upwards.") | |||
| 889 | (cons | 890 | (cons |
| 890 | (substring | 891 | (substring |
| 891 | result (match-beginning 1) (match-end 1)) | 892 | result (match-beginning 1) (match-end 1)) |
| 892 | (string-to-int | 893 | (string-to-int |
| 893 | (substring | 894 | (substring |
| 894 | result (match-beginning 2) (match-end 2))))))) | 895 | result (match-beginning 2) (match-end 2))))))) |
| 895 | result) | 896 | result) |
| @@ -901,7 +902,7 @@ a better solution in 6.1 upwards.") | |||
| 901 | (setq gud-last-frame | 902 | (setq gud-last-frame |
| 902 | (cons | 903 | (cons |
| 903 | file | 904 | file |
| 904 | (string-to-int | 905 | (string-to-int |
| 905 | (substring | 906 | (substring |
| 906 | result (match-beginning 1) (match-end 1))))))) | 907 | result (match-beginning 1) (match-end 1))))))) |
| 907 | (setq result (substring result 0 (match-beginning 0)))))) | 908 | (setq result (substring result 0 (match-beginning 0)))))) |
| @@ -952,7 +953,7 @@ This was tested using R4.11.") | |||
| 952 | ;; If the incomplete line APPEARS to begin with another marker, keep it | 953 | ;; If the incomplete line APPEARS to begin with another marker, keep it |
| 953 | ;; in the accumulator. Otherwise, clear the accumulator to avoid an | 954 | ;; in the accumulator. Otherwise, clear the accumulator to avoid an |
| 954 | ;; unnecessary concat during the next call. | 955 | ;; unnecessary concat during the next call. |
| 955 | (setq gud-marker-acc | 956 | (setq gud-marker-acc |
| 956 | (if (string-match "Stopped\\|Frame" gud-marker-acc start) | 957 | (if (string-match "Stopped\\|Frame" gud-marker-acc start) |
| 957 | (substring gud-marker-acc (match-beginning 0)) | 958 | (substring gud-marker-acc (match-beginning 0)) |
| 958 | nil))) | 959 | nil))) |
| @@ -1016,7 +1017,7 @@ and source-file directory for your debugger." | |||
| 1016 | (process-send-string (get-buffer-process gud-comint-buffer) | 1017 | (process-send-string (get-buffer-process gud-comint-buffer) |
| 1017 | "printf \"\032\032%1d:\",(int)$curline;file\n")) | 1018 | "printf \"\032\032%1d:\",(int)$curline;file\n")) |
| 1018 | (gud-dbx-use-stopformat-p | 1019 | (gud-dbx-use-stopformat-p |
| 1019 | (process-send-string (get-buffer-process gud-comint-buffer) | 1020 | (process-send-string (get-buffer-process gud-comint-buffer) |
| 1020 | "set $stopformat=1\n")) | 1021 | "set $stopformat=1\n")) |
| 1021 | (t | 1022 | (t |
| 1022 | (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") | 1023 | (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") |
| @@ -1098,8 +1099,8 @@ containing the executable being debugged." | |||
| 1098 | (substring result (match-beginning 1) (match-end 1))))) | 1099 | (substring result (match-beginning 1) (match-end 1))))) |
| 1099 | (if file | 1100 | (if file |
| 1100 | (setq gud-last-frame (cons file line)))))) | 1101 | (setq gud-last-frame (cons file line)))))) |
| 1101 | (or result ""))) | 1102 | (or result ""))) |
| 1102 | 1103 | ||
| 1103 | (defun gud-xdb-find-file (f) | 1104 | (defun gud-xdb-find-file (f) |
| 1104 | (save-excursion | 1105 | (save-excursion |
| 1105 | (let ((realf (gud-xdb-file-name f))) | 1106 | (let ((realf (gud-xdb-file-name f))) |
| @@ -1162,10 +1163,10 @@ directories if your program contains sources from more than one directory." | |||
| 1162 | (defvar gud-perldb-history nil) | 1163 | (defvar gud-perldb-history nil) |
| 1163 | 1164 | ||
| 1164 | (defun gud-perldb-massage-args (file args) | 1165 | (defun gud-perldb-massage-args (file args) |
| 1165 | (cond ((equal (car args) "-e") | 1166 | (cond ((equal (car args) "-e") |
| 1166 | (cons "-d" | 1167 | (cons "-d" |
| 1167 | (cons (car args) | 1168 | (cons (car args) |
| 1168 | (cons (nth 1 args) | 1169 | (cons (nth 1 args) |
| 1169 | (cons "--" (cons "-emacs" (cdr (cdr args)))))))) | 1170 | (cons "--" (cons "-emacs" (cdr (cdr args)))))))) |
| 1170 | (t | 1171 | (t |
| 1171 | (cons "-d" (cons (car args) (cons "-emacs" (cdr args))))))) | 1172 | (cons "-d" (cons (car args) (cons "-emacs" (cdr args))))))) |
| @@ -1176,8 +1177,6 @@ directories if your program contains sources from more than one directory." | |||
| 1176 | ;; receive a chunk of text which looks like it might contain the | 1177 | ;; receive a chunk of text which looks like it might contain the |
| 1177 | ;; beginning of a marker, we save it here between calls to the | 1178 | ;; beginning of a marker, we save it here between calls to the |
| 1178 | ;; filter. | 1179 | ;; filter. |
| 1179 | (defvar gud-perldb-marker-acc "") | ||
| 1180 | |||
| 1181 | (defun gud-perldb-marker-filter (string) | 1180 | (defun gud-perldb-marker-filter (string) |
| 1182 | (setq gud-marker-acc (concat gud-marker-acc string)) | 1181 | (setq gud-marker-acc (concat gud-marker-acc string)) |
| 1183 | (let ((output "")) | 1182 | (let ((output "")) |
| @@ -1285,7 +1284,7 @@ and source-file directory for your debugger." | |||
| 1285 | ;; | 1284 | ;; |
| 1286 | ;; It responds with: | 1285 | ;; It responds with: |
| 1287 | ;; | 1286 | ;; |
| 1288 | ;; Run jdb (like this): jdb | 1287 | ;; Run jdb (like this): jdb |
| 1289 | ;; | 1288 | ;; |
| 1290 | ;; type any jdb switches followed by the name of the class you'd like to debug. | 1289 | ;; type any jdb switches followed by the name of the class you'd like to debug. |
| 1291 | ;; Supply a fully qualfied classname (these do not have the ".class" extension) | 1290 | ;; Supply a fully qualfied classname (these do not have the ".class" extension) |
| @@ -1309,7 +1308,7 @@ and source-file directory for your debugger." | |||
| 1309 | ;; To execute the program type: | 1308 | ;; To execute the program type: |
| 1310 | ;; | 1309 | ;; |
| 1311 | ;; > run | 1310 | ;; > run |
| 1312 | ;; run hello | 1311 | ;; run hello |
| 1313 | ;; | 1312 | ;; |
| 1314 | ;; Breakpoint hit: running ... | 1313 | ;; Breakpoint hit: running ... |
| 1315 | ;; hello.main (hello:12) | 1314 | ;; hello.main (hello:12) |
| @@ -1355,7 +1354,7 @@ and source-file directory for your debugger." | |||
| 1355 | 1354 | ||
| 1356 | ;; List of Java source file directories. | 1355 | ;; List of Java source file directories. |
| 1357 | (defvar gud-jdb-directories (list ".") | 1356 | (defvar gud-jdb-directories (list ".") |
| 1358 | "*A list of directories that gud jdb should search for source code. | 1357 | "*A list of directories that gud jdb should search for source code. |
| 1359 | The file names should be absolute, or relative to the current directory.") | 1358 | The file names should be absolute, or relative to the current directory.") |
| 1360 | 1359 | ||
| 1361 | ;; List of the java source files for this debugging session. | 1360 | ;; List of the java source files for this debugging session. |
| @@ -1379,30 +1378,30 @@ The file names should be absolute, or relative to the current directory.") | |||
| 1379 | (defun gud-jdb-skip-traditional-or-documentation-comment () | 1378 | (defun gud-jdb-skip-traditional-or-documentation-comment () |
| 1380 | (forward-char 2) | 1379 | (forward-char 2) |
| 1381 | (catch 'break | 1380 | (catch 'break |
| 1382 | (while (not (eobp)) | 1381 | (while (not (eobp)) |
| 1383 | (if (eq (following-char) ?*) | 1382 | (if (eq (following-char) ?*) |
| 1384 | (progn | 1383 | (progn |
| 1385 | (forward-char) | 1384 | (forward-char) |
| 1386 | (if (not (eobp)) | 1385 | (if (not (eobp)) |
| 1387 | (if (eq (following-char) ?/) | 1386 | (if (eq (following-char) ?/) |
| 1388 | (progn | 1387 | (progn |
| 1389 | (forward-char) | 1388 | (forward-char) |
| 1390 | (throw 'break nil))))) | 1389 | (throw 'break nil))))) |
| 1391 | (forward-char))))) | 1390 | (forward-char))))) |
| 1392 | 1391 | ||
| 1393 | ;; Move point past any number of consecutive whitespace chars and/or comments. | 1392 | ;; Move point past any number of consecutive whitespace chars and/or comments. |
| 1394 | (defun gud-jdb-skip-whitespace-and-comments () | 1393 | (defun gud-jdb-skip-whitespace-and-comments () |
| 1395 | (gud-jdb-skip-whitespace) | 1394 | (gud-jdb-skip-whitespace) |
| 1396 | (catch 'done | 1395 | (catch 'done |
| 1397 | (while t | 1396 | (while t |
| 1398 | (cond | 1397 | (cond |
| 1399 | ((looking-at "//") | 1398 | ((looking-at "//") |
| 1400 | (gud-jdb-skip-single-line-comment) | 1399 | (gud-jdb-skip-single-line-comment) |
| 1401 | (gud-jdb-skip-whitespace)) | 1400 | (gud-jdb-skip-whitespace)) |
| 1402 | ((looking-at "/\\*") | 1401 | ((looking-at "/\\*") |
| 1403 | (gud-jdb-skip-traditional-or-documentation-comment) | 1402 | (gud-jdb-skip-traditional-or-documentation-comment) |
| 1404 | (gud-jdb-skip-whitespace)) | 1403 | (gud-jdb-skip-whitespace)) |
| 1405 | (t (throw 'done nil)))))) | 1404 | (t (throw 'done nil)))))) |
| 1406 | 1405 | ||
| 1407 | ;; Move point past things that are id-like. The intent is to skip regular | 1406 | ;; Move point past things that are id-like. The intent is to skip regular |
| 1408 | ;; id's, such as class or interface names as well as package and interface | 1407 | ;; id's, such as class or interface names as well as package and interface |
| @@ -1414,152 +1413,152 @@ The file names should be absolute, or relative to the current directory.") | |||
| 1414 | (defun gud-jdb-skip-string-literal () | 1413 | (defun gud-jdb-skip-string-literal () |
| 1415 | (forward-char) | 1414 | (forward-char) |
| 1416 | (while | 1415 | (while |
| 1417 | (progn | 1416 | (progn |
| 1418 | (if (eq (following-char) ?\\) | 1417 | (if (eq (following-char) ?\\) |
| 1419 | (forward-char 2)) | 1418 | (forward-char 2)) |
| 1420 | (not (eq (following-char) ?\042))) | 1419 | (not (eq (following-char) ?\042))) |
| 1421 | (forward-char)) | 1420 | (forward-char)) |
| 1422 | (forward-char)) | 1421 | (forward-char)) |
| 1423 | 1422 | ||
| 1424 | ;; Move point past a character literal. | 1423 | ;; Move point past a character literal. |
| 1425 | (defun gud-jdb-skip-character-literal () | 1424 | (defun gud-jdb-skip-character-literal () |
| 1426 | (forward-char) | 1425 | (forward-char) |
| 1427 | (while | 1426 | (while |
| 1428 | (progn | 1427 | (progn |
| 1429 | (if (eq (following-char) ?\\) | 1428 | (if (eq (following-char) ?\\) |
| 1430 | (forward-char 2)) | 1429 | (forward-char 2)) |
| 1431 | (not (eq (following-char) ?\'))) | 1430 | (not (eq (following-char) ?\'))) |
| 1432 | (forward-char)) | 1431 | (forward-char)) |
| 1433 | (forward-char)) | 1432 | (forward-char)) |
| 1434 | 1433 | ||
| 1435 | ;; Move point past the following block. There may be (legal) cruft before | 1434 | ;; Move point past the following block. There may be (legal) cruft before |
| 1436 | ;; the block's opening brace. There must be a block or it's the end of life | 1435 | ;; the block's opening brace. There must be a block or it's the end of life |
| 1437 | ;; in petticoat junction. | 1436 | ;; in petticoat junction. |
| 1438 | (defun gud-jdb-skip-block () | 1437 | (defun gud-jdb-skip-block () |
| 1439 | 1438 | ||
| 1440 | ;; Find the begining of the block. | 1439 | ;; Find the begining of the block. |
| 1441 | (while | 1440 | (while |
| 1442 | (not (eq (following-char) ?{)) | 1441 | (not (eq (following-char) ?{)) |
| 1442 | |||
| 1443 | ;; Skip any constructs that can harbor literal block delimiter | ||
| 1444 | ;; characters and/or the delimiters for the constructs themselves. | ||
| 1445 | (cond | ||
| 1446 | ((looking-at "//") | ||
| 1447 | (gud-jdb-skip-single-line-comment)) | ||
| 1448 | ((looking-at "/\\*") | ||
| 1449 | (gud-jdb-skip-traditional-or-documentation-comment)) | ||
| 1450 | ((eq (following-char) ?\042) | ||
| 1451 | (gud-jdb-skip-string-literal)) | ||
| 1452 | ((eq (following-char) ?\') | ||
| 1453 | (gud-jdb-skip-character-literal)) | ||
| 1454 | (t (forward-char)))) | ||
| 1443 | 1455 | ||
| 1444 | ;; Skip any constructs that can harbor literal block delimiter | ||
| 1445 | ;; characters and/or the delimiters for the constructs themselves. | ||
| 1446 | (cond | ||
| 1447 | ((looking-at "//") | ||
| 1448 | (gud-jdb-skip-single-line-comment)) | ||
| 1449 | ((looking-at "/\\*") | ||
| 1450 | (gud-jdb-skip-traditional-or-documentation-comment)) | ||
| 1451 | ((eq (following-char) ?\042) | ||
| 1452 | (gud-jdb-skip-string-literal)) | ||
| 1453 | ((eq (following-char) ?\') | ||
| 1454 | (gud-jdb-skip-character-literal)) | ||
| 1455 | (t (forward-char)))) | ||
| 1456 | |||
| 1457 | ;; Now at the begining of the block. | 1456 | ;; Now at the begining of the block. |
| 1458 | (forward-char) | 1457 | (forward-char) |
| 1459 | 1458 | ||
| 1460 | ;; Skip over the body of the block as well as the final brace. | 1459 | ;; Skip over the body of the block as well as the final brace. |
| 1461 | (let ((open-level 1)) | 1460 | (let ((open-level 1)) |
| 1462 | (while (not (eq open-level 0)) | 1461 | (while (not (eq open-level 0)) |
| 1463 | (cond | 1462 | (cond |
| 1464 | ((looking-at "//") | 1463 | ((looking-at "//") |
| 1465 | (gud-jdb-skip-single-line-comment)) | 1464 | (gud-jdb-skip-single-line-comment)) |
| 1466 | ((looking-at "/\\*") | 1465 | ((looking-at "/\\*") |
| 1467 | (gud-jdb-skip-traditional-or-documentation-comment)) | 1466 | (gud-jdb-skip-traditional-or-documentation-comment)) |
| 1468 | ((eq (following-char) ?\042) | 1467 | ((eq (following-char) ?\042) |
| 1469 | (gud-jdb-skip-string-literal)) | 1468 | (gud-jdb-skip-string-literal)) |
| 1470 | ((eq (following-char) ?\') | 1469 | ((eq (following-char) ?\') |
| 1471 | (gud-jdb-skip-character-literal)) | 1470 | (gud-jdb-skip-character-literal)) |
| 1472 | ((eq (following-char) ?{) | 1471 | ((eq (following-char) ?{) |
| 1473 | (setq open-level (+ open-level 1)) | 1472 | (setq open-level (+ open-level 1)) |
| 1474 | (forward-char)) | 1473 | (forward-char)) |
| 1475 | ((eq (following-char) ?}) | 1474 | ((eq (following-char) ?}) |
| 1476 | (setq open-level (- open-level 1)) | 1475 | (setq open-level (- open-level 1)) |
| 1477 | (forward-char)) | 1476 | (forward-char)) |
| 1478 | (t (forward-char)))))) | 1477 | (t (forward-char)))))) |
| 1479 | 1478 | ||
| 1480 | ;; Find the package and class definitions in Java source file FILE. Assumes | 1479 | ;; Find the package and class definitions in Java source file FILE. Assumes |
| 1481 | ;; that FILE contains a legal Java program. BUF is a scratch buffer used | 1480 | ;; that FILE contains a legal Java program. BUF is a scratch buffer used |
| 1482 | ;; to hold the source during analysis. | 1481 | ;; to hold the source during analysis. |
| 1483 | (defun gud-jdb-analyze-source (buf file) | 1482 | (defun gud-jdb-analyze-source (buf file) |
| 1484 | (let ((l nil)) | 1483 | (let ((l nil)) |
| 1485 | (set-buffer buf) | 1484 | (set-buffer buf) |
| 1486 | (insert-file-contents file nil nil nil t) | 1485 | (insert-file-contents file nil nil nil t) |
| 1487 | (goto-char 0) | 1486 | (goto-char 0) |
| 1488 | (catch 'abort | 1487 | (catch 'abort |
| 1489 | (let ((p "")) | 1488 | (let ((p "")) |
| 1490 | (while (progn | 1489 | (while (progn |
| 1491 | (gud-jdb-skip-whitespace) | 1490 | (gud-jdb-skip-whitespace) |
| 1492 | (not (eobp))) | 1491 | (not (eobp))) |
| 1493 | (cond | 1492 | (cond |
| 1494 | 1493 | ||
| 1495 | ;; Any number of semi's following a block is legal. Move point | 1494 | ;; Any number of semi's following a block is legal. Move point |
| 1496 | ;; past them. Note that comments and whitespace may be | 1495 | ;; past them. Note that comments and whitespace may be |
| 1497 | ;; interspersed as well. | 1496 | ;; interspersed as well. |
| 1498 | ((eq (following-char) ?\073) | 1497 | ((eq (following-char) ?\073) |
| 1499 | (forward-char)) | 1498 | (forward-char)) |
| 1500 | 1499 | ||
| 1501 | ;; Move point past a single line comment. | 1500 | ;; Move point past a single line comment. |
| 1502 | ((looking-at "//") | 1501 | ((looking-at "//") |
| 1503 | (gud-jdb-skip-single-line-comment)) | 1502 | (gud-jdb-skip-single-line-comment)) |
| 1504 | 1503 | ||
| 1505 | ;; Move point past a traditional or documentation comment. | 1504 | ;; Move point past a traditional or documentation comment. |
| 1506 | ((looking-at "/\\*") | 1505 | ((looking-at "/\\*") |
| 1507 | (gud-jdb-skip-traditional-or-documentation-comment)) | 1506 | (gud-jdb-skip-traditional-or-documentation-comment)) |
| 1508 | 1507 | ||
| 1509 | ;; Move point past a package statement, but save the PackageName. | 1508 | ;; Move point past a package statement, but save the PackageName. |
| 1510 | ((looking-at "package") | 1509 | ((looking-at "package") |
| 1511 | (forward-char 7) | 1510 | (forward-char 7) |
| 1512 | (gud-jdb-skip-whitespace-and-comments) | 1511 | (gud-jdb-skip-whitespace-and-comments) |
| 1513 | (let ((s (point))) | 1512 | (let ((s (point))) |
| 1514 | (gud-jdb-skip-id-ish-thing) | 1513 | (gud-jdb-skip-id-ish-thing) |
| 1515 | (setq p (concat (buffer-substring s (point)) ".")) | 1514 | (setq p (concat (buffer-substring s (point)) ".")) |
| 1516 | (gud-jdb-skip-whitespace-and-comments) | 1515 | (gud-jdb-skip-whitespace-and-comments) |
| 1517 | (if (eq (following-char) ?\073) | 1516 | (if (eq (following-char) ?\073) |
| 1518 | (forward-char)))) | 1517 | (forward-char)))) |
| 1519 | 1518 | ||
| 1520 | ;; Move point past an import statement. | 1519 | ;; Move point past an import statement. |
| 1521 | ((looking-at "import") | 1520 | ((looking-at "import") |
| 1522 | (forward-char 6) | 1521 | (forward-char 6) |
| 1523 | (gud-jdb-skip-whitespace-and-comments) | 1522 | (gud-jdb-skip-whitespace-and-comments) |
| 1524 | (gud-jdb-skip-id-ish-thing) | 1523 | (gud-jdb-skip-id-ish-thing) |
| 1525 | (gud-jdb-skip-whitespace-and-comments) | 1524 | (gud-jdb-skip-whitespace-and-comments) |
| 1526 | (if (eq (following-char) ?\073) | 1525 | (if (eq (following-char) ?\073) |
| 1527 | (forward-char))) | 1526 | (forward-char))) |
| 1528 | 1527 | ||
| 1529 | ;; Move point past the various kinds of ClassModifiers. | 1528 | ;; Move point past the various kinds of ClassModifiers. |
| 1530 | ((looking-at "public") | 1529 | ((looking-at "public") |
| 1531 | (forward-char 6)) | 1530 | (forward-char 6)) |
| 1532 | ((looking-at "abstract") | 1531 | ((looking-at "abstract") |
| 1533 | (forward-char 8)) | 1532 | (forward-char 8)) |
| 1534 | ((looking-at "final") | 1533 | ((looking-at "final") |
| 1535 | (forward-char 5)) | 1534 | (forward-char 5)) |
| 1536 | 1535 | ||
| 1537 | ;; Move point past a ClassDeclaraction, but save the class | 1536 | ;; Move point past a ClassDeclaraction, but save the class |
| 1538 | ;; Identifier. | 1537 | ;; Identifier. |
| 1539 | ((looking-at "class") | 1538 | ((looking-at "class") |
| 1540 | (forward-char 5) | 1539 | (forward-char 5) |
| 1541 | (gud-jdb-skip-whitespace-and-comments) | 1540 | (gud-jdb-skip-whitespace-and-comments) |
| 1542 | (let ((s (point))) | 1541 | (let ((s (point))) |
| 1543 | (gud-jdb-skip-id-ish-thing) | 1542 | (gud-jdb-skip-id-ish-thing) |
| 1544 | (setq | 1543 | (setq |
| 1545 | l (nconc l (list (concat p (buffer-substring s (point))))))) | 1544 | l (nconc l (list (concat p (buffer-substring s (point))))))) |
| 1546 | (gud-jdb-skip-block)) | 1545 | (gud-jdb-skip-block)) |
| 1547 | 1546 | ||
| 1548 | ;; Move point past an interface statement. | 1547 | ;; Move point past an interface statement. |
| 1549 | ((looking-at "interface") | 1548 | ((looking-at "interface") |
| 1550 | (forward-char 9) | 1549 | (forward-char 9) |
| 1551 | (gud-jdb-skip-block)) | 1550 | (gud-jdb-skip-block)) |
| 1552 | 1551 | ||
| 1553 | ;; Anything else means the input is invalid. | 1552 | ;; Anything else means the input is invalid. |
| 1554 | (t | 1553 | (t |
| 1555 | (message (format "Error parsing file %s." file)) | 1554 | (message (format "Error parsing file %s." file)) |
| 1556 | (throw 'abort nil)))))) | 1555 | (throw 'abort nil)))))) |
| 1557 | l)) | 1556 | l)) |
| 1558 | 1557 | ||
| 1559 | (defun gud-jdb-build-class-source-alist-for-file (file) | 1558 | (defun gud-jdb-build-class-source-alist-for-file (file) |
| 1560 | (mapcar | 1559 | (mapcar |
| 1561 | (lambda (c) | 1560 | (lambda (c) |
| 1562 | (cons c file)) | 1561 | (cons c file)) |
| 1563 | (gud-jdb-analyze-source gud-jdb-analysis-buffer file))) | 1562 | (gud-jdb-analyze-source gud-jdb-analysis-buffer file))) |
| 1564 | 1563 | ||
| 1565 | ;; Association list of fully qualified class names (package + class name) and | 1564 | ;; Association list of fully qualified class names (package + class name) and |
| @@ -1575,19 +1574,19 @@ The file names should be absolute, or relative to the current directory.") | |||
| 1575 | (defun gud-jdb-build-class-source-alist (sources) | 1574 | (defun gud-jdb-build-class-source-alist (sources) |
| 1576 | (setq gud-jdb-analysis-buffer (get-buffer-create "*gud-jdb-scratch*")) | 1575 | (setq gud-jdb-analysis-buffer (get-buffer-create "*gud-jdb-scratch*")) |
| 1577 | (prog1 | 1576 | (prog1 |
| 1578 | (apply | 1577 | (apply |
| 1579 | 'nconc | 1578 | 'nconc |
| 1580 | (mapcar | 1579 | (mapcar |
| 1581 | 'gud-jdb-build-class-source-alist-for-file | 1580 | 'gud-jdb-build-class-source-alist-for-file |
| 1582 | sources)) | 1581 | sources)) |
| 1583 | (kill-buffer gud-jdb-analysis-buffer) | 1582 | (kill-buffer gud-jdb-analysis-buffer) |
| 1584 | (setq gud-jdb-analysis-buffer nil))) | 1583 | (setq gud-jdb-analysis-buffer nil))) |
| 1585 | 1584 | ||
| 1586 | ;; Change what was given in the minibuffer to something that can be used to | 1585 | ;; Change what was given in the minibuffer to something that can be used to |
| 1587 | ;; invoke the debugger. | 1586 | ;; invoke the debugger. |
| 1588 | (defun gud-jdb-massage-args (file args) | 1587 | (defun gud-jdb-massage-args (file args) |
| 1589 | ;; The jdb executable must have whitespace between "-classpath" and | 1588 | ;; The jdb executable must have whitespace between "-classpath" and |
| 1590 | ;; it's value while gud-common-init expects all switch values to | 1589 | ;; its value while gud-common-init expects all switch values to |
| 1591 | ;; follow the switch keyword without intervening whitespace. We | 1590 | ;; follow the switch keyword without intervening whitespace. We |
| 1592 | ;; require that when the user enters the "-classpath" switch in the | 1591 | ;; require that when the user enters the "-classpath" switch in the |
| 1593 | ;; EMACS minibuffer that they do so without the intervening | 1592 | ;; EMACS minibuffer that they do so without the intervening |
| @@ -1596,35 +1595,35 @@ The file names should be absolute, or relative to the current directory.") | |||
| 1596 | ;; instance "-host" and "-password") but I don't care about them | 1595 | ;; instance "-host" and "-password") but I don't care about them |
| 1597 | ;; yet. | 1596 | ;; yet. |
| 1598 | (if args | 1597 | (if args |
| 1599 | (let (massaged-args user-error) | 1598 | (let (massaged-args user-error) |
| 1600 | 1599 | ||
| 1601 | (while | 1600 | (while |
| 1602 | (and args | 1601 | (and args |
| 1603 | (not (string-match "-classpath\\(.+\\)" (car args))) | 1602 | (not (string-match "-classpath\\(.+\\)" (car args))) |
| 1604 | (not (setq user-error | 1603 | (not (setq user-error |
| 1605 | (string-match "-classpath$" (car args))))) | 1604 | (string-match "-classpath$" (car args))))) |
| 1606 | (setq massaged-args (append massaged-args (list (car args)))) | 1605 | (setq massaged-args (append massaged-args (list (car args)))) |
| 1607 | (setq args (cdr args))) | 1606 | (setq args (cdr args))) |
| 1608 | 1607 | ||
| 1609 | ;; By this point the current directory is all screwed up. Maybe we | 1608 | ;; By this point the current directory is all screwed up. Maybe we |
| 1610 | ;; could fix things and re-invoke gud-common-init, but for now I think | 1609 | ;; could fix things and re-invoke gud-common-init, but for now I think |
| 1611 | ;; issueing the error is good enough. | 1610 | ;; issueing the error is good enough. |
| 1612 | (if user-error | 1611 | (if user-error |
| 1613 | (progn | 1612 | (progn |
| 1614 | (kill-buffer (current-buffer)) | 1613 | (kill-buffer (current-buffer)) |
| 1615 | (error "Error: Omit whitespace between '-classpath' and it's value"))) | 1614 | (error "Error: Omit whitespace between '-classpath' and it's value"))) |
| 1616 | 1615 | ||
| 1617 | (if args | 1616 | (if args |
| 1618 | (setq massaged-args | 1617 | (setq massaged-args |
| 1619 | (append | 1618 | (append |
| 1620 | massaged-args | 1619 | massaged-args |
| 1621 | (list "-classpath") | 1620 | (list "-classpath") |
| 1622 | (list | 1621 | (list |
| 1623 | (substring | 1622 | (substring |
| 1624 | (car args) | 1623 | (car args) |
| 1625 | (match-beginning 1) (match-end 1))) | 1624 | (match-beginning 1) (match-end 1))) |
| 1626 | (cdr args))) | 1625 | (cdr args))) |
| 1627 | massaged-args)))) | 1626 | massaged-args)))) |
| 1628 | 1627 | ||
| 1629 | ;; Search for an association with P, a fully qualified class name, in | 1628 | ;; Search for an association with P, a fully qualified class name, in |
| 1630 | ;; gud-jdb-class-source-alist. The asssociation gives the fully | 1629 | ;; gud-jdb-class-source-alist. The asssociation gives the fully |
| @@ -1638,91 +1637,91 @@ The file names should be absolute, or relative to the current directory.") | |||
| 1638 | 1637 | ||
| 1639 | ;; Build up the accumulator. | 1638 | ;; Build up the accumulator. |
| 1640 | (setq gud-marker-acc | 1639 | (setq gud-marker-acc |
| 1641 | (if gud-marker-acc | 1640 | (if gud-marker-acc |
| 1642 | (concat gud-marker-acc string) | 1641 | (concat gud-marker-acc string) |
| 1643 | string)) | 1642 | string)) |
| 1644 | 1643 | ||
| 1645 | ;; We process STRING from left to right. Each time through the following | 1644 | ;; We process STRING from left to right. Each time through the following |
| 1646 | ;; loop we process at most one marker. The start variable keeps track of | 1645 | ;; loop we process at most one marker. The start variable keeps track of |
| 1647 | ;; where we are in the input string through the iterations of this loop. | 1646 | ;; where we are in the input string through the iterations of this loop. |
| 1648 | (let (start file-found) | 1647 | (let (start file-found) |
| 1649 | 1648 | ||
| 1650 | ;; Process each complete marker in the input. There may be an incomplete | 1649 | ;; Process each complete marker in the input. There may be an incomplete |
| 1651 | ;; marker at the end of the input string. Incomplete markers are left | 1650 | ;; marker at the end of the input string. Incomplete markers are left |
| 1652 | ;; in the accumulator for processing the next time the function is called. | 1651 | ;; in the accumulator for processing the next time the function is called. |
| 1653 | (while | 1652 | (while |
| 1654 | 1653 | ||
| 1655 | ;; Do we see a marker? | 1654 | ;; Do we see a marker? |
| 1656 | (string-match | 1655 | (string-match |
| 1657 | ;; jdb puts out a string of the following form when it | 1656 | ;; jdb puts out a string of the following form when it |
| 1658 | ;; hits a breakpoint: | 1657 | ;; hits a breakpoint: |
| 1659 | ;; | 1658 | ;; |
| 1660 | ;; <fully-qualified-class><method> (<class>:<line-number>) | 1659 | ;; <fully-qualified-class><method> (<class>:<line-number>) |
| 1661 | ;; | 1660 | ;; |
| 1662 | ;; <fully-qualified-class>'s are composed of Java ID's | 1661 | ;; <fully-qualified-class>'s are composed of Java ID's |
| 1663 | ;; separated by periods. <method> and <class> are | 1662 | ;; separated by periods. <method> and <class> are |
| 1664 | ;; also Java ID's. <method> begins with a period and | 1663 | ;; also Java ID's. <method> begins with a period and |
| 1665 | ;; may contain less-than and greater-than (constructors, | 1664 | ;; may contain less-than and greater-than (constructors, |
| 1666 | ;; for instance, are called <init> in the symbol table.) | 1665 | ;; for instance, are called <init> in the symbol table.) |
| 1667 | ;; Java ID's begin with a letter followed by letters | 1666 | ;; Java ID's begin with a letter followed by letters |
| 1668 | ;; and/or digits. The set of letters includes underscore | 1667 | ;; and/or digits. The set of letters includes underscore |
| 1669 | ;; and dollar sign. | 1668 | ;; and dollar sign. |
| 1670 | ;; | 1669 | ;; |
| 1671 | ;; The first group matches <fully-qualified-class>, | 1670 | ;; The first group matches <fully-qualified-class>, |
| 1672 | ;; the second group matches <class> and the third group | 1671 | ;; the second group matches <class> and the third group |
| 1673 | ;; matches <line-number>. We don't care about using | 1672 | ;; matches <line-number>. We don't care about using |
| 1674 | ;; <method> so we don't "group" it. | 1673 | ;; <method> so we don't "group" it. |
| 1675 | ;; | 1674 | ;; |
| 1676 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII | 1675 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII |
| 1677 | ;; ID's only. | 1676 | ;; ID's only. |
| 1678 | "\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>]+ (\\([a-zA-Z0-9$_]+\\):\\([0-9]+\\))" | 1677 | "\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>]+ (\\([a-zA-Z0-9$_]+\\):\\([0-9]+\\))" |
| 1679 | gud-marker-acc start) | 1678 | gud-marker-acc start) |
| 1680 | 1679 | ||
| 1681 | ;; Figure out the line on which to position the debugging arrow. | 1680 | ;; Figure out the line on which to position the debugging arrow. |
| 1682 | ;; Return the info as a cons of the form: | 1681 | ;; Return the info as a cons of the form: |
| 1683 | ;; | 1682 | ;; |
| 1684 | ;; (<file-name> . <line-number>) . | 1683 | ;; (<file-name> . <line-number>) . |
| 1685 | (if (setq | 1684 | (if (setq |
| 1686 | file-found | 1685 | file-found |
| 1687 | (gud-jdb-find-source-file | 1686 | (gud-jdb-find-source-file |
| 1688 | (substring gud-marker-acc | 1687 | (substring gud-marker-acc |
| 1689 | (match-beginning 1) | 1688 | (match-beginning 1) |
| 1690 | (match-end 1)))) | 1689 | (match-end 1)))) |
| 1691 | (setq gud-last-frame | 1690 | (setq gud-last-frame |
| 1692 | (cons | 1691 | (cons |
| 1693 | file-found | 1692 | file-found |
| 1694 | (string-to-int | 1693 | (string-to-int |
| 1695 | (substring gud-marker-acc | 1694 | (substring gud-marker-acc |
| 1696 | (match-beginning 3) | 1695 | (match-beginning 3) |
| 1697 | (match-end 3))))) | 1696 | (match-end 3))))) |
| 1698 | (message "Could not find source file.")) | 1697 | (message "Could not find source file.")) |
| 1699 | 1698 | ||
| 1700 | ;; Set start after the last character of STRING that we've looked at | 1699 | ;; Set start after the last character of STRING that we've looked at |
| 1701 | ;; and loop to look for another marker. | 1700 | ;; and loop to look for another marker. |
| 1702 | (setq start (match-end 0)))) | 1701 | (setq start (match-end 0)))) |
| 1703 | 1702 | ||
| 1704 | ;; We don't filter any debugger output so just return what we were given. | 1703 | ;; We don't filter any debugger output so just return what we were given. |
| 1705 | string) | 1704 | string) |
| 1706 | 1705 | ||
| 1707 | (defun gud-jdb-find-file (f) | 1706 | (defun gud-jdb-find-file (f) |
| 1708 | (and (file-readable-p f) | 1707 | (and (file-readable-p f) |
| 1709 | (find-file-noselect f))) | 1708 | (find-file-noselect f))) |
| 1710 | 1709 | ||
| 1711 | (defvar gud-jdb-command-name "jdb" "Command that executes the Java debugger.") | 1710 | (defvar gud-jdb-command-name "jdb" "Command that executes the Java debugger.") |
| 1712 | 1711 | ||
| 1713 | ;;;###autoload | 1712 | ;;;###autoload |
| 1714 | (defun jdb (command-line) | 1713 | (defun jdb (command-line) |
| 1715 | "Run jdb with command line COMMAND-LINE in a buffer. The buffer is named | 1714 | "Run jdb with command line COMMAND-LINE in a buffer. The buffer is named |
| 1716 | \"*gud*\" if no initial class is given or \"*gud-<initial-class-basename>*\" | 1715 | \"*gud*\" if no initial class is given or \"*gud-<initial-class-basename>*\" |
| 1717 | if there is. If the \"-classpath\" switch is given, omit all whitespace | 1716 | if there is. If the \"-classpath\" switch is given, omit all whitespace |
| 1718 | between it and it's value." | 1717 | between it and it's value." |
| 1719 | (interactive | 1718 | (interactive |
| 1720 | (list (read-from-minibuffer "Run jdb (like this): " | 1719 | (list (read-from-minibuffer "Run jdb (like this): " |
| 1721 | (if (consp gud-jdb-history) | 1720 | (if (consp gud-jdb-history) |
| 1722 | (car gud-jdb-history) | 1721 | (car gud-jdb-history) |
| 1723 | (concat gud-jdb-command-name " ")) | 1722 | (concat gud-jdb-command-name " ")) |
| 1724 | nil nil | 1723 | nil nil |
| 1725 | '(gud-jdb-history . 1)))) | 1724 | '(gud-jdb-history . 1)))) |
| 1726 | 1725 | ||
| 1727 | (gud-common-init command-line 'gud-jdb-massage-args | 1726 | (gud-common-init command-line 'gud-jdb-massage-args |
| 1728 | 'gud-jdb-marker-filter 'gud-jdb-find-file) | 1727 | 'gud-jdb-marker-filter 'gud-jdb-find-file) |
| @@ -1742,9 +1741,9 @@ between it and it's value." | |||
| 1742 | (setq | 1741 | (setq |
| 1743 | gud-jdb-class-source-alist | 1742 | gud-jdb-class-source-alist |
| 1744 | (gud-jdb-build-class-source-alist | 1743 | (gud-jdb-build-class-source-alist |
| 1745 | (setq | 1744 | (setq |
| 1746 | gud-jdb-source-files | 1745 | gud-jdb-source-files |
| 1747 | (gud-jdb-build-source-files-list gud-jdb-directories "\\.java$"))))) | 1746 | (gud-jdb-build-source-files-list gud-jdb-directories "\\.java$"))))) |
| 1748 | 1747 | ||
| 1749 | 1748 | ||
| 1750 | ;; | 1749 | ;; |
| @@ -2129,7 +2128,7 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2129 | (setq subst (if insource | 2128 | (setq subst (if insource |
| 2130 | (save-excursion | 2129 | (save-excursion |
| 2131 | (beginning-of-line) | 2130 | (beginning-of-line) |
| 2132 | (save-restriction (widen) | 2131 | (save-restriction (widen) |
| 2133 | (1+ (count-lines 1 (point))))) | 2132 | (1+ (count-lines 1 (point))))) |
| 2134 | (cdr frame)))) | 2133 | (cdr frame)))) |
| 2135 | ((eq key ?e) | 2134 | ((eq key ?e) |
| @@ -2156,7 +2155,7 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2156 | (progn (re-search-forward "[^0-9a-f]") | 2155 | (progn (re-search-forward "[^0-9a-f]") |
| 2157 | (forward-char -1) | 2156 | (forward-char -1) |
| 2158 | (point)))) | 2157 | (point)))) |
| 2159 | (t (setq begin (progn (re-search-backward "[^0-9]") | 2158 | (t (setq begin (progn (re-search-backward "[^0-9]") |
| 2160 | (forward-char 1) | 2159 | (forward-char 1) |
| 2161 | (point))) | 2160 | (point))) |
| 2162 | (forward-char 1) | 2161 | (forward-char 1) |
| @@ -2246,14 +2245,14 @@ and create such a submap in that new map." | |||
| 2246 | (defun gud-innermost-expr () | 2245 | (defun gud-innermost-expr () |
| 2247 | "Returns the smallest expr that point is in; move point to beginning of it. | 2246 | "Returns the smallest expr that point is in; move point to beginning of it. |
| 2248 | The expr is represented as a cons cell, where the car specifies the point in | 2247 | The expr is represented as a cons cell, where the car specifies the point in |
| 2249 | the current buffer that marks the beginning of the expr and the cdr specifies | 2248 | the current buffer that marks the beginning of the expr and the cdr specifies |
| 2250 | the character after the end of the expr." | 2249 | the character after the end of the expr." |
| 2251 | (let ((p (point)) begin end) | 2250 | (let ((p (point)) begin end) |
| 2252 | (gud-backward-sexp) | 2251 | (gud-backward-sexp) |
| 2253 | (setq begin (point)) | 2252 | (setq begin (point)) |
| 2254 | (gud-forward-sexp) | 2253 | (gud-forward-sexp) |
| 2255 | (setq end (point)) | 2254 | (setq end (point)) |
| 2256 | (if (>= p end) | 2255 | (if (>= p end) |
| 2257 | (progn | 2256 | (progn |
| 2258 | (setq begin p) | 2257 | (setq begin p) |
| 2259 | (goto-char p) | 2258 | (goto-char p) |
| @@ -2278,7 +2277,7 @@ the character after the end of the expr." | |||
| 2278 | (defun gud-prev-expr () | 2277 | (defun gud-prev-expr () |
| 2279 | "Returns the previous expr, point is set to beginning of that expr. | 2278 | "Returns the previous expr, point is set to beginning of that expr. |
| 2280 | The expr is represented as a cons cell, where the car specifies the point in | 2279 | The expr is represented as a cons cell, where the car specifies the point in |
| 2281 | the current buffer that marks the beginning of the expr and the cdr specifies | 2280 | the current buffer that marks the beginning of the expr and the cdr specifies |
| 2282 | the character after the end of the expr" | 2281 | the character after the end of the expr" |
| 2283 | (let ((begin) (end)) | 2282 | (let ((begin) (end)) |
| 2284 | (gud-backward-sexp) | 2283 | (gud-backward-sexp) |
| @@ -2291,7 +2290,7 @@ the character after the end of the expr" | |||
| 2291 | (defun gud-next-expr () | 2290 | (defun gud-next-expr () |
| 2292 | "Returns the following expr, point is set to beginning of that expr. | 2291 | "Returns the following expr, point is set to beginning of that expr. |
| 2293 | The expr is represented as a cons cell, where the car specifies the point in | 2292 | The expr is represented as a cons cell, where the car specifies the point in |
| 2294 | the current buffer that marks the beginning of the expr and the cdr specifies | 2293 | the current buffer that marks the beginning of the expr and the cdr specifies |
| 2295 | the character after the end of the expr." | 2294 | the character after the end of the expr." |
| 2296 | (let ((begin) (end)) | 2295 | (let ((begin) (end)) |
| 2297 | (gud-forward-sexp) | 2296 | (gud-forward-sexp) |
| @@ -2313,7 +2312,7 @@ If no punctuation is found, return `? '." | |||
| 2313 | (cond | 2312 | (cond |
| 2314 | ((= syntax ?\ ) t) | 2313 | ((= syntax ?\ ) t) |
| 2315 | ((= syntax ?.) (setq syntax (char-after span-start)) | 2314 | ((= syntax ?.) (setq syntax (char-after span-start)) |
| 2316 | (cond | 2315 | (cond |
| 2317 | ((= syntax ?.) (setq result ?.)) | 2316 | ((= syntax ?.) (setq result ?.)) |
| 2318 | ((and (= syntax ?-) (= (char-after (+ span-start 1)) ?>)) | 2317 | ((and (= syntax ?-) (= (char-after (+ span-start 1)) ?>)) |
| 2319 | (setq result ?.) | 2318 | (setq result ?.) |
| @@ -2325,8 +2324,8 @@ If no punctuation is found, return `? '." | |||
| 2325 | 2324 | ||
| 2326 | (defun gud-expr-compound (first second) | 2325 | (defun gud-expr-compound (first second) |
| 2327 | "Non-nil if concatenating FIRST and SECOND makes a single C expression. | 2326 | "Non-nil if concatenating FIRST and SECOND makes a single C expression. |
| 2328 | The two exprs are represented as a cons cells, where the car | 2327 | The two exprs are represented as a cons cells, where the car |
| 2329 | specifies the point in the current buffer that marks the beginning of the | 2328 | specifies the point in the current buffer that marks the beginning of the |
| 2330 | expr and the cdr specifies the character after the end of the expr. | 2329 | expr and the cdr specifies the character after the end of the expr. |
| 2331 | Link exprs of the form: | 2330 | Link exprs of the form: |
| 2332 | Expr -> Expr | 2331 | Expr -> Expr |