aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2008-07-01 01:57:50 +0000
committerNick Roberts2008-07-01 01:57:50 +0000
commit959005e4db6c259b7a76b425cb6062004c42804a (patch)
treeb48012d1d63880b7ce71c2a70a6218b480816d65
parent21247f1b17543d8483bebb7bbb312a67756dad0f (diff)
downloademacs-959005e4db6c259b7a76b425cb6062004c42804a.tar.gz
emacs-959005e4db6c259b7a76b425cb6062004c42804a.zip
(gdb-create-source-file-list): New option.
(gdb-init-2): Use it. Don't run gdb-mode-hook again. (gdb-var-list-children-regexp, gdb-var-update-regexp) (gdb-info-breakpoints-custom, gdb-stack-list-frames-regexp) (gdb-var-list-children-regexp-1, gdb-var-update-regexp-1) (gdb-stack-list-locals-regexp): Future proof regexps better.
-rw-r--r--lisp/progmodes/gdb-ui.el51
1 files changed, 31 insertions, 20 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 9bea7c703a5..7f49679641c 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -366,6 +366,18 @@ predefined macros."
366 :group 'gdb 366 :group 'gdb
367 :version "22.1") 367 :version "22.1")
368 368
369(defcustom gdb-create-source-file-list t
370 "Non-nil means create a list of files from which the executable was built.
371Set this to nil if the GUD buffer displays \"initializing...\" in the mode
372line for a long time when starting, possibly because your executable was
373built from a large number of files. This allows quicker initialization
374but means that these files are not automatically enabled for debugging,
375e.g., you won't be able to click in the fringe to set a breakpoint until
376execution has already stopped there."
377 :type 'boolean
378 :group 'gdb
379 :version "23.1")
380
369(defcustom gdb-show-main nil 381(defcustom gdb-show-main nil
370 "Non-nil means display source file containing the main routine at startup. 382 "Non-nil means display source file containing the main routine at startup.
371Also display the main routine in the disassembly buffer if present." 383Also display the main routine in the disassembly buffer if present."
@@ -652,7 +664,7 @@ otherwise do not."
652 (gdb-enqueue-input (list "set width 0\n" 'ignore)) 664 (gdb-enqueue-input (list "set width 0\n" 'ignore))
653 665
654 (if (string-equal gdb-version "pre-6.4") 666 (if (string-equal gdb-version "pre-6.4")
655 (progn 667 (if gdb-create-source-file-list
656 (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n") 668 (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n")
657 'gdb-set-gud-minor-mode-existing-buffers)) 669 'gdb-set-gud-minor-mode-existing-buffers))
658 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1)) 670 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1))
@@ -660,17 +672,16 @@ otherwise do not."
660 (list "server interpreter mi -data-list-register-names\n" 672 (list "server interpreter mi -data-list-register-names\n"
661 'gdb-get-register-names)) 673 'gdb-get-register-names))
662 ; Needs GDB 6.2 onwards. 674 ; Needs GDB 6.2 onwards.
663 (gdb-enqueue-input 675 (if gdb-create-source-file-list
664 (list "server interpreter mi \"-file-list-exec-source-files\"\n" 676 (gdb-enqueue-input
665 'gdb-set-gud-minor-mode-existing-buffers-1)) 677 (list "server interpreter mi \"-file-list-exec-source-files\"\n"
678 'gdb-set-gud-minor-mode-existing-buffers-1)))
666 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2)) 679 (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2))
667 680
668 ;; Find source file and compilation directory here. 681 ;; Find source file and compilation directory here.
669 ;; Works for C, C++, Fortran and Ada but not Java (GDB 6.4) 682 ;; Works for C, C++, Fortran and Ada but not Java (GDB 6.4)
670 (gdb-enqueue-input (list "server list\n" 'ignore)) 683 (gdb-enqueue-input (list "server list\n" 'ignore))
671 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) 684 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)))
672
673 (run-hooks 'gdb-mode-hook))
674 685
675(defun gdb-get-version () 686(defun gdb-get-version ()
676 (goto-char (point-min)) 687 (goto-char (point-min))
@@ -853,8 +864,8 @@ With arg, enter name of variable to be watched in the minibuffer."
853 `(lambda () (gdb-var-list-children-handler ,varnum))))) 864 `(lambda () (gdb-var-list-children-handler ,varnum)))))
854 865
855(defconst gdb-var-list-children-regexp 866(defconst gdb-var-list-children-regexp
856 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ 867 "child={.*?name=\"\\(.*?\\)\".*?,exp=\"\\(.*?\\)\".*?,\
857numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") 868numchild=\"\\(.*?\\)\"\\(}\\|.*?,\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
858 869
859(defun gdb-var-list-children-handler (varnum) 870(defun gdb-var-list-children-handler (varnum)
860 (goto-char (point-min)) 871 (goto-char (point-min))
@@ -891,7 +902,7 @@ numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
891 (push 'gdb-var-update gdb-pending-triggers))) 902 (push 'gdb-var-update gdb-pending-triggers)))
892 903
893(defconst gdb-var-update-regexp 904(defconst gdb-var-update-regexp
894 "{.*?name=\"\\(.*?\\)\",.*?in_scope=\"\\(.*?\\)\",.*?\ 905 "{.*?name=\"\\(.*?\\)\".*?,in_scope=\"\\(.*?\\)\".*?,\
895type_changed=\".*?\".*?}") 906type_changed=\".*?\".*?}")
896 907
897(defun gdb-var-update-handler () 908(defun gdb-var-update-handler ()
@@ -1960,7 +1971,7 @@ static char *magick[] = {
1960 (match-beginning 1) (match-end 1) 1971 (match-beginning 1) (match-end 1)
1961 '(face font-lock-function-name-face))) 1972 '(face font-lock-function-name-face)))
1962 (if (re-search-forward 1973 (if (re-search-forward
1963 ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$" nil t) 1974 ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$" el t)
1964 (let ((line (match-string 2)) 1975 (let ((line (match-string 2))
1965 (file (match-string 1))) 1976 (file (match-string 1)))
1966 (add-text-properties bl el 1977 (add-text-properties bl el
@@ -3638,8 +3649,8 @@ is set in them."
3638 3649
3639;; Used for -stack-info-frame but could be used for -stack-list-frames too. 3650;; Used for -stack-info-frame but could be used for -stack-list-frames too.
3640(defconst gdb-stack-list-frames-regexp 3651(defconst gdb-stack-list-frames-regexp
3641".*?level=\"\\(.*?\\)\",.*?addr=\"\\(.*?\\)\",.*?func=\"\\(.*?\\)\",\ 3652".*?level=\"\\(.*?\\)\".*?,addr=\"\\(.*?\\)\".*?,func=\"\\(.*?\\)\",\
3642\\(?:.*?file=\".*?\",.*?fullname=\"\\(.*?\\)\",.*?line=\"\\(.*?\\)\".*?}\\|\ 3653\\(?:.*?file=\".*?\".*?,fullname=\"\\(.*?\\)\".*?,line=\"\\(.*?\\)\".*?}\\|\
3643from=\"\\(.*?\\)\"\\)") 3654from=\"\\(.*?\\)\"\\)")
3644 3655
3645(defun gdb-frame-handler-1 () 3656(defun gdb-frame-handler-1 ()
@@ -3682,9 +3693,9 @@ from=\"\\(.*?\\)\"\\)")
3682 `(lambda () (gdb-var-list-children-handler-1 ,varnum))))) 3693 `(lambda () (gdb-var-list-children-handler-1 ,varnum)))))
3683 3694
3684(defconst gdb-var-list-children-regexp-1 3695(defconst gdb-var-list-children-regexp-1
3685 "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\ 3696 "child={.*?name=\"\\(.+?\\)\".*?,exp=\"\\(.+?\\)\".*?,\
3686numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\ 3697numchild=\"\\(.+?\\)\".*?,value=\\(\".*?\"\\)\
3687\\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)") 3698\\(}\\|.*?,\\(type=\"\\(.+?\\)\"\\)?.*?}\\)")
3688 3699
3689(defun gdb-var-list-children-handler-1 (varnum) 3700(defun gdb-var-list-children-handler-1 (varnum)
3690 (goto-char (point-min)) 3701 (goto-char (point-min))
@@ -3721,7 +3732,7 @@ numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\
3721 (push 'gdb-var-update gdb-pending-triggers)))) 3732 (push 'gdb-var-update gdb-pending-triggers))))
3722 3733
3723(defconst gdb-var-update-regexp-1 3734(defconst gdb-var-update-regexp-1
3724 "{.*?name=\"\\(.*?\\)\",.*?\\(?:value=\\(\".*?\"\\),\\)?.*?\ 3735 "{.*?name=\"\\(.*?\\)\".*?,\\(?:value=\\(\".*?\"\\),\\)?.*?\
3725in_scope=\"\\(.*?\\)\".*?}") 3736in_scope=\"\\(.*?\\)\".*?}")
3726 3737
3727(defun gdb-var-update-handler-1 () 3738(defun gdb-var-update-handler-1 ()
@@ -3761,7 +3772,7 @@ in_scope=\"\\(.*?\\)\".*?}")
3761 gdb-data-list-register-values-handler) 3772 gdb-data-list-register-values-handler)
3762 3773
3763(defconst gdb-data-list-register-values-regexp 3774(defconst gdb-data-list-register-values-regexp
3764 "{.*?number=\"\\(.*?\\)\",.*?value=\"\\(.*?\\)\".*?}") 3775 "{.*?number=\"\\(.*?\\)\".*?,value=\"\\(.*?\\)\".*?}")
3765 3776
3766(defun gdb-data-list-register-values-handler () 3777(defun gdb-data-list-register-values-handler ()
3767 (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1 3778 (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1
@@ -3856,7 +3867,7 @@ in_scope=\"\\(.*?\\)\".*?}")
3856 gdb-stack-list-locals-handler) 3867 gdb-stack-list-locals-handler)
3857 3868
3858(defconst gdb-stack-list-locals-regexp 3869(defconst gdb-stack-list-locals-regexp
3859 "{.*?name=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\"") 3870 "{.*?name=\"\\(.*?\\)\".*?,type=\"\\(.*?\\)\"")
3860 3871
3861(defvar gdb-locals-watch-map-1 3872(defvar gdb-locals-watch-map-1
3862 (let ((map (make-sparse-keymap))) 3873 (let ((map (make-sparse-keymap)))
@@ -3883,7 +3894,7 @@ in_scope=\"\\(.*?\\)\".*?}")
3883 (let* ((var (current-word)) 3894 (let* ((var (current-word))
3884 (value (read-string (format "New value (%s): " var)))) 3895 (value (read-string (format "New value (%s): " var))))
3885 (gdb-enqueue-input 3896 (gdb-enqueue-input
3886 (list (concat gdb-server-prefix"set variable " var " = " value "\n") 3897 (list (concat gdb-server-prefix "set variable " var " = " value "\n")
3887 'ignore))))) 3898 'ignore)))))
3888 3899
3889;; Dont display values of arrays or structures. 3900;; Dont display values of arrays or structures.