This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc][1/13] Eliminate read_register: write_register in solib-sunos.c
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: drow at false dot org (Daniel Jacobowitz)
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 14 Jun 2007 00:11:02 +0200 (CEST)
- Subject: Re: [rfc][1/13] Eliminate read_register: write_register in solib-sunos.c
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