diff options
| author | Nick Roberts | 2006-06-15 00:57:53 +0000 |
|---|---|---|
| committer | Nick Roberts | 2006-06-15 00:57:53 +0000 |
| commit | 3e0b9c08a04ca1df81854f0f40fe43b79aab8720 (patch) | |
| tree | 94d99847a6219052afa25c52accd3c609519e9ef | |
| parent | e86a3316d12123298a59c7c7e6946ab68ad43e8c (diff) | |
| download | emacs-3e0b9c08a04ca1df81854f0f40fe43b79aab8720.tar.gz emacs-3e0b9c08a04ca1df81854f0f40fe43b79aab8720.zip | |
(gdb-same-frame): New option.
(gud-old-arrow, gdb-frame-begin, gdb-printing): New variables.
(gdb-init-1): Initialise them.
(gdb-starting): Reset gdb-printing
(gdb-starting): Save value of gud-overlay-arrow-position.
(gdb-frame-begin): Set gdb-frame-begin, gdb-printing.
(gdb-stopped): Don't look for source if calling procedure e.g "p a ()".
Use gdb-*-gdb-buffer conditionally on gdb-same-frame.
(gdb-frame-gdb-buffer): Keep menu bar, tool bar for GUD buffer.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index bb821907aa8..f3144cbb84a 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -76,6 +76,9 @@ | |||
| 76 | ;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. | 76 | ;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. |
| 77 | ;; 4) M-x gdb doesn't work if the corefile is specified in the command in the | 77 | ;; 4) M-x gdb doesn't work if the corefile is specified in the command in the |
| 78 | ;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer). | 78 | ;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer). |
| 79 | ;; 5) If you wish to call procedures from your program in GDB | ||
| 80 | ;; e.g "call myproc ()", "p mysquare (5)" then use level 2 annotations | ||
| 81 | ;; "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed. | ||
| 79 | 82 | ||
| 80 | ;;; Problems with watch expressions, GDB/MI: | 83 | ;;; Problems with watch expressions, GDB/MI: |
| 81 | ;; 1) They go out of scope when the inferior is re-run. | 84 | ;; 1) They go out of scope when the inferior is re-run. |
| @@ -110,6 +113,7 @@ Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) | |||
| 110 | where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame | 113 | where STATUS is nil (unchanged), `changed' or `out-of-scope', FP the frame |
| 111 | address for root variables.") | 114 | address for root variables.") |
| 112 | (defvar gdb-main-file nil "Source file from which program execution begins.") | 115 | (defvar gdb-main-file nil "Source file from which program execution begins.") |
| 116 | (defvar gud-old-arrow nil) | ||
| 113 | (defvar gdb-overlay-arrow-position nil) | 117 | (defvar gdb-overlay-arrow-position nil) |
| 114 | (defvar gdb-server-prefix nil) | 118 | (defvar gdb-server-prefix nil) |
| 115 | (defvar gdb-flush-pending-output nil) | 119 | (defvar gdb-flush-pending-output nil) |
| @@ -126,6 +130,9 @@ and #define directives otherwise.") | |||
| 126 | (defvar gdb-inferior-status nil) | 130 | (defvar gdb-inferior-status nil) |
| 127 | (defvar gdb-continuation nil) | 131 | (defvar gdb-continuation nil) |
| 128 | (defvar gdb-look-up-stack nil) | 132 | (defvar gdb-look-up-stack nil) |
| 133 | (defvar gdb-frame-begin nil | ||
| 134 | "Non-nil when GDB generates frame-begin annotation.") | ||
| 135 | (defvar gdb-printing t) | ||
| 129 | 136 | ||
| 130 | (defvar gdb-buffer-type nil | 137 | (defvar gdb-buffer-type nil |
| 131 | "One of the symbols bound in `gdb-buffer-rules'.") | 138 | "One of the symbols bound in `gdb-buffer-rules'.") |
| @@ -543,7 +550,10 @@ With arg, use separate IO iff arg is positive." | |||
| 543 | gdb-source-window nil | 550 | gdb-source-window nil |
| 544 | gdb-inferior-status nil | 551 | gdb-inferior-status nil |
| 545 | gdb-continuation nil | 552 | gdb-continuation nil |
| 546 | gdb-look-up-stack nil) | 553 | gdb-look-up-stack nil |
| 554 | gdb-frame-begin nil | ||
| 555 | gdb-printing t | ||
| 556 | gud-old-arrow nil) | ||
| 547 | 557 | ||
| 548 | (setq gdb-buffer-type 'gdba) | 558 | (setq gdb-buffer-type 'gdba) |
| 549 | 559 | ||
| @@ -1270,6 +1280,7 @@ This sends the next command (if any) to gdb." | |||
| 1270 | This says that I/O for the subprocess is now the program being debugged, | 1280 | This says that I/O for the subprocess is now the program being debugged, |
| 1271 | not GDB." | 1281 | not GDB." |
| 1272 | (setq gdb-active-process t) | 1282 | (setq gdb-active-process t) |
| 1283 | (setq gdb-printing t) | ||
| 1273 | (let ((sink gdb-output-sink)) | 1284 | (let ((sink gdb-output-sink)) |
| 1274 | (cond | 1285 | (cond |
| 1275 | ((eq sink 'user) | 1286 | ((eq sink 'user) |
| @@ -1278,6 +1289,7 @@ not GDB." | |||
| 1278 | (setq gdb-inferior-status "running") | 1289 | (setq gdb-inferior-status "running") |
| 1279 | (gdb-force-mode-line-update gdb-inferior-status) | 1290 | (gdb-force-mode-line-update gdb-inferior-status) |
| 1280 | (gdb-remove-text-properties) | 1291 | (gdb-remove-text-properties) |
| 1292 | (setq gud-old-arrow gud-overlay-arrow-position) | ||
| 1281 | (setq gud-overlay-arrow-position nil) | 1293 | (setq gud-overlay-arrow-position nil) |
| 1282 | (setq gdb-overlay-arrow-position nil) | 1294 | (setq gdb-overlay-arrow-position nil) |
| 1283 | (if gdb-use-separate-io-buffer | 1295 | (if gdb-use-separate-io-buffer |
| @@ -1321,6 +1333,8 @@ directives." | |||
| 1321 | (setq gdb-signalled t)) | 1333 | (setq gdb-signalled t)) |
| 1322 | 1334 | ||
| 1323 | (defun gdb-frame-begin (ignored) | 1335 | (defun gdb-frame-begin (ignored) |
| 1336 | (setq gdb-frame-begin t) | ||
| 1337 | (setq gdb-printing nil) | ||
| 1324 | (let ((sink gdb-output-sink)) | 1338 | (let ((sink gdb-output-sink)) |
| 1325 | (cond | 1339 | (cond |
| 1326 | ((eq sink 'inferior) | 1340 | ((eq sink 'inferior) |
| @@ -1331,25 +1345,33 @@ directives." | |||
| 1331 | (gdb-resync) | 1345 | (gdb-resync) |
| 1332 | (error "Unexpected frame-begin annotation (%S)" sink))))) | 1346 | (error "Unexpected frame-begin annotation (%S)" sink))))) |
| 1333 | 1347 | ||
| 1348 | (defcustom gdb-same-frame focus-follows-mouse | ||
| 1349 | "Non-nil means pop up GUD buffer in same frame." | ||
| 1350 | :group 'gud | ||
| 1351 | :type 'boolean | ||
| 1352 | :version "22.1") | ||
| 1353 | |||
| 1334 | (defun gdb-stopped (ignored) | 1354 | (defun gdb-stopped (ignored) |
| 1335 | "An annotation handler for `stopped'. | 1355 | "An annotation handler for `stopped'. |
| 1336 | It is just like `gdb-stopping', except that if we already set the output | 1356 | It is just like `gdb-stopping', except that if we already set the output |
| 1337 | sink to `user' in `gdb-stopping', that is fine." | 1357 | sink to `user' in `gdb-stopping', that is fine." |
| 1338 | (setq gud-running nil) | 1358 | (setq gud-running nil) |
| 1339 | (unless (or gud-overlay-arrow-position gud-last-frame) | 1359 | (unless (or gud-overlay-arrow-position gud-last-frame) |
| 1360 | (if (and gdb-frame-begin gdb-printing) | ||
| 1361 | (setq gud-overlay-arrow-position gud-old-arrow) | ||
| 1340 | ;;Pop up GUD buffer to display current frame when it doesn't have source | 1362 | ;;Pop up GUD buffer to display current frame when it doesn't have source |
| 1341 | ;;information i.e id not compiled with -g as with libc routines generally. | 1363 | ;;information i.e id not compiled with -g as with libc routines generally. |
| 1342 | (let ((special-display-regexps (append special-display-regexps '(".*"))) | 1364 | (if gdb-same-frame |
| 1343 | (special-display-frame-alist gdb-frame-parameters) | 1365 | (gdb-display-gdb-buffer) |
| 1344 | (same-window-regexps nil)) | 1366 | (gdb-frame-gdb-buffer)) |
| 1345 | (display-buffer gud-comint-buffer)) | ||
| 1346 | ;;Try to find source further up stack e.g after signal. | 1367 | ;;Try to find source further up stack e.g after signal. |
| 1347 | (setq gdb-look-up-stack | 1368 | (setq gdb-look-up-stack |
| 1348 | (if (gdb-get-buffer 'gdb-stack-buffer) 'keep | 1369 | (if (gdb-get-buffer 'gdb-stack-buffer) |
| 1370 | 'keep | ||
| 1349 | (progn | 1371 | (progn |
| 1350 | (gdb-get-buffer-create 'gdb-stack-buffer) | 1372 | (gdb-get-buffer-create 'gdb-stack-buffer) |
| 1351 | (gdb-invalidate-frames) | 1373 | (gdb-invalidate-frames) |
| 1352 | 'delete)))) | 1374 | 'delete))))) |
| 1353 | (unless (member gdb-inferior-status '("exited" "signal")) | 1375 | (unless (member gdb-inferior-status '("exited" "signal")) |
| 1354 | (setq gdb-inferior-status "stopped") | 1376 | (setq gdb-inferior-status "stopped") |
| 1355 | (gdb-force-mode-line-update gdb-inferior-status)) | 1377 | (gdb-force-mode-line-update gdb-inferior-status)) |
| @@ -2757,7 +2779,9 @@ corresponding to the mode line clicked." | |||
| 2757 | "Display GUD buffer in a new frame." | 2779 | "Display GUD buffer in a new frame." |
| 2758 | (interactive) | 2780 | (interactive) |
| 2759 | (let ((special-display-regexps (append special-display-regexps '(".*"))) | 2781 | (let ((special-display-regexps (append special-display-regexps '(".*"))) |
| 2760 | (special-display-frame-alist gdb-frame-parameters) | 2782 | (special-display-frame-alist |
| 2783 | (remove '(menu-bar-lines) (remove '(tool-bar-lines) | ||
| 2784 | gdb-frame-parameters))) | ||
| 2761 | (same-window-regexps nil)) | 2785 | (same-window-regexps nil)) |
| 2762 | (display-buffer gud-comint-buffer))) | 2786 | (display-buffer gud-comint-buffer))) |
| 2763 | 2787 | ||