diff options
| author | Alan Mackenzie | 2011-10-28 14:02:04 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2011-10-28 14:02:04 +0000 |
| commit | bc97a826f8ea89a269f6043be3148930f023e2b2 (patch) | |
| tree | e927788ae7ba1058100dfb6c211ff57e6440de4c /lisp/progmodes | |
| parent | c0f13227ab16ad9a87a16182e9d9ace5d2f7a6d9 (diff) | |
| parent | 9aba60432c25b060680eb7db698b20b05d7b94a0 (diff) | |
| download | emacs-bc97a826f8ea89a269f6043be3148930f023e2b2.tar.gz emacs-bc97a826f8ea89a269f6043be3148930f023e2b2.zip | |
Merge
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 22db7b2e5f4..dde00d753ac 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -43,21 +43,10 @@ | |||
| 43 | 43 | ||
| 44 | ;; M-x gdb will start the debugger. | 44 | ;; M-x gdb will start the debugger. |
| 45 | 45 | ||
| 46 | ;; This file uses GDB/MI as the primary interface to GDB. It is still under | 46 | ;; This file uses GDB/MI as the primary interface to GDB. It runs gdb with |
| 47 | ;; development and is part of a process to migrate Emacs from annotations (as | 47 | ;; GDB/MI (-interp=mi) and access CLI using "-interpreter-exec console |
| 48 | ;; used in gdb-ui.el) to GDB/MI. It runs gdb with GDB/MI (-interp=mi) and | 48 | ;; cli-command". This code works without gdb-ui.el and uses MI tokens instead |
| 49 | ;; access CLI using "-interpreter-exec console cli-command". This code works | 49 | ;; of queues. Eventually MI should be asynchronous. |
| 50 | ;; without gdb-ui.el and uses MI tokens instead of queues. Eventually MI | ||
| 51 | ;; should be asynchronous. | ||
| 52 | |||
| 53 | ;; This mode will PARTLY WORK WITH RECENT GDB RELEASES (status in modeline | ||
| 54 | ;; doesn't update properly when execution commands are issued from GUD buffer) | ||
| 55 | ;; and WORKS BEST when GDB runs asynchronously: maint set linux-async on. | ||
| 56 | ;; | ||
| 57 | ;; You need development version of GDB 7.0 for the thread buffer to work. | ||
| 58 | |||
| 59 | ;; This file replaces gdb-ui.el and is for development with GDB. Use the | ||
| 60 | ;; release branch of Emacs 22 for the latest version of gdb-ui.el. | ||
| 61 | 50 | ||
| 62 | ;; Windows Platforms: | 51 | ;; Windows Platforms: |
| 63 | 52 | ||
| @@ -599,6 +588,22 @@ NOARG must be t when this macro is used outside `gud-def'" | |||
| 599 | (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2) | 588 | (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2) |
| 600 | ,(when (not noarg) 'arg))) | 589 | ,(when (not noarg) 'arg))) |
| 601 | 590 | ||
| 591 | (defun gdb--check-interpreter (proc string) | ||
| 592 | (unless (zerop (length string)) | ||
| 593 | (let ((filter (process-get proc 'gud-normal-filter))) | ||
| 594 | (set-process-filter proc filter) | ||
| 595 | (unless (memq (aref string 0) '(?^ ?~ ?@ ?& ?* ?=)) | ||
| 596 | ;; Apparently we're not running with -i=mi. | ||
| 597 | (let ((msg "Error: you did not specify -i=mi on GDB's command line!")) | ||
| 598 | (message msg) | ||
| 599 | (setq string (concat (propertize msg 'font-lock-face 'error) | ||
| 600 | "\n" string))) | ||
| 601 | ;; Use the old gud-gbd filter, not because it works, but because it | ||
| 602 | ;; will properly display GDB's answers rather than hanging waiting for | ||
| 603 | ;; answers that aren't coming. | ||
| 604 | (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter)) | ||
| 605 | (funcall filter proc string)))) | ||
| 606 | |||
| 602 | ;;;###autoload | 607 | ;;;###autoload |
| 603 | (defun gdb (command-line) | 608 | (defun gdb (command-line) |
| 604 | "Run gdb on program FILE in buffer *gud-FILE*. | 609 | "Run gdb on program FILE in buffer *gud-FILE*. |
| @@ -665,6 +670,13 @@ detailed description of this mode. | |||
| 665 | "Multiple debugging requires restarting in text command mode")) | 670 | "Multiple debugging requires restarting in text command mode")) |
| 666 | ;; | 671 | ;; |
| 667 | (gud-common-init command-line nil 'gud-gdbmi-marker-filter) | 672 | (gud-common-init command-line nil 'gud-gdbmi-marker-filter) |
| 673 | |||
| 674 | ;; Setup a temporary process filter to warn when GDB was not started | ||
| 675 | ;; with -i=mi. | ||
| 676 | (let ((proc (get-buffer-process gud-comint-buffer))) | ||
| 677 | (process-put proc 'gud-normal-filter (process-filter proc)) | ||
| 678 | (set-process-filter proc #'gdb--check-interpreter)) | ||
| 679 | |||
| 668 | (set (make-local-variable 'gud-minor-mode) 'gdbmi) | 680 | (set (make-local-variable 'gud-minor-mode) 'gdbmi) |
| 669 | (setq comint-input-sender 'gdb-send) | 681 | (setq comint-input-sender 'gdb-send) |
| 670 | (when (ring-empty-p comint-input-ring) ; cf shell-mode | 682 | (when (ring-empty-p comint-input-ring) ; cf shell-mode |