1

I want to find a PID of a process which is being debugged with eclipse, while it is being debugged. I want to use some c plus plus code that does not have any relation with the debugged process.

For finding the PID of a "normal" running process, I can use the code in the answer .

Is it possible? Thanks

Community
  • 1
  • 1
hudac
  • 2,584
  • 6
  • 34
  • 57
  • Did you try `getpid()`? – jxh May 02 '13 at 18:25
  • sorry: I want to use some c plus plus code that does not have any relation with the debugged process. – hudac May 02 '13 at 18:31
  • I would then ask why you are debugging a program that you cannot change. – jxh May 02 '13 at 18:38
  • I can change it. I have two separated programs: A and B. Lets say, A is a server, and B is a client. I want to debug A, the server, in eclipse. so I opened a project in eclipse for the server, but I must run it with a client, so I run the client in a terminal. Now, lets say that I must know if the server is working, and it's PID, when I start the client. when I start the server in another terminal, I can do that using the code in the answer above, and my question is: how can I do that when I'm debugging the server with eclipse – hudac May 02 '13 at 22:59
  • Eclipse is running the program, so explain why the above answer doesn't work when in eclipse. But if the above answer isn't working for some reason, the work around is really easy. Since you have the server code in eclipse, just add a line of code that prints out the process id. – jxh May 02 '13 at 23:07
  • Indeed, It doesn't work for some reason. The above answer can't find the server's PID when it is being debugged with eclipse. I guess I can solve it using a line which prints out the server's PID, but I was wondering about a neater solution, like the above answer... – hudac May 02 '13 at 23:20

0 Answers0