Operating System - HP-UX
1748073 Members
4671 Online
108758 Solutions
New Discussion

Can't stop at defined breakpoints under GDB

 
andreani
New Member

Can't stop at defined breakpoints under GDB

Hello,

I'm trying to use gdb to debug in a shared library (.sl) compiled in debug mode.

I define my breakpoints, which are correctly set:
Breakpoint 1 at 0xc000000001d1b8f4: file mcc_pml_str_obj.c, line 5942 from /usr/opt/temip/lib//libmcc_parpml.sl.


But when I continue the execution, I have:

warning: Cannot insert breakpoint 1: in /usr/opt/temip/lib//libmcc_parpml.sl
warning: This is because your shared libraries are
warning: not mapped private. To attach to a process
warning: and debug its shared libraries you must
warning: prepare the program with
warning: "/opt/langtools/bin/pxdb -s on a.out "
warning: or "chatr +dbg enable a.out ".
warning: Add this to your Makefile for debug builds
warning: so that each rebuilt debuggable a.out would
warning: have this feature turned on.
warning: Temporarily disabling shared library breakpoints: 1

Then, the breakpoint is never trapped.

Then when I try to:

[14] % pxdb64 -s on /usr/opt/temip/tal/bin/tal_orbix_server.exe
Error opening: /usr/opt/temip/tal/bin/tal_orbix_server.exe for read/write.
or
[15] % chatr +dbg enable /usr/users/fcl_pm/libmcc_parpml.sl
..
chatr(error): cannot open file for writing /usr/users/fcl_pm/libmcc_parpml.sl

whereas:

ll /usr/users/fcl_pm/libmcc_parpml.sl
-rwxrwxrwx 1 root sys 1405560 Jul 4 libmcc_parpml.sl

Any ideas ?

Thanks for your help,

Monique.
1 REPLY 1
Mike Stroyan
Honored Contributor

Re: Can't stop at defined breakpoints under GDB

The error about opening the file for writing is caused by having the shared library in use by some process. The shared library loaded uses a special mapping that allows it to share the same read/execute protection id for multiple processes mapping the same shared library. That has a side-effect of forcing the file to be treated as only having read/execute permission. You can use "chatr +dbg enable" after stopping all processes that are linked with that library. If that is not practical, then I would suggest making a copy of the shared library and using chatr on it. You can then use SHLIB_PATH or LD_PRELOAD to get the program to use the new copy. See "man dld.sl" for information on those environment variables.