From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7479 invoked by alias); 29 Jan 2008 20:26:13 -0000 Received: (qmail 7469 invoked by uid 22791); 29 Jan 2008 20:26:12 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jan 2008 20:25:50 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 4D35498151; Tue, 29 Jan 2008 20:25:49 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 2E3279811F; Tue, 29 Jan 2008 20:25:49 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JJx1g-000459-AM; Tue, 29 Jan 2008 15:25:48 -0500 Date: Tue, 29 Jan 2008 20:28:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: [rfc][2/3] gdbserver bi-arch support: core s390x part Message-ID: <20080129202548.GA15063@caradoc.them.org> Mail-Followup-To: Ulrich Weigand , gdb-patches@sourceware.org References: <200801211745.m0LHjqHo002475@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200801211745.m0LHjqHo002475@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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: 2008-01/txt/msg00721.txt.bz2 On Mon, Jan 21, 2008 at 06:45:52PM +0100, Ulrich Weigand wrote: > @@ -548,6 +548,7 @@ status_pending_p (struct inferior_list_e > static void > linux_wait_for_process (struct process_info **childp, int *wstatp) > { > + static int arch_setup_done = 0; > int ret; > int to_wait_for = -1; > This isn't quite good enough. It's already possible for the architecture to change during a single gdbserver run, so I think we have to support re-calling arch_setup. Right now you have to run in extended mode and replace a 32-bit binary with a 64-bit one before restarting it, but I'll be checking in the support for "set remote exec-file" shortly if I catch up on patch review :-) All it takes is hopefully a global flag that we can reset when switching to a new inferior. > diff -urNp gdb-orig/gdb/gdbserver/linux-s390-low.c gdb-head/gdb/gdbserver/linux-s390-low.c > --- gdb-orig/gdb/gdbserver/linux-s390-low.c 2008-01-18 00:57:40.000000000 +0100 > +++ gdb-head/gdb/gdbserver/linux-s390-low.c 2008-01-18 01:00:18.000000000 +0100 > @@ -102,24 +102,61 @@ static const unsigned char s390_breakpoi > static CORE_ADDR > s390_get_pc () > { > - unsigned long pc; > - collect_register_by_name ("pswa", &pc); > + if (register_size (0) == 4) > + { > + unsigned int pc; > + collect_register_by_name ("pswa", &pc); > #ifndef __s390x__ > - pc &= 0x7fffffff; > + pc &= 0x7fffffff; > #endif > - return pc; > + return pc; > + } > + else > + { > + unsigned long pc; > + collect_register_by_name ("pswa", &pc); > + return pc; > + } > } This is harmlessly if dead if gdbserver is 32-bit, right? > +static void > +s390_arch_setup (void) > +{ > + /* Assume 31-bit inferior process. */ > + init_registers_s390 (); > + > + /* On a 64-bit host, check the low bit of the (31-bit) PSWM > + -- if this is one, we actually have a 64-bit inferior. */ > +#ifdef __s390x__ > + { > + unsigned int pswm; > + collect_register_by_name ("pswm", &pswm); > + if (pswm & 1) > + init_registers_s390x (); > + } > +#endif This makes my head hurt quite a lot. You're fetching registers into the cache before you know their size for sure? I think using ptrace directly in this case might be more obvious. -- Daniel Jacobowitz CodeSourcery