views:

1134

answers:

3

Hello

I am using GDB to debug a closed source program on Solaris 10 x86.

I attach gdb to the program and continue execution, however when I want to pause execution later to examine some memory I cant. When I press CTRL-C it only prints ^C instead of pausing the program and dropping me to a (gdb) prompt.

bash-3.00# gdb --pid=1521
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.10".
Attaching to process 1521
Retry #1:
Retry #2:
Retry #3:
Retry #4:
[New LWP 1]
0xfe3b5a23 in ?? ()
(gdb) c
Continuing.
^C^C^C^C^C^C^C^C

How do I get back to a (gdb) prompt? Am I doing something wrong or how can I go about getting this to work.

Thanks in advance.

+2  A: 

Just found a workaround. From another terminal give the following command:

kill -INT 1521

GDB will pause execution upon the debugged program receiving the SIGINT.

A: 

This would be a bug in GDB.

If you can reproduce this with the current version of GDB from CVS Head, please file a bug.

Employed Russian
A: 

As you ar using Solaris, and I see your using bash, your probably not setting your terminal up properly, bash often can handle a lot of this for you but if you were in ksh or something, your backspace may be printing ^H instead of backspacing (in that case you need stty erase '^H'... you can always set your console with stty sane.

A likely problem here, which is not a bug, is that the app your debugging, is resetting your termnial, I'm not on a Solaris box right now, but the GNU stty allow's you to do something like stty tostop,

  • [-]tostop stop background jobs that try to write to the terminal

You can also run reset or tset from another terminal and re-configure your ^C

from inside gdb, you can use the "tty" alias or set inferior-tty /path/to/term

Set terminal for future runs of program being debugged.
Usage: set inferior-tty /dev/pts/1
RandomNickName42