emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog progmodes/gdb-mi.el


From: Dmitry Dzhus
Subject: [Emacs-diffs] emacs/lisp ChangeLog progmodes/gdb-mi.el
Date: Tue, 14 Jul 2009 08:41:05 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Dmitry Dzhus <sphinx>   09/07/14 08:41:05

Modified files:
        lisp           : ChangeLog 
        lisp/progmodes : gdb-mi.el 

Log message:
        (json-partial-output): Fix broken GDB/MI output in -break-info command
        (Emacs bug #3794).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15804&r2=1.15805
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/progmodes/gdb-mi.el?cvsroot=emacs&r1=1.13&r2=1.14

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15804
retrieving revision 1.15805
diff -u -b -r1.15804 -r1.15805
--- ChangeLog   14 Jul 2009 08:01:50 -0000      1.15804
+++ ChangeLog   14 Jul 2009 08:40:58 -0000      1.15805
@@ -1,3 +1,8 @@
+2009-07-14  Dmitry Dzhus  <address@hidden>
+
+       * progmodes/gdb-mi.el (json-partial-output): Fix broken GDB/MI
+       output in -break-info command (Emacs bug #3794).
+
 2009-07-14  Glenn Morris  <address@hidden>
 
        * emacs-lisp/edebug.el (edebug-setup-hook, edebug-all-forms)

Index: progmodes/gdb-mi.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/gdb-mi.el,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- progmodes/gdb-mi.el 8 Jul 2009 04:51:57 -0000       1.13
+++ progmodes/gdb-mi.el 14 Jul 2009 08:41:04 -0000      1.14
@@ -1436,7 +1436,7 @@
   (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
     (erase-buffer)))
 
-(defun json-partial-output (&optional fix-key)
+(defun json-partial-output (&optional fix-key fix-list)
   "Parse gdb-partial-output-buffer with `json-read'.
 
 If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurences from
@@ -1445,13 +1445,35 @@
 -break-info are examples of MI commands which issue such
 responses.
 
+If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with
+\"FIX-LIST=[..]\" prior to parsing. This is used to fix broken
+-break-info output when it contains breakpoint script field
+incompatible with GDB/MI output syntax.
+
 Note that GDB/MI output syntax is different from JSON both
 cosmetically and (in some cases) structurally, so correct results
 are not guaranteed."
   (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
     (goto-char (point-min))
+    (when fix-key
+      (save-excursion
     (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t)
-      (replace-match "" nil nil nil 1))
+          (replace-match "" nil nil nil 1))))
+    (when fix-list
+      (save-excursion
+        ;; Find positions of brackets which enclose broken list
+        (while (re-search-forward (concat fix-list "={\"") nil t)
+          (let ((p1 (goto-char (- (point) 2)))
+                (p2 (progn (forward-sexp)
+                           (1- (point)))))
+            ;; Replace braces with brackets
+            (save-excursion
+              (goto-char p1)
+              (delete-char 1)
+              (insert "[")
+              (goto-char p2)
+              (delete-char 1)
+              (insert "]"))))))
      (goto-char (point-min))
      (insert "{")
     ;; Wrap field names in double quotes and replace equal sign with
@@ -1542,7 +1564,7 @@
   (setq gdb-pending-triggers (delq 'gdb-invalidate-breakpoints
                                  gdb-pending-triggers))
   (let ((breakpoints-list (gdb-get-field 
-                           (json-partial-output "bkpt")
+                           (json-partial-output "bkpt" "script")
                            'BreakpointTable 'body)))
     (setq gdb-breakpoints-list breakpoints-list)
     (insert "Num\tType\t\tDisp\tEnb\tHits\tAddr       What\n")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]