Subject: Re: bug#9858: 24.0.90; M-x gdb breaks if gdb-show-main is non-nil but there's no file loaded

From: Ken Brown <[email-masked]>
Date: Mon, 24 Oct 2011 15:23:52 -0400

On 10/24/2011 12:10 PM, Ken Brown wrote:
> The info node GDB Graphical Interface File > GDB User Interface Layout
> suggests setting the (customizable) variable gdb-show-main non-nil in
> order to have the source buffer displayed on startup of M-x gdb. But if
> you do this and then run M-x gdb without specifying a file to debug, M-x
> gdb doesn't initialize properly, and the *Messages* buffer contains
>
> error in process filter: gud-find-file: Wrong type argument: stringp, nil

The following patch seems to fix it.  OK to apply?

=== 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-24 19:17:07 +0000
@@ -4121,7 +4121,7 @@
    (if gdb-many-windows
        (gdb-setup-windows)
      (gdb-get-buffer-create 'gdb-breakpoints-buffer)
-    (if gdb-show-main
+    (if (and gdb-show-main gdb-main-file)
          (let ((pop-up-windows t))
            (display-buffer (gud-find-file gdb-main-file))))))