Community
Participate
Working Groups
Created attachment 238575 [details] showing the setting for the GDB debugger I'm working on a Eclipse project where I need to run gdb elevated using sudo. I've added gdb to my sudoers file so sudo doesn't ask for a password. This runs as expected from bash when I run "sudo -u <username> gdb" (no quotes). When I use the same command into the GDB debugger setting in the debugger dialog (as shown in the attachment) and run debug, I consistently get the same error: "Could not determine GDB version after sending: sudo -u wwahammy gdb --version." I've created a basic hello world program and the problem happens there so it's not unique to the project. The bizarre part of this is that while this happens on Fedora 20, I know it does not happen on Ubuntu (Saucy I believe).
What is the output when you run: sudo -u wwahammy gdb --version from a shell?
GNU gdb (GDB) Fedora 7.6.50.20130731-16.fc20 Copyright (C) 2013 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-redhat-linux-gnu". 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".
It is hard to know what is happening without any error message. I've opened and proposed a fix to Bug 424996 which will allow to see what the error message is. But until you can use that, let's try to figure it out another way. What I'd like to do is have eclipse run the gdb command in question so that we can see the output. I believe you can do this by doing the following: from a shell: echo "sudo -u wwahammy gdb --version" > test chmod u+x test from eclipse Run->External Tools->External Tools Configurations... Double click on "Program" In the Main sub-tab in the "Location" box, put the path to the 'test' script above. Press Run. You should see the output in the Console window. Hopefully there will be some error that will allow us to understand what is happening.
I needed to use sudo because I my application opens a socket listening port below 1024. ----------------------------------------------- To answer Marc's question I created a run configuration to run sudo with argument "-u username gdb --version" In the console view this is what appeared. Sorry, user username is not allowed to execute '/bin/gdb --version' as 1125627 on hostname. So gdb is emitting this text so gdb may need to be modified for this to work. ----------------------------------------------- I am able to get this to work using the -A parameter of sudo and not -u. I needed to enable askpass by 1) installing ssh-askpass 2) edit the /etc/sudo.conf file by adding this line Path askpass /usr/libexec/openssh/ssh-askpass I have a Red Hat and a CentOS machine. On the CentOS a popup dialog appears to enter my password but not on the RedHat. This may be due to the way my IT department has these configured. ----------------------------------------------- I will post another bug to request that the debugger plug in provide check boxes in the GUI to enable sudo capability so that people who need this don't have to spend hours searching the internet to figure it out.