• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/progmodes/

Lines Matching +refs:gdb +refs:buffer +refs:list

29 ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu> It was
47 (defvar gdb-active-process)
48 (defvar gdb-define-alist)
49 (defvar gdb-macro-info)
50 (defvar gdb-server-prefix)
51 (defvar gdb-show-changed-values)
52 (defvar gdb-var-list)
53 (defvar gdb-speedbar-auto-raise)
60 "Grand Unified Debugger mode for gdb and other debuggers under Emacs.
61 Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python), jdb."
85 (defvar gud-comint-buffer nil)
87 (defvar gud-keep-buffer nil)
107 ;; Use existing Info buffer, if possible.
112 (display-buffer-reuse-frames t))
116 (if (eq (window-buffer window) (get-buffer "*info*"))
127 (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode)
133 (with-current-buffer gud-comint-buffer
150 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
151 ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go
160 :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb))
168 '(gdbmi gdba gdb sdb xdb)))
175 '(gdbmi gdba gdb dbx xdb jdb pdb)))
179 '(gdbmi gdba gdb dbx xdb jdb pdb)))
182 gdb-active-process)
184 (buffer-local-value
185 'gud-target-name gud-comint-buffer) "emacs")
189 :visible (memq gud-minor-mode '(gdbmi gdba gdb)))
198 '(gdbmi gdba gdb xdb jdb pdb)))
201 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
204 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
233 :visible (memq gud-minor-mode '(gdbmi gdba gdb perldb)))
239 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
251 ([menu-bar buffer] . undefined)
315 ;; Copy `gud-minor-mode' to the found buffer to turn on the menu.
316 (with-current-buffer buf
321 (make-local-variable 'gdb-define-alist)
322 (unless gdb-define-alist (gdb-create-define-alist))
323 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))
324 (make-local-variable 'gud-keep-buffer))
356 The `current' source file is the file of the current buffer (if
358 step (if we're in the GUD buffer).
359 The `current' line is that of the current buffer (if we're in a
361 we're in the GUD buffer)."
364 ,@(if doc (list doc))
393 ;; The job of the massage-args method is to modify the given list of
399 ;; whatever the method *returns* is displayed in the buffer; thus, you
403 ;; The job of the find-file method is to visit and return the buffer indicated
410 (eval-when-compile (require 'speedbar)) ;For speedbar-with-attached-buffer.
421 (let ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)))
427 "Install those variables used by speedbar to enhance gud/gdb."
436 (define-key gud-speedbar-key-map "D" 'gdb-var-delete)
439 (speedbar-add-expansion-list '("GUD" gud-speedbar-menu-items
443 (add-to-list
444 'speedbar-mode-functions-list
450 :visible (not (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
453 :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
455 ["Delete expression" gdb-var-delete
456 :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
458 ["Auto raise frame" gdb-speedbar-auto-raise
459 :style toggle :selected gdb-speedbar-auto-raise
460 :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
470 "Wrapper for call to speedbar-add-expansion-list. DIRECTORY and
472 (gud-speedbar-buttons gud-comint-buffer))
474 (defun gud-speedbar-buttons (buffer)
479 (when (and gud-comint-buffer
480 ;; gud-comint-buffer might be killed
481 (buffer-name gud-comint-buffer))
482 (let* ((minor-mode (with-current-buffer buffer gud-minor-mode))
483 (window (get-buffer-window (current-buffer) 0))
488 (erase-buffer)
490 (if gdb-speedbar-auto-raise
492 (let ((var-list gdb-var-list) parent)
493 (while var-list
494 (let* (char (depth 0) (start 0) (var (car var-list))
513 nil 'gdb-edit-value)
515 (if gdb-show-changed-values
523 (if (and (nth 1 var-list)
525 (car (nth 1 var-list))))
531 'gdb-speedbar-expand-node varnum
534 nil 'gdb-edit-value)
536 (if gdb-show-changed-values
545 'gdb-speedbar-expand-node varnum
548 (if (and (or parent status) gdb-show-changed-values)
551 (setq var-list (cdr var-list)))))
556 (let ((gud-frame-list
557 (cond ((eq minor-mode 'gdb)
558 (gud-gdb-get-stackframe buffer))
560 (t (speedbar-remove-localized-speedbar-support buffer)
562 (erase-buffer)
563 (if (not gud-frame-list)
566 (dolist (frame gud-frame-list)
577 (cond ((memq minor-mode '(gdbmi gdba gdb))
578 'gud-gdb-goto-stackframe)
588 ;; gdb functions
590 ;; History of argument lists passed to gdb.
591 (defvar gud-gdb-history nil)
593 (defcustom gud-gdb-command-name "gdb --annotate=3"
598 (defvar gud-gdb-marker-regexp
612 (make-variable-buffer-local 'gud-marker-acc)
614 (defun gud-gdb-marker-filter (string)
619 (while (string-match gud-gdb-marker-regexp gud-marker-acc)
640 (if (string-equal match "stopped") (setq gdb-active-process t))
644 (require 'gdb-ui)
645 (gdb-prompt nil))
708 (defvar gdb-first-prompt t)
714 (defun gdb (command-line)
715 "Run gdb on program FILE in buffer *gud-FILE*.
724 `gud-gdb-command-name' for all future sessions. You need to use
727 (interactive (list (gud-query-cmdline 'gdb)))
729 (when (and gud-comint-buffer
730 (buffer-name gud-comint-buffer)
731 (get-buffer-process gud-comint-buffer)
732 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
733 (gdb-restore-windows)
737 (gud-common-init command-line nil 'gud-gdb-marker-filter)
738 (set (make-local-variable 'gud-minor-mode) 'gdb)
766 (local-set-key "\C-i" 'gud-gdb-complete-command)
767 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
769 (setq gdb-first-prompt t)
771 (run-hooks 'gdb-mode-hook))
775 ;; in the GUD buffer by using a GDB command designed just for Emacs.
778 (defvar gud-gdb-fetch-lines-in-progress)
781 (defvar gud-gdb-fetch-lines-string)
784 (defvar gud-gdb-fetch-lines-break)
786 ;; The completion list is constructed by the process filter.
787 (defvar gud-gdb-fetched-lines)
789 (defun gud-gdb-complete-command (&optional command a b)
795 ;; Used by gud-watch in mini-buffer.
797 ;; Used in GUD buffer.
799 (setq command (buffer-substring (comint-line-beginning-position) end))))
804 (complete-list
805 (gud-gdb-run-command-fetch-lines (concat "complete " command)
806 (current-buffer)
810 (and complete-list
811 (string-match "^Undefined command: \"complete\"" (car complete-list))
813 ;; Sort the list like readline.
814 (setq complete-list (sort complete-list (function string-lessp)))
816 (let ((first complete-list)
817 (second (cdr complete-list)))
825 (and (= (length complete-list) 1)
826 (let ((str (car complete-list))
833 (setq complete-list (list (concat str "'"))))))
835 (comint-dynamic-simple-complete command-word complete-list)))
838 ;; output of GDB up to the next prompt and build the completion list.
839 (defun gud-gdb-fetch-lines-filter (string filter)
840 "Filter used to read the list of lines output by a command.
844 (setq string (concat gud-gdb-fetch-lines-string string))
846 (push (substring string gud-gdb-fetch-lines-break (match-beginning 0))
847 gud-gdb-fetched-lines)
851 (setq gud-gdb-fetch-lines-in-progress nil)
854 (setq gud-gdb-fetch-lines-string string)
857 ;; gdb speedbar functions
859 (defun gud-gdb-goto-stackframe (text token indent)
861 (speedbar-with-attached-buffer
865 (defvar gud-gdb-fetched-stack-frame nil
868 ;(defun gud-gdb-get-scope-data (text token indent)
873 ; (gud-gdb-run-command-fetch-lines "info args")
875 ; (gud-gdb-run-command-fetch-lines "info local")
879 (defun gud-gdb-get-stackframe (buffer)
882 (fetched-stack-frame-list
883 (gud-gdb-run-command-fetch-lines "server backtrace" buffer)))
884 (if (and (car fetched-stack-frame-list)
885 (string-match "No stack" (car fetched-stack-frame-list)))
888 (dolist (e fetched-stack-frame-list)
897 (list (nth 0 (car newlst))
907 (list name num (match-string 1 e)
909 (list name num))
913 ;(defun gud-gdb-selected-frame-info (buffer)
917 (defun gud-gdb-run-command-fetch-lines (command buffer &optional skip)
918 "Run COMMAND, and return the list of lines it outputs.
919 BUFFER is the current buffer which may be the GUD buffer in which to run.
921 (with-current-buffer gud-comint-buffer
922 (if (and (eq gud-comint-buffer buffer)
930 (let ((gud-gdb-fetch-lines-in-progress t)
931 (gud-gdb-fetched-lines nil)
932 (gud-gdb-fetch-lines-string nil)
933 (gud-gdb-fetch-lines-break (or skip 0))
936 (gud-gdb-fetch-lines-filter string ',gud-marker-filter))))
940 (while gud-gdb-fetch-lines-in-progress
941 (accept-process-output (get-buffer-process gud-comint-buffer)))
942 (nreverse gud-gdb-fetched-lines)))))
1003 "Run sdb on program FILE in buffer *gud-FILE*.
1006 (interactive (list (gud-query-cmdline 'sdb)))
1040 "*A list of directories that dbx should search for source code.
1090 ;; OSF1, not necessarily elsewhere, it produces markers similar to gdb's.
1103 ;; This is just like the gdb one except for the regexps since we need to cope
1111 ;; This is like th gdb marker but with an optional
1159 ;; the gdb marker but you can't get the file name without a newline...
1194 ;; -emacs flag for gdb-like output (which ought to be possible as most
1197 ;; this filter is influenced by the xdb one rather than the gdb one
1216 (process-send-string (get-buffer-process gud-comint-buffer)
1291 "Run dbx on program FILE in buffer *gud-FILE*.
1294 (interactive (list (gud-query-cmdline 'dbx)))
1327 (process-send-string (get-buffer-process gud-comint-buffer)
1335 (process-send-string (get-buffer-process gud-comint-buffer)
1360 "*A list of directories that xdb should search for source code.
1401 "Run xdb on program FILE in buffer *gud-FILE*.
1405 You can set the variable `gud-xdb-directories' to a list of program source
1407 (interactive (list (gud-query-cmdline 'xdb)))
1533 "Run perldb on program FILE in buffer *gud-FILE*.
1537 (list (gud-query-cmdline 'perldb
1538 (concat (or (buffer-file-name) "-e 0") " "))))
1640 "Run pdb on program FILE in buffer `*gud-FILE*'.
1644 (list (gud-query-cmdline 'pdb)))
1764 The list of directories to search is the value of `gud-jdb-classpath'.
1779 "Java/jdb classpath directories list.
1781 list automatically using the following methods in sequence
1799 "Directory list provided by an (optional) \"-sourcepath\" option to jdb.
1800 This list is prepended to `gud-jdb-classpath' to form the complete
1801 list of directories searched for source files.")
1814 (defvar gud-jdb-directories (list ".")
1815 "*A list of directories that gud jdb should search for source code.
1829 ;; Association list of fully qualified class names (package + class name)
1832 "Association list of fully qualified class names and source files.")
1835 (defvar gud-jdb-analysis-buffer nil)
1840 (defun gud-jdb-build-source-files-list (path extn)
1841 "Return a list of java source files (absolute paths).
1960 ;; that FILE contains a legal Java program. BUF is a scratch buffer used
1964 (set-buffer buf)
1994 (setq p (concat (buffer-substring s (point)) "."))
2024 l (nconc l (list (concat p (buffer-substring s (point)))))))
2042 (gud-jdb-analyze-source gud-jdb-analysis-buffer file)))
2045 ;; holding their definitions. SOURCES holds a list of all the source
2048 (setq gud-jdb-analysis-buffer (get-buffer-create " *gud-jdb-scratch*"))
2055 (kill-buffer gud-jdb-analysis-buffer)
2056 (setq gud-jdb-analysis-buffer nil)))
2080 (list "-classpath"
2086 (list "-sourcepath"
2089 (t (setq massaged-args (append massaged-args (list (car args))))))
2097 (kill-buffer (current-buffer))
2147 "Parse the classpath list and convert each item to an absolute pathname."
2268 "Run jdb with command line COMMAND-LINE in a buffer.
2269 The buffer is named \"*gud*\" if no initial class is given or
2281 (list (gud-query-cmdline 'jdb)))
2331 ;; Else create and bind the class/source association list as well
2332 ;; as the source file list.
2336 (gud-jdb-build-source-files-list gud-jdb-directories
2348 ;; buffer; we have other ways of knowing the command has completed.
2350 ;; If the buffer looks like this:
2352 ;; (gdb) set args foo bar
2353 ;; (gdb) -!-
2356 ;; source file to set a breakpoint, we want the buffer to end up like
2359 ;; (gdb) set args foo bar
2361 ;; (gdb) -!-
2367 ;; process-send-string, and it never enters the buffer. However,
2395 You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx,
2397 hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook',
2401 interaction buffer and any source buffer GUD visits due to a breakpoint stop
2405 GUD buffer, the current file and line are those of the last breakpoint or
2406 step. In a source buffer, they are the buffer's file and current line.
2411 in the gud buffer.
2424 Under gdb, sdb and xdb, \\[gud-tbreak] behaves exactly like \\[gud-break],
2428 Under gdb, dbx, and xdb, \\[gud-up] pops up through an enclosing stack
2431 If you are using gdb or xdb, \\[gud-finish] runs execution to the return from
2434 All the keystrokes above are accessible in the GUD buffer
2455 (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook nil t))
2467 "The apparent name of the program being debugged in a gud buffer.")
2473 ;; for local variables in the debugger buffer.
2501 (existing-buffer (get-buffer (concat "*gud" filepart "*"))))
2502 (pop-to-buffer (concat "*gud" filepart "*"))
2503 (when (and existing-buffer (get-buffer-process existing-buffer))
2505 ;; Set the dir, in case the buffer already existed with a different dir.
2536 (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
2537 (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel)
2538 (gud-set-buffer))
2540 (defun gud-set-buffer ()
2542 (setq gud-comint-buffer (current-buffer))))
2549 ;; into the buffer. The hard work is done by the method that is
2553 ;; Here's where the actual buffer insertion is done
2555 (if (buffer-name (process-buffer proc))
2571 (with-current-buffer (process-buffer proc)
2575 (if (marker-buffer gud-delete-prompt-marker)
2586 ;; and (2) this buffer is on the screen.
2590 (get-buffer-window (current-buffer)))))
2598 ;; in case the source file is our current buffer.
2602 ;; We have to be in the proper buffer, (process-buffer proc),
2604 (with-current-buffer (process-buffer proc)
2614 (add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position)
2617 (cond ((null (buffer-name (process-buffer proc)))
2618 ;; buffer killed
2621 (set-process-buffer proc nil)
2623 (string-equal speedbar-initial-expansion-list-name "GUD"))
2624 (speedbar-change-initial-expansion-list
2625 speedbar-previously-used-expansion-list-name))
2627 (gdb-reset)
2632 (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
2634 (gdb-reset)
2636 (let* ((obuf (current-buffer)))
2638 ;; process-buffer is current-buffer
2642 (set-buffer (process-buffer proc))
2653 ;; If buffer and mode line will show that the process
2655 ;; will stay around until M-x list-processes.
2657 ;; Restore old buffer, but don't restore old point
2658 ;; if obuf is the gud buffer.
2659 (set-buffer obuf))))))
2661 (defun gud-kill-buffer-hook ()
2664 (kill-process (get-buffer-process (current-buffer)))
2668 (dolist (buffer (buffer-list))
2669 (unless (eq buffer gud-comint-buffer)
2670 (with-current-buffer buffer
2680 (gud-set-buffer)
2685 ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
2687 ;; Put the overlay-arrow on the line LINE in that buffer.
2689 ;; region-restriction if that's possible. We use an explicit display-buffer
2694 (buffer
2695 (with-current-buffer gud-comint-buffer
2697 (window (and buffer (or (get-buffer-window buffer)
2699 (unless (gdb-display-source-buffer buffer)
2700 (gdb-display-buffer buffer nil)))
2701 (display-buffer buffer))))
2703 (if buffer
2705 (with-current-buffer buffer
2706 (unless (or (verify-visited-file-modtime buffer) gud-keep-buffer)
2709 (buffer-name)))
2710 (revert-buffer t t)
2711 (setq gud-keep-buffer t)))
2718 (set-marker gud-overlay-arrow-position (point) (current-buffer))
2733 (setq gdb-source-window window)))))))
2736 ;; keystroke is from the GUD buffer itself (via major-mode binding)
2737 ;; or a C buffer. In the former case, we want to supply data from
2741 (let ((insource (not (eq (current-buffer) gud-comint-buffer)))
2752 (buffer-file-name)
2757 (buffer-file-name)
2761 (buffer-file-name)
2779 (buffer-file-name)
2795 "Return a string containing the core-address found in the buffer at point."
2802 (buffer-substring found
2812 (buffer-substring begin (point))))))))
2823 (gud-set-buffer)
2824 (let ((proc (get-buffer-process gud-comint-buffer)))
2825 (or proc (error "Current buffer has no process"))
2828 (set-buffer gud-comint-buffer)
2839 (apply comint-input-sender (list proc command))
2858 (buffer-substring (region-beginning) (region-end))
2863 (with-current-buffer gud-comint-buffer
2865 (goto-char (process-mark (get-buffer-process gud-comint-buffer)))
2870 (unless (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
2893 (if (member (buffer-substring (car test-expr) (cdr test-expr))
2902 (buffer-substring (car expr) (cdr expr)))))
2907 the current buffer that marks the beginning of the expr and the cdr specifies
2939 the current buffer that marks the beginning of the expr and the cdr specifies
2952 the current buffer that marks the beginning of the expr and the cdr specifies
2987 specifies the point in the current buffer that marks the beginning of the
3018 `gud-jdb-sourcepath') list(s) to derive a file
3022 If F is visited by a buffer and its mode is CC-mode(Java),
3030 (fbuffer (get-file-buffer f))
3034 ;; in the syntactical analysis result list, syntax-point
3035 ;; returns the buffer position of same
3038 ;; Search through classpath list for an entry that is
3048 ;; if f is visited by a java(cc-mode) buffer, walk up the
3054 (set-buffer fbuffer)
3076 (append (list (match-string-no-properties 1))
3090 ;; Not using classpath - try class/source association list
3103 (defvar gdb-script-mode-syntax-table
3110 (defvar gdb-script-font-lock-keywords
3115 (defvar gdb-script-font-lock-syntactic-keywords
3135 (defun gdb-script-font-lock-syntactic-face (state)
3141 (defvar gdb-script-basic-indent 2)
3143 (defun gdb-script-skip-to-head ()
3147 (gdb-script-skip-to-head)))
3149 (defun gdb-script-calculate-indentation ()
3152 (gdb-script-skip-to-head)
3157 (gdb-script-skip-to-head))
3165 gdb-script-basic-indent 0)))))
3167 (defun gdb-script-indent-line ()
3182 (max (gdb-script-calculate-indentation) 0))
3189 (defun gdb-script-beginning-of-defun ()
3200 (defun gdb-script-end-of-defun ()
3210 (add-to-list 'auto-mode-alist '("/\\.gdbinit" . gdb-script-mode))
3213 (define-derived-mode gdb-script-mode nil "GDB-Script"
3220 (set (make-local-variable 'indent-line-function) 'gdb-script-indent-line)
3222 #'gdb-script-beginning-of-defun)
3224 #'gdb-script-end-of-defun)
3226 '(gdb-script-font-lock-keywords nil nil ((?_ . "w")) nil
3228 . gdb-script-font-lock-syntactic-keywords)
3230 . gdb-script-font-lock-syntactic-face))))
3255 (if (and gud-comint-buffer
3256 (buffer-name gud-comint-buffer); gud-comint-buffer might be killed
3257 (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
3261 (dolist (buffer (buffer-list))
3262 (unless (eq buffer gud-comint-buffer)
3263 (with-current-buffer buffer
3266 (buffer-name))))
3267 (make-local-variable 'gdb-define-alist)
3268 (gdb-create-define-alist)
3270 'gdb-create-define-alist nil t))))))
3271 (kill-local-variable 'gdb-define-alist)
3272 (remove-hook 'after-save-hook 'gdb-create-define-alist t))))
3282 '((eq (tooltip-event-buffer gud-tooltip-event)
3283 (marker-buffer gud-overlay-arrow-position)))
3286 Forms in the list are combined with AND. The default is to display
3287 only tooltips in the buffer containing the overlay arrow."
3313 (dolist (buffer (buffer-list))
3315 (set-buffer buffer)
3322 "Locally t in a buffer if tooltip processing of mouse motion is enabled.")
3326 ;; which does a set-buffer, like the summary buffer of Gnus. Calling
3327 ;; set-buffer prevents redisplay optimizations, so every mouse motion
3331 "Activate/deactivate mouse motion events for the current buffer.
3380 ; the tooltip incompletely and spill over into the gud buffer.
3383 ; gdb-ui.el gets round this problem.
3410 gud-comint-buffer
3411 (buffer-name gud-comint-buffer); might be killed
3412 (setq process (get-buffer-process gud-comint-buffer))
3414 (or (and (eq gud-minor-mode 'gdba) (not gdb-active-process))
3420 (not gdb-active-process))
3422 (with-current-buffer
3423 (window-buffer (let ((mouse (mouse-position)))
3426 (let ((define-elt (assoc expr gdb-define-alist)))
3435 (when (and gud-tooltip-mode (eq gud-minor-mode 'gdb))
3441 (if gdb-macro-info
3442 (gdb-enqueue-input
3443 (list (concat
3444 gdb-server-prefix "macro expand " expr "\n")
3445 `(lambda () (gdb-tooltip-print-1 ,expr))))
3446 (gdb-enqueue-input
3447 (list (concat cmd "\n")
3448 `(lambda () (gdb-tooltip-print ,expr)))))