SysV.3 shared libs - not debugable ?!

Andrew Dingwall andrew at root.co.uk
Sat Jun 30 01:31:44 AEST 1990


In article <1990Jun24.001636.20821 at scuzzy.uucp> src at scuzzy.uucp (Source Admin) writes:
>i tried to debug a program that uses the nsl_s (sp?) shared lib
>under ISC 2.0.3 with gdb version 3.4. of course it doesn't work - the program
>get's a SIGTRP in the middle of some lib routine. is this normal/intended or
>a bug in gdb ?
>-- 
>Heiko Blume c/o Diakite   blume at scuzzy.mbx.sub.org    FAX   (+49 30) 882 50 65
>Kottbusser Damm 28        blume at netmbx.UUCP           VOICE (+49 30) 691 88 93
>D-1000 Berlin 61          blume at netmbx.netmbx.de      TELEX 184174 intro d

This is probably a kernel problem.
Breakpoints are often implemented by overwriting the instruction where you
want the breakpoint to be with an instruction that will cause a trap of some
kind, and then restoring the original instruction afterwards.

If a process is to be traced (ie: it has executed a ptrace(0, ...) call) and
the text segment is read-only, the kernel marks the text segment for that
process as copy-on-write so that, if breakpoints are set, a private writeable
copy of the page containing the breakpoint is created.

The text of a shared library is (obviously) read-only; the trouble is that
not all kernels make the special arrangements described above for shared
library text.
-- 
Andrew Dingwall  UniSoft Ltd., Saunderson House, Hayne Street, London EC1A 9HH
andrew at root.co.uk ..!mcsun!ukc!root44!andrew +44-71-315-6600 FAX:+44-71-315-6622



More information about the Comp.unix.questions mailing list