0

I am developing a C++ application that requires root privilege. I am working under Eclipse and I would like to be able to launch/debug from it.

I know I could start Eclipse as a root, but I am looking for other options, such as somehow requesting the elevation in the launch configurations.

Any idea ?


Note that my question is not about how to discourage myself to debug with root privilege.

11
  • It might be dangerous to run a a program as root that is likely to contain errors. I suggest to debug the program with modifications and/or in a special testing environment that allow running it without root privilege. I suggest to edit the question and add details about the program why it needs to run as root to get more specific hints how to do this. Maybe you can run the program with gdbserver as root outside eclipse or as an external tool from Eclipse, and use gdbserver based "remote" debugging in Eclipse. Commented May 18, 2022 at 7:49
  • how does eclipse run the compiled application ? can you trick command line from ./myapp to sudo /absolute/path/to/mypapp (and edit /etc/sudoers accordinlgy) ? Commented May 18, 2022 at 12:03
  • @Bodo: this is required by a third-party library, that's all I know. I want to work from Eclipse, this is why I am asking the question. Commented May 18, 2022 at 12:04
  • @Archemar: I have no idea how Eclipse does. Spawning a process ? Commented May 18, 2022 at 12:06
  • @YvesDaoust Please add all requested information or clarification to the question, don't use comments for this purpose. Adding to my previous comment: It might be possible to add something like sudo gdbserver other_args... your_program as an external tool (green button with red toolbox) and use remote debugging, see e.g. stackoverflow.com/q/4038760/10622916. Commented May 18, 2022 at 12:44

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.