SysV.3 shared libs - not debugable ?!

Michael Meissner meissner at osf.org
Thu Jun 28 01:23:23 AEST 1990


In article <451 at mtndew.UUCP> friedl at mtndew.UUCP (Stephen J. Friedl)
writes:

| 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 ?
| 
| With shared libraries, the text segment is not writable.  This means
| that you can't stuff a breakpoint instruction ( INT ? ) there for the
| debugger to use, and there is not much you can do about it except
| building in a very slow and laborious interpreter.

Building an interpreter is not the only possible solution.  Another
solution if you can remap text pages with shmem or mmap, is to remap
the pages into a shared memory segment.  If the OS cooperates, the
normal ptrace calls would not modify the read-only pages, but modify a
copy of the pages.  If you have mmap with copy on write, you just use
that, and then all pages which do not have breakpoints set will be
shared with other clients.  Granted you will have to know exactly what
your system does in dark corner type cases.....
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Do apple growers tell their kids money doesn't grow on bushes?



More information about the Comp.unix.questions mailing list