From: Nick Roberts Date: Fri, 5 Jan 2007 04:20:20 +0000 (+0000) Subject: (gdb-max-children): New customizable variable. X-Git-Tag: emacs-pretest-22.0.93~251 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e1204172cebc642dc8f5f7bc2f1fea3d65804465;p=emacs.git (gdb-max-children): New customizable variable. (gdb-speedbar-expand-node): Ask user for confirmation before expanding large structures/arrays. --- diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 3a253796f28..980c6b3f07b 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -896,6 +896,12 @@ Changed values are highlighted with the face `font-lock-warning-face'." :group 'gud :version "22.1") +(defcustom gdb-max-children 40 + "Maximum number of children allowed before Emacs asks" + :type 'integer + :group 'gud + :version "22.1") + (defun gdb-speedbar-expand-node (text token indent) "Expand the node the user clicked on. TEXT is the text of the button we clicked on, a + or - item. @@ -904,11 +910,17 @@ INDENT is the current indentation depth." (if (and gud-comint-buffer (buffer-name gud-comint-buffer)) (progn (cond ((string-match "+" text) ;expand this node - (if (and (eq (buffer-local-value - 'gud-minor-mode gud-comint-buffer) 'gdba) - (string-equal gdb-version "pre-6.4")) - (gdb-var-list-children token) - (gdb-var-list-children-1 token))) + (let* ((var (assoc token gdb-var-list)) + (expr (nth 1 var)) (children (nth 2 var))) + (if (or (<= (string-to-number children) gdb-max-children) + (y-or-n-p + (format + "%s has %s children. Continue? " expr children))) + (if (and (eq (buffer-local-value + 'gud-minor-mode gud-comint-buffer) 'gdba) + (string-equal gdb-version "pre-6.4")) + (gdb-var-list-children token) + (gdb-var-list-children-1 token))))) ((string-match "-" text) ;contract this node (dolist (var gdb-var-list) (if (string-match (concat token "\\.") (car var))