56 |
;; explicitly in your program if you want timely display of I/O in Emacs. |
;; explicitly in your program if you want timely display of I/O in Emacs. |
57 |
;; Alternatively you can make the output stream unbuffered, for example, by |
;; Alternatively you can make the output stream unbuffered, for example, by |
58 |
;; using a macro: |
;; using a macro: |
59 |
;; |
;; |
60 |
;; #ifdef UNBUFFERED |
;; #ifdef UNBUFFERED |
61 |
;; setvbuf(stdout,(char *)NULL, _IONBF,0); |
;; setvbuf(stdout,(char *)NULL, _IONBF,0); |
62 |
;; #endif |
;; #endif |
79 |
|
|
80 |
(require 'gud) |
(require 'gud) |
81 |
|
|
82 |
(defvar gdb-frame-address "main" "Initialisation for Assembler buffer.") |
(defvar gdb-frame-address "main" "Initialization for Assembler buffer.") |
83 |
(defvar gdb-previous-frame-address nil) |
(defvar gdb-previous-frame-address nil) |
84 |
(defvar gdb-memory-address "main") |
(defvar gdb-memory-address "main") |
85 |
(defvar gdb-previous-frame nil) |
(defvar gdb-previous-frame nil) |
87 |
(defvar gdb-frame-number nil) |
(defvar gdb-frame-number nil) |
88 |
(defvar gdb-current-language nil) |
(defvar gdb-current-language nil) |
89 |
(defvar gdb-var-list nil "List of variables in watch window.") |
(defvar gdb-var-list nil "List of variables in watch window.") |
90 |
(defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") |
(defvar gdb-var-changed nil "Non-nil means that `gdb-var-list' has changed.") |
91 |
(defvar gdb-main-file nil "Source file from which program execution begins.") |
(defvar gdb-main-file nil "Source file from which program execution begins.") |
92 |
(defvar gdb-buffer-type nil) |
(defvar gdb-buffer-type nil) |
93 |
(defvar gdb-overlay-arrow-position nil) |
(defvar gdb-overlay-arrow-position nil) |
118 |
`user' -- gdb output should be copied to the GUD buffer |
`user' -- gdb output should be copied to the GUD buffer |
119 |
for the user to see. |
for the user to see. |
120 |
|
|
121 |
`inferior' -- gdb output should be copied to the inferior-io buffer |
`inferior' -- gdb output should be copied to the inferior-io buffer. |
122 |
|
|
123 |
`pre-emacs' -- output should be ignored util the post-prompt |
`pre-emacs' -- output should be ignored util the post-prompt |
124 |
annotation is received. Then the output-sink |
annotation is received. Then the output-sink |
130 |
`post-emacs' -- ignore output until the prompt annotation is |
`post-emacs' -- ignore output until the prompt annotation is |
131 |
received, then go to USER disposition. |
received, then go to USER disposition. |
132 |
|
|
133 |
gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two |
gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two |
134 |
\(`user' and `emacs').") |
\(`user' and `emacs').") |
135 |
|
|
136 |
(defvar gdb-current-item nil |
(defvar gdb-current-item nil |
149 |
and source-file directory for your debugger. |
and source-file directory for your debugger. |
150 |
|
|
151 |
If `gdb-many-windows' is nil (the default value) then gdb just |
If `gdb-many-windows' is nil (the default value) then gdb just |
152 |
pops up the GUD buffer unless `gdb-show-main' is t. In this case |
pops up the GUD buffer unless `gdb-show-main' is t. In this case |
153 |
it starts with two windows: one displaying the GUD buffer and the |
it starts with two windows: one displaying the GUD buffer and the |
154 |
other with the source file with the main routine of the inferior. |
other with the source file with the main routine of the inferior. |
155 |
|
|
217 |
(defcustom gdb-cpp-define-alist-program "gcc -E -dM -" |
(defcustom gdb-cpp-define-alist-program "gcc -E -dM -" |
218 |
"Shell command for generating a list of defined macros in a source file. |
"Shell command for generating a list of defined macros in a source file. |
219 |
This list is used to display the #define directive associated |
This list is used to display the #define directive associated |
220 |
with an identifier as a tooltip. It works in a debug session with |
with an identifier as a tooltip. It works in a debug session with |
221 |
GDB, when gud-tooltip-mode is t. |
GDB, when gud-tooltip-mode is t. |
222 |
|
|
223 |
Set `gdb-cpp-define-alist-flags' for any include paths or |
Set `gdb-cpp-define-alist-flags' for any include paths or |
280 |
'gdb-tooltip-print)))))) |
'gdb-tooltip-print)))))) |
281 |
|
|
282 |
(defun gdb-set-gud-minor-mode (buffer) |
(defun gdb-set-gud-minor-mode (buffer) |
283 |
"Set gud-minor-mode from find-file if appropriate." |
"Set `gud-minor-mode' from find-file if appropriate." |
284 |
(goto-char (point-min)) |
(goto-char (point-min)) |
285 |
(unless (search-forward "No source file named " nil t) |
(unless (search-forward "No source file named " nil t) |
286 |
(condition-case nil |
(condition-case nil |
973 |
(defun gdb-exited (ignored) |
(defun gdb-exited (ignored) |
974 |
"An annotation handler for `exited' and `signalled'. |
"An annotation handler for `exited' and `signalled'. |
975 |
They say that I/O for the subprocess is now GDB, not the program |
They say that I/O for the subprocess is now GDB, not the program |
976 |
being debugged and that the program is no longer running. This |
being debugged and that the program is no longer running. This |
977 |
function is used to change the focus of GUD tooltips to #define |
function is used to change the focus of GUD tooltips to #define |
978 |
directives." |
directives." |
979 |
(setq gdb-active-process nil) |
(setq gdb-active-process nil) |
2226 |
(set-window-dedicated-p (selected-window) t)) |
(set-window-dedicated-p (selected-window) t)) |
2227 |
|
|
2228 |
(defun gdb-setup-windows () |
(defun gdb-setup-windows () |
2229 |
"Layout the window pattern for gdb-many-windows." |
"Layout the window pattern for `gdb-many-windows'." |
2230 |
(gdb-display-locals-buffer) |
(gdb-display-locals-buffer) |
2231 |
(gdb-display-stack-buffer) |
(gdb-display-stack-buffer) |
2232 |
(delete-other-windows) |
(delete-other-windows) |
2380 |
(defun gdb-put-string (putstring pos &optional dprop) |
(defun gdb-put-string (putstring pos &optional dprop) |
2381 |
"Put string PUTSTRING in front of POS in the current buffer. |
"Put string PUTSTRING in front of POS in the current buffer. |
2382 |
PUTSTRING is displayed by putting an overlay into the current buffer with a |
PUTSTRING is displayed by putting an overlay into the current buffer with a |
2383 |
`before-string' STRING that has a `display' property whose value is |
`before-string' string that has a `display' property whose value is |
2384 |
PUTSTRING." |
PUTSTRING." |
2385 |
(let ((string (make-string 1 ?x)) |
(let ((string (make-string 1 ?x)) |
2386 |
(buffer (current-buffer))) |
(buffer (current-buffer))) |
2485 |
|
|
2486 |
(def-gdb-auto-updated-buffer gdb-assembler-buffer |
(def-gdb-auto-updated-buffer gdb-assembler-buffer |
2487 |
gdb-invalidate-assembler |
gdb-invalidate-assembler |
2488 |
(concat gdb-server-prefix "disassemble " |
(concat gdb-server-prefix "disassemble " |
2489 |
(if (member gdb-frame-address '(nil "main")) nil "0x") |
(if (member gdb-frame-address '(nil "main")) nil "0x") |
2490 |
gdb-frame-address "\n") |
gdb-frame-address "\n") |
2491 |
gdb-assembler-handler |
gdb-assembler-handler |