Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 1996 08:09:00 -0700
From:      John Polstra <jdp@polstra.com>
To:        msmith@atrad.adelaide.edu.au
Cc:        freebsd-current@freebsd.org
Subject:   Re: kern/1848: breakpoints in shared libraries don't fire
Message-ID:  <199610211509.IAA08924@austin.polstra.com>
In-Reply-To: <199610210204.LAA04119@genesis.atrad.adelaide.edu.au>
References:  <199610210204.LAA04119@genesis.atrad.adelaide.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> > What about pages mmapped MAP_PRIVATE, couldn't the page be copied for
> > private use when the breakpoint is set?
> 
> I'm sure it _could_, after all it's just software.  However ld.so most
> likely maps pages as readonly, so you would have to make some changes
> there (to detect whether a program was being debugged etc.), or teach 
> gdb to change the mappings on shared libraries.

Actually, ld.so maps everything MAP_COPY (same as MAP_PRIVATE) already.
The text segment starts out read-only.  GDB does (or at least did)
change the protections to read/write as needed when it has to insert a
breakpoint.  As John-Mark Gurney pointed out in a different posting,
this all used to work just fine.  If it's broken now in -current, then
it's probably a problem with gdb.

I just checked it on a current from just a few days ago, and it works
fine for me.  I was able to set a breakpoint on gethostbyname() in libc,
and the debugger really stopped when it got there.  This is with the
standard gdb in /usr/bin.  I don't have the version from the ports
collection installed at the moment.

This all sounds like a bunch of todo over a problem that never existed
in the first place.
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610211509.IAA08924>