GNU bug report logs -
#21777
25.0.50; gud-gdb uses a pager, which is harmful inside emacs
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Wed, 28 Oct 2015 19:21:02 UTC
Severity: normal
Found in version 25.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #47 received at 21777 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> IME, users sometimes have some use cases that look really weird to me,
> but are somehow very important to them. So I'm trying to avoid
> stepping on their toes as much as possible, even if I cannot imagine
> those use cases in advance.
I worked up a patch for this, but in testing, there's a number of
problems.
1) When resizing a frame, the height in gdb is overwritten. Where does
that come from? I tried grepping, but couldn't find anything.
2) Sending a command this way to gdb gives us an extra prompt, which
isn't nice.
3) If you start gdb with M-x gdb instead of M-x gud-gdb, the height
variable in gdb is always switched off:
(gdb-input "-gdb-set height 0" 'ignore)
So why shouldn't gud-gdb do the same thing?
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 7074bd45d7..ac54c570cd 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1040,6 +1040,15 @@ GDB User Interface Layout
need to check that the breakpoints in recently edited source files are
still in the right places.
+@vindex gud-pager-height
+ GDB normally uses a pager when displaying output (like backtraces).
+This can be inconvenient when running inside Emacs, so the default
+value of @code{gud-pager-height} is @code{unlimited}, meaning that the
+pager is disabled. This variable can also be a number (which is used
+as the number of lines by the pager), or @code{nil}, meaning that the
+pager setting shouldn't be changed from the gdb defaults (or
+@file{.gdbinit} settings).
+
@node Source Buffers
@subsubsection Source Buffers
@cindex fringes, for debugging
diff --git a/etc/NEWS b/etc/NEWS
index 1f52341ae4..3014eddbdd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1034,6 +1034,10 @@ window after starting). This variable defaults to nil.
** Miscellaneous
+*** New user option 'gud-pager-height'
+This variable is used to set up the gdb pager, and defaults to
+`unlimited', meaning that a pager won't be used.
+
+++
*** Interactive regular expression search now uses faces for sub-groups.
E.g., 'C-M-s foo-\([0-9]+\)' will now use the 'isearch-group-1' face
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 84c473ddb7..7acc540b01 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -67,6 +67,19 @@ gud-key-prefix
:type 'key-sequence
:group 'gud)
+(defcustom gud-pager-height 'unlimited
+ "The size of a page when gdb displays output.
+gdb normally uses a pager when displaying things like
+backtraces (or other things that take a lot of room). This
+variable allows customizing the pager when gdb is run from Emacs.
+
+This can be a number (the number of lines), `unlimited' (don't
+use the pager at all), or nil (don't change the defaults)."
+ :type '(choice (const :tag "No paging" unlimited)
+ integer
+ (const :tag "Don't set" nil))
+ :version "28.1")
+
(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh)
;; (define-key ctl-x-map " " 'gud-break); backward compatibility hack
@@ -796,6 +809,9 @@ gud-gdb
(setq gdb-first-prompt t)
(setq gud-running nil)
(setq gud-filter-pending-text nil)
+
+ (when gud-pager-height
+ (gud-basic-call (format "set height %s" gud-pager-height)))
(run-hooks 'gud-gdb-mode-hook))
;; The completion process filter indicates when it is finished.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 297 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.