Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugging a shared library in attached process
Debugging a shared library in attached process [message #206101] Wed, 05 December 2007 16:32 Go to next message
Eclipse UserFriend
Originally posted by: bevans.ittvis.com

I am attempting to debug a debug version of a shared library for a large
non-debug application using Eclipse. I believe that I am not filling out
the Debug Dialog for attached processes correctly.

I'm using the following versions of programs:
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
Eclipse 3.3.0
CDT 4.0.2.200711280800

I can debug the program outside of Eclipse in gdb with the following
process:
1. I start the application program and make sure the debug library is
loaded.
2. Next I issue the following gdb commands
> gdb
(gdb) attach <pid of application>
(gdb) break '<classname::method>'
(gdb) c

I've tried a variety of options in the Debug Dialog. Here is the process
I use to try to debug it:
1. I build the shared library with Eclipse.
2. I start the application program and make sure the debug library is
loaded.
3. In Eclipse I set desired breakpoints.
4. I create a Debug Dialog to Attach to Local Application
Main:
I set my current project as the project
I set the application I will attach to (but it is not a debug version)
I leave all other defaults. My source is located in the Source > Source
Lookup Path
5. Eclipse will try to rebuild the shared library unless I disable the
build in the Project properties.
** Any way to disable this build? I don't want the library to rebuild
because it is already loaded in the application. **
6. I attach to the pid of application.
7. I get an error in the console that the 'No source file named xxx' and a
<symbol is not availalbe> editor pane is displayed stating no source is
available.
8. I press the resume button.
9. I get the error
Execution is suspended because of error.
Warning:
Cannot insert breakpoint -2.
Error accessing memory address xxx: Input/output error.

The source in my project is available via a link. I've tried changing the
Debug Dialog to Attach to Local Application Source to be an explicit path
to a File System Directory but same results.

Any ideas on changes I can make to the Debug Dialog to make this work?

Thanks
Betty
Re: Success - Debugging a shared library in attached process [message #206179 is a reply to message #206101] Thu, 06 December 2007 15:33 Go to previous message
Eclipse UserFriend
Originally posted by: bevans.ittvis.com

I finally had success using Eclipse to debug my shared library. The
problem is that the commercial program was started with either a shell
script or a java program (running an Eclipse derivative) which would
eventually load the shared library I was attempting to debug. I could not
put either of these in the C/C++ Attach to Local Application > Main >
C/C++ Application and I could not leave that field blank. I was able to
debug the library by specifying the original c program as the application.


Having to specify the C/C++ Application seems unnecessary since I am
attaching to the process that will be loading the library. I can run gdb
without specifying a program to debug and can debug the shared library
successfully. Removing this requirement would make the CDT more flexible
for debugging complex programs.

Hope this helps someone else to use Eclipse.

Thanks
Betty
Previous Topic:Problem with "Display as array" on pointers inside global variables
Next Topic:Weird ToolChain in project wizard
Goto Forum:
  


Current Time: Wed May 07 11:44:28 EDT 2025

Powered by FUDForum. Page generated in 0.03616 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top