From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19533 invoked by alias); 13 Jun 2007 22:11:14 -0000 Received: (qmail 19523 invoked by uid 22791); 13 Jun 2007 22:11:13 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate1.de.ibm.com (HELO mtagate1.de.ibm.com) (195.212.29.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 13 Jun 2007 22:11:07 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.8/8.13.8) with ESMTP id l5DMB3PR064770 for ; Wed, 13 Jun 2007 22:11:03 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l5DMB30T4137170 for ; Thu, 14 Jun 2007 00:11:03 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l5DMB2LK016773 for ; Thu, 14 Jun 2007 00:11:02 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l5DMB2qW016770; Thu, 14 Jun 2007 00:11:02 +0200 Message-Id: <200706132211.l5DMB2qW016770@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 14 Jun 2007 00:11:02 +0200 Subject: Re: [rfc][1/13] Eliminate read_register: write_register in solib-sunos.c To: drow@false.org (Daniel Jacobowitz) Date: Wed, 13 Jun 2007 22:11:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20070612134525.GB7815@caradoc.them.org> from "Daniel Jacobowitz" at Jun 12, 2007 09:45:25 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00276.txt.bz2 Daniel Jacobowitz wrote: > On Thu, Jun 07, 2007 at 10:57:11PM +0200, Ulrich Weigand wrote: > > this patch eliminates the use of write_register in solib-sunos.c. > > As discussed when I've originally posted the patch, the whole > > "if (DECR_PC_AFTER_BREAK)" block is questionable, and the correct > > solution might be to completely remove it. > > I'd prefer that - unfortunately I believe Mark is travelling now > so it may be a while before he can test it. I suppose that if you're > feeling really brave, you could try running OpenBSD in aranym. > Actually, i386-openbsd3.3 in qemu would probably be much easier. qemu does work pretty well, indeed. However, testing i386-openbsd3.3 there confirmed that the "if (DECR_PC_AFTER_BREAK)" block is actually required. This is because the breakpoint is inserted by the *dynamic linker* itself, and is therefore not on GDB's breakpoint list, which is why adjust_pc_after_break doesn't recognize it. This is in fact even noted in a comment in solib-sunos.c: For SunOS, there is a special flag location (in_debugger) which we set to 1. When the dynamic linker sees this flag set, it will set a breakpoint at a location known only to itself, after saving the original contents of that place and the breakpoint address itself, in it's own internal structures. When we resume the inferior, it will eventually take a SIGTRAP when it runs into the breakpoint. We handle this (in a different place) by restoring the contents of the breakpointed location (which is only known after it stops), chasing around to locate the shared libraries that have been loaded, then resuming. So I guess it's back to my original patch ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com