From: Lluís <xscript@gmx.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Tom Tromey <tromey@redhat.com>,
David Reitter <david.reitter@gmail.com>,
"emacs-devel@gnu.org devel" <emacs-devel@gnu.org>
Subject: Re: Gdb in emacs 24
Date: Sun, 23 Oct 2011 21:47:01 +0200 [thread overview]
Message-ID: <87pqhnlccq.fsf@ginnungagap.bsc.es> (raw)
In-Reply-To: <jwvfwimfen2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 21 Oct 2011 13:20:46 -0400")
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
Stefan Monnier writes:
>> Right, both were assuming the use of the "interpreter-exec" command.
> Makes sense. But as I said, I think for 24.1, it's too late to make
> this change.
Sure.
I've attached a series of patches to:
* Check if we are using a supported gdb interpreter
* Disable gdb annotations
* gdb >= 7 should be considered recent
In addition, command "maint set linux-async on" does not exist.
Feel free to change the code, as I don't know if my approach is the cleanliest
way of doing it.
Lluis
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 00-check-mi.patch --]
[-- Type: text/x-patch, Size: 2251 bytes --]
=== modified file 'lisp/progmodes/gdb-mi.el'
--- lisp/progmodes/gdb-mi.el 2011-10-06 16:11:38 +0000
+++ lisp/progmodes/gdb-mi.el 2011-10-23 19:30:03 +0000
@@ -599,6 +599,29 @@
(concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2)
,(when (not noarg) 'arg)))
+(defun gdb--interpreter-ok ()
+ "Whether the expected interpreter is being used.
+-1: Not checked.
+ 0: Incorrect interpreter.
+ 1: Correct interpreter."
+ (let* ((buffer gud-comint-buffer)
+ (process (get-buffer-process buffer))
+ (res (process-get process 'gdb--interpreter-ok)))
+ (if (equal res nil) -1 res)))
+
+(defun gdb--interpreter-check (string)
+ "Initial filter to check if a correct interpreter is being used."
+ (when (= (gdb--interpreter-ok) -1)
+ (let* ((target "=thread-group-added") ; first line in GDB/MI
+ (buffer gud-comint-buffer)
+ (process (get-buffer-process buffer)))
+ (if (or (> (length target) (length string))
+ (string= (substring string 0 (length target)) target))
+ (process-put process 'gdb--interpreter-ok 1)
+ (process-put process 'gdb--interpreter-ok 0))))
+ (when (= (gdb--interpreter-ok) 1)
+ (gud-gdbmi-marker-filter string)))
+
;;;###autoload
(defun gdb (command-line)
"Run gdb on program FILE in buffer *gud-FILE*.
@@ -663,8 +686,18 @@
(gdb-restore-windows)
(error
"Multiple debugging requires restarting in text command mode"))
- ;;
- (gud-common-init command-line nil 'gud-gdbmi-marker-filter)
+
+ ;; Start gdb and check for the interpreter being used
+ (gud-common-init command-line nil 'gdb--interpreter-check)
+ (while (= (gdb--interpreter-ok) -1) ; must wait until established
+ (sleep-for 1))
+ (unless (= (gdb--interpreter-ok) 1)
+ (setq-default gud-marker-filter 'gud-gdbmi-marker-filter)
+ (insert "\nerror: You must start gdb with the GDB/MI interface (i.e., \"gdb -i=mi\")\n")
+ (error "You must start gdb with the GDB/MI interface (i.e., \"gdb -i=mi\")"))
+ ;; Change to "standard" filter
+ (setq gud-marker-filter 'gud-gdbmi-marker-filter)
+
(set (make-local-variable 'gud-minor-mode) 'gdbmi)
(setq comint-input-sender 'gdb-send)
(when (ring-empty-p comint-input-ring) ; cf shell-mode
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 01-unannotate.patch --]
[-- Type: text/x-patch, Size: 476 bytes --]
=== modified file 'lisp/progmodes/gdb-mi.el'
--- lisp/progmodes/gdb-mi.el 2011-10-23 19:30:03 +0000
+++ lisp/progmodes/gdb-mi.el 2011-10-23 19:33:06 +0000
@@ -698,6 +698,9 @@
;; Change to "standard" filter
(setq gud-marker-filter 'gud-gdbmi-marker-filter)
+ ;; Disable annotations
+ (gud-call "set annotate 0")
+
(set (make-local-variable 'gud-minor-mode) 'gdbmi)
(setq comint-input-sender 'gdb-send)
(when (ring-empty-p comint-input-ring) ; cf shell-mode
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 02-todos.patch --]
[-- Type: text/x-patch, Size: 736 bytes --]
=== modified file 'lisp/progmodes/gdb-mi.el'
--- lisp/progmodes/gdb-mi.el 2011-10-06 16:11:38 +0000
+++ lisp/progmodes/gdb-mi.el 2011-10-20 12:49:18 +0000
@@ -50,12 +50,6 @@
;; without gdb-ui.el and uses MI tokens instead of queues. Eventually MI
;; should be asynchronous.
-;; This mode will PARTLY WORK WITH RECENT GDB RELEASES (status in modeline
-;; doesn't update properly when execution commands are issued from GUD buffer)
-;; and WORKS BEST when GDB runs asynchronously: maint set linux-async on.
-;;
-;; You need development version of GDB 7.0 for the thread buffer to work.
-
;; This file replaces gdb-ui.el and is for development with GDB. Use the
;; release branch of Emacs 22 for the latest version of gdb-ui.el.
[-- Attachment #5: Type: text/plain, Size: 218 bytes --]
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
next prev parent reply other threads:[~2011-10-23 19:47 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 8:07 Gdb in emacs 24 Andrea Crotti
2011-03-08 8:56 ` Eli Zaretskii
2011-10-05 21:55 ` David Reitter
2011-10-06 5:52 ` Eli Zaretskii
2011-10-06 10:45 ` David Reitter
2011-10-06 11:25 ` Eli Zaretskii
2011-10-06 13:37 ` David Reitter
2011-10-06 14:55 ` Chong Yidong
2011-10-06 18:07 ` Eli Zaretskii
2011-10-06 20:00 ` David Reitter
2011-10-06 20:07 ` Stephen J. Turnbull
2011-10-06 20:45 ` Eli Zaretskii
2011-10-07 6:08 ` Stephen J. Turnbull
2011-10-07 12:28 ` Eli Zaretskii
2011-10-06 12:40 ` Stefan Monnier
2011-10-19 1:48 ` Tom Tromey
2011-10-19 13:10 ` Lluís
2011-10-19 13:38 ` Tom Tromey
2011-10-19 14:14 ` Lluís
2011-10-19 14:35 ` Stefan Monnier
2011-10-19 14:54 ` Tom Tromey
2011-10-19 17:54 ` Stefan Monnier
2011-10-19 18:55 ` Lluís
2011-10-19 21:22 ` Stefan Monnier
2011-10-20 16:11 ` Lluís
2011-10-21 17:20 ` Stefan Monnier
2011-10-23 19:47 ` Lluís [this message]
2011-10-28 2:25 ` Stefan Monnier
2011-10-19 15:42 ` Lluís
2011-03-09 22:23 ` Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
2011-03-09 0:22 Nick Roberts
2011-03-09 14:20 ` Andrea Crotti
2011-03-10 13:50 Nick Roberts
2011-03-10 14:07 ` Andreas Schwab
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=87pqhnlccq.fsf@ginnungagap.bsc.es \
--to=xscript@gmx.net \
--cc=david.reitter@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=tromey@redhat.com \
/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.