40 |
;; Kingdon and uses GDB's annotation interface. You don't need to know about |
;; Kingdon and uses GDB's annotation interface. You don't need to know about |
41 |
;; annotations to use this mode as a debugger, but if you are interested |
;; annotations to use this mode as a debugger, but if you are interested |
42 |
;; developing the mode itself, then see the Annotations section in the GDB |
;; developing the mode itself, then see the Annotations section in the GDB |
43 |
;; info manual. Some GDB/MI commands are also used through th CLI command |
;; info manual. |
44 |
;; 'interpreter mi <mi-command>'. |
;; |
45 |
|
;; GDB developers plan to make the annotation interface obsolete. A new |
46 |
|
;; interface called GDB/MI (machine interface) has been designed to replace |
47 |
|
;; it. Some GDB/MI commands are used in this file through the CLI command |
48 |
|
;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included in the |
49 |
|
;; GDB repository for future releases (6.2 onwards) that uses GDB/MI as the |
50 |
|
;; primary interface to GDB. It is still under development and is part of a |
51 |
|
;; process to migrate Emacs from annotations to GDB/MI. |
52 |
;; |
;; |
53 |
;; Known Bugs: |
;; Known Bugs: |
54 |
;; |
;; |
60 |
(defvar gdb-current-address "main" "Initialisation for Assembler buffer.") |
(defvar gdb-current-address "main" "Initialisation for Assembler buffer.") |
61 |
(defvar gdb-previous-address nil) |
(defvar gdb-previous-address nil) |
62 |
(defvar gdb-previous-frame nil) |
(defvar gdb-previous-frame nil) |
63 |
(defvar gdb-current-frame "main") |
(defvar gdb-current-frame nil) |
64 |
(defvar gdb-current-language nil) |
(defvar gdb-current-language nil) |
65 |
(defvar gdb-view-source t "Non-nil means that source code can be viewed.") |
(defvar gdb-view-source t "Non-nil means that source code can be viewed.") |
66 |
(defvar gdb-selected-view 'source "Code type that user wishes to view.") |
(defvar gdb-selected-view 'source "Code type that user wishes to view.") |
182 |
(setq gdb-current-address "main") |
(setq gdb-current-address "main") |
183 |
(setq gdb-previous-address nil) |
(setq gdb-previous-address nil) |
184 |
(setq gdb-previous-frame nil) |
(setq gdb-previous-frame nil) |
185 |
(setq gdb-current-frame "main") |
(setq gdb-current-frame nil) |
186 |
(setq gdb-view-source t) |
(setq gdb-view-source t) |
187 |
(setq gdb-selected-view 'source) |
(setq gdb-selected-view 'source) |
188 |
(setq gdb-var-list nil) |
(setq gdb-var-list nil) |
221 |
(require 'tooltip) |
(require 'tooltip) |
222 |
(let ((expr (tooltip-identifier-from-point (point)))) |
(let ((expr (tooltip-identifier-from-point (point)))) |
223 |
(if (and (string-equal gdb-current-language "c") |
(if (and (string-equal gdb-current-language "c") |
224 |
gdb-use-colon-colon-notation) |
gdb-use-colon-colon-notation gdb-current-frame) |
225 |
(setq expr (concat gdb-current-frame "::" expr))) |
(setq expr (concat gdb-current-frame "::" expr))) |
226 |
(catch 'already-watched |
(catch 'already-watched |
227 |
(dolist (var gdb-var-list) |
(dolist (var gdb-var-list) |
1226 |
(interactive) |
(interactive) |
1227 |
(save-excursion |
(save-excursion |
1228 |
(beginning-of-line 1) |
(beginning-of-line 1) |
1229 |
(re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi)) |
1230 |
(looking-at "\\(\\S-*\\):\\([0-9]+\\)")) |
(looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)") |
1231 |
|
(re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) |
1232 |
|
(looking-at "\\(\\S-*\\):\\([0-9]+\\)"))) |
1233 |
(if (match-string 2) |
(if (match-string 2) |
1234 |
(let ((line (match-string 2)) |
(let ((line (match-string 2)) |
1235 |
(file (match-string 1))) |
(file (match-string 1))) |
1320 |
|
|
1321 |
(defun gdb-get-frame-number () |
(defun gdb-get-frame-number () |
1322 |
(save-excursion |
(save-excursion |
1323 |
(let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) |
(let* ((pos (re-search-backward "^#*\\([0-9]*\\)" nil t)) |
1324 |
(n (or (and pos (match-string-no-properties 1)) "0"))) |
(n (or (and pos (match-string-no-properties 1)) "0"))) |
1325 |
n))) |
n))) |
1326 |
|
|
1511 |
|
|
1512 |
\\{gdb-locals-mode-map}" |
\\{gdb-locals-mode-map}" |
1513 |
(setq major-mode 'gdb-locals-mode) |
(setq major-mode 'gdb-locals-mode) |
1514 |
(setq mode-name "Locals") |
(setq mode-name (concat "Locals:" gdb-current-frame)) |
1515 |
(setq buffer-read-only t) |
(setq buffer-read-only t) |
1516 |
(use-local-map gdb-locals-mode-map) |
(use-local-map gdb-locals-mode-map) |
1517 |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
(if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
2008 |
(if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") |
(if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") |
2009 |
(progn |
(progn |
2010 |
(setq gdb-current-frame (match-string 2)) |
(setq gdb-current-frame (match-string 2)) |
2011 |
|
(if (gdb-get-buffer 'gdb-locals-buffer) |
2012 |
|
(with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) |
2013 |
|
(setq mode-name (concat "Locals:" gdb-current-frame)))) |
2014 |
(let ((address (match-string 1))) |
(let ((address (match-string 1))) |
2015 |
;; remove leading 0s from output of info frame command. |
;; remove leading 0s from output of info frame command. |
2016 |
(if (string-match "^0+\\(.*\\)" address) |
(if (string-match "^0+\\(.*\\)" address) |