- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Debugging shared libraries with gdb
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2012 02:50 PM - last edited on 11-29-2012 10:30 PM by Cathy_xu
11-29-2012 02:50 PM - last edited on 11-29-2012 10:30 PM by Cathy_xu
HP-UX 11.23, ia64.
I am using gcc 4.7.0 and gdb 7.5, and I am having problems debugging anything inside a shared library.
The creation of the shared library:
$ gcc -c -g3 -fPIC hello.c
$ gcc -g3 -shared hello.o -o libhello.so
I then compiled and linked an executable against it:
$ gcc -c -g3 foo.c
$ gcc -g3 foo.o -lhello -L.
I can post the contents of hello.c and foo.c if necessary, but I doubt it will matter. The main() in foo.c calls a function in hello.c
When I try to set a breakpoint in gdb, I get this:
(gdb) break hello
Function "hello" not defined.
Make breakpoint pending on future shared library load? (y or [n])
Even if I answer yes, the breakpoint is never reached, even though the function is called on execution. Also, if I attempt to step through the statements in foo.c, it steps over the call into the shared library.
I have also attempted chatr +dbg enable on both the resulting binary and the shared object itself, with the same result. What do I need to do in order to debug a shared library?
P.S.This thread has been moved from HP-UX>System Administration to HP-UX > languages- HP Forums Moderator
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2012 08:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2012 09:51 AM
11-30-2012 09:51 AM
Re: Debugging shared libraries with gdb
The gdb 6.3 from the HP WDB package does work. Functions from shared libraries are not immediately recognizable (.i.e., I still get "Breakpoint deferred until a shared library containing "hello" is loaded."), but that's only a minor annoyance as program execution actually does break when it hits that function.
Thanks for the assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2012 11:00 AM
11-30-2012 11:00 AM
Re: Debugging shared libraries with gdb
>Thanks for the assistance.
If you are happy with your answers, please click on the Kudos star.
Was there a particular feature you wanted in gdb 7.5?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2012 12:00 PM
11-30-2012 12:00 PM
Re: Debugging shared libraries with gdb
> Was there a particular feature you wanted in gdb 7.5?
Nothing in particular, no. Python scripting support and reversible debugging would be nice, but they're not essential.
I just downloaded and installed the latest version I could find on the Porting and Archive Centre, rather than going to the official HP packages. It usually works for everything else, and since the debugger seemed to work and run, I expected that it would work for more or less all features. I knew that HP had some people working on GDB and other open source projects a long time ago (I was a member of the initial HP Caliper team on the same floor as you, Dennis), but I didn't know that it continued to this day.