aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog17
-rw-r--r--lisp/progmodes/gdb-mi.el299
2 files changed, 164 insertions, 152 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1e4d263a351..b71ae44fb3b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,22 @@
12009-07-07 Dmitry Dzhus <dima@sphinx.net.ru> 12009-07-07 Dmitry Dzhus <dima@sphinx.net.ru>
2 2
3 * progmodes/gdb-mi.el (gdb-init-1): Set mode name for disassembly
4 buffer properly.
5 (gdb-breakpoints-list-handler-custom): Replacement for
6 gdb-break-list-handler. Using real parser instead of regexps now.
7 (gdb-place-breakpoints): Replacement for gdb-break-list-custom.
8 Use gdb-breakpoints-list instead of parsing breakpoints buffer to
9 place breakpoints.
10 (def-gdb-memory-unit): A new macro to define gdb-memory-unit-..
11 functions.
12 (gdb-disassembly-handler-custom): Show overlay arrow.
13 (gdb-disassembly-place-breakpoints): Show breakpoints in
14 disassembly buffer.
15 (gdb-toggle-breakpoint, gdb-delete-breakpoint)
16 (gdb-goto-breakpoint): Using gdb-breakpoint text properties
17 instead of parsing breakpoints buffer.
18 Fixed old menu references in gud-menu-map.
19
3 * fadr.el: Removed. 20 * fadr.el: Removed.
4 21
5 * progmodes/gdb-mi.el: Port memory buffer from gdb-ui.el 22 * progmodes/gdb-mi.el: Port memory buffer from gdb-ui.el
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 1b68aca74ef..3c3438a6e6b 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -126,6 +126,12 @@ STATUS is nil (unchanged), `changed' or `out-of-scope'.")
126(defvar gdb-main-file nil "Source file from which program execution begins.") 126(defvar gdb-main-file nil "Source file from which program execution begins.")
127(defvar gdb-overlay-arrow-position nil) 127(defvar gdb-overlay-arrow-position nil)
128(defvar gdb-stack-position nil) 128(defvar gdb-stack-position nil)
129(defvar gdb-breakpoints-list nil
130 "List of breakpoints.
131
132`gdb-get-field' is used to access breakpoints data stored in this
133variable. Each element contains the same fields as \"body\"
134member of \"-break-info\".")
129(defvar gdb-location-alist nil 135(defvar gdb-location-alist nil
130 "Alist of breakpoint numbers and full filenames. Only used for files that 136 "Alist of breakpoint numbers and full filenames. Only used for files that
131Emacs can't find.") 137Emacs can't find.")
@@ -382,7 +388,7 @@ detailed description of this mode.
382 (run-hooks 'gdb-mode-hook)) 388 (run-hooks 'gdb-mode-hook))
383 389
384(defun gdb-init-1 () 390(defun gdb-init-1 ()
385 (gud-def gud-break (if (not (string-equal mode-name "Machine")) 391 (gud-def gud-break (if (not (string-equal mode-name "Disassembly"))
386 (gud-call "break %f:%l" arg) 392 (gud-call "break %f:%l" arg)
387 (save-excursion 393 (save-excursion
388 (beginning-of-line) 394 (beginning-of-line)
@@ -390,7 +396,7 @@ detailed description of this mode.
390 (gud-call "break *%a" arg))) 396 (gud-call "break *%a" arg)))
391 "\C-b" "Set breakpoint at current line or address.") 397 "\C-b" "Set breakpoint at current line or address.")
392 ;; 398 ;;
393 (gud-def gud-remove (if (not (string-equal mode-name "Machine")) 399 (gud-def gud-remove (if (not (string-equal mode-name "Disassembly"))
394 (gud-call "clear %f:%l" arg) 400 (gud-call "clear %f:%l" arg)
395 (save-excursion 401 (save-excursion
396 (beginning-of-line) 402 (beginning-of-line)
@@ -398,7 +404,7 @@ detailed description of this mode.
398 (gud-call "clear *%a" arg))) 404 (gud-call "clear *%a" arg)))
399 "\C-d" "Remove breakpoint at current line or address.") 405 "\C-d" "Remove breakpoint at current line or address.")
400 ;; 406 ;;
401 (gud-def gud-until (if (not (string-equal mode-name "Machine")) 407 (gud-def gud-until (if (not (string-equal mode-name "Disassembly"))
402 (gud-call "-exec-until %f:%l" arg) 408 (gud-call "-exec-until %f:%l" arg)
403 (save-excursion 409 (save-excursion
404 (beginning-of-line) 410 (beginning-of-line)
@@ -1214,6 +1220,7 @@ static char *magick[] = {
1214 (gdb-get-changed-registers) 1220 (gdb-get-changed-registers)
1215 (gdb-invalidate-registers) 1221 (gdb-invalidate-registers)
1216 (gdb-invalidate-locals) 1222 (gdb-invalidate-locals)
1223 (gdb-invalidate-disassembly)
1217 (gdb-invalidate-memory) 1224 (gdb-invalidate-memory)
1218 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) 1225 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
1219 (dolist (var gdb-var-list) 1226 (dolist (var gdb-var-list)
@@ -1530,61 +1537,50 @@ OUTPUT-HANDLER-NAME handler uses customization of CUSTOM-DEFUN."
1530 'gdb-breakpoints-buffer-name 1537 'gdb-breakpoints-buffer-name
1531 'gdb-breakpoints-mode) 1538 'gdb-breakpoints-mode)
1532 1539
1533(def-gdb-auto-update-trigger gdb-invalidate-breakpoints 1540(def-gdb-auto-updated-buffer gdb-breakpoints-buffer
1534 (gdb-get-buffer 'gdb-breakpoints-buffer) 1541 gdb-invalidate-breakpoints "-break-list\n"
1535 "-break-list\n" 1542 gdb-breakpoints-list-handler gdb-breakpoints-list-handler-custom)
1536 gdb-break-list-handler)
1537
1538(defconst gdb-break-list-regexp
1539"bkpt={.*?number=\"\\(.*?\\)\".*?,type=\"\\(.*?\\)\".*?,disp=\"\\(.*?\\)\".*?,\
1540enabled=\"\\(.\\)\".*?,addr=\"\\(.*?\\)\",\\(?:.*?func=\"\\(.*?\\)\".*?,\
1541file=\"\\(.*?\\)\".*?,fullname=\".*?\".*?,line=\"\\(.*?\\)\",\
1542\\|\\(?:.*?what=\"\\(.*?\\)\",\\)*\\).*?times=\"\\(.*?\\)\".*?}")
1543 1543
1544(defun gdb-break-list-handler () 1544(defun gdb-breakpoints-list-handler-custom ()
1545 (setq gdb-pending-triggers (delq 'gdb-invalidate-breakpoints 1545 (setq gdb-pending-triggers (delq 'gdb-invalidate-breakpoints
1546 gdb-pending-triggers)) 1546 gdb-pending-triggers))
1547 (let ((breakpoint) (breakpoints-list)) 1547 (let ((breakpoints-list (gdb-get-field
1548 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) 1548 (json-partial-output "bkpt")
1549 (goto-char (point-min)) 1549 'BreakpointTable 'body)))
1550 (while (re-search-forward gdb-break-list-regexp nil t) 1550 (setq gdb-breakpoints-list breakpoints-list)
1551 (let ((breakpoint (list (match-string 1) 1551 (insert "Num\tType\t\tDisp\tEnb\tHits\tAddr What\n")
1552 (match-string 2) 1552 (dolist (breakpoint breakpoints-list)
1553 (match-string 3) 1553 (insert
1554 (match-string 4) 1554 (concat
1555 (match-string 5) 1555 (gdb-get-field breakpoint 'number) "\t"
1556 (match-string 6) 1556 (gdb-get-field breakpoint 'type) "\t"
1557 (match-string 7) 1557 (gdb-get-field breakpoint 'disp) "\t"
1558 (match-string 8) 1558 (let ((flag (gdb-get-field breakpoint 'enabled)))
1559 (match-string 9) 1559 (if (string-equal flag "y")
1560 (match-string 10)))) 1560 (propertize "on" 'face font-lock-warning-face)
1561 (push breakpoint breakpoints-list)))) 1561 (propertize "off" 'face font-lock-type-face))) "\t"
1562 (let ((buf (gdb-get-buffer 'gdb-breakpoints-buffer))) 1562 (gdb-get-field breakpoint 'times) "\t"
1563 (and buf (with-current-buffer buf 1563 (gdb-get-field breakpoint 'addr)))
1564 (let ((p (point)) 1564 (let ((at (gdb-get-field breakpoint 'at)))
1565 (buffer-read-only nil)) 1565 (cond ((not at)
1566 (erase-buffer) 1566 (progn
1567 (insert "Num Type Disp Enb Hits Addr What\n") 1567 (insert
1568 (dolist (breakpoint breakpoints-list) 1568 (concat " in "
1569 (insert 1569 (propertize (gdb-get-field breakpoint 'func)
1570 (concat 1570 'face font-lock-function-name-face)))
1571 (nth 0 breakpoint) " " 1571 (gdb-insert-frame-location breakpoint)))
1572 (nth 1 breakpoint) " " 1572 (at (insert at))
1573 (nth 2 breakpoint) " " 1573 (t (insert (gdb-get-field breakpoint 'original-location)))))
1574 (propertize (nth 3 breakpoint) 1574 (add-text-properties (line-beginning-position)
1575 'face (if (eq (string-to-char (nth 3 breakpoint)) ?y) 1575 (line-end-position)
1576 font-lock-warning-face 1576 `(gdb-breakpoint ,breakpoint
1577 font-lock-type-face)) " " 1577 mouse-face highlight
1578 (nth 9 breakpoint) " " 1578 help-echo "mouse-2, RET: visit breakpoint"))
1579 (nth 4 breakpoint) " " 1579 (newline))
1580 (if (nth 5 breakpoint) 1580 (gdb-place-breakpoints)))
1581 (concat "in " (nth 5 breakpoint) " at " (nth 6 breakpoint) ":" (nth 7 breakpoint) "\n")
1582 (concat (nth 8 breakpoint) "\n")))))
1583 (goto-char p))))))
1584 (gdb-break-list-custom))
1585 1581
1586;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). 1582;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
1587(defun gdb-break-list-custom () 1583(defun gdb-place-breakpoints ()
1588 (let ((flag) (bptno)) 1584 (let ((flag) (bptno))
1589 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. 1585 ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
1590 (dolist (buffer (buffer-list)) 1586 (dolist (buffer (buffer-list))
@@ -1592,49 +1588,30 @@ file=\"\\(.*?\\)\".*?,fullname=\".*?\".*?,line=\"\\(.*?\\)\",\
1592 (if (and (eq gud-minor-mode 'gdbmi) 1588 (if (and (eq gud-minor-mode 'gdbmi)
1593 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) 1589 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name))))
1594 (gdb-remove-breakpoint-icons (point-min) (point-max))))) 1590 (gdb-remove-breakpoint-icons (point-min) (point-max)))))
1595 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) 1591 (dolist (breakpoint gdb-breakpoints-list)
1596 (save-excursion 1592 (let ((line (gdb-get-field breakpoint 'line)))
1597 (goto-char (point-min)) 1593 (when line
1598 (while (< (point) (- (point-max) 1)) 1594 (let ((file (gdb-get-field breakpoint 'file))
1599 (forward-line 1) 1595 (flag (gdb-get-field breakpoint 'enabled))
1600 (if (looking-at "[^\t].*?breakpoint") 1596 (bptno (gdb-get-field breakpoint 'number)))
1601 (progn 1597 (unless (file-exists-p file)
1602 (looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)") 1598 (setq file (cdr (assoc bptno gdb-location-alist))))
1603 (setq bptno (match-string 1)) 1599 (if (and file
1604 (setq flag (char-after (match-beginning 2))) 1600 (not (string-equal file "File not found")))
1605 (beginning-of-line) 1601 (with-current-buffer
1606 (if (re-search-forward " in \\(.*\\) at\\s-+" nil t) 1602 (find-file-noselect file 'nowarn)
1607 (progn 1603 (gdb-init-buffer)
1608 (let ((buffer-read-only nil)) 1604 ;; Only want one breakpoint icon at each location.
1609 (add-text-properties (match-beginning 1) (match-end 1) 1605 (save-excursion
1610 '(face font-lock-function-name-face))) 1606 (goto-line (string-to-number line))
1611 (looking-at "\\(\\S-+\\):\\([0-9]+\\)") 1607 (gdb-put-breakpoint-icon (string-equal flag "y") bptno)))
1612 (let ((line (match-string 2)) (buffer-read-only nil) 1608 (gdb-input
1613 (file (match-string 1))) 1609 (list (concat "list " file ":1\n")
1614 (add-text-properties (line-beginning-position) 1610 'ignore))
1615 (line-end-position) 1611 (gdb-input
1616 '(mouse-face highlight 1612 (list "-file-list-exec-source-file\n"
1617 help-echo "mouse-2, RET: visit breakpoint")) 1613 `(lambda () (gdb-get-location
1618 (unless (file-exists-p file) 1614 ,bptno ,line ,flag)))))))))))
1619 (setq file (cdr (assoc bptno gdb-location-alist))))
1620 (if (and file
1621 (not (string-equal file "File not found")))
1622 (with-current-buffer
1623 (find-file-noselect file 'nowarn)
1624 (gdb-init-buffer)
1625 ;; Only want one breakpoint icon at each location.
1626 (save-excursion
1627 (goto-line (string-to-number line))
1628 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
1629 (gdb-input
1630 (list (concat "list "
1631 (match-string-no-properties 3) ":1\n")
1632 'ignore))
1633 (gdb-input
1634 (list "-file-list-exec-source-file\n"
1635 `(lambda () (gdb-get-location
1636 ,bptno ,line ,flag))))))))))))
1637 (end-of-line))))
1638 1615
1639(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") 1616(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"")
1640 1617
@@ -1684,7 +1661,7 @@ If not in a source or disassembly buffer just set point."
1684 (mouse-minibuffer-check event) 1661 (mouse-minibuffer-check event)
1685 (let ((posn (event-end event))) 1662 (let ((posn (event-end event)))
1686 (with-selected-window (posn-window posn) 1663 (with-selected-window (posn-window posn)
1687 (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode)) 1664 (if (or (buffer-file-name) (eq major-mode 'gdb-disassembly-mode))
1688 (if (numberp (posn-point posn)) 1665 (if (numberp (posn-point posn))
1689 (save-excursion 1666 (save-excursion
1690 (goto-char (posn-point posn)) 1667 (goto-char (posn-point posn))
@@ -1971,7 +1948,7 @@ FILE is a full path."
1971 (interactive "e") 1948 (interactive "e")
1972 (save-selected-window 1949 (save-selected-window
1973 (select-window (posn-window (event-start event))) 1950 (select-window (posn-window (event-start event)))
1974 (gdb-memory-set-address-1))) 1951 (gdb-memory-set-address)))
1975 1952
1976;; Non-event version for use within keymap 1953;; Non-event version for use within keymap
1977(defun gdb-memory-set-address () 1954(defun gdb-memory-set-address ()
@@ -2074,29 +2051,26 @@ DOC is an optional documentation string."
2074 (vector (car selection)))))) 2051 (vector (car selection))))))
2075 (if binding (call-interactively binding))))) 2052 (if binding (call-interactively binding)))))
2076 2053
2077(defun gdb-memory-unit-giant () 2054(defmacro def-gdb-memory-unit (name unit-size doc)
2078 "Set the unit size to giant words (eight bytes)." 2055 "Define a function NAME to switch memory unit size to UNIT-SIZE.
2079 (interactive)
2080 (customize-set-variable 'gdb-memory-unit 8)
2081 (gdb-invalidate-memory))
2082 2056
2083(defun gdb-memory-unit-word () 2057DOC is an optional documentation string."
2084 "Set the unit size to words (four bytes)." 2058 `(defun ,name () ,(when doc doc)
2085 (interactive) 2059 (interactive)
2086 (customize-set-variable 'gdb-memory-unit 4) 2060 (customize-set-variable 'gdb-memory-unit ,unit-size)
2087 (gdb-invalidate-memory)) 2061 (gdb-invalidate-memory)))
2088 2062
2089(defun gdb-memory-unit-halfword () 2063(def-gdb-memory-unit gdb-memory-unit-giant 8
2090 "Set the unit size to halfwords (two bytes)." 2064 "Set the unit size to giant words (eight bytes).")
2091 (interactive)
2092 (customize-set-variable 'gdb-memory-unit 2)
2093 (gdb-invalidate-memory))
2094 2065
2095(defun gdb-memory-unit-byte () 2066(def-gdb-memory-unit gdb-memory-unit-word 4
2096 "Set the unit size to bytes." 2067 "Set the unit size to words (four bytes).")
2097 (interactive) 2068
2098 (customize-set-variable 'gdb-memory-unit 1) 2069(def-gdb-memory-unit gdb-memory-unit-halfword 2
2099 (gdb-invalidate-memory)) 2070 "Set the unit size to halfwords (two bytes).")
2071
2072(def-gdb-memory-unit gdb-memory-unit-byte 1
2073 "Set the unit size to bytes.")
2100 2074
2101(defmacro def-gdb-memory-show-page (name address-var &optional doc) 2075(defmacro def-gdb-memory-show-page (name address-var &optional doc)
2102 "Define a function NAME which show new address in memory buffer. 2076 "Define a function NAME which show new address in memory buffer.
@@ -2254,9 +2228,10 @@ corresponding to the mode line clicked."
2254 (interactive) 2228 (interactive)
2255 (let* ((special-display-regexps (append special-display-regexps '(".*"))) 2229 (let* ((special-display-regexps (append special-display-regexps '(".*")))
2256 (special-display-frame-alist 2230 (special-display-frame-alist
2257 (cons '(left-fringe . 0) 2231 `((left-fringe . 0)
2258 (cons '(right-fringe . 0) 2232 (right-fringe . 0)
2259 (cons '(width . 83) gdb-frame-parameters))))) 2233 (width . 83)
2234 ,@gdb-frame-parameters)))
2260 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) 2235 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
2261 2236
2262 2237
@@ -2320,6 +2295,9 @@ corresponding to the mode line clicked."
2320 (kill-all-local-variables) 2295 (kill-all-local-variables)
2321 (setq major-mode 'gdb-disassembly-mode) 2296 (setq major-mode 'gdb-disassembly-mode)
2322 (setq mode-name "Disassembly") 2297 (setq mode-name "Disassembly")
2298 (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position)
2299 (setq fringes-outside-margins t)
2300 (setq gdb-overlay-arrow-position (make-marker))
2323 (use-local-map gdb-disassembly-mode-map) 2301 (use-local-map gdb-disassembly-mode-map)
2324 (setq buffer-read-only t) 2302 (setq buffer-read-only t)
2325 (buffer-disable-undo) 2303 (buffer-disable-undo)
@@ -2332,8 +2310,28 @@ corresponding to the mode line clicked."
2332 (let* ((res (json-partial-output)) 2310 (let* ((res (json-partial-output))
2333 (instructions (gdb-get-field res 'asm_insns))) 2311 (instructions (gdb-get-field res 'asm_insns)))
2334 (dolist (instr instructions) 2312 (dolist (instr instructions)
2313 ;; Put overlay arrow
2314 (when (string-equal (gdb-get-field instr 'address)
2315 gdb-pc-address)
2316 (progn
2317 (setq fringe-indicator-alist
2318 (if (string-equal gdb-frame-number "0")
2319 nil
2320 '((overlay-arrow . hollow-right-triangle))))
2321 (set-marker gdb-overlay-arrow-position (point))))
2335 (insert (apply 'format `("%s <%s+%s>:\t%s\n" 2322 (insert (apply 'format `("%s <%s+%s>:\t%s\n"
2336 ,@(gdb-get-many-fields instr 'address 'func-name 'offset 'inst))))))) 2323 ,@(gdb-get-many-fields instr 'address 'func-name 'offset 'inst))))))
2324 (gdb-disassembly-place-breakpoints))
2325
2326(defun gdb-disassembly-place-breakpoints ()
2327 (dolist (breakpoint gdb-breakpoints-list)
2328 (let ((bptno (gdb-get-field breakpoint 'number))
2329 (flag (gdb-get-field breakpoint 'enabled))
2330 (address (gdb-get-field breakpoint 'addr)))
2331 (save-excursion
2332 (goto-char (point-min))
2333 (if (re-search-forward (concat "^" address) nil t)
2334 (gdb-put-breakpoint-icon (string-equal flag "y") bptno))))))
2337 2335
2338 2336
2339;;; Breakpoints view 2337;;; Breakpoints view
@@ -2384,44 +2382,40 @@ corresponding to the mode line clicked."
2384 (run-mode-hooks 'gdb-breakpoints-mode-hook) 2382 (run-mode-hooks 'gdb-breakpoints-mode-hook)
2385 'gdb-invalidate-breakpoints) 2383 'gdb-invalidate-breakpoints)
2386 2384
2387(defconst gdb-breakpoint-regexp
2388 "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+")
2389
2390(defun gdb-toggle-breakpoint () 2385(defun gdb-toggle-breakpoint ()
2391 "Enable/disable breakpoint at current line." 2386 "Enable/disable breakpoint at current line of breakpoints buffer."
2392 (interactive) 2387 (interactive)
2393 (save-excursion 2388 (save-excursion
2394 (beginning-of-line 1) 2389 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
2395 (if (looking-at gdb-breakpoint-regexp) 2390 (if breakpoint
2396 (gud-basic-call 2391 (gud-basic-call
2397 (concat (if (eq ?y (char-after (match-beginning 2))) 2392 (concat (if (string-equal "y" (gdb-get-field breakpoint 'enabled))
2398 "-break-disable " 2393 "-break-disable "
2399 "-break-enable ") 2394 "-break-enable ")
2400 (match-string 1))) 2395 (gdb-get-field breakpoint 'number)))
2401 (error "Not recognized as break/watchpoint line")))) 2396 (error "Not recognized as break/watchpoint line")))))
2402 2397
2403(defun gdb-delete-breakpoint () 2398(defun gdb-delete-breakpoint ()
2404 "Delete the breakpoint at current line." 2399 "Delete the breakpoint at current line of breakpoints buffer."
2405 (interactive) 2400 (interactive)
2406 (save-excursion 2401 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
2407 (beginning-of-line 1) 2402 (if breakpoint
2408 (if (looking-at gdb-breakpoint-regexp) 2403 (gud-basic-call (concat "-break-delete " (gdb-get-field breakpoint 'number)))
2409 (gud-basic-call (concat "-break-delete " (match-string 1)))
2410 (error "Not recognized as break/watchpoint line")))) 2404 (error "Not recognized as break/watchpoint line"))))
2411 2405
2412(defun gdb-goto-breakpoint (&optional event) 2406(defun gdb-goto-breakpoint (&optional event)
2413 "Display the breakpoint location specified at current line." 2407 "Go to the location of breakpoint at current line of
2408breakpoints buffer."
2414 (interactive (list last-input-event)) 2409 (interactive (list last-input-event))
2415 (if event (posn-set-point (event-end event))) 2410 (if event (posn-set-point (event-end event)))
2416 ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer. 2411 ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer.
2417 (let ((window (get-buffer-window gud-comint-buffer))) 2412 (let ((window (get-buffer-window gud-comint-buffer)))
2418 (if window (save-selected-window (select-window window)))) 2413 (if window (save-selected-window (select-window window))))
2419 (save-excursion 2414 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
2420 (beginning-of-line 1) 2415 (if breakpoint
2421 (if (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") 2416 (let ((bptno (gdb-get-field breakpoint 'number))
2422 (let ((bptno (match-string 1)) 2417 (file (gdb-get-field breakpoint 'file))
2423 (file (match-string 2)) 2418 (line (gdb-get-field breakpoint 'line)))
2424 (line (match-string 3)))
2425 (save-selected-window 2419 (save-selected-window
2426 (let* ((buffer (find-file-noselect 2420 (let* ((buffer (find-file-noselect
2427 (if (file-exists-p file) file 2421 (if (file-exists-p file) file
@@ -2447,7 +2441,10 @@ corresponding to the mode line clicked."
2447 gdb-stack-list-frames-handler) 2441 gdb-stack-list-frames-handler)
2448 2442
2449(defun gdb-insert-frame-location (frame) 2443(defun gdb-insert-frame-location (frame)
2450 "Insert \"file:line\" button or library name for FRAME object." 2444 "Insert \"of file:line\" button or library name for structure FRAME.
2445
2446FRAME must have either \"file\" and \"line\" members or \"from\"
2447member."
2451 (let ((file (gdb-get-field frame 'fullname)) 2448 (let ((file (gdb-get-field frame 'fullname))
2452 (line (gdb-get-field frame 'line)) 2449 (line (gdb-get-field frame 'line))
2453 (from (gdb-get-field frame 'from))) 2450 (from (gdb-get-field frame 'from)))
@@ -2861,7 +2858,7 @@ is set in them."
2861 (let ((frame (gdb-get-field (json-partial-output) 'frame))) 2858 (let ((frame (gdb-get-field (json-partial-output) 'frame)))
2862 (when frame 2859 (when frame
2863 (setq gdb-frame-number (gdb-get-field frame 'level)) 2860 (setq gdb-frame-number (gdb-get-field frame 'level))
2864 (setq gdb-pc-address (gdb-get-field frame addr)) 2861 (setq gdb-pc-address (gdb-get-field frame 'addr))
2865 (setq gdb-selected-frame (gdb-get-field frame 'func)) 2862 (setq gdb-selected-frame (gdb-get-field frame 'func))
2866 (setq gdb-selected-file (gdb-get-field frame 'fullname)) 2863 (setq gdb-selected-file (gdb-get-field frame 'fullname))
2867 (let ((line (gdb-get-field frame 'line))) 2864 (let ((line (gdb-get-field frame 'line)))
@@ -2927,8 +2924,7 @@ is set in them."
2927 :visible (eq gud-minor-mode 'gdbmi))) 2924 :visible (eq gud-minor-mode 'gdbmi)))
2928 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) 2925 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
2929 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) 2926 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
2930; (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) 2927 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
2931 (define-key menu [memory] '("Memory" . gdb-todo-memory))
2932 (define-key menu [disassembly] 2928 (define-key menu [disassembly]
2933 '("Disassembly" . gdb-display-disassembly-buffer)) 2929 '("Disassembly" . gdb-display-disassembly-buffer))
2934 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) 2930 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
@@ -2946,8 +2942,7 @@ is set in them."
2946 :visible (eq gud-minor-mode 'gdbmi))) 2942 :visible (eq gud-minor-mode 'gdbmi)))
2947 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) 2943 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
2948 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) 2944 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
2949; (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) 2945 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
2950 (define-key menu [memory] '("Memory" . gdb-todo-memory))
2951 (define-key menu [disassembly] '("Disassembly" . gdb-frame-disassembly-buffer)) 2946 (define-key menu [disassembly] '("Disassembly" . gdb-frame-disassembly-buffer))
2952 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) 2947 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
2953 (define-key menu [inferior] 2948 (define-key menu [inferior]