From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11314 invoked by alias); 1 Dec 2011 15:37:44 -0000 Received: (qmail 11171 invoked by uid 22791); 1 Dec 2011 15:37:43 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Dec 2011 15:37:25 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Dec 2011 15:37:19 -0000 Received: from d06nrmr1307.portsmouth.uk.ibm.com ([9.149.38.129]) by e06smtp12.uk.ibm.com ([192.168.101.142]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Dec 2011 15:37:16 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pB1FbGxJ2453562; Thu, 1 Dec 2011 15:37:16 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pB1FbFFl016654; Thu, 1 Dec 2011 08:37:15 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id pB1FbE1Z016620; Thu, 1 Dec 2011 08:37:14 -0700 Message-Id: <201112011537.pB1FbE1Z016620@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 01 Dec 2011 16:37:14 +0100 Subject: [rfa, s390] [bfd part] Support extended register sets To: binutils@sourceware.org, gdb-patches@sourceware.org Date: Thu, 01 Dec 2011 15:37:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-cbid: 11120115-8372-0000-0000-000000F8E843 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: 2011-12/txt/msg00004.txt.bz2 Hello, recent Linux kernels have added two new core file note types that are not yet supported in BFD. The patch below adds those to elf/common.h, and also provided support for reading/writing them, to be used by GDB. Tested (together with the GDB patch) on s390x-ibm-linux (31-bit and 64-bit) and s390-ibm-linux. OK for BFD mainline? Bye, Ulrich include/elf/ChangeLog: * common.h (NT_S390_LAST_BREAK): Define. (NT_S390_SYSTEM_CALL): Likewise. bfd/ChangeLog: * elf-bfd.h (elfcore_write_s390_last_break): Add prototype. (elfcore_write_s390_system_call): Likewise. * elf.c (elfcore_write_s390_last_break): New function. (elfcore_write_s390_system_call): Likewise. (elfcore_write_register_note): Call them. (elfcore_grok_s390_last_break): New function. (elfcore_grok_s390_system_call): Likewise. (elfcore_grok_note): Call them. Index: gdb-head/bfd/elf-bfd.h =================================================================== --- gdb-head.orig/bfd/elf-bfd.h +++ gdb-head/bfd/elf-bfd.h @@ -2237,6 +2237,10 @@ extern char *elfcore_write_s390_ctrs (bfd *, char *, int *, const void *, int); extern char *elfcore_write_s390_prefix (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_s390_last_break + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_s390_system_call + (bfd *, char *, int *, const void *, int); extern char *elfcore_write_arm_vfp (bfd *, char *, int *, const void *, int); extern char *elfcore_write_lwpstatus Index: gdb-head/bfd/elf.c =================================================================== --- gdb-head.orig/bfd/elf.c +++ gdb-head/bfd/elf.c @@ -7983,6 +7983,18 @@ elfcore_grok_s390_prefix (bfd *abfd, Elf } static bfd_boolean +elfcore_grok_s390_last_break (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".reg-s390-last-break", note); +} + +static bfd_boolean +elfcore_grok_s390_system_call (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".reg-s390-system-call", note); +} + +static bfd_boolean elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note) { return elfcore_make_note_pseudosection (abfd, ".reg-arm-vfp", note); @@ -8407,6 +8419,20 @@ elfcore_grok_note (bfd *abfd, Elf_Intern else return TRUE; + case NT_S390_LAST_BREAK: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) + return elfcore_grok_s390_last_break (abfd, note); + else + return TRUE; + + case NT_S390_SYSTEM_CALL: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) + return elfcore_grok_s390_system_call (abfd, note); + else + return TRUE; + case NT_ARM_VFP: if (note->namesz == 6 && strcmp (note->namedata, "LINUX") == 0) @@ -9168,6 +9194,32 @@ elfcore_write_s390_prefix (bfd *abfd, } char * +elfcore_write_s390_last_break (bfd *abfd, + char *buf, + int *bufsiz, + const void *s390_last_break, + int size) +{ + char *note_name = "LINUX"; + return elfcore_write_note (abfd, buf, bufsiz, + note_name, NT_S390_LAST_BREAK, + s390_last_break, size); +} + +char * +elfcore_write_s390_system_call (bfd *abfd, + char *buf, + int *bufsiz, + const void *s390_system_call, + int size) +{ + char *note_name = "LINUX"; + return elfcore_write_note (abfd, buf, bufsiz, + note_name, NT_S390_SYSTEM_CALL, + s390_system_call, size); +} + +char * elfcore_write_arm_vfp (bfd *abfd, char *buf, int *bufsiz, @@ -9209,6 +9261,10 @@ elfcore_write_register_note (bfd *abfd, return elfcore_write_s390_ctrs (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-s390-prefix") == 0) return elfcore_write_s390_prefix (abfd, buf, bufsiz, data, size); + if (strcmp (section, ".reg-s390-last-break") == 0) + return elfcore_write_s390_last_break (abfd, buf, bufsiz, data, size); + if (strcmp (section, ".reg-s390-system-call") == 0) + return elfcore_write_s390_system_call (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-arm-vfp") == 0) return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size); return NULL; Index: gdb-head/include/elf/common.h =================================================================== --- gdb-head.orig/include/elf/common.h +++ gdb-head/include/elf/common.h @@ -543,6 +543,10 @@ /* note name must be "LINUX". */ #define NT_S390_PREFIX 0x305 /* S390 prefix register */ /* note name must be "LINUX". */ +#define NT_S390_LAST_BREAK 0x306 /* S390 breaking event address */ + /* note name must be "LINUX". */ +#define NT_S390_SYSTEM_CALL 0x307 /* S390 system call restart data */ + /* note name must be "LINUX". */ #define NT_ARM_VFP 0x400 /* ARM VFP registers */ /* note name must be "LINUX". */ -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com