From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24098 invoked by alias); 25 Mar 2006 07:18:41 -0000 Received: (qmail 24089 invoked by uid 22791); 25 Mar 2006 07:18:39 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 25 Mar 2006 07:18:36 +0000 Received: from kahikatea.snap.net.nz (p202-124-115-166.snap.net.nz [202.124.115.166]) by viper.snap.net.nz (Postfix) with ESMTP id 6E24974A368 for ; Sat, 25 Mar 2006 19:18:23 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 665B288E8; Sat, 25 Mar 2006 19:16:53 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17444.61028.687335.767627@kahikatea.snap.net.nz> Date: Sat, 25 Mar 2006 08:19:00 -0000 To: gdb-patches@sources.redhat.com Subject: [PATCH] gdb-mi.el Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00290.txt.bz2 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 * 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 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 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))))