aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Dzhus2009-07-14 08:40:58 +0000
committerDmitry Dzhus2009-07-14 08:40:58 +0000
commitbfc99364d98004ce7d128f4d126d5af03f9c1b81 (patch)
treef3653395d87f4799ba7515abbe26584037f9baf0 /lisp
parent1e46f9e42b32121e43ee37a677b2021254f10a15 (diff)
downloademacs-bfc99364d98004ce7d128f4d126d5af03f9c1b81.tar.gz
emacs-bfc99364d98004ce7d128f4d126d5af03f9c1b81.zip
(json-partial-output): Fix broken GDB/MI output in -break-info command
(Emacs bug #3794).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/gdb-mi.el34
2 files changed, 33 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3a7a2546673..6b1755cc6a2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-07-14 Dmitry Dzhus <dima@sphinx.net.ru>
2
3 * progmodes/gdb-mi.el (json-partial-output): Fix broken GDB/MI
4 output in -break-info command (Emacs bug #3794).
5
12009-07-14 Glenn Morris <rgm@gnu.org> 62009-07-14 Glenn Morris <rgm@gnu.org>
2 7
3 * emacs-lisp/edebug.el (edebug-setup-hook, edebug-all-forms) 8 * emacs-lisp/edebug.el (edebug-setup-hook, edebug-all-forms)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 17916b60b4c..1b61820fd01 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1436,7 +1436,7 @@ static char *magick[] = {
1436 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) 1436 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
1437 (erase-buffer))) 1437 (erase-buffer)))
1438 1438
1439(defun json-partial-output (&optional fix-key) 1439(defun json-partial-output (&optional fix-key fix-list)
1440 "Parse gdb-partial-output-buffer with `json-read'. 1440 "Parse gdb-partial-output-buffer with `json-read'.
1441 1441
1442If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurences from 1442If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurences from
@@ -1445,15 +1445,37 @@ in MI messages, e.g.: [key=.., key=..]. -stack-list-frames and
1445-break-info are examples of MI commands which issue such 1445-break-info are examples of MI commands which issue such
1446responses. 1446responses.
1447 1447
1448If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with
1449\"FIX-LIST=[..]\" prior to parsing. This is used to fix broken
1450-break-info output when it contains breakpoint script field
1451incompatible with GDB/MI output syntax.
1452
1448Note that GDB/MI output syntax is different from JSON both 1453Note that GDB/MI output syntax is different from JSON both
1449cosmetically and (in some cases) structurally, so correct results 1454cosmetically and (in some cases) structurally, so correct results
1450are not guaranteed." 1455are not guaranteed."
1451 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) 1456 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
1452 (goto-char (point-min)) 1457 (goto-char (point-min))
1453 (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t) 1458 (when fix-key
1454 (replace-match "" nil nil nil 1)) 1459 (save-excursion
1455 (goto-char (point-min)) 1460 (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t)
1456 (insert "{") 1461 (replace-match "" nil nil nil 1))))
1462 (when fix-list
1463 (save-excursion
1464 ;; Find positions of brackets which enclose broken list
1465 (while (re-search-forward (concat fix-list "={\"") nil t)
1466 (let ((p1 (goto-char (- (point) 2)))
1467 (p2 (progn (forward-sexp)
1468 (1- (point)))))
1469 ;; Replace braces with brackets
1470 (save-excursion
1471 (goto-char p1)
1472 (delete-char 1)
1473 (insert "[")
1474 (goto-char p2)
1475 (delete-char 1)
1476 (insert "]"))))))
1477 (goto-char (point-min))
1478 (insert "{")
1457 ;; Wrap field names in double quotes and replace equal sign with 1479 ;; Wrap field names in double quotes and replace equal sign with
1458 ;; semicolon. 1480 ;; semicolon.
1459 ;; TODO: This breaks badly with foo= inside constants 1481 ;; TODO: This breaks badly with foo= inside constants
@@ -1542,7 +1564,7 @@ OUTPUT-HANDLER-NAME handler uses customization of CUSTOM-DEFUN."
1542 (setq gdb-pending-triggers (delq 'gdb-invalidate-breakpoints 1564 (setq gdb-pending-triggers (delq 'gdb-invalidate-breakpoints
1543 gdb-pending-triggers)) 1565 gdb-pending-triggers))
1544 (let ((breakpoints-list (gdb-get-field 1566 (let ((breakpoints-list (gdb-get-field
1545 (json-partial-output "bkpt") 1567 (json-partial-output "bkpt" "script")
1546 'BreakpointTable 'body))) 1568 'BreakpointTable 'body)))
1547 (setq gdb-breakpoints-list breakpoints-list) 1569 (setq gdb-breakpoints-list breakpoints-list)
1548 (insert "Num\tType\t\tDisp\tEnb\tHits\tAddr What\n") 1570 (insert "Num\tType\t\tDisp\tEnb\tHits\tAddr What\n")