From owner-freebsd-current Mon Oct 21 14:36:45 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA14750 for current-outgoing; Mon, 21 Oct 1996 14:36:45 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA14737 for ; Mon, 21 Oct 1996 14:36:40 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id HAA29513; Tue, 22 Oct 1996 07:35:39 +1000 Date: Tue, 22 Oct 1996 07:35:39 +1000 From: Bruce Evans Message-Id: <199610212135.HAA29513@godzilla.zeta.org.au> To: jdp@polstra.com, msmith@atrad.adelaide.edu.au Subject: Re: kern/1848: breakpoints in shared libraries don't fire Cc: freebsd-current@freebsd.org Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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, It's broken somewhere in vm now. procfs_domem() returns 0 without writing anything, as if for EOF. (procfs_rwmem() gets to the (writing && object->backing_object) case. Then m == 0 and vm_fault() returns 0, but the faulted-in page is not used.) ptrace() seems to be broken even for putting a breakpoint at _main. This is fixed by retrying, and gcc retries with PT_WRITE_D after PT_WRITE_I fails. gcc starts with PT_WRITE_D for the shared library (this is reasonable because the shared library is above _etext) and it doesn't retry (this is reasonable because ptrace() doesn't return -1, unlike for _main). In a test program, neither PT_WRITE_I nor PT_WRITE_D works the first time, ands no combination works the second time for the page after _etext, but ptrace() correctly returns -1 for all failures. Bruce