22

I'm writing a netscape iplanet plugin (on solaris/C using eclipse) which is basically a shared object with specific entry points, and I'd like to be able to debug the shared object with eclipse's debugger (gdb). I remember doing something similar in AIX where you could make xldb attach to a running process. Is it possible to get eclipse to run gdb to attach to a running binary? And should I expect grief because I want to debug a dynamically loaded piece of code?

stu
  • 8,461
  • 18
  • 74
  • 112
  • Did you try http://stackoverflow.com/questions/655853/is-it-possible-to-attach-a-debugging-session-to-a-running-program-in-eclipse-cdt/719936#719936? – lothar Apr 16 '09 at 20:19

2 Answers2

27

Yes it is. You need to go to the Lauch Configuration Dialog and select "C++ Attach to ...". Depending on your Eclipse version there may be only one or more "C++ Attach to ..." variants available.

moritz
  • 5,094
  • 1
  • 26
  • 33
lothar
  • 19,853
  • 5
  • 45
  • 59
10

I use Eclipse CDT for HP/UX remote environment. I'm not sure whether it will work for you:

  1. have your app running on unix

  2. go to Run / Debug Configurations / C/C++ Attach to Remote

  3. click Debug and a list of processess will be shown

  4. select the process you want to debug.

Paulo Guedes
  • 7,189
  • 5
  • 40
  • 60
  • In step #1, how can I make sure the app doesn't run past the point I want to debug? (on HP-UX) – Hassaan Mar 27 '18 at 10:36
  • Hi, can you specify which plugin you are using? I am not able to find any option under Debug Configurations for C++ Attach To Remote I have C++ Remote Application. – AAB Jan 07 '20 at 12:51
  • @Hassaan hi you can write int x = 1; while(x) { sleep(1000);} this will make sure code stops at someplace. If the symbol files are loaded and mapped then any breakpoints you set after will be hit and work like a charm. – AAB Jan 07 '20 at 12:52