# HG changeset patch # User Nick Roberts # Date 1167970820 0 # Node ID 5b3d80ea3c0e0bd36ca6ca158d43b4b3abee3e84 # Parent e566d4fc8dd2f942dd507d06df9b3b1a5d729d82 (gdb-max-children): New customizable variable. (gdb-speedbar-expand-node): Ask user for confirmation before expanding large structures/arrays. diff -r e566d4fc8dd2 -r 5b3d80ea3c0e lisp/progmodes/gdb-ui.el --- a/lisp/progmodes/gdb-ui.el Fri Jan 05 02:09:07 2007 +0000 +++ b/lisp/progmodes/gdb-ui.el Fri Jan 05 04:20:20 2007 +0000 @@ -896,6 +896,12 @@ :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 @@ (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))