From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15315 invoked by alias); 31 Dec 2003 23:37:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15308 invoked from network); 31 Dec 2003 23:37:29 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 31 Dec 2003 23:37:29 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id hBVNXUiu007704; Thu, 1 Jan 2004 00:33:30 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id hBVNXTTe016636; Thu, 1 Jan 2004 00:33:29 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id hBVNXNvg016633; Thu, 1 Jan 2004 00:33:23 +0100 (CET) Date: Wed, 31 Dec 2003 23:37:00 -0000 Message-Id: <200312312333.hBVNXNvg016633@elgar.kettenis.dyndns.org> From: Mark Kettenis To: davidm@hpl.hp.com CC: kevinb@redhat.com, jjohnstn@redhat.com, gdb-patches@sources.redhat.com In-reply-to: <16371.12104.503371.251351@napali.hpl.hp.com> (message from David Mosberger on Wed, 31 Dec 2003 12:19:20 -0800) Subject: Re: make inferior calls work on ia64 even when syscall is pending References: <16371.12104.503371.251351@napali.hpl.hp.com> X-SW-Source: 2003-12/txt/msg00543.txt.bz2 From: David Mosberger Date: Wed, 31 Dec 2003 12:19:20 -0800 If the gdb patch looks OK, please check it in. David, there are two issues with the patch: * I suspect that this approach is Linux-specific. If so, you really shouldn't be adding this bit of code to the generic ia64_write_pc(). Instead you should create a Linux-specific ia64_linux_write_pc() and put it in ia64-linux-tdep.c; you'll probably want to call the generic ia64_write_pc() from there. Then you must hook in the Linux-specific version if the OSABI is GDB_OSABI_LINUX. * You should use write_register_pid() instead of write_register(). Mark Thanks! --david 2003-12-31 David Mosberger * ia64-tdep.c (ia64_write_pc): Clear r10 after writing the instruction-pointer (PC) to prevent the kernel from attempting to restart an interrupt system call. Index: ia64-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ia64-tdep.c,v retrieving revision 1.106 diff -u -r1.106 ia64-tdep.c --- ia64-tdep.c 13 Dec 2003 03:51:56 -0000 1.106 +++ ia64-tdep.c 31 Dec 2003 19:49:49 -0000 @@ -683,6 +683,17 @@ write_register_pid (IA64_PSR_REGNUM, psr_value, ptid); write_register_pid (IA64_IP_REGNUM, new_pc, ptid); + + /* We must be careful with modifying the instruction-pointer: if we + just interrupt a system call, the kernel would ordinarily try to + restart it when we resume the inferior, which typically results + in SIGSEGV or SIGILL. We prevent this by clearing r10, which + will tell the kernel that r8 does NOT contain a valid error code + and hence it will skip system-call restart. + + The clearing of r10 is safe as long as ia64_write_pc() is only + called as part of setting up an inferior call. */ + write_register (IA64_GR10_REGNUM, 0); } #define IS_NaT_COLLECTION_ADDR(addr) ((((addr) >> 3) & 0x3f) == 0x3f)