diff options
| author | Pavel Janík | 2002-12-21 23:06:34 +0000 |
|---|---|---|
| committer | Pavel Janík | 2002-12-21 23:06:34 +0000 |
| commit | b059213896f9a3f3e78fc447a90764f5e24df295 (patch) | |
| tree | e270b9f35a06e8a6bd4946708b09d7938384865c | |
| parent | 02a0d085b2a6f5eae286a96559e052344ee24e48 (diff) | |
| download | emacs-b059213896f9a3f3e78fc447a90764f5e24df295.tar.gz emacs-b059213896f9a3f3e78fc447a90764f5e24df295.zip | |
(gud-menu-map): Add jdb support for "run".
(gud-jdb-find-source-using-classpath): Use 'identity.
(gud-jdb-marker-filter): Marker regexp and filename filtering change to
support a backwards-incompatible change in Sun's jdb line number display in
SDK versions 1.4.
(gud-format-command): gud-find-class now requires two parameters (file and
linenumber).
(gud-find-class): Bulk of the change related to using c-syntactic symbols
to locate nested class declarations in java sources visited by java-mode
(cc-mode).
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/gud.el | 124 |
2 files changed, 110 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d8cf057768..7cc566e564a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2002-12-22 Zoltan Kemenczy <zoltan@ieee.org> | ||
| 2 | |||
| 3 | * gud.el (gud-menu-map): Add jdb support for "run". | ||
| 4 | (gud-jdb-find-source-using-classpath): Use 'identity. | ||
| 5 | (gud-jdb-marker-filter): Marker regexp and filename filtering | ||
| 6 | change to support a backwards-incompatible change in Sun's jdb | ||
| 7 | line number display in SDK versions 1.4. | ||
| 8 | (gud-format-command): gud-find-class now requires two | ||
| 9 | parameters (file and linenumber). | ||
| 10 | (gud-find-class): Bulk of the change related to using c-syntactic | ||
| 11 | symbols to locate nested class declarations in java sources | ||
| 12 | visited by java-mode (cc-mode). | ||
| 13 | |||
| 1 | 2002-12-21 Nick Roberts <nick@nick.uklinux.net> | 14 | 2002-12-21 Nick Roberts <nick@nick.uklinux.net> |
| 2 | 15 | ||
| 3 | * gdb-ui.el Remove the concept of an instance. This means that | 16 | * gdb-ui.el Remove the concept of an instance. This means that |
diff --git a/lisp/gud.el b/lisp/gud.el index e3c2c9f41bf..2842ce09ab1 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -93,7 +93,7 @@ Used to grey out relevant toolbar icons.") | |||
| 93 | '(([refresh] "Refresh" . gud-refresh) | 93 | '(([refresh] "Refresh" . gud-refresh) |
| 94 | ([run] menu-item "Run" gud-run | 94 | ([run] menu-item "Run" gud-run |
| 95 | :enable (and (not gud-running) | 95 | :enable (and (not gud-running) |
| 96 | (memq gud-minor-mode '(gdba gdb)))) | 96 | (memq gud-minor-mode '(gdba gdb jdb)))) |
| 97 | ([goto] menu-item "Continue to selection" gud-goto | 97 | ([goto] menu-item "Continue to selection" gud-goto |
| 98 | :enable (and (not gud-running) | 98 | :enable (and (not gud-running) |
| 99 | (memq gud-minor-mode '(gdba gdb)))) | 99 | (memq gud-minor-mode '(gdba gdb)))) |
| @@ -1367,6 +1367,7 @@ and source-file directory for your debugger." | |||
| 1367 | ;; | 1367 | ;; |
| 1368 | ;; CREATED: Sun Feb 22 10:46:38 1998 Derek Davies. | 1368 | ;; CREATED: Sun Feb 22 10:46:38 1998 Derek Davies. |
| 1369 | ;; UPDATED: Nov 11, 2001 Zoltan Kemenczy | 1369 | ;; UPDATED: Nov 11, 2001 Zoltan Kemenczy |
| 1370 | ;; Dec 10, 2002 Zoltan Kemenczy - added nested class support | ||
| 1370 | ;; | 1371 | ;; |
| 1371 | ;; INVOCATION NOTES: | 1372 | ;; INVOCATION NOTES: |
| 1372 | ;; | 1373 | ;; |
| @@ -1810,7 +1811,7 @@ relative to a classpath directory." | |||
| 1810 | ;; name relative to classpath | 1811 | ;; name relative to classpath |
| 1811 | (filename | 1812 | (filename |
| 1812 | (concat | 1813 | (concat |
| 1813 | (mapconcat (lambda (x) x) | 1814 | (mapconcat 'identity |
| 1814 | (split-string | 1815 | (split-string |
| 1815 | ;; Eliminate any subclass references in the class | 1816 | ;; Eliminate any subclass references in the class |
| 1816 | ;; name string. These start with a "$" | 1817 | ;; name string. These start with a "$" |
| @@ -1897,8 +1898,15 @@ nil) | |||
| 1897 | ;; | 1898 | ;; |
| 1898 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII | 1899 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII |
| 1899 | ;; ID's only. | 1900 | ;; ID's only. |
| 1900 | "\\(?:\[\\([0-9]+\\)\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ | 1901 | ;; |
| 1901 | \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9]+\\)" | 1902 | ;; The "," in the last square-bracket is necessary because of |
| 1903 | ;; Sun's total disrespect for backwards compatibility in | ||
| 1904 | ;; reported line numbers from jdb - starting in 1.4.0 they | ||
| 1905 | ;; introduced a comma at the thousands position (how | ||
| 1906 | ;; ingenious!) | ||
| 1907 | |||
| 1908 | "\\(\[[0-9]+\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ | ||
| 1909 | \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9,]+\\)" | ||
| 1902 | gud-marker-acc) | 1910 | gud-marker-acc) |
| 1903 | 1911 | ||
| 1904 | ;; A good marker is one that: | 1912 | ;; A good marker is one that: |
| @@ -1911,7 +1919,10 @@ nil) | |||
| 1911 | ;; (<file-name> . <line-number>) . | 1919 | ;; (<file-name> . <line-number>) . |
| 1912 | (if (if (match-beginning 1) | 1920 | (if (if (match-beginning 1) |
| 1913 | (let (n) | 1921 | (let (n) |
| 1914 | (setq n (string-to-int (match-string 1 gud-marker-acc))) | 1922 | (setq n (string-to-int (substring |
| 1923 | gud-marker-acc | ||
| 1924 | (1+ (match-beginning 1)) | ||
| 1925 | (- (match-end 1) 2)))) | ||
| 1915 | (if (< n gud-jdb-lowest-stack-level) | 1926 | (if (< n gud-jdb-lowest-stack-level) |
| 1916 | (progn (setq gud-jdb-lowest-stack-level n) t))) | 1927 | (progn (setq gud-jdb-lowest-stack-level n) t))) |
| 1917 | t) | 1928 | t) |
| @@ -1919,7 +1930,12 @@ nil) | |||
| 1919 | (gud-jdb-find-source (match-string 2 gud-marker-acc))) | 1930 | (gud-jdb-find-source (match-string 2 gud-marker-acc))) |
| 1920 | (setq gud-last-frame | 1931 | (setq gud-last-frame |
| 1921 | (cons file-found | 1932 | (cons file-found |
| 1922 | (string-to-int (match-string 4 gud-marker-acc)))) | 1933 | (string-to-int |
| 1934 | (let | ||
| 1935 | ((numstr (match-string 4 gud-marker-acc))) | ||
| 1936 | (if (string-match "," numstr) | ||
| 1937 | (replace-match "" nil nil numstr) | ||
| 1938 | numstr))))) | ||
| 1923 | (message "Could not find source file."))) | 1939 | (message "Could not find source file."))) |
| 1924 | 1940 | ||
| 1925 | ;; Set the accumulator to the remaining text. | 1941 | ;; Set the accumulator to the remaining text. |
| @@ -1990,6 +2006,7 @@ gud, see `gud-mode'." | |||
| 1990 | (gud-def gud-finish "step up" "\C-f" "Continue until current method returns.") | 2006 | (gud-def gud-finish "step up" "\C-f" "Continue until current method returns.") |
| 1991 | (gud-def gud-up "up\C-Mwhere" "<" "Up one stack frame.") | 2007 | (gud-def gud-up "up\C-Mwhere" "<" "Up one stack frame.") |
| 1992 | (gud-def gud-down "down\C-Mwhere" ">" "Up one stack frame.") | 2008 | (gud-def gud-down "down\C-Mwhere" ">" "Up one stack frame.") |
| 2009 | (gud-def gud-run "run" nil "Run the program.") ;if VM start using jdb | ||
| 1993 | 2010 | ||
| 1994 | (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") | 2011 | (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") |
| 1995 | (setq paragraph-start comint-prompt-regexp) | 2012 | (setq paragraph-start comint-prompt-regexp) |
| @@ -2524,9 +2541,17 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2524 | ((eq key ?a) | 2541 | ((eq key ?a) |
| 2525 | (setq subst (gud-read-address))) | 2542 | (setq subst (gud-read-address))) |
| 2526 | ((eq key ?c) | 2543 | ((eq key ?c) |
| 2527 | (setq subst (gud-find-class (if insource | 2544 | (setq subst |
| 2528 | (buffer-file-name) | 2545 | (gud-find-class |
| 2529 | (car frame))))) | 2546 | (if insource |
| 2547 | (buffer-file-name) | ||
| 2548 | (car frame)) | ||
| 2549 | (if insource | ||
| 2550 | (save-restriction | ||
| 2551 | (widen) | ||
| 2552 | (+ (count-lines (point-min) (point)) | ||
| 2553 | (if (bolp) 1 0))) | ||
| 2554 | (cdr frame))))) | ||
| 2530 | ((eq key ?p) | 2555 | ((eq key ?p) |
| 2531 | (setq subst (if arg (int-to-string arg))))) | 2556 | (setq subst (if arg (int-to-string arg))))) |
| 2532 | (setq result (concat result (match-string 1 str) subst))) | 2557 | (setq result (concat result (match-string 1 str) subst))) |
| @@ -2730,32 +2755,77 @@ Link exprs of the form: | |||
| 2730 | (t nil))) | 2755 | (t nil))) |
| 2731 | (t nil)))) | 2756 | (t nil)))) |
| 2732 | 2757 | ||
| 2733 | (defun gud-find-class (f) | 2758 | (defun gud-find-class (f line) |
| 2734 | "Find fully qualified class corresponding to file F. | 2759 | "Find fully qualified class in file F at line LINE. |
| 2735 | This function uses the `gud-jdb-classpath' (and optional | 2760 | This function uses the `gud-jdb-classpath' (and optional |
| 2736 | `gud-jdb-sourcepath') list(s) to derive a file | 2761 | `gud-jdb-sourcepath') list(s) to derive a file |
| 2737 | pathname relative to its classpath directory. The values in | 2762 | pathname relative to its classpath directory. The values in |
| 2738 | `gud-jdb-classpath' are assumed to have been converted to absolute | 2763 | `gud-jdb-classpath' are assumed to have been converted to absolute |
| 2739 | pathname standards using file-truename." | 2764 | pathname standards using file-truename. |
| 2765 | If F is visited by a buffer and its mode is CC-mode(Java), | ||
| 2766 | syntactic information of LINE is used to find the enclosing (nested) | ||
| 2767 | class string which is appended to the top level | ||
| 2768 | class of the file (using s to separate nested class ids)." | ||
| 2740 | ;; Convert f to a standard representation and remove suffix | 2769 | ;; Convert f to a standard representation and remove suffix |
| 2741 | (if (and gud-jdb-use-classpath (or gud-jdb-classpath gud-jdb-sourcepath)) | 2770 | (if (and gud-jdb-use-classpath (or gud-jdb-classpath gud-jdb-sourcepath)) |
| 2742 | (save-match-data | 2771 | (save-match-data |
| 2743 | (let ((cplist (append gud-jdb-sourcepath gud-jdb-classpath)) | 2772 | (let ((cplist (append gud-jdb-sourcepath gud-jdb-classpath)) |
| 2744 | class-found) | 2773 | (fbuffer (get-file-buffer f)) |
| 2745 | (setq f (file-name-sans-extension (file-truename f))) | 2774 | class-found) |
| 2746 | ;; Search through classpath list for an entry that is | 2775 | (setq f (file-name-sans-extension (file-truename f))) |
| 2747 | ;; contained in f | 2776 | ;; Search through classpath list for an entry that is |
| 2748 | (while (and cplist (not class-found)) | 2777 | ;; contained in f |
| 2749 | (if (string-match (car cplist) f) | 2778 | (while (and cplist (not class-found)) |
| 2750 | (setq class-found | 2779 | (if (string-match (car cplist) f) |
| 2780 | (setq class-found | ||
| 2751 | (mapconcat 'identity | 2781 | (mapconcat 'identity |
| 2752 | (split-string | 2782 | (split-string |
| 2753 | (substring f (+ (match-end 0) 1)) | 2783 | (substring f (+ (match-end 0) 1)) |
| 2754 | "/") "."))) | 2784 | "/") "."))) |
| 2755 | (setq cplist (cdr cplist))) | 2785 | (setq cplist (cdr cplist))) |
| 2756 | (if (not class-found) | 2786 | ;; if f is visited by a java(cc-mode) buffer, walk up the |
| 2757 | (message "gud-find-class: class for file %s not found!" f)) | 2787 | ;; syntactic information chain and collect any 'inclass |
| 2758 | class-found)) | 2788 | ;; symbols until 'topmost-intro is reached to find out if |
| 2789 | ;; point is within a nested class | ||
| 2790 | (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode")) | ||
| 2791 | (save-excursion | ||
| 2792 | (set-buffer fbuffer) | ||
| 2793 | (let ((nclass) (syntax) | ||
| 2794 | (pos (point))) | ||
| 2795 | ;; While the c-syntactic information does not start | ||
| 2796 | ;; with the 'topmost-intro symbol, there may be | ||
| 2797 | ;; nested classes... | ||
| 2798 | (while (not (eq 'topmost-intro | ||
| 2799 | (car (car (c-guess-basic-syntax))))) | ||
| 2800 | ;; Check if the current position c-syntactic | ||
| 2801 | ;; analysis has 'inclass | ||
| 2802 | (setq syntax (c-guess-basic-syntax)) | ||
| 2803 | (while | ||
| 2804 | (and (not (eq 'inclass (car (car syntax)))) | ||
| 2805 | (cdr syntax)) | ||
| 2806 | (setq syntax (cdr syntax))) | ||
| 2807 | (if (eq 'inclass (car (car syntax))) | ||
| 2808 | (progn | ||
| 2809 | (goto-char (cdr (car syntax))) | ||
| 2810 | ;; Now we're at the beginning of a class | ||
| 2811 | ;; definition. Find class name | ||
| 2812 | (looking-at | ||
| 2813 | "[A-Za-z0-9 \t\n]*?class[ \t\n]+\\([^ \t\n]+\\)") | ||
| 2814 | (setq nclass | ||
| 2815 | (append (list (match-string-no-properties 1)) | ||
| 2816 | nclass))) | ||
| 2817 | (setq syntax (c-guess-basic-syntax)) | ||
| 2818 | (while (and (not (cdr (car syntax))) (cdr syntax)) | ||
| 2819 | (setq syntax (cdr syntax))) | ||
| 2820 | (goto-char (cdr (car syntax))) | ||
| 2821 | )) | ||
| 2822 | (string-match (concat (car nclass) "$") class-found) | ||
| 2823 | (setq class-found | ||
| 2824 | (replace-match (mapconcat 'identity nclass "$") | ||
| 2825 | t t class-found))))) | ||
| 2826 | (if (not class-found) | ||
| 2827 | (message "gud-find-class: class for file %s not found!" f)) | ||
| 2828 | class-found)) | ||
| 2759 | ;; Not using classpath - try class/source association list | 2829 | ;; Not using classpath - try class/source association list |
| 2760 | (let ((class-found (rassoc f gud-jdb-class-source-alist))) | 2830 | (let ((class-found (rassoc f gud-jdb-class-source-alist))) |
| 2761 | (if class-found | 2831 | (if class-found |