From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Minor gdb-ui patches to make it a bit more robust
Date: Mon, 18 Feb 2008 16:08:29 -0500 [thread overview]
Message-ID: <jwv4pc6dllo.fsf-monnier+emacs@gnu.org> (raw)
Here are 2 patches which help me deal with gdb-ui.
The first 2 hunks reset gdb-output-sink as it should after starting
a new process. I think this is a plain bug fix, but I'll let
Nick decide.
The second hunk make it fallback on the old gud-gdb code in case the
prompt appears before we get to receive the expected annotations.
I've been using M-x gdb RET with "gdb --fullname emacs" for ever and it
took me a while to understand why it suddenly stopped working properly:
the behavior is pretty nasty: you get all the expected GDB output but
your input isn't sent to the gdb process (because gdb-ui thinks that
GDB is still initializing) and completion just hangs (because it sends
a command which isn't passed on to the process and then waits for the
process to reply).
Maybe my hack isn't such a great idea, but it seems to work OK for my
test and it brings back Emacs-21's M-x gdb behavior of automatically
choosing gdb-ui or plain gud-gdb.
Maybe Nick can suggest a more reliable way to detect when the
annotations are missing.
Stefan
--- orig/lisp/progmodes/gdb-ui.el
+++ mod/lisp/progmodes/gdb-ui.el
@@ -150,7 +150,7 @@
(defvar gdb-prompting nil
"True when gdb is idle with no pending input.")
-(defvar gdb-output-sink 'user
+(defvar gdb-output-sink nil
"The disposition of the output of the current gdb command.
Possible values are these symbols:
@@ -317,6 +317,7 @@
(local-set-key "\C-i" 'gud-gdb-complete-command)
(setq comint-prompt-regexp "^(.*gdb[+]?) *")
(setq paragraph-start comint-prompt-regexp)
+ (setq gdb-output-sink 'user)
(setq gdb-first-prompt t)
(setq gud-running nil)
(setq gdb-ready nil)
@@ -1673,6 +1674,16 @@
(progn
(setq output (gdb-concat-output output gud-marker-acc))
(setq gud-marker-acc "")))
+ (unless gdb-ready ;Should we check gdb-first-prompt instead?
+ (when (string-match "\n(gdb) \\'" output)
+ ;; We just received a GDB prompt but haven't seen any of the
+ ;; annotations we expect to come along with it. Apparently GDB
+ ;; was not run with "annotate=3". Let's try to fallback on the
+ ;; old mode.
+ (message "Falling back to old GDB support")
+ (set (make-local-variable 'gud-minor-mode) 'gdb)
+ (kill-local-variable 'comint-input-sender)
+ (setq gud-marker-filter 'gud-gdb-marker-filter)))
output)))
(defun gdb-concat-output (so-far new)
next reply other threads:[~2008-02-18 21:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-18 21:08 Stefan Monnier [this message]
2008-02-18 22:12 ` Minor gdb-ui patches to make it a bit more robust Nick Roberts
2008-02-19 2:42 ` Stefan Monnier
2008-02-19 9:42 ` Andreas Schwab
2008-02-19 10:11 ` Nick Roberts
2008-02-19 15:57 ` Stefan Monnier
2008-02-19 23:48 ` Nick Roberts
2008-02-20 22:00 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv4pc6dllo.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.