Unable to attach to a local process in Pycharm

I trying to attach to a local process in Pycharm and the following occurs

Attaching to a process with PID=110542
/usr/bin/python /net/apps/prod/pycharm/helpers/pydev/pydevd_attach_to_process/attach_pydevd.py --port 43435 --pid 110542
Attaching with arch: i386:x86-64
Running: gdb --nw --nh --nx --pid 110542 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture i386:x86-64' --eval-command='call dlopen("/net/apps/prod/pycharm/helpers/pydev/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='call DoAttach(0, "import sys;sys.path.append(\"/net/apps/prod/pycharm/helpers/pydev\");sys.path.append(\"/net/apps/prod/pycharm/helpers/pydev/pydevd_attach_to_process\");import attach_script;attach_script.attach(port=43435, host=\"\");", 0)' --command='/net/apps/prod/pycharm/helpers/pydev/pydevd_attach_to_process/linux/gdb_threads_settrace.py'
Running gdb in target process.
stderr: gdb: unrecognized option '--nh'
Use `gdb --help' for a complete list of options.


It appears like the debugger is trying to attach to a process in an endless loop since the pause button never deactivates.

Note that I'm running on GNU gdb version 7.2-92.el6  Red Hat Enterprise Linux rhel6

Any suggestion?


Hi Rafael,

This is a guess, but first thing that cached my eye is that debugger flags: gdb --nw --nh --nx

They use double dash here, but if you read the man page for gdb, they are presented with single dash, please refer to http://man7.org/linux/man-pages/man1/gdb.1.html

-nh Do not execute commands from ~/.gdbinit.

-n Do not execute commands from any .gdbinit initialization files.

Which PyCharm version/edition are you using to reproduce the issue?


I think these flags are been set by a python file within Pycharm.

-----> "myDir/pycharm/helpers/pydev/pydevd_attach_to_process/attach_pydevd.py"

I'm not explicitly setting these flags anywhere within Pycharm. 

Are you saying there is way to set these flags within Pycharm.

And if so. where?




After further research, I came across an internet post that mention that Pycharm 2016 (installation I have) must use  the gdb version => 7.6 which is

only available on Linux rhel7, but my machine is a linux rhel6.    Fortunately, one of my co-worker has a Linux rhel7 and pycharm2016 installation and

I was able to successfully attach to a local process in their machine.  





Yes, seems it was a compatibility issue. Glad you were able to find the root cause.


Please sign in to leave a comment.