This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] gdb-mi.el
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 25 Mar 2006 19:16:52 +1200
- Subject: [PATCH] gdb-mi.el
Here's my latest patch for gdb-mi.el. I guess it's a little bit pointless as
Emacs doesn't seem to have a slow release cycle, so much as a no release cycle
- its just to keep things tidy.
OK to commit?
--
Nick http://www.inet.net.nz/~nickrob
Side Note: diff -p doesn't seem to work with Emacs Lisp
2006-03-25 Nick Roberts <nickrob@snap.net.nz>
* mi/gdb-mi.el (gdbmi-send): Improve regexp to repeat commands.
Try to deal with continuation line.
(gdbmi, gdbmi-prompt1, gud-gdbmi-marker-filter): Update to new
variable names.
(gdb-break-list-regexp, gdb-stack-list-frames-regexp):
Future proof against new fields being added to MI output.
(gdbmi-prompt2, gdb-break-list-handler,gdb-get-source-file)
(gdbmi-frame-handler): Update to new variable name
gdb-get-buffer-create.
(gdbmi-frame-handler): Use hollow-right-triangle for all selected
frames which except the innermost (where execution has stopped).
*** gdb-mi.el 14 Feb 2006 21:54:32 +1300 1.6
--- gdb-mi.el 25 Mar 2006 18:57:55 +1200
*************** detailed description of this mode.
*** 115,121 ****
;; Let's start with a basic gud-gdb buffer and then modify it a bit.
(gdb command-line)
;;
! (setq gdb-debug-log nil)
(set (make-local-variable 'gud-minor-mode) 'gdbmi)
(set (make-local-variable 'gud-marker-filter) 'gud-gdbmi-marker-filter)
;;
--- 115,121 ----
;; Let's start with a basic gud-gdb buffer and then modify it a bit.
(gdb command-line)
;;
! (setq gdb-debug-ring nil)
(set (make-local-variable 'gud-minor-mode) 'gdbmi)
(set (make-local-variable 'gud-marker-filter) 'gud-gdbmi-marker-filter)
;;
*************** detailed description of this mode.
*** 177,183 ****
gdb-selected-frame nil
gdb-frame-number nil
gdb-var-list nil
! gdb-var-changed nil
gdb-prompting nil
gdb-input-queue nil
gdb-current-item nil
--- 177,183 ----
gdb-selected-frame nil
gdb-frame-number nil
gdb-var-list nil
! gdb-force-update t
gdb-prompting nil
gdb-input-queue nil
gdb-current-item nil
*************** detailed description of this mode.
*** 225,242 ****
(setq gdb-output-sink 'user)
(setq gdb-prompting nil)
;; mimic <RET> key to repeat previous command in GDB
! (if (string-match "\\S+" string)
(setq gdb-last-command string)
(if gdb-last-command (setq string gdb-last-command)))
! (if gdb-enable-debug-log
! (push (cons 'mi-send (concat string "\n")) gdb-debug-log))
! (process-send-string
! proc
(if (string-match "^-" string)
;; MI command
! (concat string "\n")
;; CLI command
! (concat "-interpreter-exec console \"" string "\"\n")))))
(defcustom gud-gdbmi-command-name "gdb -interp=mi"
"Default command to execute an executable under the GDB-UI debugger."
--- 225,245 ----
(setq gdb-output-sink 'user)
(setq gdb-prompting nil)
;; mimic <RET> key to repeat previous command in GDB
! (if (string-match "^\\S+$" string)
(setq gdb-last-command string)
(if gdb-last-command (setq string gdb-last-command)))
! (if gdb-enable-debug
! (push (cons 'mi-send (concat string "\n")) gdb-debug-ring))
(if (string-match "^-" string)
;; MI command
! (process-send-string proc (concat string "\n"))
;; CLI command
! (if (string-match "\\\\$" string)
! (setq gdb-continuation (concat gdb-continuation string "\n"))
! (process-send-string proc
! (concat "-interpreter-exec console \""
! gdb-continuation string "\"\n"))
! (setq gdb-continuation nil)))))
(defcustom gud-gdbmi-command-name "gdb -interp=mi"
"Default command to execute an executable under the GDB-UI debugger."
*************** detailed description of this mode.
*** 265,271 ****
"Queue any GDB commands that the user interface needs."
(unless gdb-pending-triggers
(when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
! (setq gdb-var-changed t) ; force update
(dolist (var gdb-var-list)
(setcar (nthcdr 5 var) nil))
(gdb-var-update-1))
--- 268,274 ----
"Queue any GDB commands that the user interface needs."
(unless gdb-pending-triggers
(when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
! (setq gdb-force-update t)
(dolist (var gdb-var-list)
(setcar (nthcdr 5 var) nil))
(gdb-var-update-1))
*************** detailed description of this mode.
*** 282,288 ****
(when (eq sink 'emacs)
(let ((handler
(car (cdr gdb-current-item))))
! (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
(funcall handler)))))
(let ((input (gdb-dequeue-input)))
(if input
--- 285,291 ----
(when (eq sink 'emacs)
(let ((handler
(car (cdr gdb-current-item))))
! (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
(funcall handler)))))
(let ((input (gdb-dequeue-input)))
(if input
*************** detailed description of this mode.
*** 296,303 ****
"Filter GDB/MI output."
(if gdb-flush-pending-output
nil
! (if gdb-enable-debug-log (push (cons 'recv (list string gdb-output-sink))
! gdb-debug-log))
;; Recall the left over gud-marker-acc from last time
(setq gud-marker-acc (concat gud-marker-acc string))
;; Start accumulating output for the GUD buffer
--- 299,306 ----
"Filter GDB/MI output."
(if gdb-flush-pending-output
nil
! (if gdb-enable-debug (push (cons 'recv (list string gdb-output-sink))
! gdb-debug-ring))
;; Recall the left over gud-marker-acc from last time
(setq gud-marker-acc (concat gud-marker-acc string))
;; Start accumulating output for the GUD buffer
*************** detailed description of this mode.
*** 400,415 ****
gdb-break-list-handler)
(defconst gdb-break-list-regexp
! "number=\"\\(.*?\\)\",type=\"\\(.*?\\)\",disp=\"\\(.*?\\)\",enabled=\"\\(.\\)\",\
! addr=\"\\(.*?\\)\",\
! \\(?:func=\"\\(.*?\\)\",file=\"\\(.*?\\)\",fullname=\".*?\",line=\"\\(.*?\\)\",\
! \\|\\(?:what=\"\\(.*?\\)\",\\)*\\)times=\"\\(.*?\\)\"")
(defun gdb-break-list-handler ()
(setq gdb-pending-triggers (delq 'gdbmi-invalidate-breakpoints
gdb-pending-triggers))
(let ((breakpoint) (breakpoints-list))
! (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
(goto-char (point-min))
(while (re-search-forward gdb-break-list-regexp nil t)
(let ((breakpoint (list (match-string 1)
--- 403,418 ----
gdb-break-list-handler)
(defconst gdb-break-list-regexp
! "bkpt={.*?number=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\",.*?disp=\"\\(.*?\\)\",.*?\
! enabled=\"\\(.\\)\",.*?addr=\"\\(.*?\\)\",\\(?:.*?func=\"\\(.*?\\)\",.*?\
! file=\"\\(.*?\\)\",.*?fullname=\".*?\",.*?line=\"\\(.*?\\)\",\
! \\|\\(?:.*?what=\"\\(.*?\\)\",\\)*\\).*?times=\"\\(.*?\\)\".*?}")
(defun gdb-break-list-handler ()
(setq gdb-pending-triggers (delq 'gdbmi-invalidate-breakpoints
gdb-pending-triggers))
(let ((breakpoint) (breakpoints-list))
! (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
(goto-char (point-min))
(while (re-search-forward gdb-break-list-regexp nil t)
(let ((breakpoint (list (match-string 1)
*************** Add directory to search path for source
*** 476,483 ****
gdb-stack-list-frames-handler)
(defconst gdb-stack-list-frames-regexp
! "level=\"\\(.*?\\)\",addr=\"\\(.*?\\)\",func=\"\\(.*?\\)\",\
! \\(?:file=\".*?\",fullname=\"\\(.*?\\)\",line=\"\\(.*?\\)\"\\|\
from=\"\\(.*?\\)\"\\)")
(defun gdb-stack-list-frames-handler ()
--- 479,486 ----
gdb-stack-list-frames-handler)
(defconst gdb-stack-list-frames-regexp
! "{.*?level=\"\\(.*?\\)\",.*?addr=\"\\(.*?\\)\",.*?func=\"\\(.*?\\)\",\
! \\(?:.*?file=\".*?\",.*?fullname=\"\\(.*?\\)\",.*?line=\"\\(.*?\\)\".*?}\\|\
from=\"\\(.*?\\)\"\\)")
(defun gdb-stack-list-frames-handler ()
*************** from=\"\\(.*?\\)\"\\)")
*** 485,491 ****
gdb-pending-triggers))
(let ((frame nil)
(call-stack nil))
! (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
(goto-char (point-min))
(while (re-search-forward gdb-stack-list-frames-regexp nil t)
(let ((frame (list (match-string 1)
--- 488,494 ----
gdb-pending-triggers))
(let ((frame nil)
(call-stack nil))
! (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
(goto-char (point-min))
(while (re-search-forward gdb-stack-list-frames-regexp nil t)
(let ((frame (list (match-string 1)
*************** buffers, if required."
*** 540,546 ****
(setq gdb-main-file (match-string 1)))
(if gdb-many-windows
(gdb-setup-windows)
! (gdb-get-create-buffer 'gdb-breakpoints-buffer)
(if gdb-show-main
(let ((pop-up-windows t))
(display-buffer (gud-find-file gdb-main-file))))))
--- 543,549 ----
(setq gdb-main-file (match-string 1)))
(if gdb-many-windows
(gdb-setup-windows)
! (gdb-get-buffer-create 'gdb-breakpoints-buffer)
(if gdb-show-main
(let ((pop-up-windows t))
(display-buffer (gud-find-file gdb-main-file))))))
*************** buffers, if required."
*** 556,562 ****
(defun gdbmi-frame-handler ()
(setq gdb-pending-triggers
(delq 'gdbmi-get-selected-frame gdb-pending-triggers))
! (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
(goto-char (point-min))
(when (re-search-forward gdb-stack-list-frames-regexp nil t)
(setq gdb-frame-number (match-string 1))
--- 559,565 ----
(defun gdbmi-frame-handler ()
(setq gdb-pending-triggers
(delq 'gdbmi-get-selected-frame gdb-pending-triggers))
! (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
(goto-char (point-min))
(when (re-search-forward gdb-stack-list-frames-regexp nil t)
(setq gdb-frame-number (match-string 1))
*************** buffers, if required."
*** 565,570 ****
--- 568,584 ----
(setq gud-last-frame
(cons (match-string 4) (string-to-number (match-string 5))))
(gud-display-frame)
+ (if gud-overlay-arrow-position
+ (let ((buffer (marker-buffer gud-overlay-arrow-position))
+ (position (marker-position gud-overlay-arrow-position)))
+ (when buffer
+ (with-current-buffer buffer
+ (setq fringe-indicator-alist
+ (if (string-equal gdb-frame-number "0")
+ nil
+ '((overlay-arrow . hollow-right-triangle))))
+ (setq gud-overlay-arrow-position (make-marker))
+ (set-marker gud-overlay-arrow-position position)))))
(if (gdb-get-buffer 'gdb-locals-buffer)
(with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
(setq mode-name (concat "Locals:" gdb-selected-frame))))