Try running gdb outside of emacs, and use the --nx gdb command line option. gdb --nx myprogram and in emacs: gdb --nx --annotate=3 myprogram gud (emacs gdb) is not super robust.  It can get confused about the state of gdb when gdb has weird output. Your "Current directory ...." should really be the first line.  Certainly, there shouldn't be anything after (gdb).  So, gud may well be confused. >________________________________ >From: Chun Zhang >To: help-gnu-emacs@gnu.org >Sent: Tuesday, October 18, 2011 7:06:24 AM >Subject: problems in gud under emacs > > >Hi all, >I'm running into problems debugging c++ under emacs. When I start the debugging command: >M-x gdb --annotate=3 myprogram >The gdb shell does not prompt. Instead it stuck after showing "(gdb) Current directory is ~/programs/small/" as pasted below. I can't type any debug command then... However the status bar shows no error messages. Does any body know how to fix it? Thank you! >GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2  >Copyright (C) 2010 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 "x86_64-linux-gnu".  >For bug reporting instructions, please see:  >http://www.gnu.org/software/gdb/bugs/...  >Reading symbols from /home/chzhang/programs/small/loop...done.  >(gdb) Current directory is ~/programs/small/  > > > > >-- >Best Regards, > >====================== >Chun Zhang >chun.zhang.cz@gmail.com > > >