title: Howto debug program that needs to run as root from gdb (Eclipse) as user (set gdb suid root?)
body: <p>I need to debug a program on Linux with Eclipse (gdb). The program run as root and is quite large. The binary with debug symbols is about 250MB large and has more than 60 running threads after startup.</p>
  
  <p>I'm thinking about the best solution:</p>
  
  <ol>
  <li>Use gdbserver </li>
  <li>Run Eclipse as root</li>
  <li>Set gdb suid </li>
  </ol>
  
  <p>I think number 1 (gdbserver) would be the best solution, unfortunately it's not working reliable. The connection between gdb and gdbserver is lost. I think there is a problem with the huge amount of data transferred between eclipse &lt;-> gdb &lt;-> gdbserver.</p>
  
  <p>Number 2 (run eclipse as root) means to run every process as root and so interferes also with the version control system, because the Eclipse plugin would use the root user instead of mine to change version-controlled files.</p>
  
  <p>I didn't try number 3 (suid gdb). What do you think about it? Does it work at all?
  I'm aware that a suid root gdb is as safe as having no root-Password at all, but the machine is used for development and debugging by me only. And of course there could be an "enable/disable" script that sets the suid bit only when necessary.</p>
  
  <p>Do you have any other suggestions?</p>