Subject: bug#24508: 25.1; M-x gdb crashes when used on windows + cygwin

From: Martijn Saelens <[email-masked]>
Date: Thu, 22 Sep 2016 11:35:05 +0200

M-x gdb crashes when trying to set a breakpoint on main. Emacs runs on

windows and uses the gdb from cygwin. I can reproduce this on multiple

machines using the following steps in emacs -Q:

1. Open a *.cpp file in emacs. I've used the following file "test.cpp":

        #include <iostream>

        int main()

        {

          std::cout << "Hello world!" << std::endl;

          return 0;

        }

2. Compile the file using M-x compile: g++ -g test.cpp -o test.exe

3. start gdb using M-x gdb: gdb -i=mi test.exe

4. inside gdb type "break main". The gdb prompt dissapears and the

debugger becomes unusable. The full output of *gud-test.exe*:

         Current directory is c:/Users/martijns/

         GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1

         Copyright (C) 2015 Free Software Foundation, Inc.

         License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>

         This is free software: you are free to change and redistribute it.

         There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"

         and "show warranty" for details.

         This GDB was configured as "i686-pc-cygwin".

         Type "show configuration" for configuration details.

         For bug reporting instructions, please see:

         <http://www.gnu.org/software/gdb/bugs/>.

         Find the GDB manual and other documentation resources online at:

         <http://www.gnu.org/software/gdb/documentation/>.

         For help, type "help".

         Type "apropos word" to search for commands related to "word"...

         Reading symbols from test.exe...done.

         (gdb) break main

         Breakpoint 1 at 0x4011de: file test.cpp, line 6.

         (gdb) list test.cpp:1

         1

         2     #include <iostream>

         3

         4     int main()

         5     {

         6       std::cout << "Hello world!" << std::endl;

         7       return 0;

         8     }

If I use the commandline for gdb, then gdb works as expected.

Versions of the used software:

         $ gdb --version

         GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1

         Copyright (C) 2015 Free Software Foundation, Inc.

         License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>

         This is free software: you are free to change and redistribute it.

         There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"

         and "show warranty" for details.

         This GDB was configured as "i686-pc-cygwin".

         Type "show configuration" for configuration details.

         For bug reporting instructions, please see:

         <http://www.gnu.org/software/gdb/bugs/>.

         Find the GDB manual and other documentation resources online at:

         <http://www.gnu.org/software/gdb/documentation/>.

         For help, type "help".

         Type "apropos word" to search for commands related to "word".

         $ emacs --version

         GNU Emacs 25.1.1

         Copyright (C) 2016 Free Software Foundation, Inc.

         GNU Emacs comes with ABSOLUTELY NO WARRANTY.

         You may redistribute copies of GNU Emacs

         under the terms of the GNU General Public License.

         For more information about these matters, see the file named
COPYING.

========================================================================

In GNU Emacs 25.1.1 (i686-w64-mingw32)

 of 2016-09-17 built on LAPHROAIG

Windowing system distributor 'Microsoft Corp.', version 6.3.9600

Configured using:

 'configure --host=i686-w64-mingw32 --without-dbus

 --without-compress-install CFLAGS=-static'

Configured features:

XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB

TOOLKIT_SCROLL_BARS

Important settings:

  value of $LANG: ENU

  locale-coding-system: cp1252

Major mode: Debugger

Minor modes in effect:

  shell-dirtrack-mode: t

  diff-auto-refine-mode: t

  tooltip-mode: t

  global-eldoc-mode: t

  electric-indent-mode: t

  mouse-wheel-mode: t

  tool-bar-mode: t

  menu-bar-mode: t

  file-name-shadow-mode: t

  global-font-lock-mode: t

  font-lock-mode: t

  blink-cursor-mode: t

  auto-composition-mode: t

  auto-encryption-mode: t

  auto-compression-mode: t

  line-number-mode: t

  transient-mark-mode: t

Recent messages:

Making completion list... [2 times]

Compilation finished

Making completion list...

delete-backward-char: Text is read-only

Compilation finished

mwheel-scroll: Beginning of buffer [3 times]

C-c e is undefined

<C-tab> is undefined [2 times]

Target doesn’t support non-stop mode.  Turning it off.

Note: file is write protected

Load-path shadows:

None found.

Features:

(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml

mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies

mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail

rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils cl-seq

gdb-mi bindat json map seq byte-opt gv bytecomp byte-compile cconv gud

shell pcomplete compile comint ansi-color ring vc-git diff-mode

easy-mmode cl-extra help-mode cc-mode cc-fonts easymenu cc-guess

cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs

cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric

uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp

disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image

regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode

prog-mode register page menu-bar rfn-eshadow timer select scroll-bar

mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham

georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao

korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech

european ethiopic indian cyrillic chinese charscript case-table epa-hook

jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice

loaddefs button faces cus-face macroexp files text-properties overlay

sha1 md5 base64 format env code-pages mule custom widget

hashtable-print-readable backquote w32notify w32 multi-tty

make-network-process emacs)

Memory information:

((conses 8 136689 12899)

 (symbols 32 24315 0)

 (miscs 32 103 225)

 (strings 16 30312 5157)

 (string-bytes 1 977977)

 (vectors 8 19122)

 (vector-slots 4 511617 4848)

 (floats 8 202 47)

 (intervals 28 691 49)

 (buffers 520 27))