Accepting request 531264 from devel:gcc

- Link gdb against a bundled libipt (processor trace
  library) on x86_64 and i686 for improved tracing support
  on Intel CPUs.  [bnc#985550]
  Adds v1.6.1.tar.gz and patches
  v1.5-libipt-static.patch and v1.6.1-implicit-fallthrough.patch.

- Rebase to 8.0.1 release (fixing PR21886, PR22046)
- Updated libstdc++ pretty printers to
- Replace gdb-libstdc++-v3-python-6.3.1-20170212.tar.bz2 with
  gdb-libstdc++-v3-python-7.1.1-20170526.tar.bz2 .
- Add patches for s390x z14 feates [fate #321514, fate #322272]
  gdb-s390x-1b63490.patch
  gdb-s390x-289e23a.patch
  gdb-s390x-8fe09d7.patch
  gdb-s390x-96235dc.patch
  gdb-s390x-ad33963.patch
- Adjust some patches:
  gdb-ppc-power7-test.patch
  gdb-rhbz795424-bitpos-20of25.patch
  gdb-rhbz795424-bitpos-21of25.patch
  gdb-vla-intel-fortran-vla-strings.patch
- Add some patches from Fedora:
  gdb-rhbz1420304-s390x-01of35.patch
  gdb-rhbz1420304-s390x-02of35.patch
  gdb-rhbz1420304-s390x-03of35.patch
  gdb-rhbz1420304-s390x-04of35.patch
  gdb-rhbz1420304-s390x-05of35.patch
  gdb-rhbz1420304-s390x-06of35.patch
  gdb-rhbz1420304-s390x-07of35.patch
  gdb-rhbz1420304-s390x-08of35.patch

OBS-URL: https://build.opensuse.org/request/show/531264
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=116
This commit is contained in:
Dominique Leuenberger 2017-10-10 09:34:36 +00:00 committed by Git OBS Bridge
commit 0cf647c132
54 changed files with 6749 additions and 580 deletions

3
gdb-8.0.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9da134b6d42100d7738174dfd646eb2e0f2e834ca28ee3ff6bd0772a63c9e6f5
size 28051531

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96a6e2e693e4b4ac9e59b2c65000100f2fc100a38f6329bc1f4e153393564471
size 28071680

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae85ba0279cbf1f3d7d263b5136613c2dd707b80907b3f991db43b3b23432cc1
size 19356

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7275fc3bbd850ca7caae7a1137b4bb8ee01efb1d017cfa54025b6bccb615d8cf
size 21054

View File

@ -1,6 +1,6 @@
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp
@@ -0,0 +1,182 @@
@@ -0,0 +1,178 @@
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -76,17 +76,13 @@
+# [PATCH] Remove support for POWER7 VSX load/store with update instructions
+# http://sourceware.org/ml/binutils/2009-09/msg00680.html
+# http://sourceware.org/ml/binutils-cvs/2009-09/msg00331.html
+# lxvd2ux vs3,r4,r5
+func_check 0x4 ".long 0x7c642ed8"
+func_check 0x4 "lxvb16x vs3,r4,r5"
+func_check 0x8 "lxvd2x vs43,r4,r5"
+# lxvd2ux vs43,r4,r5
+func_check 0xc ".long 0x7d642ed9"
+func_check 0xc "lxvb16x vs43,r4,r5"
+func_check 0x10 "stxvd2x vs3,r4,r5"
+# stxvd2ux vs3,r4,r5
+func_check 0x14 ".long 0x7c642fd8"
+func_check 0x14 "stxvb16x vs3,r4,r5"
+func_check 0x18 "stxvd2x vs43,r4,r5"
+# stxvd2ux vs43,r4,r5
+func_check 0x1c ".long 0x7d642fd9"
+func_check 0x1c "stxvb16x vs43,r4,r5"
+func_check 0x20 "xxmrghd vs3,vs4,vs5"
+func_check 0x24 "xxmrghd vs43,vs44,vs45"
+func_check 0x28 "xxmrgld vs3,vs4,vs5"

View File

@ -0,0 +1,62 @@
commit d7ab4911f8aa3e1cd06ece40f74d0b4a532d6a10
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 8 19:10:42 2017 +0200
S/390: Fix ifunc missing runtime reloc
This fixes a problem with a missing R_390_64 reloc against .data for a
function pointer to an ifunc function.
No regressions on s390x.
Pushed to mainline.
bfd/ChangeLog:
2017-05-08 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf-s390-common.c: Don't check non_got_ref flag.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
--- a/bfd/elf-s390-common.c
+++ b/bfd/elf-s390-common.c
@@ -161,9 +161,7 @@ keep:
h->type = STT_FUNC;
}
- /* We need dynamic relocation for STT_GNU_IFUNC symbol only when
- there is a non-GOT reference in a shared object. */
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
*head = NULL;
/* Finally, allocate space. */
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2774,7 +2774,7 @@ elf_s390_relocate_section (bfd *output_bfd,
&& s390_is_ifunc_symbol_p (h)
&& h->def_regular)
{
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
{
/* For a non-shared object STT_GNU_IFUNC symbol must
go through PLT. */
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2737,10 +2737,11 @@ elf_s390_relocate_section (bfd *output_bfd,
&& s390_is_ifunc_symbol_p (h)
&& h->def_regular)
{
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
{
- /* For a non-shared object STT_GNU_IFUNC symbol must
- go through PLT. */
+ /* For a non-shared object the symbol will not
+ change. Hence we can write the address of the
+ target IPLT slot now. */
relocation = (htab->elf.iplt->output_section->vma
+ htab->elf.iplt->output_offset
+ h ->plt.offset);

View File

@ -0,0 +1,43 @@
commit a0a110b0dd5077373c4102d1502130eb159c366b
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Wed May 17 12:39:39 2017 +0200
S/390: Fix arch level of pckmo instruction.
Fix wrong architecture level of PCKMO instruction.
Committed to mainline.
opcodes/ChangeLog:
2017-05-17 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.txt: PCKMO change arch level to z196.
gas/ChangeLog:
2017-05-17 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/zarch-z10.d: Remove pckmo.
* testsuite/gas/s390/zarch-z10.s: Remove pckmo.
* testsuite/gas/s390/zarch-z196.d: Add pckmo.
* testsuite/gas/s390/zarch-z196.s: Add pckmo.
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -976,7 +976,6 @@ b286 qsi S_RD "query sampling information" z10 zarch
b2e0 scctr RRE_RR "set cpu counter" z10 zarch
b2e1 spctr RRE_RR "set peripheral counter" z10 zarch
b280 lpp S_RD "load program parameter" z10 zarch
-b928 pckmo RRE_00 "perform cryptographic key management operation" z10 zarch
# The new instructions of the IBM zEnterprise z196
b9c8 ahhhr RRF_R0RR2 "add high high" z196 zarch
@@ -1116,6 +1115,7 @@ b92a kmf RRE_RR "cipher message with CFB" z196 zarch
b92b kmo RRE_RR "cipher message with OFB" z196 zarch
b92c pcc RRE_00 "perform cryptographic computation" z196 zarch
b92d kmctr RRF_R0RR "cipher message with counter" z196 zarch
+b928 pckmo RRE_00 "perform cryptographic key management operation" z196 zarch
# The new instructions of the IBM zEnterprise EC12
b2ec etnd RRE_R0 "extract transaction nesting depth" zEC12 zarch htm

View File

@ -0,0 +1,52 @@
commit bfcfbe611b4d7e650236f8b8ba7d0706cfe6a0b7
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 29 12:33:15 2017 +0200
S/390: Remove optional operand flag.
The per operand optional flag hasn't been used for quite some time.
Cleanup some remains.
include/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* opcode/s390.h: Remove S390_OPERAND_OPTIONAL.
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (md_gather_operands): Remove code dealing with
S390_OPERAND_OPTIONAL.
--- a/include/opcode/s390.h
+++ b/include/opcode/s390.h
@@ -156,21 +156,17 @@ extern const struct s390_operand s390_operands[];
/* This operand is a length. */
#define S390_OPERAND_LENGTH 0x200
-/* This operand is optional. Only a single operand at the end of
- the instruction may be optional. */
-#define S390_OPERAND_OPTIONAL 0x400
-
/* The operand needs to be a valid GP or FP register pair. */
-#define S390_OPERAND_REG_PAIR 0x800
+#define S390_OPERAND_REG_PAIR 0x400
/* This operand names a vector register. The disassembler uses this
to print register names with a leading 'v'. */
-#define S390_OPERAND_VR 0x1000
+#define S390_OPERAND_VR 0x800
-#define S390_OPERAND_CP16 0x2000
+#define S390_OPERAND_CP16 0x1000
-#define S390_OPERAND_OR1 0x4000
-#define S390_OPERAND_OR2 0x8000
-#define S390_OPERAND_OR8 0x10000
+#define S390_OPERAND_OR1 0x2000
+#define S390_OPERAND_OR2 0x4000
+#define S390_OPERAND_OR8 0x8000
#endif /* S390_H */

View File

@ -0,0 +1,97 @@
commit a09f2586017aeed82fa07c8bfea6c75859295bd9
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 29 12:34:56 2017 +0200
S/390: Improve error checking for optional operands
So far we only had an instruction flag which made an arbitrary number
of operands optional. This limits error checking capabilities for
instructions marked that way. With this patch the optparm flag only
allows a single optional parameter and another one is added (optparm2)
allowing 2 optional arguments. Hopefully we won't need more than that
in the future. So far there will be only a single use of optparm2.
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (md_gather_operands): Support new optparm2
instruction flag.
include/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* opcode/s390.h: Add new instruction flags optparm2.
opcodes/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-dis.c (s390_print_insn_with_opcode): Support new optparm2
instruction flag.
* s390-mkopc.c (main): Recognize the new instruction flag when
parsing instruction list.
--- a/include/opcode/s390.h
+++ b/include/opcode/s390.h
@@ -48,10 +48,11 @@ enum s390_opcode_cpu_val
/* Instruction specific flags. */
#define S390_INSTR_FLAG_OPTPARM 0x1
+#define S390_INSTR_FLAG_OPTPARM2 0x2
-#define S390_INSTR_FLAG_HTM 0x2
-#define S390_INSTR_FLAG_VX 0x4
-#define S390_INSTR_FLAG_FACILITY_MASK 0x6
+#define S390_INSTR_FLAG_HTM 0x4
+#define S390_INSTR_FLAG_VX 0x8
+#define S390_INSTR_FLAG_FACILITY_MASK 0xc
/* The opcode table is an array of struct s390_opcode. */
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -206,11 +206,20 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
/* For instructions with a last optional operand don't print it
if zero. */
- if ((opcode->flags & S390_INSTR_FLAG_OPTPARM)
+ if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2))
&& val.u == 0
&& opindex[1] == 0)
break;
+ if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2)
+ && val.u == 0 && opindex[1] != 0 && opindex[2] == 0)
+ {
+ union operand_value next_op_val =
+ s390_extract_operand (buffer, s390_operands + opindex[1]);
+ if (next_op_val.u == 0)
+ break;
+ }
+
if (flags & S390_OPERAND_GPR)
info->fprintf_func (info->stream, "%c%%r%u", separator, val.u);
else if (flags & S390_OPERAND_FPR)
--- a/opcodes/s390-mkopc.c
+++ b/opcodes/s390-mkopc.c
@@ -411,12 +411,16 @@ main (void)
&& (str[7] == 0 || str[7] == ',')) {
flag_bits |= S390_INSTR_FLAG_OPTPARM;
str += 7;
+ } else if (strncmp (str, "optparm2", 8) == 0
+ && (str[8] == 0 || str[8] == ',')) {
+ flag_bits |= S390_INSTR_FLAG_OPTPARM2;
+ str += 8;
} else if (strncmp (str, "htm", 3) == 0
- && (str[3] == 0 || str[3] == ',')) {
+ && (str[3] == 0 || str[3] == ',')) {
flag_bits |= S390_INSTR_FLAG_HTM;
str += 3;
} else if (strncmp (str, "vx", 2) == 0
- && (str[2] == 0 || str[2] == ',')) {
+ && (str[2] == 0 || str[2] == ',')) {
flag_bits |= S390_INSTR_FLAG_VX;
str += 2;
} else {

View File

@ -0,0 +1,58 @@
commit ffc61c5de1a5a89e3e37fb9376725c32a839c34d
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 29 12:36:57 2017 +0200
S/390: Add ipte/idte variants with optional operands
This patch adds missing variants of ipte and idte instructions added with later CPU
generations.
ipte got an optional operand with z196 and another one with zEC12.
idte got an optional operand with zEC12
opcodes/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.c: Add new idte/ipte variants.
* s390-opc.txt: Likewise.
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/zarch-z196.d: Add new idte/ipte variants.
* testsuite/gas/s390/zarch-z196.s: Likewise.
* testsuite/gas/s390/zarch-zEC12.d: Likewise.
* testsuite/gas/s390/zarch-zEC12.s: Likewise.
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -355,7 +355,7 @@ const struct s390_operand s390_operands[] =
#define INSTR_RRF_FEUFEFE 4, { FE_24,FE_16,FE_28,U4_20,0,0 } /* e.g. qaxtr */
#define INSTR_RRF_FUFF2 4, { F_24,F_28,F_16,U4_20,0,0 } /* e.g. adtra */
#define INSTR_RRF_FEUFEFE2 4, { FE_24,FE_28,FE_16,U4_20,0,0 } /* e.g. axtra */
-#define INSTR_RRF_RURR 4, { R_24,R_28,R_16,U4_20,0,0 } /* e.g. .insn */
+#define INSTR_RRF_RURR 4, { R_24,R_28,R_16,U4_20,0,0 } /* e.g. ipte */
#define INSTR_RRF_RURR2 4, { R_24,R_16,R_28,U4_20,0,0 } /* e.g. lptea */
#define INSTR_RRF_R0RR 4, { R_24,R_16,R_28,0,0,0 } /* e.g. idte */
#define INSTR_RRF_R0RR2 4, { R_24,R_28,R_16,0,0,0 } /* e.g. ark */
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -1116,6 +1116,7 @@ b92b kmo RRE_RR "cipher message with OFB" z196 zarch
b92c pcc RRE_00 "perform cryptographic computation" z196 zarch
b92d kmctr RRF_R0RR "cipher message with counter" z196 zarch
b928 pckmo RRE_00 "perform cryptographic key management operation" z196 zarch
+b221 ipte RRF_R0RR2 "invalidate page table entry" z196 zarch optparm
# The new instructions of the IBM zEnterprise EC12
b2ec etnd RRE_R0 "extract transaction nesting depth" zEC12 zarch htm
@@ -1143,6 +1144,8 @@ ed00000000aa cdzt RSL_LRDFU "convert from zoned long" zEC12 zarch
ed00000000ab cxzt RSL_LRDFEU "convert from zoned extended" zEC12 zarch
ed00000000a8 czdt RSL_LRDFU "convert to zoned long" zEC12 zarch
ed00000000a9 czxt RSL_LRDFEU "convert to zoned extended" zEC12 zarch
+b98e idte RRF_RURR2 "invalidate dat table entry" zEC12 zarch optparm
+b221 ipte RRF_RURR "invalidate page table entry" zEC12 zarch optparm2
# The new instructions of IBM z13

View File

@ -0,0 +1,31 @@
commit 67aa8be4cb43cd94bc322fed8bdba48b3c8719c4
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 29 12:38:11 2017 +0200
S/390: Add missing operand to tb instruction
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/esa-g5.d: Add missing operand to tb
instruction.
* testsuite/gas/s390/esa-g5.s: Likewise.
opcodes/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.txt: Add missing operand to tb instruction.
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -228,7 +228,7 @@ b246 stura RRE_RR "store using real address" g5 esa,zarch
2f swr RR_FF "subtract unnormalized (long)" g5 esa,zarch
37 sxr RR_FEFE "subtract normalized (ext.)" g5 esa,zarch
b24c tar RRE_AR "test access" g5 esa,zarch
-b22c tb RRE_0R "test block" g5 esa,zarch
+b22c tb RRE_RR "test block" g5 esa,zarch
91 tm SI_URD "test under mask" g5 esa,zarch
b236 tpi S_RD "test pending interruption" g5 esa,zarch
e501 tprot SSE_RDRD "test protection" g5 esa,zarch

View File

@ -0,0 +1,53 @@
commit ca87ae741fe9c8aad9db1afbf109dc070d0168cf
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon May 29 12:38:42 2017 +0200
S/390: Fix instruction types of csdtr and csxtr
opcodes/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.c: Add new instruction types RRF_0URF and RRF_0UREFE.
* s390-opc.txt: Fix instruction typs of csdtr and csxtr.
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/zarch-z9-ec.d: Adjust csdtr and csxtr.
* testsuite/gas/s390/zarch-z9-ec.s: Likewise.
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -374,6 +374,8 @@ const struct s390_operand s390_operands[] =
#define INSTR_RRF_U0RER 4, { RE_24,R_28,U4_16,0,0,0 } /* e.g. trte */
#define INSTR_RRF_U0RERE 4, { RE_24,RE_28,U4_16,0,0,0 } /* e.g. cu24 */
#define INSTR_RRF_00RR 4, { R_24,R_28,0,0,0,0 } /* e.g. clrtne */
+#define INSTR_RRF_0URF 4, { R_24,F_28,U4_20,0,0,0 } /* e.g. csdtr */
+#define INSTR_RRF_0UREFE 4, { RE_24,FE_28,U4_20,0,0,0 } /* e.g. csxtr */
#define INSTR_RRF_UUFR 4, { F_24,U4_16,R_28,U4_20,0,0 } /* e.g. cdgtra */
#define INSTR_RRF_UUFER 4, { FE_24,U4_16,R_28,U4_20,0,0 } /* e.g. cxfbra */
#define INSTR_RRF_UURF 4, { R_24,U4_16,F_28,U4_20,0,0 } /* e.g. cgdtra */
@@ -590,6 +592,8 @@ const struct s390_operand s390_operands[] =
#define MASK_RRF_U0RER { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
#define MASK_RRF_U0RERE { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
#define MASK_RRF_00RR { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 }
+#define MASK_RRF_0URF { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00 }
+#define MASK_RRF_0UREFE { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00 }
#define MASK_RRF_UUFR { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RRF_UUFER { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RRF_UURF { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -817,8 +817,8 @@ b3f2 cdutr RRE_FR "convert from unsigned bcd to long dfp" z9-ec zarch
b3fa cxutr RRE_FER "convert from unsigned bcd to extended dfp" z9-ec zarch
b3e1 cgdtr RRF_U0RF "convert from long dfp to fixed" z9-ec zarch
b3e9 cgxtr RRF_U0RFE "convert from extended dfp to fixed" z9-ec zarch
-b3e3 csdtr RRE_RF "convert from long dfp to signed bcd" z9-ec zarch
-b3eb csxtr RRE_RFE "convert from extended dfp to signed bcd" z9-ec zarch
+b3e3 csdtr RRF_0URF "convert from long dfp to signed bcd" z9-ec zarch
+b3eb csxtr RRF_0UREFE "convert from extended dfp to signed bcd" z9-ec zarch
b3e2 cudtr RRE_RF "convert from long dfp to unsigned bcd" z9-ec zarch
b3ea cuxtr RRE_RFE "convert from extended dfp to unsigned bcd" z9-ec zarch
b3d1 ddtr RRR_F0FF "divide long dfp" z9-ec zarch

View File

@ -0,0 +1,76 @@
commit 19fb31c0060f646a9f84be1a84ed1bea04e7ed57
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Thu Jun 1 13:46:15 2017 +0200
S/390: idte/ipte fixes
Later CPU generations added optional operands to the ipte/idte
instructions. I've added these with:
https://sourceware.org/ml/binutils/2017-05/msg00316.html ... but
supported the optional operands only with the specific hardware
levels. However, it is more useful to have the optional operands
already in the first versions. Of course they need to be zero there.
Regression-tested with on s390 and s390x. Committed to mainline.
Bye,
-Andreas-
opcodes/ChangeLog:
2017-06-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.txt: Support the optional parameters with the first
versions of ipte/idte.
gas/ChangeLog:
2017-06-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/esa-g5.d: Add ipte tests.
* testsuite/gas/s390/esa-g5.s: Likewise.
* testsuite/gas/s390/zarch-z196.d: Remove ipte tests.
* testsuite/gas/s390/zarch-z196.s: Likewise.
* testsuite/gas/s390/zarch-z990.d: Add idte tests.
* testsuite/gas/s390/zarch-z990.s: Likewise.
* testsuite/gas/s390/zarch-zEC12.d: Remove ipte/idte tests.
* testsuite/gas/s390/zarch-zEC12.s: Likewise.
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -79,7 +79,7 @@ b224 iac RRE_R0 "insert address space control" g5 esa,zarch
bf icm RS_RURD "insert characters under mask" g5 esa,zarch
b20b ipk S_00 "insert PSW key" g5 esa,zarch
b222 ipm RRE_R0 "insert program mask" g5 esa,zarch
-b221 ipte RRE_RR "invalidate page table entry" g5 esa,zarch
+b221 ipte RRF_RURR "invalidate page table entry" g5 esa,zarch optparm2
b229 iske RRE_RR "insert storage key extended" g5 esa,zarch
b223 ivsk RRE_RR "insert virtual storage key" g5 esa,zarch
58 l RX_RRRD "load" g5 esa,zarch
@@ -700,7 +700,7 @@ eb000000008f clclu RSY_RRRD "compare logical long unicode with long offset" z990
eb0000000096 lmh RSY_RRRD "load multiple high" z990 zarch
# new z990 instructions
b98a cspg RRE_RR "compare and swap and purge" z990 zarch
-b98e idte RRF_R0RR "invalidate dat table entry" z990 zarch
+b98e idte RRF_RURR2 "invalidate dat table entry" z990 zarch optparm
b33e madr RRF_F0FF "multiply and add long hfp" z990 esa,zarch
ed000000003e mad RXF_FRRDF "multiply and add long hfp" z990 esa,zarch
b32e maer RRF_F0FF "multiply and add short hfp" z990 esa,zarch
@@ -1116,7 +1116,6 @@ b92b kmo RRE_RR "cipher message with OFB" z196 zarch
b92c pcc RRE_00 "perform cryptographic computation" z196 zarch
b92d kmctr RRF_R0RR "cipher message with counter" z196 zarch
b928 pckmo RRE_00 "perform cryptographic key management operation" z196 zarch
-b221 ipte RRF_R0RR2 "invalidate page table entry" z196 zarch optparm
# The new instructions of the IBM zEnterprise EC12
b2ec etnd RRE_R0 "extract transaction nesting depth" zEC12 zarch htm
@@ -1144,8 +1143,6 @@ ed00000000aa cdzt RSL_LRDFU "convert from zoned long" zEC12 zarch
ed00000000ab cxzt RSL_LRDFEU "convert from zoned extended" zEC12 zarch
ed00000000a8 czdt RSL_LRDFU "convert to zoned long" zEC12 zarch
ed00000000a9 czxt RSL_LRDFEU "convert to zoned extended" zEC12 zarch
-b98e idte RRF_RURR2 "invalidate dat table entry" zEC12 zarch optparm
-b221 ipte RRF_RURR "invalidate page table entry" zEC12 zarch optparm2
# The new instructions of IBM z13

View File

@ -0,0 +1,123 @@
commit 3704e3589d3d187fbf76e688388b1a92fd627c8d
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Fri Jun 9 11:19:01 2017 +0200
S/390: Return with an error for broken tls rewrites
bfd/ChangeLog:
2017-06-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf32-s390.c (elf_s390_relocate_section): Return false in case
the rewriting fails.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3231,7 +3231,6 @@ elf_s390_relocate_section (bfd *output_bfd,
unsigned int insn, ry;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- ry = 0;
if ((insn & 0xff00f000) == 0x58000000)
/* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x000f0000);
@@ -3245,7 +3244,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn = 0x18000700 | (insn & 0x00f00000) | ry;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
@@ -3258,7 +3260,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
{
if ((insn & 0xff000000) == 0x0d000000)
@@ -3287,7 +3292,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* If basr is used in the pic case to invoke
_tls_get_offset, something went wrong before. */
if ((insn & 0xff000000) == 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x4d000000)
{
@@ -3317,7 +3325,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x0d000000)
{
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3197,8 +3197,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if (insn1 != 0x0004)
- invalid_tls_insn (input_bfd, input_section, rel);
- ry = 0;
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn0 & 0xff00f000) == 0xe3000000)
/* lg %rx,0(%ry,0) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x000f0000);
@@ -3212,7 +3214,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* lg %rx,0(%r12,%ry) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry;
insn1 = 0x000d;
bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
@@ -3226,7 +3231,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
{
/* GD->LE transition.
@@ -3253,7 +3261,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
/* LD->LE transition.
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
insn0 = 0xc0040000;

View File

@ -0,0 +1,270 @@
commit 0567c9861e113a573cc905002a59cb1bc3d78450
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:25 2017 +0200
Add test for modifiable DWARF locations
This adds a test for read/write access to variables with various types of
DWARF locations. It uses register- and memory locations and composite
locations with register- and memory pieces.
Since the new test calls gdb_test_no_output with commands that contain
braces, it is necessary for string_to_regexp to quote braces as well.
This was not done before.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/var-access.c: New file.
* gdb.dwarf2/var-access.exp: New test.
* lib/gdb-utils.exp (string_to_regexp): Quote braces as well.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,9 @@
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.c: New file.
+ * gdb.dwarf2/var-access.exp: New test.
+ * lib/gdb-utils.exp (string_to_regexp): Quote braces as well.
+
2017-06-12 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/formdata16.exp: Add tests.
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/var-access.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+char buf[] = {0, 1, 2, 3, 4, 5, 6, 7};
+
+int
+main (void)
+{
+ asm volatile ("main_label: .globl main_label");
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -0,0 +1,197 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test reading/writing variables with non-trivial DWARF locations. In
+# particular the test uses register- and memory locations as well as
+# composite locations with register- and memory pieces.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+# Choose suitable integer registers for the test.
+
+set dwarf_regnum {0 1}
+
+if { [istarget "aarch64*-*-*"] } {
+ set regname {x0 x1}
+} elseif { [istarget "arm*-*-*"]
+ || [istarget "s390*-*-*" ]
+ || [istarget "powerpc*-*-*"]
+ || [istarget "rs6000*-*-aix*"] } {
+ set regname {r0 r1}
+} elseif { [istarget "i?86-*-*"] } {
+ set regname {eax edx}
+} elseif { [istarget "x86_64-*-*"] } {
+ set regname {rax rdx}
+} else {
+ verbose "Skipping tests for accessing DWARF-described variables."
+ return
+}
+
+standard_testfile .c ${gdb_test_file_name}-dw.S
+
+# Make some DWARF for the test.
+
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ global srcdir subdir srcfile
+ global dwarf_regnum regname
+
+ set buf_var [gdb_target_symbol buf]
+
+ cu {} {
+ DW_TAG_compile_unit {
+ {DW_AT_name var-pieces-dw.c}
+ {DW_AT_comp_dir /tmp}
+ } {
+ declare_labels char_type_label
+ declare_labels int_type_label short_type_label
+ declare_labels array_a8_label struct_s_label
+
+ # char
+ char_type_label: base_type {
+ {name "char"}
+ {encoding @DW_ATE_unsigned_char}
+ {byte_size 1 DW_FORM_sdata}
+ }
+
+ # int
+ int_type_label: base_type {
+ {name "int"}
+ {encoding @DW_ATE_signed}
+ {byte_size 4 DW_FORM_sdata}
+ }
+
+ # char [8]
+ array_a8_label: array_type {
+ {type :$char_type_label}
+ } {
+ subrange_type {
+ {type :$int_type_label}
+ {upper_bound 7 DW_FORM_udata}
+ }
+ }
+
+ # struct s { char a, b, c, d; };
+ struct_s_label: structure_type {
+ {name "s"}
+ {byte_size 4 DW_FORM_sdata}
+ } {
+ member {
+ {name "a"}
+ {type :$char_type_label}
+ {data_member_location 0 DW_FORM_udata}
+ }
+ member {
+ {name "b"}
+ {type :$char_type_label}
+ {data_member_location 1 DW_FORM_udata}
+ }
+ member {
+ {name "c"}
+ {type :$char_type_label}
+ {data_member_location 2 DW_FORM_udata}
+ }
+ member {
+ {name "d"}
+ {type :$char_type_label}
+ {data_member_location 3 DW_FORM_udata}
+ }
+ }
+
+ DW_TAG_subprogram {
+ {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+ {DW_AT_external 1 flag}
+ } {
+ # Simple memory location.
+ DW_TAG_variable {
+ {name "a"}
+ {type :$array_a8_label}
+ {location {
+ addr $buf_var
+ } SPECIAL_expr}
+ }
+ # Memory pieces: two bytes from &buf[2], and two bytes
+ # from &buf[0].
+ DW_TAG_variable {
+ {name "s1"}
+ {type :$struct_s_label}
+ {location {
+ addr $buf_var
+ plus_uconst 2
+ piece 2
+ addr $buf_var
+ piece 2
+ } SPECIAL_expr}
+ }
+ # Register- and memory pieces: one byte each from r0,
+ # &buf[4], r1, and &buf[5].
+ DW_TAG_variable {
+ {name "s2"}
+ {type :$struct_s_label}
+ {location {
+ regx [lindex $dwarf_regnum 0]
+ piece 1
+ addr "$buf_var + 4"
+ piece 1
+ regx [lindex $dwarf_regnum 1]
+ piece 1
+ addr "$buf_var + 5"
+ piece 1
+ } SPECIAL_expr}
+ }
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# Byte-aligned memory pieces.
+gdb_test "print/d s1" " = \\{a = 2, b = 3, c = 0, d = 1\\}" \
+ "s1 == re-ordered buf"
+gdb_test_no_output "set var s1.a = 63"
+gdb_test "print/d s1" " = \\{a = 63, b = 3, c = 0, d = 1\\}" \
+ "verify s1.a"
+gdb_test "print/d a" " = \\{0, 1, 63, 3, 4, 5, 6, 7\\}" \
+ "verify s1.a through a"
+
+# Byte-aligned register- and memory pieces.
+gdb_test_no_output "set var \$[lindex $regname 0] = 81" \
+ "init reg for s2.a"
+gdb_test_no_output "set var \$[lindex $regname 1] = 28" \
+ "init reg for s2.c"
+gdb_test "print/d s2" " = \\{a = 81, b = 4, c = 28, d = 5\\}" \
+ "initialized s2 from mem and regs"
+gdb_test_no_output "set var s2.c += s2.a + s2.b - s2.d"
+gdb_test "print/d s2" " = \\{a = 81, b = 4, c = 108, d = 5\\}" \
+ "verify s2.c"
+gdb_test "print/d \$[lindex $regname 1]" " = 108" \
+ "verify s2.c through reg"
+gdb_test_no_output "set var s2 = {191, 73, 231, 123}" \
+ "re-initialize s2"
+gdb_test "print/d s2" " = \\{a = 191, b = 73, c = 231, d = 123\\}" \
+ "verify re-initialized s2"
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -34,6 +34,6 @@ proc gdb_init_commands {} {
proc string_to_regexp {str} {
set result $str
- regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
+ regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
return $result
}

View File

@ -0,0 +1,106 @@
commit d5d1163eff2415a01895f1cff8bbee32b3f0ab66
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:26 2017 +0200
write_pieced_value: Fix size capping logic
A field f in a structure composed of DWARF pieces may be located in
multiple pieces, where the first and last of those may contain bits from
other fields as well. So when writing to f, the beginning of the first
and the end of the last of those pieces may have to be skipped. But the
logic in write_pieced_value for handling one of those pieces is flawed
when the first and last piece are the same, i.e., f is contained in a
single piece:
< - - - - - - - - - piece_size - - - - - - - - - ->
+-------------------------------------------------+
| skipped_bits | f_bits | / / / / / / / / / / |
+-------------------------------------------------+
The current logic determines the size of the sub-piece to operate on by
limiting the piece size to the bit size of f and then subtracting the
skipped bits:
min (piece_size, f_bits) - skipped_bits
Instead of:
min (piece_size - skipped_bits, f_bits)
So the resulting sub-piece size is corrupted, leading to wrong handling of
this piece in write_pieced_value.
Note that the same bug was already found in read_pieced_value and fixed
there (but not in write_pieced_value), see PR 15391.
This patch swaps the calculations, bringing them into the same (correct)
order as in read_pieced_value.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): Fix order of calculations for
size capping.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/var-pieces.exp: Add test case for modifying a
variable at nonzero offset.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): Fix order of calculations for
+ size capping.
+
2017-06-13 Yao Qi <yao.qi@linaro.org>
* mips-linux-nat.c: Move include features/mips*-linux.c to
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1964,8 +1964,6 @@ write_pieced_value (struct value *to, struct value *from)
bits_to_skip -= this_size_bits;
continue;
}
- if (this_size_bits > type_len - offset)
- this_size_bits = type_len - offset;
if (bits_to_skip > 0)
{
dest_offset_bits = bits_to_skip;
@@ -1978,6 +1976,8 @@ write_pieced_value (struct value *to, struct value *from)
dest_offset_bits = 0;
source_offset_bits = offset;
}
+ if (this_size_bits > type_len - offset)
+ this_size_bits = type_len - offset;
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * gdb.dwarf2/var-pieces.exp: Add test case for modifying a
+ variable at nonzero offset.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* gdb.dwarf2/var-access.c: New file.
* gdb.dwarf2/var-access.exp: New test.
* lib/gdb-utils.exp (string_to_regexp): Quote braces as well.
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -178,6 +178,11 @@ gdb_test "print/d s1" " = \\{a = 63, b = 3, c = 0, d = 1\\}" \
"verify s1.a"
gdb_test "print/d a" " = \\{0, 1, 63, 3, 4, 5, 6, 7\\}" \
"verify s1.a through a"
+gdb_test_no_output "set var s1.b = 42"
+gdb_test "print/d s1" " = \\{a = 63, b = 42, c = 0, d = 1\\}" \
+ "verify s1.b"
+gdb_test "print/d a" " = \\{0, 1, 63, 42, 4, 5, 6, 7\\}" \
+ "verify s1.b through a"
# Byte-aligned register- and memory pieces.
gdb_test_no_output "set var \$[lindex $regname 0] = 81" \

View File

@ -0,0 +1,189 @@
commit e93523245b704bc126705620969b4736b00350c5
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:26 2017 +0200
PR gdb/21226: Take DWARF stack value pieces from LSB end
When taking a DW_OP_piece or DW_OP_bit_piece from a DW_OP_stack_value, the
existing logic always takes the piece from the lowest-addressed end, which
is wrong on big-endian targets. The DWARF standard states that the
"DW_OP_bit_piece operation describes a sequence of bits using the least
significant bits of that value", and this also matches the current logic
in GCC. For instance, the GCC guality test case pr54970.c fails on s390x
because of this.
This fix adjusts the piece accordingly on big-endian targets. It is
assumed that:
* DW_OP_piece shall take the piece from the LSB end as well;
* pieces reaching outside the stack value bits are considered undefined,
and a zero value can be used instead.
gdb/ChangeLog:
PR gdb/21226
* dwarf2loc.c (read_pieced_value): Anchor stack value pieces at
the LSB end, independent of endianness.
gdb/testsuite/ChangeLog:
PR gdb/21226
* gdb.dwarf2/nonvar-access.exp: Add checks for verifying that
stack value pieces are taken from the LSB end.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ PR gdb/21226
+ * dwarf2loc.c (read_pieced_value): Anchor stack value pieces at
+ the LSB end, independent of endianness.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): Fix order of calculations for
size capping.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1858,6 +1858,10 @@ read_pieced_value (struct value *v)
if (unavail)
mark_value_bits_unavailable (v, offset, this_size_bits);
}
+
+ copy_bitwise (contents, dest_offset_bits,
+ intermediate_buffer, source_offset_bits % 8,
+ this_size_bits, bits_big_endian);
}
break;
@@ -1866,26 +1870,30 @@ read_pieced_value (struct value *v)
p->v.mem.in_stack_memory,
p->v.mem.addr + source_offset,
buffer.data (), this_size);
+ copy_bitwise (contents, dest_offset_bits,
+ intermediate_buffer, source_offset_bits % 8,
+ this_size_bits, bits_big_endian);
break;
case DWARF_VALUE_STACK:
{
- size_t n = this_size;
+ struct objfile *objfile = dwarf2_per_cu_objfile (c->per_cu);
+ struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile);
+ ULONGEST stack_value_size_bits
+ = 8 * TYPE_LENGTH (value_type (p->v.value));
- if (n > c->addr_size - source_offset)
- n = (c->addr_size >= source_offset
- ? c->addr_size - source_offset
- : 0);
- if (n == 0)
- {
- /* Nothing. */
- }
- else
- {
- const gdb_byte *val_bytes = value_contents_all (p->v.value);
+ /* Use zeroes if piece reaches beyond stack value. */
+ if (p->size > stack_value_size_bits)
+ break;
- intermediate_buffer = val_bytes + source_offset;
- }
+ /* Piece is anchored at least significant bit end. */
+ if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG)
+ source_offset_bits += stack_value_size_bits - p->size;
+
+ copy_bitwise (contents, dest_offset_bits,
+ value_contents_all (p->v.value),
+ source_offset_bits,
+ this_size_bits, bits_big_endian);
}
break;
@@ -1899,6 +1907,10 @@ read_pieced_value (struct value *v)
: 0);
if (n != 0)
intermediate_buffer = p->v.literal.data + source_offset;
+
+ copy_bitwise (contents, dest_offset_bits,
+ intermediate_buffer, source_offset_bits % 8,
+ this_size_bits, bits_big_endian);
}
break;
@@ -1915,12 +1927,6 @@ read_pieced_value (struct value *v)
internal_error (__FILE__, __LINE__, _("invalid location type"));
}
- if (p->location != DWARF_VALUE_OPTIMIZED_OUT
- && p->location != DWARF_VALUE_IMPLICIT_POINTER)
- copy_bitwise (contents, dest_offset_bits,
- intermediate_buffer, source_offset_bits % 8,
- this_size_bits, bits_big_endian);
-
offset += this_size_bits;
}
}
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ PR gdb/21226
+ * gdb.dwarf2/nonvar-access.exp: Add checks for verifying that
+ stack value pieces are taken from the LSB end.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* gdb.dwarf2/var-pieces.exp: Add test case for modifying a
variable at nonzero offset.
--- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
@@ -128,14 +128,26 @@ Dwarf::assemble $asm_file {
{name def_t}
{type :$struct_t_label}
{location {
- const1u 0
+ const2s -184
stack_value
bit_piece 9 0
- const1s -1
+ const4u 1752286
stack_value
bit_piece 23 0
} SPECIAL_expr}
}
+ # Composite location with some empty pieces.
+ DW_TAG_variable {
+ {name part_def_a}
+ {type :$array_a9_label}
+ {location {
+ piece 3
+ const4u 0xf1927314
+ stack_value
+ piece 4
+ piece 2
+ } SPECIAL_expr}
+ }
# Implicit location: immediate value.
DW_TAG_variable {
{name def_implicit_s}
@@ -221,9 +233,12 @@ gdb_test "print/x *implicit_b_ptr" " = $val"
# Byte-aligned fields, pieced together from DWARF stack values.
gdb_test "print def_s" " = \\{a = 0, b = -1\\}"
+switch $endian { big {set val 0x92} little {set val 0x73} }
+gdb_test "print/x part_def_a\[4\]" " = $val"
+gdb_test "print/x part_def_a\[8\]" " = <optimized out>"
# Non-byte-aligned fields, pieced together from DWARF stack values.
-gdb_test "print def_t" " = \\{a = 0, b = -1\\}"
+gdb_test "print def_t" " = \\{a = -184, b = 1752286\\}"
# Simple variable without location.
gdb_test "print undef_int" " = <optimized out>"

View File

@ -0,0 +1,72 @@
commit 805acca042afed8e8431c92ab031167b03475676
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:26 2017 +0200
gdb/testsuite: Add "get_endianness" convenience proc
The test suite contains multiple instances of determining the target's
endianness with GDB's "show endian" command. This patch replaces these by
an invocation of a new convenience proc 'get_endianness'.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (get_endianness): New proc.
* gdb.arch/aarch64-fp.exp: Use it.
* gdb.arch/altivec-regs.exp: Likewise.
* gdb.arch/e500-regs.exp: Likewise.
* gdb.arch/vsx-regs.exp: Likewise.
* gdb.base/dump.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/gnu_vector.exp: Likewise.
* gdb.dwarf2/formdata16.exp: Likewise.
* gdb.dwarf2/implptrpiece.exp: Likewise.
* gdb.dwarf2/nonvar-access.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.trace/unavailable-dwarf-piece.exp: Likewise.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,21 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * lib/gdb.exp (get_endianness): New proc.
+ * gdb.arch/aarch64-fp.exp: Use it.
+ * gdb.arch/altivec-regs.exp: Likewise.
+ * gdb.arch/e500-regs.exp: Likewise.
+ * gdb.arch/vsx-regs.exp: Likewise.
+ * gdb.base/dump.exp: Likewise.
+ * gdb.base/funcargs.exp: Likewise.
+ * gdb.base/gnu_vector.exp: Likewise.
+ * gdb.dwarf2/formdata16.exp: Likewise.
+ * gdb.dwarf2/implptrpiece.exp: Likewise.
+ * gdb.dwarf2/nonvar-access.exp: Likewise.
+ * gdb.python/py-inferior.exp: Likewise.
+ * gdb.trace/unavailable-dwarf-piece.exp: Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
PR gdb/21226
* gdb.dwarf2/nonvar-access.exp: Add checks for verifying that
stack value pieces are taken from the LSB end.
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5671,6 +5671,19 @@ proc set_remotetimeout { timeout } {
}
}
+# Get the target's current endianness and return it.
+proc get_endianness { } {
+ global gdb_prompt
+
+ gdb_test_multiple "show endian" "determine endianness" {
+ -re ".* (little|big) endian.*\r\n$gdb_prompt $" {
+ # Pass silently.
+ return $expect_out(1,string)
+ }
+ }
+ return "little"
+}
+
# ROOT and FULL are file names. Returns the relative path from ROOT
# to FULL. Note that FULL must be in a subdirectory of ROOT.
# For example, given ROOT = /usr/bin and FULL = /usr/bin/ls, this

View File

@ -0,0 +1,70 @@
commit af547a9614969e1d1ea6fcec6b59cd77a606380f
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:27 2017 +0200
read/write_pieced_value: Respect value parent's offset
In the case of targeting a bit-field, read_pieced_value and
write_pieced_value calculate the number of bits preceding the bit-field
without considering the relative offset of the value's parent. This is
relevant for a structure variable like this:
struct s {
uint64_t foo;
struct {
uint32_t bar;
uint32_t bf : 10; /* <-- target bit-field */
} baz;
} s;
In this scenario, if 'val' is a GDB value representing s.baz.bf,
val->parent represents the whole s.baz structure, and the following holds:
- value_offset (val) == sizeof s.baz.bar == 4
- value_offset (val->parent) == sizeof s.foo == 8
The current logic would only use value_offset(val), resulting in the wrong
offset into the target value. This is fixed.
gdb/ChangeLog:
* dwarf2loc.c (read_pieced_value): Respect parent value's offset
when targeting a bit-field.
(write_pieced_value): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (read_pieced_value): Respect parent value's offset
+ when targeting a bit-field.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (struct piece_closure) <addr_size>: Remove field.
(allocate_piece_closure): Drop addr_size parameter.
(dwarf2_evaluate_loc_desc_full): Adjust call to
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1776,7 +1776,8 @@ read_pieced_value (struct value *v)
bits_to_skip = 8 * value_offset (v);
if (value_bitsize (v))
{
- bits_to_skip += value_bitpos (v);
+ bits_to_skip += (8 * value_offset (value_parent (v))
+ + value_bitpos (v));
type_len = value_bitsize (v);
}
else
@@ -1946,7 +1947,8 @@ write_pieced_value (struct value *to, struct value *from)
bits_to_skip = 8 * value_offset (to);
if (value_bitsize (to))
{
- bits_to_skip += value_bitpos (to);
+ bits_to_skip += (8 * value_offset (value_parent (to))
+ + value_bitpos (to));
type_len = value_bitsize (to);
}
else

View File

@ -0,0 +1,40 @@
commit cdaac320fd62bff75562aaa3e466494dc72dd175
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:27 2017 +0200
write_pieced_value: Fix copy/paste error in size calculation
In write_pieced_value, the number of bytes containing a portion of the
bit-field in a given piece is calculated with the wrong starting offset;
thus the result may be off by one. This bug was probably introduced when
copying this logic from read_pieced_value. Fix it.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): Fix copy/paste error in the
calculation of this_size.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (write_pieced_value): Fix copy/paste error in the
+ calculation of this_size.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (read_pieced_value): Respect parent value's offset
when targeting a bit-field.
(write_pieced_value): Likewise.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1983,7 +1983,7 @@ write_pieced_value (struct value *to, struct value *from)
if (this_size_bits > type_len - offset)
this_size_bits = type_len - offset;
- this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+ this_size = (this_size_bits + dest_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
dest_offset = dest_offset_bits / 8;
if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)

View File

@ -0,0 +1,42 @@
commit f1cc987420d9d2489eb453bd1c87139666cbe7fd
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:27 2017 +0200
write_pieced_value: Include transfer size in byte-wise check
In write_pieced_value, when checking whether the data can be transferred
byte-wise, the current logic verifies the source- and destination offsets
to be byte-aligned, but not the transfer size. This is fixed.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): Include transfer size in
byte-wise check.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (write_pieced_value): Include transfer size in
+ byte-wise check.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): Fix copy/paste error in the
calculation of this_size.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1986,7 +1986,10 @@ write_pieced_value (struct value *to, struct value *from)
this_size = (this_size_bits + dest_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
dest_offset = dest_offset_bits / 8;
- if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)
+
+ /* Check whether the data can be transferred byte-wise. */
+ if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0
+ && this_size_bits % 8 == 0)
{
source_buffer = contents + source_offset;
need_bitwise = 0;

View File

@ -0,0 +1,42 @@
commit 07c9ca3bd8e6f83bcec49c922b52422c538f60f7
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:28 2017 +0200
write_pieced_value: Fix buffer offset for memory pieces
In write_pieced_value, when transferring the data to target memory via a
buffer, the bit offset within the target value is not reduced to its
sub-byte fraction before using it as a bit offset into the buffer. This
is fixed.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): In DWARF_VALUE_MEMORY,
truncate full bytes from dest_offset_bits before using it as an
offset into the buffer.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (write_pieced_value): In DWARF_VALUE_MEMORY,
+ truncate full bytes from dest_offset_bits before using it as an
+ offset into the buffer.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): Include transfer size in
byte-wise check.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2058,7 +2058,7 @@ write_pieced_value (struct value *to, struct value *from)
read_memory (p->v.mem.addr + dest_offset, buffer.data (), 1);
read_memory (p->v.mem.addr + dest_offset + this_size - 1,
&buffer[this_size - 1], 1);
- copy_bitwise (buffer.data (), dest_offset_bits,
+ copy_bitwise (buffer.data (), dest_offset_bits % 8,
contents, source_offset_bits,
this_size_bits,
bits_big_endian);

View File

@ -0,0 +1,166 @@
commit 359b19bb24d048750aa5367ad56a33267300d1a8
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:28 2017 +0200
write_pieced_value: Transfer least significant bits into bit-field
On big-endian targets, when targeting a bit-field, write_pieced_value
currently transfers the source value's *most* significant bits to the
target value, instead of its least significant bits. This is fixed.
In particular the fix adjusts the initial value of 'offset', which can now
potentially be nonzero. Thus the variable 'type_len' is renamed to
'max_offset', to avoid confusion. And for consistency, the affected logic
that was mirrored in read_pieced_value is changed there in the same way.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): When writing to a bit-field,
transfer the source value's least significant bits, instead of its
lowest-addressed ones. Rename type_len to max_offset.
(read_pieced_value): Mirror above changes to write_pieced_value as
applicable.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,13 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (write_pieced_value): When writing to a bit-field,
+ transfer the source value's least significant bits, instead of its
+ lowest-addressed ones. Rename type_len to max_offset.
+ (read_pieced_value): Mirror above changes to write_pieced_value as
+ applicable.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): In DWARF_VALUE_MEMORY,
truncate full bytes from dest_offset_bits before using it as an
offset into the buffer.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1756,12 +1756,11 @@ static void
read_pieced_value (struct value *v)
{
int i;
- long offset = 0;
+ LONGEST offset = 0, max_offset;
ULONGEST bits_to_skip;
gdb_byte *contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (v);
- size_t type_len;
size_t buffer_size = 0;
std::vector<gdb_byte> buffer;
int bits_big_endian
@@ -1778,12 +1777,12 @@ read_pieced_value (struct value *v)
{
bits_to_skip += (8 * value_offset (value_parent (v))
+ value_bitpos (v));
- type_len = value_bitsize (v);
+ max_offset = value_bitsize (v);
}
else
- type_len = 8 * TYPE_LENGTH (value_type (v));
+ max_offset = 8 * TYPE_LENGTH (value_type (v));
- for (i = 0; i < c->n_pieces && offset < type_len; i++)
+ for (i = 0; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size, this_size_bits;
@@ -1798,20 +1797,13 @@ read_pieced_value (struct value *v)
bits_to_skip -= this_size_bits;
continue;
}
- if (bits_to_skip > 0)
- {
- dest_offset_bits = 0;
- source_offset_bits = bits_to_skip;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- }
- else
- {
- dest_offset_bits = offset;
- source_offset_bits = 0;
- }
- if (this_size_bits > type_len - offset)
- this_size_bits = type_len - offset;
+ source_offset_bits = bits_to_skip;
+ this_size_bits -= bits_to_skip;
+ bits_to_skip = 0;
+ dest_offset_bits = offset;
+
+ if (this_size_bits > max_offset - offset)
+ this_size_bits = max_offset - offset;
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
@@ -1932,12 +1924,11 @@ static void
write_pieced_value (struct value *to, struct value *from)
{
int i;
- long offset = 0;
ULONGEST bits_to_skip;
+ LONGEST offset = 0, max_offset;
const gdb_byte *contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (to);
- size_t type_len;
size_t buffer_size = 0;
std::vector<gdb_byte> buffer;
int bits_big_endian
@@ -1949,12 +1940,20 @@ write_pieced_value (struct value *to, struct value *from)
{
bits_to_skip += (8 * value_offset (value_parent (to))
+ value_bitpos (to));
- type_len = value_bitsize (to);
- }
+ /* Use the least significant bits of FROM. */
+ if (gdbarch_byte_order (get_type_arch (value_type (from)))
+ == BFD_ENDIAN_BIG)
+ {
+ max_offset = 8 * TYPE_LENGTH (value_type (from));
+ offset = max_offset - value_bitsize (to);
+ }
+ else
+ max_offset = value_bitsize (to);
+ }
else
- type_len = 8 * TYPE_LENGTH (value_type (to));
+ max_offset = 8 * TYPE_LENGTH (value_type (to));
- for (i = 0; i < c->n_pieces && offset < type_len; i++)
+ for (i = 0; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size_bits, this_size;
@@ -1968,20 +1967,13 @@ write_pieced_value (struct value *to, struct value *from)
bits_to_skip -= this_size_bits;
continue;
}
- if (bits_to_skip > 0)
- {
- dest_offset_bits = bits_to_skip;
- source_offset_bits = 0;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- }
- else
- {
- dest_offset_bits = 0;
- source_offset_bits = offset;
- }
- if (this_size_bits > type_len - offset)
- this_size_bits = type_len - offset;
+ dest_offset_bits = bits_to_skip;
+ this_size_bits -= bits_to_skip;
+ bits_to_skip = 0;
+ source_offset_bits = offset;
+
+ if (this_size_bits > max_offset - offset)
+ this_size_bits = max_offset - offset;
this_size = (this_size_bits + dest_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;

View File

@ -0,0 +1,142 @@
commit 3bf310110722b03d9ff9c4f34f5920a9be2878d0
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:29 2017 +0200
Add DWARF piece test cases for bit-field access
This verifies some of the previous fixes to the logic in
write_pieced_value when accessing bit-fields.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/var-access.exp: Add tests for accessing bit-fields
located in one or more DWARF pieces.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * gdb.dwarf2/var-access.exp: Add tests for accessing bit-fields
+ located in one or more DWARF pieces.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* lib/gdb.exp (get_endianness): New proc.
* gdb.arch/aarch64-fp.exp: Use it.
* gdb.arch/altivec-regs.exp: Likewise.
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -62,7 +62,8 @@ Dwarf::assemble $asm_file {
} {
declare_labels char_type_label
declare_labels int_type_label short_type_label
- declare_labels array_a8_label struct_s_label
+ declare_labels array_a8_label struct_s_label struct_t_label
+ declare_labels struct_st_label
# char
char_type_label: base_type {
@@ -115,6 +116,51 @@ Dwarf::assemble $asm_file {
}
}
+ # struct t { int u, x:9, y:13, z:10; };
+ struct_t_label: structure_type {
+ {name "t"}
+ {byte_size 8 DW_FORM_sdata}
+ } {
+ member {
+ {name "u"}
+ {type :$int_type_label}
+ }
+ member {
+ {name "x"}
+ {type :$int_type_label}
+ {data_member_location 4 DW_FORM_udata}
+ {bit_size 9 DW_FORM_udata}
+ }
+ member {
+ {name "y"}
+ {type :$int_type_label}
+ {data_bit_offset 41 DW_FORM_udata}
+ {bit_size 13 DW_FORM_udata}
+ }
+ member {
+ {name "z"}
+ {type :$int_type_label}
+ {data_bit_offset 54 DW_FORM_udata}
+ {bit_size 10 DW_FORM_udata}
+ }
+ }
+
+ # struct st { struct s s; struct t t; };
+ struct_st_label: structure_type {
+ {name "st"}
+ {byte_size 12 DW_FORM_udata}
+ } {
+ member {
+ {name "s"}
+ {type :$struct_s_label}
+ }
+ member {
+ {name "t"}
+ {type :$struct_t_label}
+ {data_member_location 4 DW_FORM_udata}
+ }
+ }
+
DW_TAG_subprogram {
{MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
{DW_AT_external 1 flag}
@@ -156,6 +202,19 @@ Dwarf::assemble $asm_file {
piece 1
} SPECIAL_expr}
}
+ # Memory pieces for bitfield access: 8 bytes optimized
+ # out, 3 bytes from &buf[3], and 1 byte from &buf[1].
+ DW_TAG_variable {
+ {name "st1"}
+ {type :$struct_st_label}
+ {location {
+ piece 8
+ addr "$buf_var + 3"
+ piece 3
+ addr "$buf_var + 1"
+ piece 1
+ } SPECIAL_expr}
+ }
}
}
}
@@ -170,6 +229,9 @@ if ![runto_main] {
return -1
}
+# Determine byte order.
+set endian [get_endianness]
+
# Byte-aligned memory pieces.
gdb_test "print/d s1" " = \\{a = 2, b = 3, c = 0, d = 1\\}" \
"s1 == re-ordered buf"
@@ -200,3 +262,20 @@ gdb_test_no_output "set var s2 = {191, 73, 231, 123}" \
"re-initialize s2"
gdb_test "print/d s2" " = \\{a = 191, b = 73, c = 231, d = 123\\}" \
"verify re-initialized s2"
+
+# Unaligned bitfield access through byte-aligned pieces.
+gdb_test_no_output "set var a = { 0 }"
+gdb_test_no_output "set var st1.t.x = -7"
+gdb_test_no_output "set var st1.t.z = 340"
+gdb_test_no_output "set var st1.t.y = 1234"
+gdb_test "print st1.t" " = \\{u = <optimized out>, x = -7, y = 1234, z = 340\\}" \
+ "verify st1.t"
+switch $endian {
+ little {set val "0x55, 0x0, 0xf9, 0xa5, 0x9"}
+ big {set val "0x54, 0x0, 0xfc, 0x93, 0x49"}
+}
+# | -- | z:2-9 | -- | x:0-7 | x:8 y:0-6 | y:7-12 z:0-1 | -- | -- |
+# \_______________________________________________/
+# val
+gdb_test "print/x a" " = \\{0x0, ${val}, 0x0, 0x0\\}" \
+ "verify st1 through a"

View File

@ -0,0 +1,74 @@
commit 840989c113433c069f54872d7e051e1572202326
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:30 2017 +0200
read/write_pieced_value: Drop 'buffer_size' variable
When the variable 'buffer_size' in read_pieced_value and
write_pieced_value was introduced, it was needed for tracking the buffer's
allocated size. Now that the buffer's data type has been changed to a
std::vector, the variable is no longer necessary; so remove it.
gdb/ChangeLog:
* dwarf2loc.c (read_pieced_value): Remove buffer_size variable.
(write_pieced_value): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (read_pieced_value): Remove buffer_size variable.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): When writing to a bit-field,
transfer the source value's least significant bits, instead of its
lowest-addressed ones. Rename type_len to max_offset.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1761,7 +1761,6 @@ read_pieced_value (struct value *v)
gdb_byte *contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (v);
- size_t buffer_size = 0;
std::vector<gdb_byte> buffer;
int bits_big_endian
= gdbarch_bits_big_endian (get_type_arch (value_type (v)));
@@ -1806,12 +1805,8 @@ read_pieced_value (struct value *v)
this_size_bits = max_offset - offset;
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+ buffer.reserve (this_size);
source_offset = source_offset_bits / 8;
- if (buffer_size < this_size)
- {
- buffer_size = this_size;
- buffer.reserve (buffer_size);
- }
intermediate_buffer = buffer.data ();
/* Copy from the source to DEST_BUFFER. */
@@ -1929,7 +1924,6 @@ write_pieced_value (struct value *to, struct value *from)
const gdb_byte *contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (to);
- size_t buffer_size = 0;
std::vector<gdb_byte> buffer;
int bits_big_endian
= gdbarch_bits_big_endian (get_type_arch (value_type (to)));
@@ -1988,11 +1982,7 @@ write_pieced_value (struct value *to, struct value *from)
}
else
{
- if (buffer_size < this_size)
- {
- buffer_size = this_size;
- buffer.reserve (buffer_size);
- }
+ buffer.reserve (this_size);
source_buffer = buffer.data ();
need_bitwise = 1;
}

View File

@ -0,0 +1,227 @@
commit 03c8af18d1a8f359fd023696848bda488119da60
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:30 2017 +0200
Fix handling of DWARF register pieces on big-endian targets
For big-endian targets the logic in read/write_pieced_value tries to take
a register piece from the LSB end. This requires offsets and sizes to be
adjusted accordingly, and that's where the current implementation has some
issues:
* The formulas for recalculating the bit- and byte-offsets into the
register are wrong. They just happen to yield correct results if
everything is byte-aligned and the piece's last byte belongs to the
given value.
* After recalculating the bit offset into the register, the number of
bytes to be copied from the register is not recalculated. Of course
this does not matter if everything (particularly the piece size) is
byte-aligned.
These issues are fixed. The size calculation is performed with a new
helper function bits_to_bytes().
gdb/ChangeLog:
* dwarf2loc.c (bits_to_bytes): New function.
(read_pieced_value): Fix offset calculations for register pieces
on big-endian targets.
(write_pieced_value): Likewise.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/var-access.exp: Add test for non-byte-aligned
register pieces.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,12 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (bits_to_bytes): New function.
+ (read_pieced_value): Fix offset calculations for register pieces
+ on big-endian targets.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (read_pieced_value): Remove buffer_size variable.
(write_pieced_value): Likewise.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1752,6 +1752,15 @@ copy_bitwise_tests (void)
#endif /* GDB_SELF_TEST */
+/* Return the number of bytes overlapping a contiguous chunk of N_BITS
+ bits whose first bit is located at bit offset START. */
+
+static size_t
+bits_to_bytes (ULONGEST start, ULONGEST n_bits)
+{
+ return (start % 8 + n_bits + 7) / 8;
+}
+
static void
read_pieced_value (struct value *v)
{
@@ -1804,7 +1813,7 @@ read_pieced_value (struct value *v)
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
- this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+ this_size = bits_to_bytes (source_offset_bits, this_size_bits);
buffer.reserve (this_size);
source_offset = source_offset_bits / 8;
intermediate_buffer = buffer.data ();
@@ -1817,20 +1826,20 @@ read_pieced_value (struct value *v)
struct frame_info *frame = frame_find_by_id (c->frame_id);
struct gdbarch *arch = get_frame_arch (frame);
int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
+ ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
int optim, unavail;
- LONGEST reg_offset = source_offset;
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && this_size < register_size (arch, gdb_regnum))
+ && p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- reg_offset = register_size (arch, gdb_regnum) - this_size;
- /* We want the lower-order THIS_SIZE_BITS of the bytes
- we extract from the register. */
- source_offset_bits += 8 * this_size - this_size_bits;
+ source_offset_bits += reg_bits - p->size;
}
+ this_size = bits_to_bytes (source_offset_bits, this_size_bits);
+ buffer.reserve (this_size);
- if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ if (!get_frame_register_bytes (frame, gdb_regnum,
+ source_offset_bits / 8,
this_size, buffer.data (),
&optim, &unavail))
{
@@ -1844,7 +1853,7 @@ read_pieced_value (struct value *v)
}
copy_bitwise (contents, dest_offset_bits,
- intermediate_buffer, source_offset_bits % 8,
+ buffer.data (), source_offset_bits % 8,
this_size_bits, bits_big_endian);
}
break;
@@ -1969,7 +1978,7 @@ write_pieced_value (struct value *to, struct value *from)
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
- this_size = (this_size_bits + dest_offset_bits % 8 + 7) / 8;
+ this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
source_offset = source_offset_bits / 8;
dest_offset = dest_offset_bits / 8;
@@ -1994,20 +2003,25 @@ write_pieced_value (struct value *to, struct value *from)
struct frame_info *frame = frame_find_by_id (c->frame_id);
struct gdbarch *arch = get_frame_arch (frame);
int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
- int reg_offset = dest_offset;
+ ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && this_size <= register_size (arch, gdb_regnum))
+ && p->size <= reg_bits)
{
/* Big-endian, and we want less than full size. */
- reg_offset = register_size (arch, gdb_regnum) - this_size;
+ dest_offset_bits += reg_bits - p->size;
}
+ this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
+ buffer.reserve (this_size);
- if (need_bitwise)
+ if (dest_offset_bits % 8 != 0 || this_size_bits % 8 != 0)
{
+ /* Data is copied non-byte-aligned into the register.
+ Need some bits from original register value. */
int optim, unavail;
- if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ if (!get_frame_register_bytes (frame, gdb_regnum,
+ dest_offset_bits / 8,
this_size, buffer.data (),
&optim, &unavail))
{
@@ -2022,14 +2036,14 @@ write_pieced_value (struct value *to, struct value *from)
"bitfield; containing word "
"is unavailable"));
}
- copy_bitwise (buffer.data (), dest_offset_bits,
- contents, source_offset_bits,
- this_size_bits,
- bits_big_endian);
}
- put_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, source_buffer);
+ copy_bitwise (buffer.data (), dest_offset_bits % 8,
+ contents, source_offset_bits,
+ this_size_bits, bits_big_endian);
+ put_frame_register_bytes (frame, gdb_regnum,
+ dest_offset_bits / 8,
+ this_size, buffer.data ());
}
break;
case DWARF_VALUE_MEMORY:
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,10 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * gdb.dwarf2/var-access.exp: Add test for non-byte-aligned
+ register pieces.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* gdb.dwarf2/var-access.exp: Add tests for accessing bit-fields
located in one or more DWARF pieces.
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -215,6 +215,19 @@ Dwarf::assemble $asm_file {
piece 1
} SPECIAL_expr}
}
+ # Register pieces for bitfield access: 4 bytes optimized
+ # out, 3 bytes from r0, and 1 byte from r1.
+ DW_TAG_variable {
+ {name "t2"}
+ {type :$struct_t_label}
+ {location {
+ piece 4
+ regx [lindex $dwarf_regnum 0]
+ piece 3
+ regx [lindex $dwarf_regnum 1]
+ piece 1
+ } SPECIAL_expr}
+ }
}
}
}
@@ -279,3 +292,15 @@ switch $endian {
# val
gdb_test "print/x a" " = \\{0x0, ${val}, 0x0, 0x0\\}" \
"verify st1 through a"
+
+switch $endian { big {set val 0x7ffc} little {set val 0x3ffe00} }
+gdb_test_no_output "set var \$[lindex $regname 0] = $val" \
+ "init t2, first piece"
+gdb_test_no_output "set var \$[lindex $regname 1] = 0" \
+ "init t2, second piece"
+gdb_test "print/d t2" " = \\{u = <optimized out>, x = 0, y = -1, z = 0\\}" \
+ "initialized t2 from regs"
+gdb_test_no_output "set var t2.y = 2641"
+gdb_test_no_output "set var t2.z = -400"
+gdb_test_no_output "set var t2.x = 200"
+gdb_test "print t2.x + t2.y + t2.z" " = 2441"

View File

@ -0,0 +1,220 @@
commit 242d31ab7c3901e02bd68c1824d1d3610e02562b
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:30 2017 +0200
read/write_pieced_value: Improve logic for buffer allocation
So far the main loop in read_pieced_value and write_pieced_value is
structured like this:
(1) Prepare a buffer and some variables we may need;
(2) depending on the DWARF piece type to be handled, use the buffer and
the prepared variables, ignore them, or even recalculate them.
This approach reduces readability and may also lead to unnecessary copying
of data. This patch moves the preparations to the places where sufficient
information is available and removes some of the variables involved.
gdb/ChangeLog:
* dwarf2loc.c (read_pieced_value): Move the buffer allocation and
some other preparations to the places where sufficient information
is available.
(write_pieced_value): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,12 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (read_pieced_value): Move the buffer allocation and
+ some other preparations to the places where sufficient information
+ is available.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (bits_to_bytes): New function.
(read_pieced_value): Fix offset calculations for register pieces
on big-endian targets.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1794,8 +1794,7 @@ read_pieced_value (struct value *v)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size, this_size_bits;
- long dest_offset_bits, source_offset_bits, source_offset;
- const gdb_byte *intermediate_buffer;
+ long dest_offset_bits, source_offset_bits;
/* Compute size, source, and destination offsets for copying, in
bits. */
@@ -1813,11 +1812,6 @@ read_pieced_value (struct value *v)
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
- this_size = bits_to_bytes (source_offset_bits, this_size_bits);
- buffer.reserve (this_size);
- source_offset = source_offset_bits / 8;
- intermediate_buffer = buffer.data ();
-
/* Copy from the source to DEST_BUFFER. */
switch (p->location)
{
@@ -1843,13 +1837,11 @@ read_pieced_value (struct value *v)
this_size, buffer.data (),
&optim, &unavail))
{
- /* Just so garbage doesn't ever shine through. */
- memset (buffer.data (), 0, this_size);
-
if (optim)
mark_value_bits_optimized_out (v, offset, this_size_bits);
if (unavail)
mark_value_bits_unavailable (v, offset, this_size_bits);
+ break;
}
copy_bitwise (contents, dest_offset_bits,
@@ -1859,12 +1851,15 @@ read_pieced_value (struct value *v)
break;
case DWARF_VALUE_MEMORY:
+ this_size = bits_to_bytes (source_offset_bits, this_size_bits);
+ buffer.reserve (this_size);
+
read_value_memory (v, offset,
p->v.mem.in_stack_memory,
- p->v.mem.addr + source_offset,
+ p->v.mem.addr + source_offset_bits / 8,
buffer.data (), this_size);
copy_bitwise (contents, dest_offset_bits,
- intermediate_buffer, source_offset_bits % 8,
+ buffer.data (), source_offset_bits % 8,
this_size_bits, bits_big_endian);
break;
@@ -1892,18 +1887,18 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_LITERAL:
{
- size_t n = this_size;
+ ULONGEST literal_size_bits = 8 * p->v.literal.length;
+ size_t n = this_size_bits;
- if (n > p->v.literal.length - source_offset)
- n = (p->v.literal.length >= source_offset
- ? p->v.literal.length - source_offset
- : 0);
- if (n != 0)
- intermediate_buffer = p->v.literal.data + source_offset;
+ /* Cut off at the end of the implicit value. */
+ if (source_offset_bits >= literal_size_bits)
+ break;
+ if (n > literal_size_bits - source_offset_bits)
+ n = literal_size_bits - source_offset_bits;
copy_bitwise (contents, dest_offset_bits,
- intermediate_buffer, source_offset_bits % 8,
- this_size_bits, bits_big_endian);
+ p->v.literal.data, source_offset_bits,
+ n, bits_big_endian);
}
break;
@@ -1960,9 +1955,7 @@ write_pieced_value (struct value *to, struct value *from)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size_bits, this_size;
- long dest_offset_bits, source_offset_bits, dest_offset, source_offset;
- int need_bitwise;
- const gdb_byte *source_buffer;
+ long dest_offset_bits, source_offset_bits;
this_size_bits = p->size;
if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
@@ -1978,24 +1971,6 @@ write_pieced_value (struct value *to, struct value *from)
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
- this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
- source_offset = source_offset_bits / 8;
- dest_offset = dest_offset_bits / 8;
-
- /* Check whether the data can be transferred byte-wise. */
- if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0
- && this_size_bits % 8 == 0)
- {
- source_buffer = contents + source_offset;
- need_bitwise = 0;
- }
- else
- {
- buffer.reserve (this_size);
- source_buffer = buffer.data ();
- need_bitwise = 1;
- }
-
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -2047,21 +2022,44 @@ write_pieced_value (struct value *to, struct value *from)
}
break;
case DWARF_VALUE_MEMORY:
- if (need_bitwise)
- {
- /* Only the first and last bytes can possibly have any
- bits reused. */
- read_memory (p->v.mem.addr + dest_offset, buffer.data (), 1);
- read_memory (p->v.mem.addr + dest_offset + this_size - 1,
- &buffer[this_size - 1], 1);
- copy_bitwise (buffer.data (), dest_offset_bits % 8,
- contents, source_offset_bits,
- this_size_bits,
- bits_big_endian);
- }
+ {
+ CORE_ADDR start_addr = p->v.mem.addr + dest_offset_bits / 8;
+
+ if (dest_offset_bits % 8 == 0 && this_size_bits % 8 == 0
+ && source_offset_bits % 8 == 0)
+ {
+ /* Everything is byte-aligned; no buffer needed. */
+ write_memory (start_addr,
+ contents + source_offset_bits / 8,
+ this_size_bits / 8);
+ break;
+ }
+
+ this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
+ buffer.reserve (this_size);
- write_memory (p->v.mem.addr + dest_offset,
- source_buffer, this_size);
+ if (dest_offset_bits % 8 != 0 || this_size_bits % 8 != 0)
+ {
+ if (this_size <= 8)
+ {
+ /* Perform a single read for small sizes. */
+ read_memory (start_addr, buffer.data (), this_size);
+ }
+ else
+ {
+ /* Only the first and last bytes can possibly have any
+ bits reused. */
+ read_memory (start_addr, buffer.data (), 1);
+ read_memory (start_addr + this_size - 1,
+ &buffer[this_size - 1], 1);
+ }
+ }
+
+ copy_bitwise (buffer.data (), dest_offset_bits % 8,
+ contents, source_offset_bits,
+ this_size_bits, bits_big_endian);
+ write_memory (start_addr, buffer.data (), this_size);
+ }
break;
default:
mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type (to)));

View File

@ -0,0 +1,167 @@
commit 65d84b76164dc8ec1a1f0f0e0fd41667065ffd4e
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:31 2017 +0200
Respect piece offset for DW_OP_bit_piece
So far GDB ignores the piece offset of all kinds of DWARF bit
pieces (DW_OP_bit_piece) and treats such pieces as if the offset was zero.
This is fixed, and an appropriate test is added.
gdb/ChangeLog:
* dwarf2loc.c (read_pieced_value): Respect the piece offset, as
given by DW_OP_bit_piece.
(write_pieced_value): Likewise.
Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.dwarf2/var-access.exp: Add test for composite location with
nonzero piece offsets.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (read_pieced_value): Respect the piece offset, as
+ given by DW_OP_bit_piece.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (read_pieced_value): Move the buffer allocation and
some other preparations to the places where sufficient information
is available.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1824,11 +1824,14 @@ read_pieced_value (struct value *v)
int optim, unavail;
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && p->size < reg_bits)
+ && p->offset + p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- source_offset_bits += reg_bits - p->size;
+ source_offset_bits += reg_bits - (p->offset + p->size);
}
+ else
+ source_offset_bits += p->offset;
+
this_size = bits_to_bytes (source_offset_bits, this_size_bits);
buffer.reserve (this_size);
@@ -1851,6 +1854,7 @@ read_pieced_value (struct value *v)
break;
case DWARF_VALUE_MEMORY:
+ source_offset_bits += p->offset;
this_size = bits_to_bytes (source_offset_bits, this_size_bits);
buffer.reserve (this_size);
@@ -1871,12 +1875,15 @@ read_pieced_value (struct value *v)
= 8 * TYPE_LENGTH (value_type (p->v.value));
/* Use zeroes if piece reaches beyond stack value. */
- if (p->size > stack_value_size_bits)
+ if (p->offset + p->size > stack_value_size_bits)
break;
/* Piece is anchored at least significant bit end. */
if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG)
- source_offset_bits += stack_value_size_bits - p->size;
+ source_offset_bits += (stack_value_size_bits
+ - p->offset - p->size);
+ else
+ source_offset_bits += p->offset;
copy_bitwise (contents, dest_offset_bits,
value_contents_all (p->v.value),
@@ -1891,6 +1898,7 @@ read_pieced_value (struct value *v)
size_t n = this_size_bits;
/* Cut off at the end of the implicit value. */
+ source_offset_bits += p->offset;
if (source_offset_bits >= literal_size_bits)
break;
if (n > literal_size_bits - source_offset_bits)
@@ -1981,11 +1989,14 @@ write_pieced_value (struct value *to, struct value *from)
ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && p->size <= reg_bits)
+ && p->offset + p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- dest_offset_bits += reg_bits - p->size;
+ dest_offset_bits += reg_bits - (p->offset + p->size);
}
+ else
+ dest_offset_bits += p->offset;
+
this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
buffer.reserve (this_size);
@@ -2023,6 +2034,8 @@ write_pieced_value (struct value *to, struct value *from)
break;
case DWARF_VALUE_MEMORY:
{
+ dest_offset_bits += p->offset;
+
CORE_ADDR start_addr = p->v.mem.addr + dest_offset_bits / 8;
if (dest_offset_bits % 8 == 0 && this_size_bits % 8 == 0
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -228,6 +228,24 @@ Dwarf::assemble $asm_file {
piece 1
} SPECIAL_expr}
}
+ # One piece per bitfield, using piece offsets: 32 bits of
+ # an implicit value, 9 bits of a stack value, 13 bits of
+ # r0, and 10 bits of buf.
+ DW_TAG_variable {
+ {name "t3"}
+ {type :$struct_t_label}
+ {location {
+ implicit_value 0x12 0x34 0x56 0x78 0x9a
+ bit_piece 32 4
+ const2s -280
+ stack_value
+ bit_piece 9 2
+ regx [lindex $dwarf_regnum 0]
+ bit_piece 13 14
+ addr $buf_var
+ bit_piece 10 42
+ } SPECIAL_expr}
+ }
}
}
}
@@ -304,3 +322,24 @@ gdb_test_no_output "set var t2.y = 2641"
gdb_test_no_output "set var t2.z = -400"
gdb_test_no_output "set var t2.x = 200"
gdb_test "print t2.x + t2.y + t2.z" " = 2441"
+
+# Bitfield access through pieces with nonzero piece offsets.
+gdb_test_no_output "set var \$[lindex $regname 0] = 0xa8000" \
+ "init reg for t3.y"
+gdb_test_no_output "set var *(char \[2\] *) (a + 5) = { 70, 82 }" \
+ "init mem for t3.z"
+switch $endian {
+ little {set val "u = -1484430527, x = -70, y = 42, z = 145"}
+ big {set val "u = 591751049, x = -70, y = 42, z = 101"}
+}
+gdb_test "print t3" " = \\{$val\\}" \
+ "initialized t3 from reg and mem"
+gdb_test_no_output "set var t3.y = -1" \
+ "overwrite t3.y"
+gdb_test "print/x \$[lindex $regname 0]" " = 0x7ffc000" \
+ "verify t3.y through reg"
+gdb_test_no_output "set var t3.z = -614" \
+ "overwrite t3.z"
+switch $endian {big {set val "0x59, 0xa2"} little {set val "0x6a, 0x56"}}
+gdb_test "print/x *(char \[2\] *) (a + 5)" " = \\{$val\\}" \
+ "verify t3.z through mem"

View File

@ -0,0 +1,290 @@
commit f236533e3c6a2693bea879b2a4d24d1229864ac9
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:31 2017 +0200
read/write_pieced_value: Remove unnecessary variable copies
In read_pieced_value's main loop, the variables `dest_offset_bits' and
`source_offset_bits' are basically just copies of `offset' and
`bits_to_skip', respectively. In write_pieced_value the copies are
reversed. This is not very helpful when trying to keep the logic between
these functions in sync. Since the copies are unnecessary, this patch
just removes them.
gdb/ChangeLog:
* dwarf2loc.c (read_pieced_value): Remove unnecessary variables
dest_offset_bits and source_offset_bits.
(write_pieced_value): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (read_pieced_value): Remove unnecessary variables
+ dest_offset_bits and source_offset_bits.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (read_pieced_value): Respect the piece offset, as
given by DW_OP_bit_piece.
(write_pieced_value): Likewise.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1790,25 +1790,16 @@ read_pieced_value (struct value *v)
else
max_offset = 8 * TYPE_LENGTH (value_type (v));
- for (i = 0; i < c->n_pieces && offset < max_offset; i++)
+ /* Advance to the first non-skipped piece. */
+ for (i = 0; i < c->n_pieces && bits_to_skip >= c->pieces[i].size; i++)
+ bits_to_skip -= c->pieces[i].size;
+
+ for (; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size, this_size_bits;
- long dest_offset_bits, source_offset_bits;
-
- /* Compute size, source, and destination offsets for copying, in
- bits. */
- this_size_bits = p->size;
- if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
- {
- bits_to_skip -= this_size_bits;
- continue;
- }
- source_offset_bits = bits_to_skip;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- dest_offset_bits = offset;
+ this_size_bits = p->size - bits_to_skip;
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
@@ -1827,16 +1818,16 @@ read_pieced_value (struct value *v)
&& p->offset + p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- source_offset_bits += reg_bits - (p->offset + p->size);
+ bits_to_skip += reg_bits - (p->offset + p->size);
}
else
- source_offset_bits += p->offset;
+ bits_to_skip += p->offset;
- this_size = bits_to_bytes (source_offset_bits, this_size_bits);
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.reserve (this_size);
if (!get_frame_register_bytes (frame, gdb_regnum,
- source_offset_bits / 8,
+ bits_to_skip / 8,
this_size, buffer.data (),
&optim, &unavail))
{
@@ -1846,24 +1837,23 @@ read_pieced_value (struct value *v)
mark_value_bits_unavailable (v, offset, this_size_bits);
break;
}
-
- copy_bitwise (contents, dest_offset_bits,
- buffer.data (), source_offset_bits % 8,
+ copy_bitwise (contents, offset,
+ buffer.data (), bits_to_skip % 8,
this_size_bits, bits_big_endian);
}
break;
case DWARF_VALUE_MEMORY:
- source_offset_bits += p->offset;
- this_size = bits_to_bytes (source_offset_bits, this_size_bits);
+ bits_to_skip += p->offset;
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.reserve (this_size);
read_value_memory (v, offset,
p->v.mem.in_stack_memory,
- p->v.mem.addr + source_offset_bits / 8,
+ p->v.mem.addr + bits_to_skip / 8,
buffer.data (), this_size);
- copy_bitwise (contents, dest_offset_bits,
- buffer.data (), source_offset_bits % 8,
+ copy_bitwise (contents, offset,
+ buffer.data (), bits_to_skip % 8,
this_size_bits, bits_big_endian);
break;
@@ -1880,14 +1870,13 @@ read_pieced_value (struct value *v)
/* Piece is anchored at least significant bit end. */
if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG)
- source_offset_bits += (stack_value_size_bits
- - p->offset - p->size);
+ bits_to_skip += stack_value_size_bits - p->offset - p->size;
else
- source_offset_bits += p->offset;
+ bits_to_skip += p->offset;
- copy_bitwise (contents, dest_offset_bits,
+ copy_bitwise (contents, offset,
value_contents_all (p->v.value),
- source_offset_bits,
+ bits_to_skip,
this_size_bits, bits_big_endian);
}
break;
@@ -1898,14 +1887,14 @@ read_pieced_value (struct value *v)
size_t n = this_size_bits;
/* Cut off at the end of the implicit value. */
- source_offset_bits += p->offset;
- if (source_offset_bits >= literal_size_bits)
+ bits_to_skip += p->offset;
+ if (bits_to_skip >= literal_size_bits)
break;
- if (n > literal_size_bits - source_offset_bits)
- n = literal_size_bits - source_offset_bits;
+ if (n > literal_size_bits - bits_to_skip)
+ n = literal_size_bits - bits_to_skip;
- copy_bitwise (contents, dest_offset_bits,
- p->v.literal.data, source_offset_bits,
+ copy_bitwise (contents, offset,
+ p->v.literal.data, bits_to_skip,
n, bits_big_endian);
}
break;
@@ -1924,6 +1913,7 @@ read_pieced_value (struct value *v)
}
offset += this_size_bits;
+ bits_to_skip = 0;
}
}
@@ -1959,23 +1949,16 @@ write_pieced_value (struct value *to, struct value *from)
else
max_offset = 8 * TYPE_LENGTH (value_type (to));
- for (i = 0; i < c->n_pieces && offset < max_offset; i++)
+ /* Advance to the first non-skipped piece. */
+ for (i = 0; i < c->n_pieces && bits_to_skip >= c->pieces[i].size; i++)
+ bits_to_skip -= c->pieces[i].size;
+
+ for (; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size_bits, this_size;
- long dest_offset_bits, source_offset_bits;
-
- this_size_bits = p->size;
- if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
- {
- bits_to_skip -= this_size_bits;
- continue;
- }
- dest_offset_bits = bits_to_skip;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- source_offset_bits = offset;
+ this_size_bits = p->size - bits_to_skip;
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
@@ -1992,22 +1975,22 @@ write_pieced_value (struct value *to, struct value *from)
&& p->offset + p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- dest_offset_bits += reg_bits - (p->offset + p->size);
+ bits_to_skip += reg_bits - (p->offset + p->size);
}
else
- dest_offset_bits += p->offset;
+ bits_to_skip += p->offset;
- this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.reserve (this_size);
- if (dest_offset_bits % 8 != 0 || this_size_bits % 8 != 0)
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
{
/* Data is copied non-byte-aligned into the register.
Need some bits from original register value. */
int optim, unavail;
if (!get_frame_register_bytes (frame, gdb_regnum,
- dest_offset_bits / 8,
+ bits_to_skip / 8,
this_size, buffer.data (),
&optim, &unavail))
{
@@ -2024,34 +2007,34 @@ write_pieced_value (struct value *to, struct value *from)
}
}
- copy_bitwise (buffer.data (), dest_offset_bits % 8,
- contents, source_offset_bits,
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ contents, offset,
this_size_bits, bits_big_endian);
put_frame_register_bytes (frame, gdb_regnum,
- dest_offset_bits / 8,
+ bits_to_skip / 8,
this_size, buffer.data ());
}
break;
case DWARF_VALUE_MEMORY:
{
- dest_offset_bits += p->offset;
+ bits_to_skip += p->offset;
- CORE_ADDR start_addr = p->v.mem.addr + dest_offset_bits / 8;
+ CORE_ADDR start_addr = p->v.mem.addr + bits_to_skip / 8;
- if (dest_offset_bits % 8 == 0 && this_size_bits % 8 == 0
- && source_offset_bits % 8 == 0)
+ if (bits_to_skip % 8 == 0 && this_size_bits % 8 == 0
+ && offset % 8 == 0)
{
/* Everything is byte-aligned; no buffer needed. */
write_memory (start_addr,
- contents + source_offset_bits / 8,
+ contents + offset / 8,
this_size_bits / 8);
break;
}
- this_size = bits_to_bytes (dest_offset_bits, this_size_bits);
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.reserve (this_size);
- if (dest_offset_bits % 8 != 0 || this_size_bits % 8 != 0)
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
{
if (this_size <= 8)
{
@@ -2068,8 +2051,8 @@ write_pieced_value (struct value *to, struct value *from)
}
}
- copy_bitwise (buffer.data (), dest_offset_bits % 8,
- contents, source_offset_bits,
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ contents, offset,
this_size_bits, bits_big_endian);
write_memory (start_addr, buffer.data (), this_size);
}
@@ -2079,6 +2062,7 @@ write_pieced_value (struct value *to, struct value *from)
break;
}
offset += this_size_bits;
+ bits_to_skip = 0;
}
}

View File

@ -0,0 +1,76 @@
commit 23f945bf8cebf348154aff43782de2e1977e9230
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:31 2017 +0200
Fix bit-/byte-offset mismatch in parameter to read_value_memory
The function read_value_memory accepts a parameter embedded_offset and
expects it to represent the byte offset into the given value. However,
the only invocation with a possibly non-zero embedded_offset happens in
read_pieced_value, where a bit offset is passed instead.
Adjust the implementation of read_value_memory to meet the caller's
expectation. This implicitly fixes the invocation in read_pieced_value.
gdb/ChangeLog:
* valops.c (read_value_memory): Change embedded_offset to
represent a bit offset instead of a byte offset.
* value.h (read_value_memory): Adjust comment.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * valops.c (read_value_memory): Change embedded_offset to
+ represent a bit offset instead of a byte offset.
+ * value.h (read_value_memory): Adjust comment.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (read_pieced_value): Remove unnecessary variables
dest_offset_bits and source_offset_bits.
(write_pieced_value): Likewise.
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -958,7 +958,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
}
void
-read_value_memory (struct value *val, LONGEST embedded_offset,
+read_value_memory (struct value *val, LONGEST bit_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length)
{
@@ -984,8 +984,9 @@ read_value_memory (struct value *val, LONGEST embedded_offset,
if (status == TARGET_XFER_OK)
/* nothing */;
else if (status == TARGET_XFER_UNAVAILABLE)
- mark_value_bytes_unavailable (val, embedded_offset + xfered_total,
- xfered_partial);
+ mark_value_bits_unavailable (val, (xfered_total * HOST_CHAR_BIT
+ + bit_offset),
+ xfered_partial * HOST_CHAR_BIT);
else if (status == TARGET_XFER_EOF)
memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
else
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -581,12 +581,11 @@ extern int value_contents_eq (const struct value *val1, LONGEST offset1,
/* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
which is (or will be copied to) VAL's contents buffer offset by
- EMBEDDED_OFFSET (that is, to &VAL->contents[EMBEDDED_OFFSET]).
- Marks value contents ranges as unavailable if the corresponding
- memory is likewise unavailable. STACK indicates whether the memory
- is known to be stack memory. */
+ BIT_OFFSET bits. Marks value contents ranges as unavailable if
+ the corresponding memory is likewise unavailable. STACK indicates
+ whether the memory is known to be stack memory. */
-extern void read_value_memory (struct value *val, LONGEST embedded_offset,
+extern void read_value_memory (struct value *val, LONGEST bit_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length);

View File

@ -0,0 +1,56 @@
commit f65e204425b5b46a5927d9501c42f25d98a866ce
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:32 2017 +0200
write_pieced_value: Notify memory_changed observers
So far write_pieced_value uses write_memory when writing memory pieces to
the target. However, this is a case where GDB potentially overwrites a
watchpoint value. In such a case write_memory_with_notification should be
used instead, so that memory_changed observers get notified.
gdb/ChangeLog:
* dwarf2loc.c (write_pieced_value): When writing the data for a
memory piece, use write_memory_with_notification instead of
write_memory.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (write_pieced_value): When writing the data for a
+ memory piece, use write_memory_with_notification instead of
+ write_memory.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* valops.c (read_value_memory): Change embedded_offset to
represent a bit offset instead of a byte offset.
* value.h (read_value_memory): Adjust comment.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2025,9 +2025,9 @@ write_pieced_value (struct value *to, struct value *from)
&& offset % 8 == 0)
{
/* Everything is byte-aligned; no buffer needed. */
- write_memory (start_addr,
- contents + offset / 8,
- this_size_bits / 8);
+ write_memory_with_notification (start_addr,
+ contents + offset / 8,
+ this_size_bits / 8);
break;
}
@@ -2054,7 +2054,8 @@ write_pieced_value (struct value *to, struct value *from)
copy_bitwise (buffer.data (), bits_to_skip % 8,
contents, offset,
this_size_bits, bits_big_endian);
- write_memory (start_addr, buffer.data (), this_size);
+ write_memory_with_notification (start_addr, buffer.data (),
+ this_size);
}
break;
default:

View File

@ -0,0 +1,481 @@
commit 55acdf2242372ae52abb25c80db8e75df5578b23
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue Jun 13 15:20:32 2017 +0200
read/write_pieced_value: Merge into one function
Since read_pieced_value and write_pieced_value share significant logic,
this patch merges them into a single function rw_pieced_value.
gdb/ChangeLog:
* dwarf2loc.c (rw_pieced_value): New. Merge logic from...
(read_pieced_value, write_pieced_value): ...here. Reduce to
wrappers that just call rw_pieced_value.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * dwarf2loc.c (rw_pieced_value): New. Merge logic from...
+ (read_pieced_value, write_pieced_value): ...here. Reduce to
+ wrappers that just call rw_pieced_value.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* dwarf2loc.c (write_pieced_value): When writing the data for a
memory piece, use write_memory_with_notification instead of
write_memory.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1761,31 +1761,55 @@ bits_to_bytes (ULONGEST start, ULONGEST n_bits)
return (start % 8 + n_bits + 7) / 8;
}
+/* Read or write a pieced value V. If FROM != NULL, operate in "write
+ mode": copy FROM into the pieces comprising V. If FROM == NULL,
+ operate in "read mode": fetch the contents of the (lazy) value V by
+ composing it from its pieces. */
+
static void
-read_pieced_value (struct value *v)
+rw_pieced_value (struct value *v, struct value *from)
{
int i;
LONGEST offset = 0, max_offset;
ULONGEST bits_to_skip;
- gdb_byte *contents;
+ gdb_byte *v_contents;
+ const gdb_byte *from_contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (v);
std::vector<gdb_byte> buffer;
int bits_big_endian
= gdbarch_bits_big_endian (get_type_arch (value_type (v)));
- if (value_type (v) != value_enclosing_type (v))
- internal_error (__FILE__, __LINE__,
- _("Should not be able to create a lazy value with "
- "an enclosing type"));
+ if (from != NULL)
+ {
+ from_contents = value_contents (from);
+ v_contents = NULL;
+ }
+ else
+ {
+ if (value_type (v) != value_enclosing_type (v))
+ internal_error (__FILE__, __LINE__,
+ _("Should not be able to create a lazy value with "
+ "an enclosing type"));
+ v_contents = value_contents_raw (v);
+ from_contents = NULL;
+ }
- contents = value_contents_raw (v);
bits_to_skip = 8 * value_offset (v);
if (value_bitsize (v))
{
bits_to_skip += (8 * value_offset (value_parent (v))
+ value_bitpos (v));
- max_offset = value_bitsize (v);
+ if (from != NULL
+ && (gdbarch_byte_order (get_type_arch (value_type (from)))
+ == BFD_ENDIAN_BIG))
+ {
+ /* Use the least significant bits of FROM. */
+ max_offset = 8 * TYPE_LENGTH (value_type (from));
+ offset = max_offset - value_bitsize (v);
+ }
+ else
+ max_offset = value_bitsize (v);
}
else
max_offset = 8 * TYPE_LENGTH (value_type (v));
@@ -1797,13 +1821,12 @@ read_pieced_value (struct value *v)
for (; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size, this_size_bits;
+ size_t this_size_bits, this_size;
this_size_bits = p->size - bits_to_skip;
if (this_size_bits > max_offset - offset)
this_size_bits = max_offset - offset;
- /* Copy from the source to DEST_BUFFER. */
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -1826,39 +1849,137 @@ read_pieced_value (struct value *v)
this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.reserve (this_size);
- if (!get_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
- this_size, buffer.data (),
- &optim, &unavail))
+ if (from == NULL)
{
- if (optim)
- mark_value_bits_optimized_out (v, offset, this_size_bits);
- if (unavail)
- mark_value_bits_unavailable (v, offset, this_size_bits);
- break;
+ /* Read mode. */
+ if (!get_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data (),
+ &optim, &unavail))
+ {
+ if (optim)
+ mark_value_bits_optimized_out (v, offset,
+ this_size_bits);
+ if (unavail)
+ mark_value_bits_unavailable (v, offset,
+ this_size_bits);
+ break;
+ }
+
+ copy_bitwise (v_contents, offset,
+ buffer.data (), bits_to_skip % 8,
+ this_size_bits, bits_big_endian);
+ }
+ else
+ {
+ /* Write mode. */
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
+ {
+ /* Data is copied non-byte-aligned into the register.
+ Need some bits from original register value. */
+ get_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data (),
+ &optim, &unavail);
+ if (optim)
+ throw_error (OPTIMIZED_OUT_ERROR,
+ _("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "has been optimized out"));
+ if (unavail)
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "is unavailable"));
+ }
+
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ from_contents, offset,
+ this_size_bits, bits_big_endian);
+ put_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data ());
}
- copy_bitwise (contents, offset,
- buffer.data (), bits_to_skip % 8,
- this_size_bits, bits_big_endian);
}
break;
case DWARF_VALUE_MEMORY:
- bits_to_skip += p->offset;
- this_size = bits_to_bytes (bits_to_skip, this_size_bits);
- buffer.reserve (this_size);
-
- read_value_memory (v, offset,
- p->v.mem.in_stack_memory,
- p->v.mem.addr + bits_to_skip / 8,
- buffer.data (), this_size);
- copy_bitwise (contents, offset,
- buffer.data (), bits_to_skip % 8,
- this_size_bits, bits_big_endian);
+ {
+ bits_to_skip += p->offset;
+
+ CORE_ADDR start_addr = p->v.mem.addr + bits_to_skip / 8;
+
+ if (bits_to_skip % 8 == 0 && this_size_bits % 8 == 0
+ && offset % 8 == 0)
+ {
+ /* Everything is byte-aligned; no buffer needed. */
+ if (from != NULL)
+ write_memory_with_notification (start_addr,
+ (from_contents
+ + offset / 8),
+ this_size_bits / 8);
+ else
+ read_value_memory (v, offset,
+ p->v.mem.in_stack_memory,
+ p->v.mem.addr + bits_to_skip / 8,
+ v_contents + offset / 8,
+ this_size_bits / 8);
+ break;
+ }
+
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
+ buffer.reserve (this_size);
+
+ if (from == NULL)
+ {
+ /* Read mode. */
+ read_value_memory (v, offset,
+ p->v.mem.in_stack_memory,
+ p->v.mem.addr + bits_to_skip / 8,
+ buffer.data (), this_size);
+ copy_bitwise (v_contents, offset,
+ buffer.data (), bits_to_skip % 8,
+ this_size_bits, bits_big_endian);
+ }
+ else
+ {
+ /* Write mode. */
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
+ {
+ if (this_size <= 8)
+ {
+ /* Perform a single read for small sizes. */
+ read_memory (start_addr, buffer.data (),
+ this_size);
+ }
+ else
+ {
+ /* Only the first and last bytes can possibly have
+ any bits reused. */
+ read_memory (start_addr, buffer.data (), 1);
+ read_memory (start_addr + this_size - 1,
+ &buffer[this_size - 1], 1);
+ }
+ }
+
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ from_contents, offset,
+ this_size_bits, bits_big_endian);
+ write_memory_with_notification (start_addr,
+ buffer.data (),
+ this_size);
+ }
+ }
break;
case DWARF_VALUE_STACK:
{
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
struct objfile *objfile = dwarf2_per_cu_objfile (c->per_cu);
struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile);
ULONGEST stack_value_size_bits
@@ -1874,7 +1995,7 @@ read_pieced_value (struct value *v)
else
bits_to_skip += p->offset;
- copy_bitwise (contents, offset,
+ copy_bitwise (v_contents, offset,
value_contents_all (p->v.value),
bits_to_skip,
this_size_bits, bits_big_endian);
@@ -1883,6 +2004,12 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_LITERAL:
{
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
ULONGEST literal_size_bits = 8 * p->v.literal.length;
size_t n = this_size_bits;
@@ -1893,15 +2020,21 @@ read_pieced_value (struct value *v)
if (n > literal_size_bits - bits_to_skip)
n = literal_size_bits - bits_to_skip;
- copy_bitwise (contents, offset,
+ copy_bitwise (v_contents, offset,
p->v.literal.data, bits_to_skip,
n, bits_big_endian);
}
break;
- /* These bits show up as zeros -- but do not cause the value
- to be considered optimized-out. */
case DWARF_VALUE_IMPLICIT_POINTER:
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
+ /* These bits show up as zeros -- but do not cause the value to
+ be considered optimized-out. */
break;
case DWARF_VALUE_OPTIMIZED_OUT:
@@ -1917,154 +2050,17 @@ read_pieced_value (struct value *v)
}
}
+
static void
-write_pieced_value (struct value *to, struct value *from)
+read_pieced_value (struct value *v)
{
- int i;
- ULONGEST bits_to_skip;
- LONGEST offset = 0, max_offset;
- const gdb_byte *contents;
- struct piece_closure *c
- = (struct piece_closure *) value_computed_closure (to);
- std::vector<gdb_byte> buffer;
- int bits_big_endian
- = gdbarch_bits_big_endian (get_type_arch (value_type (to)));
-
- contents = value_contents (from);
- bits_to_skip = 8 * value_offset (to);
- if (value_bitsize (to))
- {
- bits_to_skip += (8 * value_offset (value_parent (to))
- + value_bitpos (to));
- /* Use the least significant bits of FROM. */
- if (gdbarch_byte_order (get_type_arch (value_type (from)))
- == BFD_ENDIAN_BIG)
- {
- max_offset = 8 * TYPE_LENGTH (value_type (from));
- offset = max_offset - value_bitsize (to);
- }
- else
- max_offset = value_bitsize (to);
- }
- else
- max_offset = 8 * TYPE_LENGTH (value_type (to));
-
- /* Advance to the first non-skipped piece. */
- for (i = 0; i < c->n_pieces && bits_to_skip >= c->pieces[i].size; i++)
- bits_to_skip -= c->pieces[i].size;
-
- for (; i < c->n_pieces && offset < max_offset; i++)
- {
- struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size_bits, this_size;
-
- this_size_bits = p->size - bits_to_skip;
- if (this_size_bits > max_offset - offset)
- this_size_bits = max_offset - offset;
-
- switch (p->location)
- {
- case DWARF_VALUE_REGISTER:
- {
- struct frame_info *frame = frame_find_by_id (c->frame_id);
- struct gdbarch *arch = get_frame_arch (frame);
- int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
- ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
-
- if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && p->offset + p->size < reg_bits)
- {
- /* Big-endian, and we want less than full size. */
- bits_to_skip += reg_bits - (p->offset + p->size);
- }
- else
- bits_to_skip += p->offset;
-
- this_size = bits_to_bytes (bits_to_skip, this_size_bits);
- buffer.reserve (this_size);
-
- if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
- {
- /* Data is copied non-byte-aligned into the register.
- Need some bits from original register value. */
- int optim, unavail;
-
- if (!get_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
- this_size, buffer.data (),
- &optim, &unavail))
- {
- if (optim)
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Can't do read-modify-write to "
- "update bitfield; containing word "
- "has been optimized out"));
- if (unavail)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Can't do read-modify-write to update "
- "bitfield; containing word "
- "is unavailable"));
- }
- }
-
- copy_bitwise (buffer.data (), bits_to_skip % 8,
- contents, offset,
- this_size_bits, bits_big_endian);
- put_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
- this_size, buffer.data ());
- }
- break;
- case DWARF_VALUE_MEMORY:
- {
- bits_to_skip += p->offset;
-
- CORE_ADDR start_addr = p->v.mem.addr + bits_to_skip / 8;
-
- if (bits_to_skip % 8 == 0 && this_size_bits % 8 == 0
- && offset % 8 == 0)
- {
- /* Everything is byte-aligned; no buffer needed. */
- write_memory_with_notification (start_addr,
- contents + offset / 8,
- this_size_bits / 8);
- break;
- }
-
- this_size = bits_to_bytes (bits_to_skip, this_size_bits);
- buffer.reserve (this_size);
-
- if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
- {
- if (this_size <= 8)
- {
- /* Perform a single read for small sizes. */
- read_memory (start_addr, buffer.data (), this_size);
- }
- else
- {
- /* Only the first and last bytes can possibly have any
- bits reused. */
- read_memory (start_addr, buffer.data (), 1);
- read_memory (start_addr + this_size - 1,
- &buffer[this_size - 1], 1);
- }
- }
+ rw_pieced_value (v, NULL);
+}
- copy_bitwise (buffer.data (), bits_to_skip % 8,
- contents, offset,
- this_size_bits, bits_big_endian);
- write_memory_with_notification (start_addr, buffer.data (),
- this_size);
- }
- break;
- default:
- mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type (to)));
- break;
- }
- offset += this_size_bits;
- bits_to_skip = 0;
- }
+static void
+write_pieced_value (struct value *to, struct value *from)
+{
+ rw_pieced_value (to, from);
}
/* An implementation of an lval_funcs method to see whether a value is

View File

@ -0,0 +1,60 @@
commit 5524b5250e319f41933605420e9526fb74cfb9ae
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Wed Jun 14 14:24:03 2017 +0200
Fix register selection in var-access.exp
The new test var-access.exp causes FAILs on i686. This is because the
test chooses the wrong name for DWARF register number 1: It uses
"edx" (which corresponds to DWARF register number 2), but should have used
"ecx" instead.
Also, the current logic in var-access.exp does not correctly distinguish
between a 64-bit and a 32-bit program on an x86-64 target. It uses the
64-bit register names for both.
These problems are fixed. In order to address the latter, the convenience
macros is_*_target are exploited where appropriate.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/var-access.exp: Use register name ecx instead of edx
on 32-bit x86 targets. Exploit is_*_target macros where
appropriate.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,9 @@
+2017-06-14 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.exp: Use register name ecx instead of edx
+ on 32-bit x86 targets. Exploit is_*_target macros where
+ appropriate.
+
2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.dwarf2/var-access.exp: Add test for non-byte-aligned
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -28,16 +28,16 @@ if {![dwarf2_support]} {
set dwarf_regnum {0 1}
-if { [istarget "aarch64*-*-*"] } {
+if { [is_aarch64_target] } {
set regname {x0 x1}
-} elseif { [istarget "arm*-*-*"]
+} elseif { [is_aarch32_target]
|| [istarget "s390*-*-*" ]
|| [istarget "powerpc*-*-*"]
|| [istarget "rs6000*-*-aix*"] } {
set regname {r0 r1}
-} elseif { [istarget "i?86-*-*"] } {
- set regname {eax edx}
-} elseif { [istarget "x86_64-*-*"] } {
+} elseif { [is_x86_like_target] } {
+ set regname {eax ecx}
+} elseif { [is_amd64_regs_target] } {
set regname {rax rdx}
} else {
verbose "Skipping tests for accessing DWARF-described variables."

View File

@ -0,0 +1,197 @@
commit b4cbbe8f7294070cc93a71ace78f134965ddad82
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Thu Jun 8 17:24:50 2017 +0200
S/390: Add support for pgste marker
This patch adds a new S/390 specific segment type: PT_S390_PGSTE. For
binaries marked with that segment the kernel will allocate 4k page
tables. The only user so far will be qemu.
ld/ChangeLog:
2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* Makefile.in: Add s390.em as build dependency.
* emulparams/elf64_s390.sh (EXTRA_EM_FILE): Add s390.em.
* emultempl/s390.em: New file.
* gen-doc.texi: Add documentation for --s390-pgste option.
* ld.texinfo: Likewise.
include/ChangeLog:
2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf/s390.h (PT_S390_PGSTE): Define macro.
binutils/ChangeLog:
2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* readelf.c (get_s390_segment_type): Add support for the new
segment type PT_S390_PGSTE.
(get_segment_type): Call get_s390_segment_type.
elfcpp/ChangeLog:
2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elfcpp.h (enum PT): Add PT_S390_PGSTE to enum.
bfd/ChangeLog:
2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf-s390.h: New file.
* elf64-s390.c (struct elf_s390_link_hash_table): Add params
field.
(elf_s390_additional_program_headers): New function.
(elf_s390_modify_segment_map): New function.
(bfd_elf_s390_set_options): New function.
(elf_backend_additional_program_headers)
(elf_backend_modify_segment_map): Add macro definitions.
--- /dev/null
+++ b/bfd/elf-s390.h
@@ -0,0 +1,29 @@
+/* S/390-specific support for ELF.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* Used to pass info between ld and bfd. */
+struct s390_elf_params
+{
+ /* Tell the kernel to allocate 4k page tables. */
+ int pgste;
+};
+
+bfd_boolean bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params);
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -25,6 +25,7 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/s390.h"
+#include "elf-s390.h"
#include <stdarg.h>
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
@@ -660,6 +661,9 @@ struct elf_s390_link_hash_table
/* Small local sym cache. */
struct sym_cache sym_cache;
+
+ /* Options passed from the linker. */
+ struct s390_elf_params *params;
};
/* Get the s390 ELF linker hash table from a link_info structure. */
@@ -3966,6 +3970,70 @@ elf64_s390_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
return elf_s390_merge_obj_attributes (ibfd, info);
}
+/* We may add a PT_S390_PGSTE program header. */
+
+static int
+elf_s390_additional_program_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ htab = elf_s390_hash_table (info);
+ return htab->params->pgste;
+}
+
+
+/* Add the PT_S390_PGSTE program header. */
+
+static bfd_boolean
+elf_s390_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+ struct elf_segment_map *m, *pm = NULL;
+
+ htab = elf_s390_hash_table (info);
+ if (!htab->params->pgste)
+ return TRUE;
+
+ /* If there is already a PT_S390_PGSTE header, avoid adding
+ another. */
+ m = elf_seg_map (abfd);
+ while (m && m->p_type != PT_S390_PGSTE)
+ {
+ pm = m;
+ m = m->next;
+ }
+
+ if (m)
+ return TRUE;
+
+ m = (struct elf_segment_map *)
+ bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ if (m == NULL)
+ return FALSE;
+ m->p_type = PT_S390_PGSTE;
+ m->count = 0;
+ m->next = NULL;
+ if (pm)
+ pm->next = m;
+
+ return TRUE;
+}
+
+bfd_boolean
+bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ htab = elf_s390_hash_table (info);
+ htab->params = params;
+
+ return TRUE;
+}
+
+
/* Why was the hash table entry size definition changed from
ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
this is the only reason for the s390_elf64_size_info structure. */
@@ -4046,6 +4114,8 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
#define elf_backend_add_symbol_hook elf_s390_add_symbol_hook
#define elf_backend_sort_relocs_p elf_s390_elf_sort_relocs_p
+#define elf_backend_additional_program_headers elf_s390_additional_program_headers
+#define elf_backend_modify_segment_map elf_s390_modify_segment_map
#define bfd_elf64_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
--- a/include/elf/s390.h
+++ b/include/elf/s390.h
@@ -37,6 +37,9 @@
#define EF_S390_HIGH_GPRS 0x00000001
+/* Request 4k page table size. */
+#define PT_S390_PGSTE (PT_LOPROC + 0)
+
/* Relocation types. */
START_RELOC_NUMBERS (elf_s390_reloc_type)

View File

@ -0,0 +1,85 @@
commit 93ec5e23766a9f75aa4950748cf73964028a8d1b
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon Jun 26 11:01:58 2017 +0200
S/390: Fix testsuite segfault added with recent pgste patch.
The recent pgste patch caused several testcases to fail with a
segfault. Fixed with this patch by adding NULL pointer checks.
regression-tested on s390x.
bfd/ChangeLog:
2017-06-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf64-s390.c (elf_s390_additional_program_headers): Add NULL
pointer checks.
(elf_s390_modify_segment_map): Likewise.
(bfd_elf_s390_set_options): Lisewise.
### a/bfd/ChangeLog
### b/bfd/ChangeLog
## -1,3 +1,10 @@
+2017-06-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
+ pointer checks.
+ (elf_s390_modify_segment_map): Likewise.
+ (bfd_elf_s390_set_options): Lisewise.
+
2017-06-26 Alan Modra <amodra@gmail.com>
* elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3978,22 +3978,29 @@ elf_s390_additional_program_headers (bfd *abfd ATTRIBUTE_UNUSED,
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- return htab->params->pgste;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ return htab->params->pgste;
+ }
+ return 0;
}
/* Add the PT_S390_PGSTE program header. */
static bfd_boolean
-elf_s390_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
+elf_s390_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
struct elf_segment_map *m, *pm = NULL;
+ if (!abfd || !info)
+ return TRUE;
+
htab = elf_s390_hash_table (info);
- if (!htab->params->pgste)
+ if (!htab || !htab->params->pgste)
return TRUE;
/* If there is already a PT_S390_PGSTE header, avoid adding
@@ -4027,8 +4034,12 @@ bfd_elf_s390_set_options (struct bfd_link_info *info,
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- htab->params = params;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ htab->params = params;
+ }
return TRUE;
}

View File

@ -0,0 +1,169 @@
commit 88ab90e860a46a1123fcfd13bfe51cd360e9c3f7
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Thu Jun 29 10:30:09 2017 +0200
S390: Support guarded-storage core note sections
Newer Linux kernel versions offer two new register sets in support of the
z/Architecture's guarded storage facility: NT_S390_GS_CB, the
"guarded-storage registers", and NT_S390_GS_BC, the "guarded-storage
broadcast control block". This patch adds support for the respective core
notes sections to binutils.
bfd/ChangeLog:
* elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
(elfcore_write_s390_gs_bc): Likewise.
* elf.c (elfcore_grok_s390_gs_cb): New function.
(elfcore_grok_s390_gs_bc): New function.
(elfcore_grok_note): Call them.
(elfcore_write_s390_gs_cb): New function.
(elfcore_write_s390_gs_bc): New function.
(elfcore_write_register_note): Call them.
binutils/ChangeLog:
* readelf.c (get_note_type): Add NT_S390_GS_CB and NT_S390_GS_BC.
include/ChangeLog:
* elf/common.h (NT_S390_GS_CB): New macro.
(NT_S390_GS_BC): Likewise.
### a/bfd/ChangeLog
### b/bfd/ChangeLog
## -1,3 +1,14 @@
+2017-06-29 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
+ (elfcore_write_s390_gs_bc): Likewise.
+ * elf.c (elfcore_grok_s390_gs_cb): New function.
+ (elfcore_grok_s390_gs_bc): New function.
+ (elfcore_grok_note): Call them.
+ (elfcore_write_s390_gs_cb): New function.
+ (elfcore_write_s390_gs_bc): New function.
+ (elfcore_write_register_note): Call them.
+
2017-06-28 H.J. Lu <hongjiu.lu@intel.com>
* libbfd.c (_bfd_generic_get_section_contents): Don't call
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2533,6 +2533,10 @@ extern char *elfcore_write_s390_vxrs_low
(bfd *, char *, int *, const void *, int);
extern char *elfcore_write_s390_vxrs_high
(bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_cb
+ (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_bc
+ (bfd *, char *, int *, const void *, int);
extern char *elfcore_write_arm_vfp
(bfd *, char *, int *, const void *, int);
extern char *elfcore_write_aarch_tls
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9191,6 +9191,18 @@ elfcore_grok_s390_vxrs_high (bfd *abfd, Elf_Internal_Note *note)
}
static bfd_boolean
+elfcore_grok_s390_gs_cb (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-s390-gs-cb", note);
+}
+
+static bfd_boolean
+elfcore_grok_s390_gs_bc (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-s390-gs-bc", note);
+}
+
+static bfd_boolean
elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note)
{
return elfcore_make_note_pseudosection (abfd, ".reg-arm-vfp", note);
@@ -9668,6 +9680,20 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
else
return TRUE;
+ case NT_S390_GS_CB:
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_s390_gs_bc (abfd, note);
+ else
+ return TRUE;
+
+ case NT_S390_GS_BC:
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_s390_gs_cb (abfd, note);
+ else
+ return TRUE;
+
case NT_ARM_VFP:
if (note->namesz == 6
&& strcmp (note->namedata, "LINUX") == 0)
@@ -10728,6 +10754,32 @@ elfcore_write_s390_vxrs_high (bfd *abfd,
}
char *
+elfcore_write_s390_gs_cb (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *s390_gs_cb,
+ int size)
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_S390_GS_CB,
+ s390_gs_cb, size);
+}
+
+char *
+elfcore_write_s390_gs_bc (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *s390_gs_bc,
+ int size)
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_S390_GS_BC,
+ s390_gs_bc, size);
+}
+
+char *
elfcore_write_arm_vfp (bfd *abfd,
char *buf,
int *bufsiz,
@@ -10815,6 +10867,10 @@ elfcore_write_register_note (bfd *abfd,
return elfcore_write_s390_vxrs_low (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-s390-vxrs-high") == 0)
return elfcore_write_s390_vxrs_high (abfd, buf, bufsiz, data, size);
+ if (strcmp (section, ".reg-s390-gs-cb") == 0)
+ return elfcore_write_s390_gs_cb (abfd, buf, bufsiz, data, size);
+ if (strcmp (section, ".reg-s390-gs-bc") == 0)
+ return elfcore_write_s390_gs_bc (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-arm-vfp") == 0)
return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-aarch-tls") == 0)
### a/include/ChangeLog
### b/include/ChangeLog
## -1,3 +1,8 @@
+2017-06-29 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * elf/common.h (NT_S390_GS_CB): New macro.
+ (NT_S390_GS_BC): Likewise.
+
2017-06-28 Tamar Christina <tamar.christina@arm.com>
* opcode/aarch64.h: (AARCH64_FEATURE_DOTPROD): New.
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -598,6 +598,10 @@
/* note name must be "LINUX". */
#define NT_S390_VXRS_HIGH 0x30a /* S390 vector registers 16-31 */
/* note name must be "LINUX". */
+#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */
+ /* note name must be "LINUX". */
+#define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */
+ /* note name must be "LINUX". */
#define NT_ARM_VFP 0x400 /* ARM VFP registers */
/* The following definitions should really use NT_AARCH_..., but defined
this way for compatibility with Linux. */

View File

@ -0,0 +1,380 @@
commit 55efceabc6149e96134c10676adb2b1e79e0ae13
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Thu Jul 13 20:17:03 2017 +0200
S390: Add record/replay support for arch12 instructions
Support record/replay of the z/Architecture instructions that were
introduced with arch12.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_process_record): Add support for
instructions new in arch12.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2017-07-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * s390-linux-tdep.c (s390_process_record): Add support for
+ instructions new in arch12.
+
2017-07-11 John Baldwin <jhb@FreeBSD.org>
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -4992,6 +4992,8 @@ ex:
case 0xb9e9: /* SGRK - subtract */
case 0xb9ea: /* ALGRK - add logical */
case 0xb9eb: /* SLGRK - subtract logical */
+ case 0xb9ed: /* MSGRKC - multiply single 64x64 -> 64 */
+ case 0xb9fd: /* MSRKC - multiply single 32x32 -> 32 */
/* 64-bit gpr destination + flags */
if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
return -1;
@@ -5019,7 +5021,7 @@ ex:
case 0xb914: /* LGFR - load */
case 0xb916: /* LLGFR - load logical */
case 0xb917: /* LLGTR - load logical thirty one bits */
- case 0xb91c: /* MSGFR - load */
+ case 0xb91c: /* MSGFR - multiply single 64<32 */
case 0xb946: /* BCTGR - branch on count */
case 0xb984: /* LLGCR - load logical character */
case 0xb985: /* LLGHR - load logical halfword */
@@ -5038,6 +5040,7 @@ ex:
case 0xb91d: /* DSGFR - divide single */
case 0xb986: /* MLGR - multiply logical */
case 0xb987: /* DLGR - divide logical */
+ case 0xb9ec: /* MGRK - multiply 64x64 -> 128 */
/* 64-bit gpr pair destination */
if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
return -1;
@@ -5106,8 +5109,8 @@ ex:
/* 0xb922-0xb924 undefined */
/* 0xb925 privileged */
/* 0xb928 privileged */
- /* 0xb929 undefined */
+ case 0xb929: /* KMA - cipher message with authentication */
case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
case 0xb92b: /* KMO - cipher message with output feedback [partial] */
case 0xb92f: /* KMC - cipher message with chaining [partial] */
@@ -5170,6 +5173,15 @@ ex:
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
return -1;
}
+ if (tmp != 0 && insn[0] == 0xb929)
+ {
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[4]))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[4] | 1)))
+ return -1;
+ }
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
@@ -5571,10 +5583,11 @@ ex:
/* 0xb9e3 undefined */
/* 0xb9e5 undefined */
- /* 0xb9ec-0xb9f1 undefined */
+ /* 0xb9ee-0xb9f1 undefined */
/* 0xb9f3 undefined */
/* 0xb9f5 undefined */
- /* 0xb9fc-0xb9ff undefined */
+ /* 0xb9fc undefined */
+ /* 0xb9fe -0xb9ff undefined */
default:
goto UNKNOWN_OP;
@@ -5962,6 +5975,7 @@ ex:
break;
case 0xe3:
+ case 0xe6:
case 0xe7:
case 0xeb:
case 0xed:
@@ -6006,6 +6020,7 @@ ex:
case 0xe31c: /* MSGF - multiply single */
case 0xe32a: /* LZRG - load and zero rightmost byte */
case 0xe33a: /* LLZRGF - load logical and zero rightmost byte */
+ case 0xe33c: /* MGH - multiply halfword 64x16mem -> 64 */
case 0xe346: /* BCTG - branch on count */
case 0xe377: /* LGB - load byte */
case 0xe390: /* LLGC - load logical character */
@@ -6036,6 +6051,7 @@ ex:
case 0xe30d: /* DSG - divide single */
case 0xe31d: /* DSGF - divide single */
+ case 0xe384: /* MG - multiply 64x64mem -> 128 */
case 0xe386: /* MLG - multiply logical */
case 0xe387: /* DLG - divide logical */
case 0xe38f: /* LPQ - load pair from quadword */
@@ -6057,6 +6073,9 @@ ex:
/* 0xe310-0xe311 undefined */
case 0xe312: /* LT - load and test */
+ case 0xe338: /* AGH - add halfword to 64 bit value */
+ case 0xe339: /* SGH - subtract halfword from 64 bit value */
+ case 0xe353: /* MSC - multiply single 32x32mem -> 32 */
case 0xe354: /* NY - and */
case 0xe356: /* OY - or */
case 0xe357: /* XY - xor */
@@ -6066,13 +6085,14 @@ ex:
case 0xe35f: /* SLY - subtract logical */
case 0xe37a: /* AHY - add halfword */
case 0xe37b: /* SHY - subtract halfword */
+ case 0xe383: /* MSGC - multiply single 64x64mem -> 64 */
case 0xe398: /* ALC - add logical with carry */
case 0xe399: /* SLB - subtract logical with borrow */
case 0xe727: /* LCBB - load count to block bounduary */
case 0xeb81: /* ICMY - insert characters under mask */
case 0xebdc: /* SRAK - shift left single */
case 0xebdd: /* SLAK - shift left single */
- /* 32-bit gpr destination + flags */
+ /* 32/64-bit gpr destination + flags */
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
@@ -6160,7 +6180,7 @@ ex:
case 0xe336: /* PFD - prefetch data */
break;
- /* 0xe337-0xe339 undefined */
+ /* 0xe337 undefined */
/* 0xe33c-0xe33d undefined */
case 0xe33e: /* STRV - store reversed */
@@ -6183,8 +6203,12 @@ ex:
break;
/* 0xe340-0xe345 undefined */
- /* 0xe347-0xe34f undefined */
- /* 0xe352-0xe353 undefined */
+
+ case 0xe347: /* BIC - branch indirect on condition */
+ break;
+
+ /* 0xe348-0xe34f undefined */
+ /* 0xe352 undefined */
case 0xe35c: /* MFY - multiply */
case 0xe396: /* ML - multiply logical */
@@ -6216,11 +6240,12 @@ ex:
break;
/* 0xe37d-0xe37f undefined */
- /* 0xe383-0xe384 undefined */
case 0xe385: /* LGAT - load and trap */
case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
case 0xe39d: /* LLGFAT - load logical and trap */
+ case 0xe650: /* VCVB - vector convert to binary 32 bit*/
+ case 0xe652: /* VCVBG - vector convert to binary 64 bit*/
case 0xe721: /* VLGV - vector load gr from vr element */
/* 64-bit gpr destination + fpc for possible DXC write */
if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
@@ -6271,6 +6296,10 @@ ex:
/* 0xe3ce undefined */
/* 0xe3d0-0xe3ff undefined */
+ case 0xe634: /* VPKZ - vector pack zoned */
+ case 0xe635: /* VLRL - vector load rightmost with immed. length */
+ case 0xe637: /* VLRLR - vector load rightmost with length */
+ case 0xe649: /* VLIP - vector load immediate decimal */
case 0xe700: /* VLEB - vector load element */
case 0xe701: /* VLEH - vector load element */
case 0xe702: /* VLEG - vector load element */
@@ -6311,7 +6340,10 @@ ex:
case 0xe769: /* VNC - vector and with complement */
case 0xe76a: /* VO - vector or */
case 0xe76b: /* VNO - vector nor */
+ case 0xe76c: /* VNX - vector not exclusive or */
case 0xe76d: /* VX - vector xor */
+ case 0xe76e: /* VNN - vector nand */
+ case 0xe76f: /* VOC - vector or with complement */
case 0xe770: /* VESLV - vector element shift left */
case 0xe772: /* VERIM - vector element rotate and insert under mask */
case 0xe773: /* VERLLV - vector element rotate left logical */
@@ -6325,11 +6357,14 @@ ex:
case 0xe77e: /* VSRA - vector shift right arithmetic */
case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
case 0xe784: /* VPDI - vector permute doubleword immediate */
+ case 0xe785: /* VBPERM - vector bit permute */
case 0xe78c: /* VPERM - vector permute */
case 0xe78d: /* VSEL - vector select */
case 0xe78e: /* VFMS - vector fp multiply and subtract */
case 0xe78f: /* VFMA - vector fp multiply and add */
case 0xe794: /* VPK - vector pack */
+ case 0xe79e: /* VFNMS - vector fp negative multiply and subtract */
+ case 0xe79f: /* VFNMA - vector fp negative multiply and add */
case 0xe7a1: /* VMLH - vector multiply logical high */
case 0xe7a2: /* VML - vector multiply low */
case 0xe7a3: /* VMH - vector multiply high */
@@ -6345,6 +6380,7 @@ ex:
case 0xe7ae: /* VMAE - vector multiply and add even */
case 0xe7af: /* VMAO - vector multiply and add odd */
case 0xe7b4: /* VGFM - vector Galois field multiply sum */
+ case 0xe7b8: /* VMSL - vector multiply sum logical */
case 0xe7b9: /* VACCC - vector add with carry compute carry */
case 0xe7bb: /* VAC - vector add with carry */
case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
@@ -6354,8 +6390,8 @@ ex:
case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
- case 0xe7c4: /* VLDE - vector fp load lengthened */
- case 0xe7c5: /* VLED - vector fp load rounded */
+ case 0xe7c4: /* VLDE/VFLL - vector fp load lengthened */
+ case 0xe7c5: /* VLED/VFLR - vector fp load rounded */
case 0xe7c7: /* VFI - vector load fp integer */
case 0xe7cc: /* VFPSO - vector fp perform sign operation */
case 0xe7ce: /* VFSQ - vector fp square root */
@@ -6369,6 +6405,8 @@ ex:
case 0xe7e3: /* VFA - vector fp add */
case 0xe7e5: /* VFD - vector fp divide */
case 0xe7e7: /* VFM - vector fp multiply */
+ case 0xe7ee: /* VFMIN - vector fp minimum */
+ case 0xe7ef: /* VFMAX - vector fp maximum */
case 0xe7f0: /* VAVGL - vector average logical */
case 0xe7f1: /* VACC - vector add and compute carry */
case 0xe7f2: /* VAVG - vector average */
@@ -6386,6 +6424,14 @@ ex:
return -1;
break;
+ case 0xe63d: /* VSTRL - vector store rightmost with immed. length */
+ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
+ if (record_full_arch_list_add_mem (oaddr, inib[3] + 1))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
+ return -1;
+ break;
+
case 0xe708: /* VSTEB - vector store element */
oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 1))
@@ -6480,13 +6526,22 @@ ex:
return -1;
break;
+ case 0xe63c: /* VUPKZ - vector unpack zoned */
+ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
+ if (record_full_arch_list_add_mem (oaddr, (ibyte[1] + 1) & 31))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
+ return -1;
+ break;
+
+ case 0xe63f: /* VSTRLR - vector store rightmost with length */
case 0xe73f: /* VSTL - vector store with length */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[3], &tmp);
tmp &= 0xffffffffu;
- if (tmp > 16)
- tmp = 16;
- if (record_full_arch_list_add_mem (oaddr, tmp))
+ if (tmp > 15)
+ tmp = 15;
+ if (record_full_arch_list_add_mem (oaddr, tmp + 1))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
@@ -6494,6 +6549,17 @@ ex:
/* 0xe747-0xe749 undefined */
+ case 0xe658: /* VCVD - vector convert to decimal 32 bit */
+ case 0xe659: /* VSRP - vector shift and round decimal */
+ case 0xe65a: /* VCVDG - vector convert to decimal 64 bit*/
+ case 0xe65b: /* VPSOP - vector perform sign operation decimal */
+ case 0xe671: /* VAP - vector add decimal */
+ case 0xe673: /* VSP - vector subtract decimal */
+ case 0xe678: /* VMP - vector multiply decimal */
+ case 0xe679: /* VMSP - vector multiply decimal */
+ case 0xe67a: /* VDP - vector divide decimal */
+ case 0xe67b: /* VRP - vector remainder decimal */
+ case 0xe67e: /* VSDP - vector shift and divide decimal */
case 0xe74a: /* VFTCI - vector fp test data class immediate */
case 0xe75c: /* VISTR - vector isolate string */
case 0xe780: /* VFEE - vector find element equal */
@@ -6504,7 +6570,7 @@ ex:
case 0xe797: /* VPKS - vector pack saturate */
case 0xe7e8: /* VFCE - vector fp compare equal */
case 0xe7ea: /* VFCHE - vector fp compare high or equal */
- case 0xe7eb: /* VFCE - vector fp compare high */
+ case 0xe7eb: /* VFCH - vector fp compare high */
case 0xe7f8: /* VCEQ - vector compare equal */
case 0xe7f9: /* VCHL - vector compare high logical */
case 0xe7fb: /* VCH - vector compare high */
@@ -6517,6 +6583,14 @@ ex:
return -1;
break;
+ case 0xe65f: /* VTP - vector test decimal */
+ /* flags + FPC */
+ if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
+ return -1;
+ break;
+
/* 0xe74b-0xe74c undefined */
/* 0xe74e-0xe74f undefined */
/* 0xe751 undefined */
@@ -6524,26 +6598,26 @@ ex:
/* 0xe757-0xe75b undefined */
/* 0xe75d-0xe75e undefined */
/* 0xe763 undefined */
- /* 0xe76c undefined */
- /* 0xe76e-0xe76f undefined */
/* 0xe771 undefined */
/* 0xe776 undefined */
/* 0xe779 undefined */
/* 0xe77b undefined */
/* 0xe783 undefined */
- /* 0xe785-0xe789 undefined */
+ /* 0xe786-0xe789 undefined */
/* 0xe78b undefined */
/* 0xe790-0xe793 undefined */
/* 0xe796 undefined */
- /* 0xe798-0xe7a0 undefined */
- /* 0xe7a8 undefined */
+ /* 0xe798-0xe79d undefined */
+ /* 0xe7a0 undefined */
+ /* 0xe7a8 undefined */
/* 0xe7b0-0xe7b3 undefined */
- /* 0xe7b5-0xe7b8 undefined */
+ /* 0xe7b5-0xe7b7 undefined */
/* 0xe7ba undefined */
/* 0xe7be undefined */
/* 0xe7c6 undefined */
/* 0xe7c8-0xe7c9 undefined */
+ case 0xe677: /* VCP - vector compare decimal */
case 0xe7ca: /* WFK - vector fp compare and signal scalar */
case 0xe7cb: /* WFC - vector fp compare scalar */
case 0xe7d8: /* VTM - vector test under mask */
@@ -6568,7 +6642,7 @@ ex:
/* 0xe7e4 undefined */
/* 0xe7e6 undefined */
/* 0xe7e9 undefined */
- /* 0xe7ec-0xe7ef undefined */
+ /* 0xe7ec-0xe7ed undefined */
/* 0xe7f4 undefined */
/* 0xe7f6 undefined */
/* 0xe7fa undefined */
@@ -7048,8 +7122,6 @@ ex:
}
break;
- /* 0xe6 undefined */
-
case 0xec:
/* RIE/RIS/RRS-format instruction */
switch (ibyte[0] << 8 | ibyte[5])

View File

@ -0,0 +1,49 @@
commit 47826cdbec2548cd1d25acf4cfaf908ae88f3325
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Fri Jul 21 10:54:06 2017 +0200
S/390: Support z14 as CPU name.
With IBM z14 officially announced I can add z14 as CPU name.
No regressions with that patch on s390x.
gas/ChangeLog:
2017-07-21 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (s390_parse_cpu): Add z14 as alternate CPU
name.
* doc/as.texinfo: Add z14 to CPU string list.
* doc/c-s390.texi: Likewise.
opcodes/ChangeLog:
2017-07-21 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-mkopc.c (main): Enable z14 as CPU string in the opcode
table.
### a/opcodes/ChangeLog
### b/opcodes/ChangeLog
## -1,3 +1,8 @@
+2017-07-21 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * s390-mkopc.c (main): Enable z14 as CPU string in the opcode
+ table.
+
2017-07-20 Nick Clifton <nickc@redhat.com>
* po/de.po: Updated German translation.
--- a/opcodes/s390-mkopc.c
+++ b/opcodes/s390-mkopc.c
@@ -374,7 +374,8 @@ main (void)
else if (strcmp (cpu_string, "z13") == 0
|| strcmp (cpu_string, "arch11") == 0)
min_cpu = S390_OPCODE_Z13;
- else if (strcmp (cpu_string, "arch12") == 0)
+ else if (strcmp (cpu_string, "z14") == 0
+ || strcmp (cpu_string, "arch12") == 0)
min_cpu = S390_OPCODE_ARCH12;
else {
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);

View File

@ -0,0 +1,53 @@
commit 79c12faeea57e61364b6a7a3e411b096edce989c
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Fri Jul 28 17:59:25 2017 +0200
S/390: Fix segfault when linking -shared -nostartfiles
Regression-tested on s390x.
bfd/ChangeLog:
2017-07-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
pointer check for htab->elf.irelplt.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3941,7 +3941,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->elf.srelplt->size + htab->elf.irelplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
+ if (htab->elf.irelplt)
+ dyn.d_un.d_val += htab->elf.irelplt->size;
break;
}
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3745,7 +3745,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->elf.srelplt->size + htab->elf.irelplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
+ if (htab->elf.irelplt)
+ dyn.d_un.d_val += htab->elf.irelplt->size;
break;
case DT_RELASZ:
@@ -3756,7 +3758,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- dyn.d_un.d_val -= htab->elf.srelplt->size + htab->elf.irelplt->size;
+ dyn.d_un.d_val -= htab->elf.srelplt->size;
+ if (htab->elf.irelplt)
+ dyn.d_un.d_val -= htab->elf.irelplt->size;
break;
}

View File

@ -0,0 +1,67 @@
commit 1ef692ea23714876cc30b1a3ab3ef33a1369f17a
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Tue Aug 1 15:13:40 2017 +0200
S/390: Fix claimfile failures
This fixes a segfault when trying to access the local_plt field in the
s390 specific elf data althoug the underlaying object is a generic elf
object.
This fixes the following testsuite failures:
< FAIL: plugin claimfile replace symbol with source
< FAIL: plugin claimfile resolve symbol with source
< FAIL: plugin claimfile replace file with source
< FAIL: plugin set symbol visibility with source
< FAIL: plugin ignore lib with source
< FAIL: plugin claimfile replace lib with source
< FAIL: plugin 2 with source lib
< FAIL: load plugin 2 with source
< FAIL: plugin 3 with source lib
< FAIL: load plugin 3 with source
bfd/ChangeLog:
2017-08-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
isn't the S/390 specific elf data.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
### a/bfd/ChangeLog
### b/bfd/ChangeLog
## -1,3 +1,9 @@
+2017-08-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
+ isn't the S/390 specific elf data.
+ * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
+
2017-07-31 Kuan-Lin Chen <rufus@andestech.com>
* elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -4001,6 +4001,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
symtab_hdr = &elf_symtab_hdr (ibfd);
+ if (!is_s390_elf (ibfd))
+ continue;
+
local_plt = elf_s390_local_plt (ibfd);
if (local_plt != NULL)
for (i = 0; i < symtab_hdr->sh_info; i++)
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3814,6 +3814,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
symtab_hdr = &elf_symtab_hdr (ibfd);
+ if (!is_s390_elf (ibfd))
+ continue;
+
local_plt = elf_s390_local_plt (ibfd);
if (local_plt != NULL)
for (i = 0; i < symtab_hdr->sh_info; i++)

File diff suppressed because it is too large Load Diff

View File

@ -52,11 +52,11 @@ Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch
Index: gdb-7.10.90.20160211/gdb/alpha-tdep.c
Index: gdb-8.0/gdb/alpha-tdep.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/alpha-tdep.c 2016-02-11 20:56:59.224850729 +0100
+++ gdb-7.10.90.20160211/gdb/alpha-tdep.c 2016-02-11 20:57:05.385891225 +0100
@@ -413,6 +413,13 @@
--- gdb-8.0.orig/gdb/alpha-tdep.c 2017-08-19 20:07:45.469330496 +0200
+++ gdb-8.0/gdb/alpha-tdep.c 2017-08-19 20:07:50.670379152 +0200
@@ -414,6 +414,13 @@
accumulate_size = 0;
else
accumulate_size -= sizeof(arg_reg_buffer);
@ -70,11 +70,11 @@ Index: gdb-7.10.90.20160211/gdb/alpha-tdep.c
sp -= accumulate_size;
/* Keep sp aligned to a multiple of 16 as the ABI requires. */
Index: gdb-7.10.90.20160211/gdb/cp-valprint.c
Index: gdb-8.0/gdb/cp-valprint.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/cp-valprint.c 2016-02-11 20:56:59.224850729 +0100
+++ gdb-7.10.90.20160211/gdb/cp-valprint.c 2016-02-11 20:57:05.385891225 +0100
@@ -536,6 +536,8 @@
--- gdb-8.0.orig/gdb/cp-valprint.c 2017-08-19 20:07:45.470330505 +0200
+++ gdb-8.0/gdb/cp-valprint.c 2017-08-19 20:07:50.670379152 +0200
@@ -537,6 +537,8 @@
gdb_byte *buf;
struct cleanup *back_to;
@ -83,32 +83,11 @@ Index: gdb-7.10.90.20160211/gdb/cp-valprint.c
buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.10.90.20160211/gdb/dwarf2loc.c
Index: gdb-8.0/gdb/findcmd.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/dwarf2loc.c 2016-02-11 20:56:59.225850736 +0100
+++ gdb-7.10.90.20160211/gdb/dwarf2loc.c 2016-02-11 20:57:05.386891231 +0100
@@ -1744,6 +1744,8 @@
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
+ ulongest_fits_host_or_error (this_size);
+
if (buffer_size < this_size)
{
buffer_size = this_size;
@@ -1926,6 +1928,7 @@
}
else
{
+ ulongest_fits_host_or_error (this_size);
if (buffer_size < this_size)
{
buffer_size = this_size;
Index: gdb-7.10.90.20160211/gdb/findcmd.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/findcmd.c 2016-02-11 20:56:59.226850742 +0100
+++ gdb-7.10.90.20160211/gdb/findcmd.c 2016-02-11 20:57:05.387891238 +0100
@@ -184,6 +184,7 @@
--- gdb-8.0.orig/gdb/findcmd.c 2017-08-19 20:07:45.472330524 +0200
+++ gdb-8.0/gdb/findcmd.c 2017-08-19 20:07:50.672379171 +0200
@@ -186,6 +186,7 @@
size_t current_offset = pattern_buf_end - pattern_buf;
pattern_buf_size = pattern_buf_size_need * 2;
@ -116,11 +95,11 @@ Index: gdb-7.10.90.20160211/gdb/findcmd.c
pattern_buf = (gdb_byte *) xrealloc (pattern_buf, pattern_buf_size);
pattern_buf_end = pattern_buf + current_offset;
}
Index: gdb-7.10.90.20160211/gdb/p-valprint.c
Index: gdb-8.0/gdb/p-valprint.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/p-valprint.c 2016-02-11 20:56:59.226850742 +0100
+++ gdb-7.10.90.20160211/gdb/p-valprint.c 2016-02-11 20:57:05.387891238 +0100
@@ -769,6 +769,7 @@
--- gdb-8.0.orig/gdb/p-valprint.c 2017-08-19 20:07:45.472330524 +0200
+++ gdb-8.0/gdb/p-valprint.c 2017-08-19 20:07:50.673379180 +0200
@@ -772,6 +772,7 @@
gdb_byte *buf;
struct cleanup *back_to;
@ -128,11 +107,11 @@ Index: gdb-7.10.90.20160211/gdb/p-valprint.c
buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.10.90.20160211/gdb/utils.c
Index: gdb-8.0/gdb/utils.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/utils.c 2016-02-11 20:56:59.227850749 +0100
+++ gdb-7.10.90.20160211/gdb/utils.c 2016-02-11 20:57:05.388891244 +0100
@@ -2837,6 +2837,18 @@
--- gdb-8.0.orig/gdb/utils.c 2017-08-19 20:07:45.473330533 +0200
+++ gdb-8.0/gdb/utils.c 2017-08-19 20:07:50.673379180 +0200
@@ -2776,6 +2776,18 @@
return addr;
}
@ -151,11 +130,11 @@ Index: gdb-7.10.90.20160211/gdb/utils.c
char *
gdb_realpath (const char *filename)
{
Index: gdb-7.10.90.20160211/gdb/valops.c
Index: gdb-8.0/gdb/valops.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/valops.c 2016-02-11 20:56:59.228850755 +0100
+++ gdb-7.10.90.20160211/gdb/valops.c 2016-02-11 20:57:05.389891251 +0100
@@ -2057,6 +2057,7 @@
--- gdb-8.0.orig/gdb/valops.c 2017-08-19 20:07:45.474330542 +0200
+++ gdb-8.0/gdb/valops.c 2017-08-19 20:07:50.674379190 +0200
@@ -2100,6 +2100,7 @@
struct cleanup *back_to;
CORE_ADDR address;
@ -163,11 +142,11 @@ Index: gdb-7.10.90.20160211/gdb/valops.c
tmp = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, tmp);
address = value_address (*arg1p);
Index: gdb-7.10.90.20160211/gdb/value.c
Index: gdb-8.0/gdb/value.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/value.c 2016-02-11 20:56:59.229850762 +0100
+++ gdb-7.10.90.20160211/gdb/value.c 2016-02-11 20:58:35.095480877 +0100
@@ -935,6 +935,7 @@
--- gdb-8.0.orig/gdb/value.c 2017-08-19 20:07:45.476330561 +0200
+++ gdb-8.0/gdb/value.c 2017-08-19 20:07:50.675379199 +0200
@@ -936,6 +936,7 @@
description correctly. */
check_typedef (type);
@ -175,7 +154,7 @@ Index: gdb-7.10.90.20160211/gdb/value.c
val = XCNEW (struct value);
val->contents = NULL;
val->next = all_values;
@@ -1034,6 +1035,8 @@
@@ -1033,6 +1034,8 @@
static void
allocate_value_contents (struct value *val)
{
@ -184,7 +163,7 @@ Index: gdb-7.10.90.20160211/gdb/value.c
if (!val->contents)
{
check_type_length_before_alloc (val->enclosing_type);
@@ -3090,6 +3093,7 @@
@@ -3093,6 +3096,7 @@
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
{
check_type_length_before_alloc (new_encl_type);
@ -192,10 +171,10 @@ Index: gdb-7.10.90.20160211/gdb/value.c
val->contents
= (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
}
Index: gdb-7.10.90.20160211/gdb/vax-tdep.c
Index: gdb-8.0/gdb/vax-tdep.c
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/vax-tdep.c 2016-02-11 20:56:59.229850762 +0100
+++ gdb-7.10.90.20160211/gdb/vax-tdep.c 2016-02-11 20:57:05.391891264 +0100
--- gdb-8.0.orig/gdb/vax-tdep.c 2017-08-19 20:07:45.476330561 +0200
+++ gdb-8.0/gdb/vax-tdep.c 2017-08-19 20:07:50.675379199 +0200
@@ -219,6 +219,7 @@
ULONGEST addr;
@ -204,11 +183,11 @@ Index: gdb-7.10.90.20160211/gdb/vax-tdep.c
read_memory (addr, readbuf, len);
}
Index: gdb-7.10.90.20160211/gdb/defs.h
Index: gdb-8.0/gdb/defs.h
===================================================================
--- gdb-7.10.90.20160211.orig/gdb/defs.h 2016-02-11 20:56:59.229850762 +0100
+++ gdb-7.10.90.20160211/gdb/defs.h 2016-02-11 20:57:05.391891264 +0100
@@ -690,4 +690,6 @@
--- gdb-8.0.orig/gdb/defs.h 2017-08-19 20:07:45.476330561 +0200
+++ gdb-8.0/gdb/defs.h 2017-08-19 20:07:50.676379208 +0200
@@ -750,4 +750,6 @@
#include "utils.h"

359
gdb-s390x-1b63490.patch Normal file
View File

@ -0,0 +1,359 @@
commit 1b63490c9173f8c9770b7885def720516aa9b9f8
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Mon Sep 25 16:02:23 2017 +0200
S390: Add guarded-storage register support to GDB
Recognize targets with the new guarded-storage feature and then present
the guarded-storage registers and the Linux-specific guarded-storage
broadcast control block appropriately.
gdb/ChangeLog:
* s390-linux-nat.c (have_regset_gs): New static variable.
(s390_linux_fetch_inferior_registers): Handle guarded-storage
control block and guarded-storage broadcast control regsets.
(s390_read_description): Detect whether the target has
guarded-storage support, return appropriate tdesc.
* s390-linux-tdep.c (features/s390-gs-linux64.c): New include.
(features/s390x-gs-linux64.c): Likewise.
(struct gdbarch_tdep) <have_gs>: New field.
(s390_regmap_gs, s390_regmap_gsbc, s390_gs_regset)
(s390_gsbc_regset): New variables.
(s390_iterate_over_regset_sections): Iterate over s390_gs_regset
and s390_gsbc_regset, if applicable.
(s390_core_read_description): Check whether core file was from a
target with guarded-storage support; include appropriate regsets.
(s390_gdbarch_init): Add registers for guarded-storage support.
(_initialize_s390_tdep): Initialize new target descriptions that
include registers for guarded-storage support.
* s390-linux-tdep.h (HWCAP_S390_GS, S390_GSD_REGNUM)
(S390_GSSM_REGNUM, S390_GSEPLA_REGNUM)
(S390_BC_GSD_REGNUM, S390_BC_GSSM_REGNUM): New defines.
(S390_NUM_REGS): Adjust macro definition.
(s390_gs_regset, s390_gsbc_regset, tdesc_s390_gs_linux64)
(tdesc_s390x_gs_linux64): New declarations.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7c6e67f..6eb730f 100644
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index b395529..4d1b8b5 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -54,6 +54,7 @@ static int have_regset_last_break = 0;
static int have_regset_system_call = 0;
static int have_regset_tdb = 0;
static int have_regset_vxrs = 0;
+static int have_regset_gs = 0;
/* Register map for 32-bit executables running under a 64-bit
kernel. */
@@ -406,6 +407,18 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops,
fetch_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
&s390_vxrs_high_regset);
}
+
+ if (have_regset_gs)
+ {
+ if (regnum == -1 || (regnum >= S390_GSD_REGNUM
+ && regnum <= S390_GSEPLA_REGNUM))
+ fetch_regset (regcache, tid, NT_S390_GS_CB, 4 * 8,
+ &s390_gs_regset);
+ if (regnum == -1 || (regnum >= S390_BC_GSD_REGNUM
+ && regnum <= S390_BC_GSEPLA_REGNUM))
+ fetch_regset (regcache, tid, NT_S390_GS_BC, 4 * 8,
+ &s390_gsbc_regset);
+ }
}
/* Store register REGNUM back into the child process. If REGNUM is
@@ -974,8 +987,13 @@ s390_read_description (struct target_ops *ops)
&& check_regset (tid, NT_S390_VXRS_LOW, 16 * 8)
&& check_regset (tid, NT_S390_VXRS_HIGH, 16 * 16);
+ have_regset_gs = (hwcap & HWCAP_S390_GS)
+ && check_regset (tid, NT_S390_GS_CB, 4 * 8)
+ && check_regset (tid, NT_S390_GS_BC, 4 * 8);
+
if (s390_target_wordsize () == 8)
- return (have_regset_vxrs ?
+ return (have_regset_gs ? tdesc_s390x_gs_linux64 :
+ have_regset_vxrs ?
(have_regset_tdb ? tdesc_s390x_tevx_linux64 :
tdesc_s390x_vx_linux64) :
have_regset_tdb ? tdesc_s390x_te_linux64 :
@@ -984,7 +1002,8 @@ s390_read_description (struct target_ops *ops)
tdesc_s390x_linux64);
if (hwcap & HWCAP_S390_HIGH_GPRS)
- return (have_regset_vxrs ?
+ return (have_regset_gs ? tdesc_s390_gs_linux64 :
+ have_regset_vxrs ?
(have_regset_tdb ? tdesc_s390_tevx_linux64 :
tdesc_s390_vx_linux64) :
have_regset_tdb ? tdesc_s390_te_linux64 :
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index a6882fb..a6a6d5d 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -69,12 +69,14 @@
#include "features/s390-te-linux64.c"
#include "features/s390-vx-linux64.c"
#include "features/s390-tevx-linux64.c"
+#include "features/s390-gs-linux64.c"
#include "features/s390x-linux64.c"
#include "features/s390x-linux64v1.c"
#include "features/s390x-linux64v2.c"
#include "features/s390x-te-linux64.c"
#include "features/s390x-vx-linux64.c"
#include "features/s390x-tevx-linux64.c"
+#include "features/s390x-gs-linux64.c"
#define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
#define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
@@ -113,6 +115,7 @@ struct gdbarch_tdep
int have_linux_v1;
int have_linux_v2;
int have_tdb;
+ bool have_gs;
};
@@ -834,6 +837,24 @@ static const struct regcache_map_entry s390_regmap_vxrs_high[] =
{ 0 }
};
+static const struct regcache_map_entry s390_regmap_gs[] =
+ {
+ { 1, REGCACHE_MAP_SKIP, 8 },
+ { 1, S390_GSD_REGNUM, 8 },
+ { 1, S390_GSSM_REGNUM, 8 },
+ { 1, S390_GSEPLA_REGNUM, 8 },
+ { 0 }
+ };
+
+static const struct regcache_map_entry s390_regmap_gsbc[] =
+ {
+ { 1, REGCACHE_MAP_SKIP, 8 },
+ { 1, S390_BC_GSD_REGNUM, 8 },
+ { 1, S390_BC_GSSM_REGNUM, 8 },
+ { 1, S390_BC_GSEPLA_REGNUM, 8 },
+ { 0 }
+ };
+
/* Supply the TDB regset. Like regcache_supply_regset, but invalidate
the TDB registers unless the TDB format field is valid. */
@@ -905,6 +926,18 @@ const struct regset s390_vxrs_high_regset = {
regcache_collect_regset
};
+const struct regset s390_gs_regset = {
+ s390_regmap_gs,
+ regcache_supply_regset,
+ regcache_collect_regset
+};
+
+const struct regset s390_gsbc_regset = {
+ s390_regmap_gsbc,
+ regcache_supply_regset,
+ regcache_collect_regset
+};
+
/* Iterate over supported core file register note sections. */
static void
@@ -951,6 +984,23 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg-s390-vxrs-high", 16 * 16, &s390_vxrs_high_regset,
"s390 vector registers 16-31", cb_data);
}
+
+ /* Iterate over the guarded-storage regsets if in "read" mode, or if
+ their registers are available. */
+ if (tdep->have_gs)
+ {
+ if (regcache == NULL
+ || REG_VALID == regcache_register_status (regcache,
+ S390_GSD_REGNUM))
+ cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset,
+ "s390 guarded-storage registers", cb_data);
+
+ if (regcache == NULL
+ || REG_VALID == regcache_register_status (regcache,
+ S390_BC_GSD_REGNUM))
+ cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset,
+ "s390 guarded-storage broadcast control", cb_data);
+ }
}
static const struct target_desc *
@@ -959,7 +1009,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
CORE_ADDR hwcap = 0;
- int high_gprs, v1, v2, te, vx;
+ bool high_gprs, v1, v2, te, vx, gs;
target_auxv_search (target, AT_HWCAP, &hwcap);
if (!section)
@@ -971,12 +1021,14 @@ s390_core_read_description (struct gdbarch *gdbarch,
v2 = (bfd_get_section_by_name (abfd, ".reg-s390-system-call") != NULL);
vx = (hwcap & HWCAP_S390_VX);
te = (hwcap & HWCAP_S390_TE);
+ gs = (hwcap & HWCAP_S390_GS);
switch (bfd_section_size (abfd, section))
{
case s390_sizeof_gregset:
if (high_gprs)
- return (te && vx ? tdesc_s390_tevx_linux64 :
+ return (gs ? tdesc_s390_gs_linux64 :
+ te && vx ? tdesc_s390_tevx_linux64 :
vx ? tdesc_s390_vx_linux64 :
te ? tdesc_s390_te_linux64 :
v2 ? tdesc_s390_linux64v2 :
@@ -986,7 +1038,8 @@ s390_core_read_description (struct gdbarch *gdbarch,
v1 ? tdesc_s390_linux32v1 : tdesc_s390_linux32);
case s390x_sizeof_gregset:
- return (te && vx ? tdesc_s390x_tevx_linux64 :
+ return (gs ? tdesc_s390x_gs_linux64 :
+ te && vx ? tdesc_s390x_tevx_linux64 :
vx ? tdesc_s390x_vx_linux64 :
te ? tdesc_s390x_te_linux64 :
v2 ? tdesc_s390x_linux64v2 :
@@ -7767,6 +7820,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int have_linux_v2 = 0;
int have_tdb = 0;
int have_vx = 0;
+ int have_gs = 0;
int first_pseudo_reg, last_pseudo_reg;
static const char *const stap_register_prefixes[] = { "%", NULL };
static const char *const stap_register_indirection_prefixes[] = { "(",
@@ -7834,6 +7888,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
"v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
"v25", "v26", "v27", "v28", "v29", "v30", "v31",
};
+ static const char *const gs_cb[] = {
+ "gsd", "gssm", "gsepla",
+ };
+ static const char *const gs_bc[] = {
+ "bc_gsd", "bc_gssm", "bc_gsepla",
+ };
const struct tdesc_feature *feature;
int i, valid_p = 1;
@@ -7937,6 +7997,29 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_vx = 1;
}
+ /* Guarded-storage registers. */
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gs");
+ if (feature)
+ {
+ for (i = 0; i < 3; i++)
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
+ S390_GSD_REGNUM + i,
+ gs_cb[i]);
+ have_gs = 1;
+ }
+
+ /* Guarded-storage broadcast control. */
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gsbc");
+ if (feature)
+ {
+ valid_p &= have_gs;
+
+ for (i = 0; i < 3; i++)
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
+ S390_BC_GSD_REGNUM + i,
+ gs_bc[i]);
+ }
+
if (!valid_p)
{
tdesc_data_cleanup (tdesc_data);
@@ -7970,6 +8053,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
continue;
if ((tdep->gpr_full_regnum != -1) != have_upper)
continue;
+ if (tdep->have_gs != have_gs)
+ continue;
if (tdesc_data != NULL)
tdesc_data_cleanup (tdesc_data);
return arches->gdbarch;
@@ -7982,6 +8067,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->have_linux_v1 = have_linux_v1;
tdep->have_linux_v2 = have_linux_v2;
tdep->have_tdb = have_tdb;
+ tdep->have_gs = have_gs;
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_believe_pcc_promotion (gdbarch, 0);
@@ -8157,10 +8243,12 @@ _initialize_s390_tdep (void)
initialize_tdesc_s390_te_linux64 ();
initialize_tdesc_s390_vx_linux64 ();
initialize_tdesc_s390_tevx_linux64 ();
+ initialize_tdesc_s390_gs_linux64 ();
initialize_tdesc_s390x_linux64 ();
initialize_tdesc_s390x_linux64v1 ();
initialize_tdesc_s390x_linux64v2 ();
initialize_tdesc_s390x_te_linux64 ();
initialize_tdesc_s390x_vx_linux64 ();
initialize_tdesc_s390x_tevx_linux64 ();
+ initialize_tdesc_s390x_gs_linux64 ();
}
diff --git a/gdb/s390-linux-tdep.h b/gdb/s390-linux-tdep.h
index 4f818b4..e895530 100644
--- a/gdb/s390-linux-tdep.h
+++ b/gdb/s390-linux-tdep.h
@@ -33,6 +33,10 @@
#define HWCAP_S390_VX 2048
#endif
+#ifndef HWCAP_S390_GS
+#define HWCAP_S390_GS 16384
+#endif
+
/* Register information. */
/* Program Status Word. */
@@ -166,8 +170,14 @@
#define S390_V29_REGNUM 119
#define S390_V30_REGNUM 120
#define S390_V31_REGNUM 121
+#define S390_GSD_REGNUM 122
+#define S390_GSSM_REGNUM 123
+#define S390_GSEPLA_REGNUM 124
+#define S390_BC_GSD_REGNUM 125
+#define S390_BC_GSSM_REGNUM 126
+#define S390_BC_GSEPLA_REGNUM 127
/* Total. */
-#define S390_NUM_REGS 122
+#define S390_NUM_REGS 128
/* Special register usage. */
#define S390_SP_REGNUM S390_R15_REGNUM
@@ -198,6 +208,8 @@ extern const struct regset s390_tdb_regset;
#define s390_sizeof_tdbregset 0x100
extern const struct regset s390_vxrs_low_regset;
extern const struct regset s390_vxrs_high_regset;
+extern const struct regset s390_gs_regset;
+extern const struct regset s390_gsbc_regset;
/* GNU/Linux target descriptions. */
extern struct target_desc *tdesc_s390_linux32;
@@ -209,11 +221,13 @@ extern struct target_desc *tdesc_s390_linux64v2;
extern struct target_desc *tdesc_s390_te_linux64;
extern struct target_desc *tdesc_s390_vx_linux64;
extern struct target_desc *tdesc_s390_tevx_linux64;
+extern struct target_desc *tdesc_s390_gs_linux64;
extern struct target_desc *tdesc_s390x_linux64;
extern struct target_desc *tdesc_s390x_linux64v1;
extern struct target_desc *tdesc_s390x_linux64v2;
extern struct target_desc *tdesc_s390x_te_linux64;
extern struct target_desc *tdesc_s390x_vx_linux64;
extern struct target_desc *tdesc_s390x_tevx_linux64;
+extern struct target_desc *tdesc_s390x_gs_linux64;
#endif

41
gdb-s390x-289e23a.patch Normal file
View File

@ -0,0 +1,41 @@
commit 289e23aa03084b22c73ebdcf18371f1e6666ead0
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Mon Sep 25 16:02:24 2017 +0200
S390: Document guarded-storage register support
This documents the newly added support for guarded-storage registers on
IBM z.
gdb/ChangeLog:
* NEWS: Advertise support for guarded-storage registers on IBM z.
gdb/doc/ChangeLog:
* gdb.texinfo (S/390 and System z Features): Document the new
features org.gnu.gdb.s390.gs and org.gnu.gdb.s390.gsbc.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6eb730f..b6283f6 100644
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index a3612db..3e74640 100644
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6b32089..9905ff6 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -41857,6 +41857,14 @@ through @samp{f15} to present the 128-bit wide vector registers
contain the 128-bit wide vector registers @samp{v16} through
@samp{v31}.
+The @samp{org.gnu.gdb.s390.gs} feature is optional. It should contain
+the 64-bit wide guarded-storage-control registers @samp{gsd},
+@samp{gssm}, and @samp{gsepla}.
+
+The @samp{org.gnu.gdb.s390.gsbc} feature is optional. It should contain
+the 64-bit wide guarded-storage broadcast control registers
+@samp{bc_gsd}, @samp{bc_gssm}, and @samp{bc_gsepla}.
+
@node Sparc Features
@subsection Sparc Features
@cindex target descriptions, sparc32 features

38
gdb-s390x-8fe09d7.patch Normal file
View File

@ -0,0 +1,38 @@
commit 8fe09d7421db51bc13c9228547d63e6315bd6bd0
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Thu Sep 21 17:45:18 2017 +0200
S/390: Fix Elf note swap s390_gs_bc vs. s390_gs_cb
Fix two typos that resulted in swapping the BFD names for the core note
register sections NT_S390_GS_CB and NT_S390_GS_BC.
bfd/ChangeLog:
* elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and
NT_S390_GS_BC, correct the previously swapped invocations of
elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4c8c12c..ebefab3 100644
diff --git a/bfd/elf.c b/bfd/elf.c
index 2aa2337..9b61f06 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9698,14 +9698,14 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
case NT_S390_GS_CB:
if (note->namesz == 6
&& strcmp (note->namedata, "LINUX") == 0)
- return elfcore_grok_s390_gs_bc (abfd, note);
+ return elfcore_grok_s390_gs_cb (abfd, note);
else
return TRUE;
case NT_S390_GS_BC:
if (note->namesz == 6
&& strcmp (note->namedata, "LINUX") == 0)
- return elfcore_grok_s390_gs_cb (abfd, note);
+ return elfcore_grok_s390_gs_bc (abfd, note);
else
return TRUE;

823
gdb-s390x-96235dc.patch Normal file
View File

@ -0,0 +1,823 @@
commit 96235dc1ac3730c4e490d19db2e8287c0a40f307
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Mon Sep 25 16:02:23 2017 +0200
S390: Add guarded-storage register definitions and tdescs
Newer Linux kernel versions offer two new register sets in support of the
z/Architecture's guarded storage facility. This patch adds XML
descriptions and the respective autogenerated .c and .dat files for
s390/s390x targets with this feature.
gdb/ChangeLog:
* features/s390-gs-linux64.xml: New file.
* features/s390-gs.xml: New file.
* features/s390-gsbc.xml: New file.
* features/s390x-gs-linux64.xml: New file.
* features/Makefile (WHICH): Add s390-gs-linux64 and
s390x-gs-linux64.
(s390-gs-linux64-expedite, s390x-gs-linux64-expedite): New macros.
(XMLTOC): Add s390-gs-linux64.xml and s390x-linux64.xml.
* features/s390-gs-linux64.c: New generated file.
* features/s390x-gs-linux64.c: New file.
* regformats/s390-gs-linux64.dat: New file.
* regformats/s390x-gs-linux64.dat: New file.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 910580d..7c6e67f 100644
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 0a9066c..8a7f377 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -78,6 +78,7 @@ WHICH = aarch64 \
s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \
s390-tevx-linux64 s390x-tevx-linux64 \
+ s390-gs-linux64 s390x-gs-linux64 \
tic6x-c64xp tic6x-c64x tic6x-c62x \
tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
@@ -105,12 +106,14 @@ s390-linux64v2-expedite = r14l,r15l,pswa
s390-te-linux64-expedite = r14l,r15l,pswa
s390-vx-linux64-expedite = r14l,r15l,pswa
s390-tevx-linux64-expedite = r14l,r15l,pswa
+s390-gs-linux64-expedite = r14,r15,pswa
s390x-linux64-expedite = r14,r15,pswa
s390x-linux64v1-expedite = r14,r15,pswa
s390x-linux64v2-expedite = r14,r15,pswa
s390x-te-linux64-expedite = r14,r15,pswa
s390x-vx-linux64-expedite = r14,r15,pswa
s390x-tevx-linux64-expedite = r14,r15,pswa
+s390x-gs-linux64-expedite = r14,r15,pswa
tic6x-c64xp-expedite = A15,PC
tic6x-c64x-expedite = A15,PC
tic6x-c62x-expedite = A15,PC
@@ -196,6 +199,8 @@ XMLTOC = \
s390-vx-linux64.xml \
s390x-tevx-linux64.xml \
s390x-vx-linux64.xml \
+ s390-gs-linux64.xml \
+ s390x-gs-linux64.xml \
tic6x-c62x-linux.xml \
tic6x-c62x.xml \
tic6x-c64x-linux.xml \
diff --git a/gdb/features/s390-gs-linux64.c b/gdb/features/s390-gs-linux64.c
new file mode 100644
index 0000000..ce24799
--- /dev/null
+++ b/gdb/features/s390-gs-linux64.c
@@ -0,0 +1,198 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: s390-gs-linux64.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_s390_gs_linux64;
+static void
+initialize_tdesc_s390_gs_linux64 (void)
+{
+ struct target_desc *result = allocate_target_description ();
+ struct tdesc_feature *feature;
+ struct tdesc_type *field_type;
+ struct tdesc_type *type;
+
+ set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core");
+ tdesc_create_reg (feature, "pswm", 0, 1, "psw", 32, "uint32");
+ tdesc_create_reg (feature, "pswa", 1, 1, "psw", 32, "uint32");
+ tdesc_create_reg (feature, "r0h", 2, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r0l", 3, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r1h", 4, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r1l", 5, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r2h", 6, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r2l", 7, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r3h", 8, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r3l", 9, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r4h", 10, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r4l", 11, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r5h", 12, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r5l", 13, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r6h", 14, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r6l", 15, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r7h", 16, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r7l", 17, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r8h", 18, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r8l", 19, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r9h", 20, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r9l", 21, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r10h", 22, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r10l", 23, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r11h", 24, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r11l", 25, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r12h", 26, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r12l", 27, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r13h", 28, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r13l", 29, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r14h", 30, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r14l", 31, 1, "lower", 32, "uint32");
+ tdesc_create_reg (feature, "r15h", 32, 1, "upper", 32, "uint32");
+ tdesc_create_reg (feature, "r15l", 33, 1, "lower", 32, "uint32");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr");
+ tdesc_create_reg (feature, "acr0", 34, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr1", 35, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr2", 36, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr3", 37, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr4", 38, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr5", 39, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr6", 40, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr7", 41, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr8", 42, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr9", 43, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr10", 44, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr11", 45, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr12", 46, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr13", 47, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr14", 48, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr15", 49, 1, "access", 32, "uint32");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr");
+ tdesc_create_reg (feature, "fpc", 50, 1, "float", 32, "uint32");
+ tdesc_create_reg (feature, "f0", 51, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f1", 52, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f2", 53, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f3", 54, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f4", 55, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f5", 56, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f6", 57, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f7", 58, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f8", 59, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f9", 60, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f10", 61, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f11", 62, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f12", 63, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f13", 64, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f14", 65, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f15", 66, 1, "float", 64, "ieee_double");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux");
+ tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32");
+ tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr");
+ tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb");
+ tdesc_create_reg (feature, "tdb0", 70, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tac", 71, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tct", 72, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "atia", 73, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr0", 74, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr1", 75, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr2", 76, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr3", 77, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr4", 78, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr5", 79, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr6", 80, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr7", 81, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr8", 82, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr9", 83, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr10", 84, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr11", 85, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr12", 86, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr13", 87, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr14", 88, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx");
+ field_type = tdesc_named_type (feature, "ieee_single");
+ tdesc_create_vector (feature, "v4f", field_type, 4);
+
+ field_type = tdesc_named_type (feature, "ieee_double");
+ tdesc_create_vector (feature, "v2d", field_type, 2);
+
+ field_type = tdesc_named_type (feature, "int8");
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
+
+ field_type = tdesc_named_type (feature, "int16");
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
+
+ field_type = tdesc_named_type (feature, "int32");
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
+
+ field_type = tdesc_named_type (feature, "int64");
+ tdesc_create_vector (feature, "v2i64", field_type, 2);
+
+ type = tdesc_create_union (feature, "vec128");
+ field_type = tdesc_named_type (feature, "v4f");
+ tdesc_add_field (type, "v4_float", field_type);
+ field_type = tdesc_named_type (feature, "v2d");
+ tdesc_add_field (type, "v2_double", field_type);
+ field_type = tdesc_named_type (feature, "v16i8");
+ tdesc_add_field (type, "v16_int8", field_type);
+ field_type = tdesc_named_type (feature, "v8i16");
+ tdesc_add_field (type, "v8_int16", field_type);
+ field_type = tdesc_named_type (feature, "v4i32");
+ tdesc_add_field (type, "v4_int32", field_type);
+ field_type = tdesc_named_type (feature, "v2i64");
+ tdesc_add_field (type, "v2_int64", field_type);
+ field_type = tdesc_named_type (feature, "uint128");
+ tdesc_add_field (type, "uint128", field_type);
+
+ tdesc_create_reg (feature, "v0l", 90, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v1l", 91, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v2l", 92, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v3l", 93, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v4l", 94, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v5l", 95, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v6l", 96, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v7l", 97, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v8l", 98, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v9l", 99, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v10l", 100, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v11l", 101, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v12l", 102, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v13l", 103, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v14l", 104, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v15l", 105, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v16", 106, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v17", 107, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v18", 108, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v19", 109, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v20", 110, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v21", 111, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v22", 112, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v23", 113, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v24", 114, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v25", 115, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v26", 116, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v27", 117, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v28", 118, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v29", 119, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v30", 120, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v31", 121, 1, NULL, 128, "vec128");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gs");
+ tdesc_create_reg (feature, "gsd", 122, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "gssm", 123, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "gsepla", 124, 1, "gs", 64, "data_ptr");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gsbc");
+ tdesc_create_reg (feature, "bc_gsd", 125, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "bc_gssm", 126, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "bc_gsepla", 127, 1, "gs", 64, "data_ptr");
+
+ tdesc_s390_gs_linux64 = result;
+}
diff --git a/gdb/features/s390-gs-linux64.xml b/gdb/features/s390-gs-linux64.xml
new file mode 100644
index 0000000..6dc39ee
--- /dev/null
+++ b/gdb/features/s390-gs-linux64.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- S/390 31-bit user-level code on a machine operating
+ in z/Architecture mode. -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <architecture>s390:31-bit</architecture>
+ <xi:include href="s390-core64.xml"/>
+ <xi:include href="s390-acr.xml"/>
+ <xi:include href="s390-fpr.xml"/>
+
+ <feature name="org.gnu.gdb.s390.linux">
+ <reg name="orig_r2" bitsize="32" type="uint32" group="system"/>
+ <reg name="last_break" bitsize="32" type="code_ptr" group="system" save-restore="no"/>
+ <reg name="system_call" bitsize="32" type="uint32" group="system"/>
+ </feature>
+
+ <xi:include href="s390-tdb.xml"/>
+ <xi:include href="s390-vx.xml"/>
+ <xi:include href="s390-gs.xml"/>
+ <xi:include href="s390-gsbc.xml"/>
+</target>
diff --git a/gdb/features/s390-gs.xml b/gdb/features/s390-gs.xml
new file mode 100644
index 0000000..46aa1d7
--- /dev/null
+++ b/gdb/features/s390-gs.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.s390.gs">
+ <reg name="gsd" bitsize="64" type="uint64" group="gs"/>
+ <reg name="gssm" bitsize="64" type="uint64" group="gs"/>
+ <reg name="gsepla" bitsize="64" type="data_ptr" group="gs"/>
+</feature>
diff --git a/gdb/features/s390-gsbc.xml b/gdb/features/s390-gsbc.xml
new file mode 100644
index 0000000..ee09187
--- /dev/null
+++ b/gdb/features/s390-gsbc.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.s390.gsbc">
+ <reg name="bc_gsd" bitsize="64" type="uint64" group="gs"/>
+ <reg name="bc_gssm" bitsize="64" type="uint64" group="gs"/>
+ <reg name="bc_gsepla" bitsize="64" type="data_ptr" group="gs"/>
+</feature>
diff --git a/gdb/features/s390x-gs-linux64.c b/gdb/features/s390x-gs-linux64.c
new file mode 100644
index 0000000..c101fd8
--- /dev/null
+++ b/gdb/features/s390x-gs-linux64.c
@@ -0,0 +1,182 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: s390x-gs-linux64.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_s390x_gs_linux64;
+static void
+initialize_tdesc_s390x_gs_linux64 (void)
+{
+ struct target_desc *result = allocate_target_description ();
+ struct tdesc_feature *feature;
+ struct tdesc_type *field_type;
+ struct tdesc_type *type;
+
+ set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit"));
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core");
+ tdesc_create_reg (feature, "pswm", 0, 1, "psw", 64, "uint64");
+ tdesc_create_reg (feature, "pswa", 1, 1, "psw", 64, "uint64");
+ tdesc_create_reg (feature, "r0", 2, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r1", 3, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r2", 4, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r3", 5, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r4", 6, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r5", 7, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r6", 8, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r7", 9, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r8", 10, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r9", 11, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r10", 12, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r11", 13, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r12", 14, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r13", 15, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r14", 16, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "r15", 17, 1, "general", 64, "uint64");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr");
+ tdesc_create_reg (feature, "acr0", 18, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr1", 19, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr2", 20, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr3", 21, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr4", 22, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr5", 23, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr6", 24, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr7", 25, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr8", 26, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr9", 27, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr10", 28, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr11", 29, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr12", 30, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr13", 31, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr14", 32, 1, "access", 32, "uint32");
+ tdesc_create_reg (feature, "acr15", 33, 1, "access", 32, "uint32");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr");
+ tdesc_create_reg (feature, "fpc", 34, 1, "float", 32, "uint32");
+ tdesc_create_reg (feature, "f0", 35, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f1", 36, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f2", 37, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f3", 38, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f4", 39, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f5", 40, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f6", 41, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f7", 42, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f8", 43, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f9", 44, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f10", 45, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f11", 46, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f12", 47, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f13", 48, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f14", 49, 1, "float", 64, "ieee_double");
+ tdesc_create_reg (feature, "f15", 50, 1, "float", 64, "ieee_double");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux");
+ tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64");
+ tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr");
+ tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb");
+ tdesc_create_reg (feature, "tdb0", 54, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tac", 55, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tct", 56, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "atia", 57, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr0", 58, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr1", 59, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr2", 60, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr3", 61, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr4", 62, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr5", 63, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr6", 64, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr7", 65, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr8", 66, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr9", 67, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr10", 68, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr11", 69, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr12", 70, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr13", 71, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr14", 72, 1, "tdb", 64, "uint64");
+ tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx");
+ field_type = tdesc_named_type (feature, "ieee_single");
+ tdesc_create_vector (feature, "v4f", field_type, 4);
+
+ field_type = tdesc_named_type (feature, "ieee_double");
+ tdesc_create_vector (feature, "v2d", field_type, 2);
+
+ field_type = tdesc_named_type (feature, "int8");
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
+
+ field_type = tdesc_named_type (feature, "int16");
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
+
+ field_type = tdesc_named_type (feature, "int32");
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
+
+ field_type = tdesc_named_type (feature, "int64");
+ tdesc_create_vector (feature, "v2i64", field_type, 2);
+
+ type = tdesc_create_union (feature, "vec128");
+ field_type = tdesc_named_type (feature, "v4f");
+ tdesc_add_field (type, "v4_float", field_type);
+ field_type = tdesc_named_type (feature, "v2d");
+ tdesc_add_field (type, "v2_double", field_type);
+ field_type = tdesc_named_type (feature, "v16i8");
+ tdesc_add_field (type, "v16_int8", field_type);
+ field_type = tdesc_named_type (feature, "v8i16");
+ tdesc_add_field (type, "v8_int16", field_type);
+ field_type = tdesc_named_type (feature, "v4i32");
+ tdesc_add_field (type, "v4_int32", field_type);
+ field_type = tdesc_named_type (feature, "v2i64");
+ tdesc_add_field (type, "v2_int64", field_type);
+ field_type = tdesc_named_type (feature, "uint128");
+ tdesc_add_field (type, "uint128", field_type);
+
+ tdesc_create_reg (feature, "v0l", 74, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v1l", 75, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v2l", 76, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v3l", 77, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v4l", 78, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v5l", 79, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v6l", 80, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v7l", 81, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v8l", 82, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v9l", 83, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v10l", 84, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v11l", 85, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v12l", 86, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v13l", 87, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v14l", 88, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v15l", 89, 1, NULL, 64, "uint64");
+ tdesc_create_reg (feature, "v16", 90, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v17", 91, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v18", 92, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v19", 93, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v20", 94, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v21", 95, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v22", 96, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v23", 97, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v24", 98, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v25", 99, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v26", 100, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v27", 101, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v28", 102, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v29", 103, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v30", 104, 1, NULL, 128, "vec128");
+ tdesc_create_reg (feature, "v31", 105, 1, NULL, 128, "vec128");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gs");
+ tdesc_create_reg (feature, "gsd", 106, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "gssm", 107, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "gsepla", 108, 1, "gs", 64, "data_ptr");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.s390.gsbc");
+ tdesc_create_reg (feature, "bc_gsd", 109, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "bc_gssm", 110, 1, "gs", 64, "uint64");
+ tdesc_create_reg (feature, "bc_gsepla", 111, 1, "gs", 64, "data_ptr");
+
+ tdesc_s390x_gs_linux64 = result;
+}
diff --git a/gdb/features/s390x-gs-linux64.xml b/gdb/features/s390x-gs-linux64.xml
new file mode 100644
index 0000000..f71010f
--- /dev/null
+++ b/gdb/features/s390x-gs-linux64.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- S/390 64-bit user-level code. -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <architecture>s390:64-bit</architecture>
+ <xi:include href="s390x-core64.xml"/>
+ <xi:include href="s390-acr.xml"/>
+ <xi:include href="s390-fpr.xml"/>
+
+ <feature name="org.gnu.gdb.s390.linux">
+ <reg name="orig_r2" bitsize="64" type="uint64" group="system"/>
+ <reg name="last_break" bitsize="64" type="code_ptr" group="system" save-restore="no"/>
+ <reg name="system_call" bitsize="32" type="uint32" group="system"/>
+ </feature>
+
+ <xi:include href="s390-tdb.xml"/>
+ <xi:include href="s390-vx.xml"/>
+ <xi:include href="s390-gs.xml"/>
+ <xi:include href="s390-gsbc.xml"/>
+</target>
diff --git a/gdb/regformats/s390-gs-linux64.dat b/gdb/regformats/s390-gs-linux64.dat
new file mode 100644
index 0000000..130c8ec
--- /dev/null
+++ b/gdb/regformats/s390-gs-linux64.dat
@@ -0,0 +1,133 @@
+# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro:
+# Generated from: s390-gs-linux64.xml
+name:s390_gs_linux64
+xmltarget:s390-gs-linux64.xml
+expedite:r14,r15,pswa
+32:pswm
+32:pswa
+32:r0h
+32:r0l
+32:r1h
+32:r1l
+32:r2h
+32:r2l
+32:r3h
+32:r3l
+32:r4h
+32:r4l
+32:r5h
+32:r5l
+32:r6h
+32:r6l
+32:r7h
+32:r7l
+32:r8h
+32:r8l
+32:r9h
+32:r9l
+32:r10h
+32:r10l
+32:r11h
+32:r11l
+32:r12h
+32:r12l
+32:r13h
+32:r13l
+32:r14h
+32:r14l
+32:r15h
+32:r15l
+32:acr0
+32:acr1
+32:acr2
+32:acr3
+32:acr4
+32:acr5
+32:acr6
+32:acr7
+32:acr8
+32:acr9
+32:acr10
+32:acr11
+32:acr12
+32:acr13
+32:acr14
+32:acr15
+32:fpc
+64:f0
+64:f1
+64:f2
+64:f3
+64:f4
+64:f5
+64:f6
+64:f7
+64:f8
+64:f9
+64:f10
+64:f11
+64:f12
+64:f13
+64:f14
+64:f15
+32:orig_r2
+32:last_break
+32:system_call
+64:tdb0
+64:tac
+64:tct
+64:atia
+64:tr0
+64:tr1
+64:tr2
+64:tr3
+64:tr4
+64:tr5
+64:tr6
+64:tr7
+64:tr8
+64:tr9
+64:tr10
+64:tr11
+64:tr12
+64:tr13
+64:tr14
+64:tr15
+64:v0l
+64:v1l
+64:v2l
+64:v3l
+64:v4l
+64:v5l
+64:v6l
+64:v7l
+64:v8l
+64:v9l
+64:v10l
+64:v11l
+64:v12l
+64:v13l
+64:v14l
+64:v15l
+128:v16
+128:v17
+128:v18
+128:v19
+128:v20
+128:v21
+128:v22
+128:v23
+128:v24
+128:v25
+128:v26
+128:v27
+128:v28
+128:v29
+128:v30
+128:v31
+64:gsd
+64:gssm
+64:gsepla
+64:bc_gsd
+64:bc_gssm
+64:bc_gsepla
diff --git a/gdb/regformats/s390x-gs-linux64.dat b/gdb/regformats/s390x-gs-linux64.dat
new file mode 100644
index 0000000..8cd5751
--- /dev/null
+++ b/gdb/regformats/s390x-gs-linux64.dat
@@ -0,0 +1,117 @@
+# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro:
+# Generated from: s390x-gs-linux64.xml
+name:s390x_gs_linux64
+xmltarget:s390x-gs-linux64.xml
+expedite:r14,r15,pswa
+64:pswm
+64:pswa
+64:r0
+64:r1
+64:r2
+64:r3
+64:r4
+64:r5
+64:r6
+64:r7
+64:r8
+64:r9
+64:r10
+64:r11
+64:r12
+64:r13
+64:r14
+64:r15
+32:acr0
+32:acr1
+32:acr2
+32:acr3
+32:acr4
+32:acr5
+32:acr6
+32:acr7
+32:acr8
+32:acr9
+32:acr10
+32:acr11
+32:acr12
+32:acr13
+32:acr14
+32:acr15
+32:fpc
+64:f0
+64:f1
+64:f2
+64:f3
+64:f4
+64:f5
+64:f6
+64:f7
+64:f8
+64:f9
+64:f10
+64:f11
+64:f12
+64:f13
+64:f14
+64:f15
+64:orig_r2
+64:last_break
+32:system_call
+64:tdb0
+64:tac
+64:tct
+64:atia
+64:tr0
+64:tr1
+64:tr2
+64:tr3
+64:tr4
+64:tr5
+64:tr6
+64:tr7
+64:tr8
+64:tr9
+64:tr10
+64:tr11
+64:tr12
+64:tr13
+64:tr14
+64:tr15
+64:v0l
+64:v1l
+64:v2l
+64:v3l
+64:v4l
+64:v5l
+64:v6l
+64:v7l
+64:v8l
+64:v9l
+64:v10l
+64:v11l
+64:v12l
+64:v13l
+64:v14l
+64:v15l
+128:v16
+128:v17
+128:v18
+128:v19
+128:v20
+128:v21
+128:v22
+128:v23
+128:v24
+128:v25
+128:v26
+128:v27
+128:v28
+128:v29
+128:v30
+128:v31
+64:gsd
+64:gssm
+64:gsepla
+64:bc_gsd
+64:bc_gssm
+64:bc_gsepla

257
gdb-s390x-ad33963.patch Normal file
View File

@ -0,0 +1,257 @@
commit ad3396348e0ebb61fdf71cff307bac08175ed366
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Mon Sep 25 16:02:23 2017 +0200
S390: Add guarded-storage register support to gdbserver
Enable gdbserver to deal with the new guarded-storage register sets.
gdb/gdbserver/ChangeLog:
* configure.srv (s390*-*-linux*): Add s390-gs-linux64.o and
s390x-gs-linux64.o to srv_regobj. Add s390-gs-linux64.xml,
s390x-gs-linux64.xml, s390-gs.xml, and s390-gsbc.xml to
srv_xmlfiles. Add s390-gs-linux64-ipa.o and
s390x-gs-linux64-ipa.o to ipa_obj.
* linux-s390-low.c (HWCAP_S390_GS): New define.
(s390_fill_gs, s390_store_gs, s390_fill_gsbc, s390_store_gsbc):
New functions.
(s390_regsets): Add regsets for NT_S390_GS_CB and NT_S390_GS_BC.
(s390_arch_setup): Check for guarded-storage support and choose
appropriate tdesc.
(initialize_low_arch): Invoke init_registers_s390_gs_linux64 and
init_registers_s390x_gs_linux64.
* linux-s390-tdesc.h (enum s390_linux_tdesc) <S390_TDESC_GS>: New
enum value.
(init_registers_s390x_gs_linux64, tdesc_s390x_gs_linux64)
(init_registers_s390_gs_linux64, tdesc_s390_gs_linux64): Declare.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index a82dd86..a628b96 100644
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 2a0c2b2..80b4b37 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -285,12 +285,14 @@ case "${target}" in
srv_regobj="${srv_regobj} s390-te-linux64.o"
srv_regobj="${srv_regobj} s390-vx-linux64.o"
srv_regobj="${srv_regobj} s390-tevx-linux64.o"
+ srv_regobj="${srv_regobj} s390-gs-linux64.o"
srv_regobj="${srv_regobj} s390x-linux64.o"
srv_regobj="${srv_regobj} s390x-linux64v1.o"
srv_regobj="${srv_regobj} s390x-linux64v2.o"
srv_regobj="${srv_regobj} s390x-te-linux64.o"
srv_regobj="${srv_regobj} s390x-vx-linux64.o"
srv_regobj="${srv_regobj} s390x-tevx-linux64.o"
+ srv_regobj="${srv_regobj} s390x-gs-linux64.o"
srv_tgtobj="$srv_linux_obj linux-s390-low.o"
srv_xmlfiles="s390-linux32.xml"
srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
@@ -301,12 +303,14 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390-vx-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390-tevx-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-gs-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-vx-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-tevx-linux64.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390x-gs-linux64.xml"
srv_xmlfiles="${srv_xmlfiles} s390-core32.xml"
srv_xmlfiles="${srv_xmlfiles} s390-core64.xml"
srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml"
@@ -314,6 +318,8 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml"
srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml"
srv_xmlfiles="${srv_xmlfiles} s390-vx.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-gs.xml"
+ srv_xmlfiles="${srv_xmlfiles} s390-gsbc.xml"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
@@ -327,12 +333,14 @@ case "${target}" in
ipa_obj="${ipa_obj} s390-vx-linux64-ipa.o"
ipa_obj="${ipa_obj} s390-te-linux64-ipa.o"
ipa_obj="${ipa_obj} s390-tevx-linux64-ipa.o"
+ ipa_obj="${ipa_obj} s390-gs-linux64-ipa.o"
ipa_obj="${ipa_obj} s390x-linux64-ipa.o"
ipa_obj="${ipa_obj} s390x-linux64v1-ipa.o"
ipa_obj="${ipa_obj} s390x-linux64v2-ipa.o"
ipa_obj="${ipa_obj} s390x-vx-linux64-ipa.o"
ipa_obj="${ipa_obj} s390x-te-linux64-ipa.o"
ipa_obj="${ipa_obj} s390x-tevx-linux64-ipa.o"
+ ipa_obj="${ipa_obj} s390x-gs-linux64-ipa.o"
;;
sh*-*-linux*) srv_regobj=reg-sh.o
srv_tgtobj="$srv_linux_obj linux-sh-low.o"
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index f02c2d3..d7aa31c 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -45,6 +45,10 @@
#define HWCAP_S390_VX 2048
#endif
+#ifndef HWCAP_S390_GS
+#define HWCAP_S390_GS 16384
+#endif
+
#define s390_num_regs 52
static int s390_regmap[] = {
@@ -370,6 +374,46 @@ s390_store_vxrs_high (struct regcache *regcache, const void *buf)
supply_register (regcache, v16 + i, (const char *) buf + 16 * i);
}
+static void
+s390_fill_gs (struct regcache *regcache, void *buf)
+{
+ int gsd = find_regno (regcache->tdesc, "gsd");
+ int i;
+
+ for (i = 0; i < 3; i++)
+ collect_register (regcache, gsd + i, (char *) buf + 8 * (i + 1));
+}
+
+static void
+s390_store_gs (struct regcache *regcache, const void *buf)
+{
+ int gsd = find_regno (regcache->tdesc, "gsd");
+ int i;
+
+ for (i = 0; i < 3; i++)
+ supply_register (regcache, gsd + i, (const char *) buf + 8 * (i + 1));
+}
+
+static void
+s390_fill_gsbc (struct regcache *regcache, void *buf)
+{
+ int bc_gsd = find_regno (regcache->tdesc, "bc_gsd");
+ int i;
+
+ for (i = 0; i < 3; i++)
+ collect_register (regcache, bc_gsd + i, (char *) buf + 8 * (i + 1));
+}
+
+static void
+s390_store_gsbc (struct regcache *regcache, const void *buf)
+{
+ int bc_gsd = find_regno (regcache->tdesc, "bc_gsd");
+ int i;
+
+ for (i = 0; i < 3; i++)
+ supply_register (regcache, bc_gsd + i, (const char *) buf + 8 * (i + 1));
+}
+
static struct regset_info s390_regsets[] = {
{ 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
#ifndef __s390x__
@@ -388,6 +432,10 @@ static struct regset_info s390_regsets[] = {
EXTENDED_REGS, s390_fill_vxrs_low, s390_store_vxrs_low },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0,
EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_GS_CB, 0,
+ EXTENDED_REGS, s390_fill_gs, s390_store_gs },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_GS_BC, 0,
+ EXTENDED_REGS, s390_fill_gsbc, s390_store_gsbc },
NULL_REGSET
};
@@ -501,6 +549,8 @@ s390_arch_setup (void)
int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256);
int have_regset_vxrs = s390_check_regset (pid, NT_S390_VXRS_LOW, 128)
&& s390_check_regset (pid, NT_S390_VXRS_HIGH, 256);
+ int have_regset_gs = s390_check_regset (pid, NT_S390_GS_CB, 32)
+ && s390_check_regset (pid, NT_S390_GS_BC, 32);
/* Assume 31-bit inferior process. */
if (have_regset_system_call)
@@ -529,8 +579,13 @@ s390_arch_setup (void)
if (have_regset_vxrs)
have_regset_vxrs =
(s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_VX) != 0;
+ if (have_regset_gs)
+ have_regset_gs =
+ (s390_get_hwcap (tdesc_s390x_linux64v2) & HWCAP_S390_GS) != 0;
- if (have_regset_vxrs)
+ if (have_regset_gs)
+ tdesc = tdesc_s390x_gs_linux64;
+ else if (have_regset_vxrs)
tdesc = (have_regset_tdb ? tdesc_s390x_tevx_linux64 :
tdesc_s390x_vx_linux64);
else if (have_regset_tdb)
@@ -554,8 +609,12 @@ s390_arch_setup (void)
have_regset_tdb = (s390_get_hwcap (tdesc) & HWCAP_S390_TE) != 0;
if (have_regset_vxrs)
have_regset_vxrs = (s390_get_hwcap (tdesc) & HWCAP_S390_VX) != 0;
+ if (have_regset_gs)
+ have_regset_gs = (s390_get_hwcap (tdesc) & HWCAP_S390_GS) != 0;
- if (have_regset_vxrs)
+ if (have_regset_gs)
+ tdesc = tdesc_s390_gs_linux64;
+ else if (have_regset_vxrs)
tdesc = (have_regset_tdb ? tdesc_s390_tevx_linux64 :
tdesc_s390_vx_linux64);
else if (have_regset_tdb)
@@ -596,6 +655,9 @@ s390_arch_setup (void)
case NT_S390_VXRS_HIGH:
regset->size = have_regset_vxrs ? 256 : 0;
break;
+ case NT_S390_GS_CB:
+ case NT_S390_GS_BC:
+ regset->size = have_regset_gs ? 32 : 0;
default:
break;
}
@@ -2797,6 +2859,7 @@ initialize_low_arch (void)
init_registers_s390_te_linux64 ();
init_registers_s390_vx_linux64 ();
init_registers_s390_tevx_linux64 ();
+ init_registers_s390_gs_linux64 ();
#ifdef __s390x__
init_registers_s390x_linux64 ();
init_registers_s390x_linux64v1 ();
@@ -2804,6 +2867,7 @@ initialize_low_arch (void)
init_registers_s390x_te_linux64 ();
init_registers_s390x_vx_linux64 ();
init_registers_s390x_tevx_linux64 ();
+ init_registers_s390x_gs_linux64 ();
#endif
initialize_regsets_info (&s390_regsets_info);
diff --git a/gdb/gdbserver/linux-s390-tdesc.h b/gdb/gdbserver/linux-s390-tdesc.h
index 6dc3899..170ab8a 100644
--- a/gdb/gdbserver/linux-s390-tdesc.h
+++ b/gdb/gdbserver/linux-s390-tdesc.h
@@ -31,6 +31,7 @@ enum s390_linux_tdesc {
S390_TDESC_TE,
S390_TDESC_VX,
S390_TDESC_TEVX,
+ S390_TDESC_GS,
};
#ifdef __s390x__
@@ -59,6 +60,10 @@ extern const struct target_desc *tdesc_s390x_vx_linux64;
void init_registers_s390x_tevx_linux64 (void);
extern const struct target_desc *tdesc_s390x_tevx_linux64;
+/* Defined in auto-generated file s390x-gs-linux64.c. */
+void init_registers_s390x_gs_linux64 (void);
+extern const struct target_desc *tdesc_s390x_gs_linux64;
+
#endif
#if !defined __s390x__ || !defined IN_PROCESS_AGENT
@@ -99,4 +104,8 @@ extern const struct target_desc *tdesc_s390_vx_linux64;
void init_registers_s390_tevx_linux64 (void);
extern const struct target_desc *tdesc_s390_tevx_linux64;
+/* Defined in auto-generated file s390-gs-linux64.c. */
+void init_registers_s390_gs_linux64 (void);
+extern const struct target_desc *tdesc_s390_gs_linux64;
+
#endif

76
gdb-upstream.patch Normal file
View File

@ -0,0 +1,76 @@
commit 16eb6b2db49e6cf2fdca56efd37689fcc170cd37
Author: Leszek Swirski <leszeks@google.com>
Date: Mon Aug 7 16:40:38 2017 +0200
Fix dwarf2_string_attr for -gsplit-dwarf
The dwarf2_string_attr did not allow DW_FORM_GNU_str_index as a form for
string types. This manifested as null strings in the namespace_name
lookup (replaced with "(anonymous namespace)") when debugging
Fission-compiled code.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,7 @@
+2017-08-07 Leszek Swirski <leszeks@google.com>
+
+ * dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.
+
2017-08-07 Simon Marchi <simon.marchi@ericsson.com>
* remote-sim.c (gdbsim_load): Remove char **argv local variable.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17623,7 +17623,8 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
if (attr != NULL)
{
if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
- || attr->form == DW_FORM_string || attr->form == DW_FORM_GNU_strp_alt)
+ || attr->form == DW_FORM_string || DW_FORM_GNU_str_index
+ || attr->form == DW_FORM_GNU_strp_alt)
str = DW_STRING (attr);
else
complaint (&symfile_complaints,
commit b33404388e5bbd8a1fddfde73cd4593ae2b557e8
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Aug 9 05:01:55 2017 -0700
gdb: Fix build failure with GCC 7
Fix:
/export/gnu/import/git/sources/binutils-gdb/gdb/dwarf2read.c: In function const char* dwarf2_string_attr(die_info*, unsigned int, dwarf2_cu*):
/export/gnu/import/git/sources/binutils-gdb/gdb/dwarf2read.c:17626:39: error: enum constant in boolean context [-Werror=int-in-bool-context]
|| attr->form == DW_FORM_string || DW_FORM_GNU_str_index
* dwarf2read.c (dwarf2_string_attr): Fix a typo.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,7 @@
+2017-08-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf2read.c (dwarf2_string_attr): Fix a typo.
+
2017-08-09 Alex Lindsay <alexlindsay239@gmail.com>
Yao Qi <yao.qi@linaro.org>
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17623,7 +17623,8 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
if (attr != NULL)
{
if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
- || attr->form == DW_FORM_string || DW_FORM_GNU_str_index
+ || attr->form == DW_FORM_string
+ || attr->form == DW_FORM_GNU_str_index
|| attr->form == DW_FORM_GNU_strp_alt)
str = DW_STRING (attr);
else

View File

@ -1,9 +1,6 @@
git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings
0ad7d8d1a3a36c6e04e3b6d37d8825f18d595723
entry for NEWS:
* Fortran: Support pointers to dynamic types.
gdb/NEWS | 2 +
gdb/c-valprint.c | 22 +++++
gdb/dwarf2read.c | 158 +++++++++++++++++++++++++-----
@ -26,10 +23,23 @@ entry for NEWS:
gdb/valprint.c | 6 --
20 files changed, 827 insertions(+), 110 deletions(-)
Index: gdb-7.99.90.20170420/gdb/c-valprint.c
Index: gdb-8.0/gdb/NEWS
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/c-valprint.c 2017-04-20 22:27:47.077032118 +0200
+++ gdb-7.99.90.20170420/gdb/c-valprint.c 2017-04-20 22:27:49.947050243 +0200
--- gdb-8.0.orig/gdb/NEWS 2017-06-09 05:51:58.211401718 +0200
+++ gdb-8.0/gdb/NEWS 2017-06-09 05:52:11.586504927 +0200
@@ -1,6 +1,8 @@
What has changed in GDB?
(Organized release by release)
+* Fortran: Support pointers to dynamic types.
+
*** Changes in GDB 8.0
* GDB now supports access to the PKU register on GNU/Linux. The register is
Index: gdb-8.0/gdb/c-valprint.c
===================================================================
--- gdb-8.0.orig/gdb/c-valprint.c 2017-06-09 05:51:55.838383406 +0200
+++ gdb-8.0/gdb/c-valprint.c 2017-06-09 05:51:58.212401726 +0200
@@ -650,6 +650,28 @@
else
{
@ -59,10 +69,10 @@ Index: gdb-7.99.90.20170420/gdb/c-valprint.c
fprintf_filtered (stream, "(");
type_print (value_type (val), "", stream, -1);
fprintf_filtered (stream, ") ");
Index: gdb-7.99.90.20170420/gdb/dwarf2read.c
Index: gdb-8.0/gdb/dwarf2read.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/dwarf2read.c 2017-04-20 22:27:47.091032206 +0200
+++ gdb-7.99.90.20170420/gdb/dwarf2read.c 2017-04-20 22:28:28.878296105 +0200
--- gdb-8.0.orig/gdb/dwarf2read.c 2017-06-09 05:51:55.859383569 +0200
+++ gdb-8.0/gdb/dwarf2read.c 2017-06-09 05:51:58.218401772 +0200
@@ -1872,7 +1872,8 @@
static int attr_to_dynamic_prop (const struct attribute *attr,
@ -323,10 +333,10 @@ Index: gdb-7.99.90.20170420/gdb/dwarf2read.c
add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type, objfile);
if (dwarf2_per_objfile->die_type_hash == NULL)
Index: gdb-7.99.90.20170420/gdb/f-typeprint.c
Index: gdb-8.0/gdb/f-typeprint.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/f-typeprint.c 2017-04-20 22:27:26.288900835 +0200
+++ gdb-7.99.90.20170420/gdb/f-typeprint.c 2017-04-20 22:27:49.953050280 +0200
--- gdb-8.0.orig/gdb/f-typeprint.c 2017-06-09 05:51:39.273255581 +0200
+++ gdb-8.0/gdb/f-typeprint.c 2017-06-09 05:51:58.218401772 +0200
@@ -37,7 +37,7 @@
#endif
@ -476,11 +486,11 @@ Index: gdb-7.99.90.20170420/gdb/f-typeprint.c
fputs_filtered ("\n", stream);
}
fprintfi_filtered (level, stream, "End Type ");
Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
Index: gdb-8.0/gdb/gdbtypes.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/gdbtypes.c 2017-04-20 22:27:47.093032219 +0200
+++ gdb-7.99.90.20170420/gdb/gdbtypes.c 2017-04-20 22:27:49.954050287 +0200
@@ -1840,7 +1840,8 @@
--- gdb-8.0.orig/gdb/gdbtypes.c 2017-06-09 05:51:55.864383607 +0200
+++ gdb-8.0/gdb/gdbtypes.c 2017-06-09 05:51:58.219401780 +0200
@@ -1839,7 +1839,8 @@
type = check_typedef (type);
/* We only want to recognize references at the outermost level. */
@ -490,7 +500,7 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
type = check_typedef (TYPE_TARGET_TYPE (type));
/* Types that have a dynamic TYPE_DATA_LOCATION are considered
@@ -1874,6 +1875,7 @@
@@ -1873,6 +1874,7 @@
}
case TYPE_CODE_ARRAY:
@ -498,7 +508,7 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
{
gdb_assert (TYPE_NFIELDS (type) == 1);
@@ -1986,7 +1988,8 @@
@@ -1985,7 +1987,8 @@
struct type *ary_dim;
struct dynamic_prop *prop;
@ -508,7 +518,7 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
type = copy_type (type);
@@ -2011,13 +2014,17 @@
@@ -2010,13 +2013,17 @@
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
@ -529,7 +539,7 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
}
/* Resolve dynamic bounds of members of the union TYPE to static
@@ -2147,6 +2154,28 @@
@@ -2146,6 +2153,28 @@
return resolved_type;
}
@ -558,7 +568,7 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
/* Worker for resolved_dynamic_type. */
static struct type *
@@ -2195,7 +2224,12 @@
@@ -2194,7 +2223,12 @@
break;
}
@ -571,10 +581,10 @@ Index: gdb-7.99.90.20170420/gdb/gdbtypes.c
resolved_type = resolve_dynamic_array (type, addr_stack);
break;
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.cc
Index: gdb-8.0/gdb/testsuite/gdb.cp/vla-cxx.cc
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.cp/vla-cxx.cc 2017-04-20 22:27:47.094032225 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.cc 2017-04-20 22:27:49.955050293 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.cp/vla-cxx.cc 2017-06-09 05:51:55.864383607 +0200
+++ gdb-8.0/gdb/testsuite/gdb.cp/vla-cxx.cc 2017-06-09 05:51:58.219401780 +0200
@@ -15,6 +15,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -603,10 +613,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.cc
+
return vla[2];
}
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.exp
Index: gdb-8.0/gdb/testsuite/gdb.cp/vla-cxx.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.cp/vla-cxx.exp 2017-04-20 22:27:47.094032225 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.exp 2017-04-20 22:27:49.955050293 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.cp/vla-cxx.exp 2017-06-09 05:51:55.864383607 +0200
+++ gdb-8.0/gdb/testsuite/gdb.cp/vla-cxx.exp 2017-06-09 05:51:58.220401787 +0200
@@ -23,6 +23,12 @@
return -1
}
@ -627,10 +637,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.cp/vla-cxx.exp
+gdb_test "ptype ptr" "int \\(\\*\\)\\\[3\\\]"
+gdb_test "print ptr" "\\(int \\(\\*\\)\\\[3\\\]\\) $hex"
+gdb_test "print *ptr" " = \\{5, 7, 9\\}"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/pointers.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.exp 2017-04-20 22:27:49.955050293 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/pointers.exp 2017-06-09 05:51:58.220401787 +0200
@@ -0,0 +1,143 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
@ -775,10 +785,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.exp
+gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array"
+gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla"
+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.f90
Index: gdb-8.0/gdb/testsuite/gdb.fortran/pointers.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.f90 2017-04-20 22:27:49.955050293 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/pointers.f90 2017-06-09 05:51:58.220401787 +0200
@@ -0,0 +1,109 @@
+! Copyright 2016 Free Software Foundation, Inc.
+!
@ -889,10 +899,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/pointers.f90
+ intv = intv + 1 ! After value assignment
+
+end program pointers
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/print_type.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/print_type.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/print_type.exp 2017-04-20 22:27:49.956050299 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/print_type.exp 2017-06-09 05:51:58.220401787 +0200
@@ -0,0 +1,100 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
@ -994,10 +1004,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/print_type.exp
+ }
+}
+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-ptype.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/vla-ptype.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.fortran/vla-ptype.exp 2017-04-20 22:27:47.094032225 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-ptype.exp 2017-04-20 22:27:49.956050299 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.fortran/vla-ptype.exp 2017-06-09 05:51:55.865383615 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/vla-ptype.exp 2017-06-09 05:51:58.221401795 +0200
@@ -32,9 +32,9 @@
# Check the ptype of various VLA states and pointer to VLA's.
gdb_breakpoint [gdb_get_line_number "vla1-init"]
@ -1035,10 +1045,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-ptype.exp
gdb_test "ptype vla2(5, 45, 20)" \
"no such vector element \\\(vector not allocated\\\)" \
"ptype vla2(5, 45, 20) not allocated"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/vla-strings.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.exp 2017-04-20 22:27:49.956050299 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/vla-strings.exp 2017-06-09 05:51:58.221401795 +0200
@@ -0,0 +1,103 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
@ -1143,10 +1153,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.exp
+ pass $test
+ }
+}
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.f90
Index: gdb-8.0/gdb/testsuite/gdb.fortran/vla-strings.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.f90 2017-04-20 22:27:49.956050299 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/vla-strings.f90 2017-06-09 05:51:58.221401795 +0200
@@ -0,0 +1,39 @@
+! Copyright 2016 Free Software Foundation, Inc.
+!
@ -1187,10 +1197,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-strings.f90
+ var_char_p => null()
+ l = associated(var_char_p) ! var_char_p-not-associated
+end program vla_strings
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-type.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/vla-type.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.fortran/vla-type.exp 2017-04-20 22:27:47.094032225 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-type.exp 2017-04-20 22:27:49.956050299 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.fortran/vla-type.exp 2017-06-09 05:51:55.866383622 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/vla-type.exp 2017-06-09 05:51:58.221401795 +0200
@@ -132,7 +132,10 @@
"End Type one" ]
@ -1212,10 +1222,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-type.exp
"End Type one" ] \
"ptype fivedynarr(2)%tone, not allocated"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-value.exp
Index: gdb-8.0/gdb/testsuite/gdb.fortran/vla-value.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.fortran/vla-value.exp 2017-04-20 22:27:47.095032231 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-value.exp 2017-04-20 22:27:49.957050306 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.fortran/vla-value.exp 2017-06-09 05:51:55.866383622 +0200
+++ gdb-8.0/gdb/testsuite/gdb.fortran/vla-value.exp 2017-06-09 05:51:58.221401795 +0200
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -1268,10 +1278,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/vla-value.exp
"print associated &pvla"
gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-var-child-f.exp
Index: gdb-8.0/gdb/testsuite/gdb.mi/mi-var-child-f.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2017-04-20 22:27:47.095032231 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2017-04-20 22:27:49.957050306 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2017-06-09 05:51:55.867383630 +0200
+++ gdb-8.0/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2017-06-09 05:51:58.222401803 +0200
@@ -17,6 +17,7 @@
load_lib mi-support.exp
@ -1293,10 +1303,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-var-child-f.exp
set children [list [list "array.-1" "-1" 2 "$int4 \\(2\\)"] \
[list "array.0" "0" 2 "$int4 \\(2\\)"] \
Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
Index: gdb-8.0/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2017-04-20 22:27:47.095032231 +0200
+++ gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2017-04-20 22:27:49.957050306 +0200
--- gdb-8.0.orig/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2017-06-09 05:51:55.867383630 +0200
+++ gdb-8.0/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2017-06-09 05:51:58.222401803 +0200
@@ -17,7 +17,9 @@
# Array (VLA).
@ -1395,10 +1405,10 @@ Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
"info type variable pvla2_associated"
mi_gdb_test "592-var-show-format pvla2_associated" \
"592\\^done,format=\"natural\"" \
Index: gdb-7.99.90.20170420/gdb/typeprint.c
Index: gdb-8.0/gdb/typeprint.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/typeprint.c 2017-04-20 22:27:47.095032231 +0200
+++ gdb-7.99.90.20170420/gdb/typeprint.c 2017-04-20 22:27:49.957050306 +0200
--- gdb-8.0.orig/gdb/typeprint.c 2017-06-09 05:51:55.867383630 +0200
+++ gdb-8.0/gdb/typeprint.c 2017-06-09 05:51:58.222401803 +0200
@@ -474,6 +474,25 @@
printf_filtered (" */\n");
}
@ -1425,10 +1435,10 @@ Index: gdb-7.99.90.20170420/gdb/typeprint.c
LA_PRINT_TYPE (type, "", gdb_stdout, show, 0, &flags);
printf_filtered ("\n");
Index: gdb-7.99.90.20170420/gdb/valops.c
Index: gdb-8.0/gdb/valops.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/valops.c 2017-04-20 22:27:47.096032238 +0200
+++ gdb-7.99.90.20170420/gdb/valops.c 2017-04-20 22:27:49.958050312 +0200
--- gdb-8.0.orig/gdb/valops.c 2017-06-09 05:51:55.869383646 +0200
+++ gdb-8.0/gdb/valops.c 2017-06-09 05:51:58.223401811 +0200
@@ -1574,6 +1574,19 @@
if (TYPE_CODE (base_type) == TYPE_CODE_PTR)
{
@ -1459,10 +1469,10 @@ Index: gdb-7.99.90.20170420/gdb/valops.c
enc_type = value_type (arg2);
return readjust_indirect_value_type (arg2, enc_type, base_type, arg1);
Index: gdb-7.99.90.20170420/gdb/valprint.c
Index: gdb-8.0/gdb/valprint.c
===================================================================
--- gdb-7.99.90.20170420.orig/gdb/valprint.c 2017-04-20 22:25:38.224218378 +0200
+++ gdb-7.99.90.20170420/gdb/valprint.c 2017-04-20 22:27:49.959050318 +0200
--- gdb-8.0.orig/gdb/valprint.c 2017-06-04 17:51:27.000000000 +0200
+++ gdb-8.0/gdb/valprint.c 2017-06-09 05:51:58.224401818 +0200
@@ -1166,12 +1166,6 @@
return 0;
}

View File

@ -1,3 +1,68 @@
-------------------------------------------------------------------
Wed Oct 4 11:20:39 UTC 2017 - matz@suse.com
- Link gdb against a bundled libipt (processor trace
library) on x86_64 and i686 for improved tracing support
on Intel CPUs. [bnc#985550]
Adds v1.6.1.tar.gz and patches
v1.5-libipt-static.patch and v1.6.1-implicit-fallthrough.patch.
-------------------------------------------------------------------
Mon Oct 2 14:49:04 UTC 2017 - matz@suse.com
- Rebase to 8.0.1 release (fixing PR21886, PR22046)
- Updated libstdc++ pretty printers to
- Replace gdb-libstdc++-v3-python-6.3.1-20170212.tar.bz2 with
gdb-libstdc++-v3-python-7.1.1-20170526.tar.bz2 .
- Add patches for s390x z14 feates [fate #321514, fate #322272]
gdb-s390x-1b63490.patch
gdb-s390x-289e23a.patch
gdb-s390x-8fe09d7.patch
gdb-s390x-96235dc.patch
gdb-s390x-ad33963.patch
- Adjust some patches:
gdb-ppc-power7-test.patch
gdb-rhbz795424-bitpos-20of25.patch
gdb-rhbz795424-bitpos-21of25.patch
gdb-vla-intel-fortran-vla-strings.patch
- Add some patches from Fedora:
gdb-rhbz1420304-s390x-01of35.patch
gdb-rhbz1420304-s390x-02of35.patch
gdb-rhbz1420304-s390x-03of35.patch
gdb-rhbz1420304-s390x-04of35.patch
gdb-rhbz1420304-s390x-05of35.patch
gdb-rhbz1420304-s390x-06of35.patch
gdb-rhbz1420304-s390x-07of35.patch
gdb-rhbz1420304-s390x-08of35.patch
gdb-rhbz1420304-s390x-09of35.patch
gdb-rhbz1420304-s390x-10of35.patch
gdb-rhbz1420304-s390x-11of35.patch
gdb-rhbz1420304-s390x-12of35.patch
gdb-rhbz1420304-s390x-13of35.patch
gdb-rhbz1420304-s390x-14of35.patch
gdb-rhbz1420304-s390x-15of35.patch
gdb-rhbz1420304-s390x-16of35.patch
gdb-rhbz1420304-s390x-17of35.patch
gdb-rhbz1420304-s390x-18of35.patch
gdb-rhbz1420304-s390x-19of35.patch
gdb-rhbz1420304-s390x-20of35.patch
gdb-rhbz1420304-s390x-21of35.patch
gdb-rhbz1420304-s390x-22of35.patch
gdb-rhbz1420304-s390x-23of35.patch
gdb-rhbz1420304-s390x-24of35.patch
gdb-rhbz1420304-s390x-25of35.patch
gdb-rhbz1420304-s390x-26of35.patch
gdb-rhbz1420304-s390x-27of35.patch
gdb-rhbz1420304-s390x-28of35.patch
gdb-rhbz1420304-s390x-29of35.patch
gdb-rhbz1420304-s390x-30of35.patch
gdb-rhbz1420304-s390x-31of35.patch
gdb-rhbz1420304-s390x-32of35.patch
gdb-rhbz1420304-s390x-33of35.patch
gdb-rhbz1420304-s390x-34of35.patch
gdb-rhbz1420304-s390x-35of35.patch
gdb-upstream.patch
-------------------------------------------------------------------
Wed Sep 13 14:09:26 UTC 2017 - matz@suse.com

397
gdb.spec
View File

@ -24,7 +24,7 @@ License: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and LGPL-3
Group: Development/Tools/Debuggers
Name: gdb
Version: 8.0
Version: 8.0.1
Release: 0
# The release always contains a leading reserved number, start it at 1.
@ -74,13 +74,17 @@ Source3: gdb-gstack.man
#=fedora
Source4: gdbinit
# libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental).
%global libstdcxxpython gdb-libstdc++-v3-python-6.3.1-20170212
# libstdc++ pretty printers from GCC SVN.
%global libstdcxxpython gdb-libstdc++-v3-python-7.1.1-20170526
Source5: %{libstdcxxpython}.tar.bz2
# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664).
Source6: gdbtui
# libipt: Intel Processor Trace Decoder Library
%global libipt_version 1.6.1
Source7: v%{libipt_version}.tar.gz
# Infrastructure to sync patches from the Fedora rpm
Source10: patchlist.pl
Source11: patchname_get.sh
@ -89,142 +93,189 @@ Source13: gdb-rpmlintrc
#Fedora Packages begin
Patch1: gdb-6.3-rh-testversion-20041202.patch
Patch2: gdb-archer.patch
Patch3: gdb-vla-intel-fortran-strides.patch
Patch4: gdb-vla-intel-fortran-vla-strings.patch
Patch5: gdb-vla-intel-stringbt-fix.patch
Patch6: gdb-6.3-rh-dummykfail-20041202.patch
Patch7: gdb-6.3-ppc64syscall-20040622.patch
Patch8: gdb-6.3-ppc64displaysymbol-20041124.patch
Patch9: gdb-6.3-gstack-20050411.patch
Patch10: gdb-6.3-test-pie-20050107.patch
Patch11: gdb-6.3-test-self-20050110.patch
Patch12: gdb-6.3-test-dtorfix-20050121.patch
Patch13: gdb-6.3-test-movedir-20050125.patch
Patch14: gdb-6.3-threaded-watchpoints2-20050225.patch
Patch15: gdb-6.3-inferior-notification-20050721.patch
Patch16: gdb-6.3-inheritancetest-20050726.patch
Patch17: gdb-6.3-readnever-20050907.patch
Patch18: gdb-6.5-bz203661-emit-relocs.patch
Patch19: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Patch20: gdb-6.5-sharedlibrary-path.patch
Patch21: gdb-6.5-BEA-testsuite.patch
Patch22: gdb-6.5-last-address-space-byte-test.patch
Patch23: gdb-6.5-readline-long-line-crash-test.patch
Patch24: gdb-6.5-bz216711-clone-is-outermost.patch
Patch25: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch26: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
Patch27: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch28: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch29: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch30: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch31: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch32: gdb-6.6-bz235197-fork-detach-info.patch
Patch33: gdb-6.6-testsuite-timeouts.patch
Patch34: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch35: gdb-6.6-scheduler_locking-step-is-default.patch
Patch36: gdb-6.3-attach-see-vdso-test.patch
Patch37: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch38: gdb-6.6-buildid-locate.patch
Patch39: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch40: gdb-6.6-buildid-locate-rpm.patch
Patch41: gdb-6.7-charsign-test.patch
Patch42: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch43: gdb-6.7-testsuite-stable-results.patch
Patch44: gdb-6.5-ia64-libunwind-leak-test.patch
Patch45: gdb-6.5-missed-trap-on-step-test.patch
Patch46: gdb-6.5-gcore-buffer-limit-test.patch
Patch47: gdb-6.6-threads-static-test.patch
Patch48: gdb-6.3-mapping-zero-inode-test.patch
Patch49: gdb-6.3-focus-cmd-prev-test.patch
Patch50: gdb-6.8-bz442765-threaded-exec-test.patch
Patch51: gdb-6.8-sparc64-silence-memcpy-check.patch
Patch52: gdb-6.5-section-num-fixup-test.patch
Patch53: gdb-6.8-bz436037-reg-no-longer-active.patch
Patch54: gdb-6.8-watchpoint-conditionals-test.patch
Patch55: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch56: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch57: gdb-core-open-vdso-warning.patch
Patch58: gdb-x86_64-i386-syscall-restart.patch
Patch59: gdb-bz533176-fortran-omp-step.patch
Patch60: gdb-follow-child-stale-parent.patch
Patch61: gdb-ccache-workaround.patch
Patch62: gdb-archer-pie-addons.patch
Patch63: gdb-archer-pie-addons-keep-disabled.patch
Patch64: gdb-lineno-makeup-test.patch
Patch65: gdb-ppc-power7-test.patch
Patch66: gdb-bz541866-rwatch-before-run.patch
Patch67: gdb-moribund-utrace-workaround.patch
Patch68: gdb-archer-next-over-throw-cxx-exec.patch
Patch69: gdb-bz601887-dwarf4-rh-test.patch
Patch70: gdb-6.6-buildid-locate-core-as-arg.patch
Patch71: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch72: gdb-test-bt-cfi-without-die.patch
Patch73: gdb-gdb-add-index-script.patch
Patch74: gdb-bz568248-oom-is-error.patch
Patch75: gdb-bz634108-solib_address.patch
Patch76: gdb-test-pid0-core.patch
Patch77: gdb-test-dw2-aranges.patch
Patch78: gdb-test-expr-cumulative-archer.patch
Patch79: gdb-physname-pr11734-test.patch
Patch80: gdb-physname-pr12273-test.patch
Patch81: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
Patch82: gdb-test-ivy-bridge.patch
Patch83: gdb-glibc-vdso-workaround.patch
Patch84: gdb-runtest-pie-override.patch
Patch85: gdb-attach-fail-reasons-5of5.patch
Patch86: gdb-stale-frame_info.patch
Patch87: gdb-glibc-strstr-workaround.patch
Patch88: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch89: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch90: gdb-rhbz795424-bitpos-20of25.patch
Patch91: gdb-rhbz795424-bitpos-21of25.patch
Patch92: gdb-rhbz795424-bitpos-22of25.patch
Patch93: gdb-rhbz795424-bitpos-23of25.patch
Patch94: gdb-rhbz795424-bitpos-25of25.patch
Patch95: gdb-rhbz795424-bitpos-25of25-test.patch
Patch96: gdb-rhbz795424-bitpos-lazyvalue.patch
Patch97: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch98: gdb-gnat-dwarf-crash-3of3.patch
Patch99: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch100: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch101: gdb-archer-vla-tests.patch
Patch102: gdb-vla-intel-tests.patch
Patch103: gdb-btrobust.patch
Patch104: gdb-fortran-frame-string.patch
Patch105: gdb-python-gil.patch
Patch106: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch107: gdb-jit-reader-multilib.patch
Patch108: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch109: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch110: gdb-rhbz1350436-type-printers-error.patch
Patch111: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch112: gdb-bz1219747-attach-kills.patch
Patch113: gdb-fedora-libncursesw.patch
Patch114: gdb-opcodes-clflushopt-test.patch
Patch115: gdb-dts-rhel6-python-compat.patch
Patch116: gdb-6.6-buildid-locate-rpm-scl.patch
Patch117: gdb-readline62-ask-more-rh.patch
Patch118: gdb-6.8-attach-signalled-detach-stopped.patch
Patch119: gdb-6.8-quit-never-aborts.patch
Patch120: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch121: gdb-container-rh-pkg.patch
Patch122: gdb-rhbz1325795-framefilters-test.patch
Patch123: gdb-linux_perf-bundle.patch
Patch124: gdb-tls-1of2.patch
Patch125: gdb-tls-2of2.patch
Patch126: gdb-libexec-add-index.patch
Patch127: gdb-add-index-chmod.patch
Patch128: gdb-rhbz1398387-tab-crash-test.patch
Patch130: gdb-testsuite-readline63-sigint.patch
Patch2: gdb-upstream.patch
Patch3: gdb-archer.patch
Patch4: gdb-vla-intel-fortran-strides.patch
Patch5: gdb-vla-intel-fortran-vla-strings.patch
Patch6: gdb-vla-intel-stringbt-fix.patch
Patch7: gdb-6.3-rh-dummykfail-20041202.patch
Patch8: gdb-6.3-ppc64syscall-20040622.patch
Patch9: gdb-6.3-ppc64displaysymbol-20041124.patch
Patch10: gdb-6.3-gstack-20050411.patch
Patch11: gdb-6.3-test-pie-20050107.patch
Patch12: gdb-6.3-test-self-20050110.patch
Patch13: gdb-6.3-test-dtorfix-20050121.patch
Patch14: gdb-6.3-test-movedir-20050125.patch
Patch15: gdb-6.3-threaded-watchpoints2-20050225.patch
Patch16: gdb-6.3-inferior-notification-20050721.patch
Patch17: gdb-6.3-inheritancetest-20050726.patch
Patch18: gdb-6.3-readnever-20050907.patch
Patch19: gdb-6.5-bz203661-emit-relocs.patch
Patch20: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Patch21: gdb-6.5-sharedlibrary-path.patch
Patch22: gdb-6.5-BEA-testsuite.patch
Patch23: gdb-6.5-last-address-space-byte-test.patch
Patch24: gdb-6.5-readline-long-line-crash-test.patch
Patch25: gdb-6.5-bz216711-clone-is-outermost.patch
Patch26: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch27: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
Patch28: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch29: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch30: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch31: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch32: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch33: gdb-6.6-bz235197-fork-detach-info.patch
Patch34: gdb-6.6-testsuite-timeouts.patch
Patch35: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch36: gdb-6.6-scheduler_locking-step-is-default.patch
Patch37: gdb-6.3-attach-see-vdso-test.patch
Patch38: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch39: gdb-6.6-buildid-locate.patch
Patch40: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch41: gdb-6.6-buildid-locate-rpm.patch
Patch42: gdb-6.7-charsign-test.patch
Patch43: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch44: gdb-6.7-testsuite-stable-results.patch
Patch45: gdb-6.5-ia64-libunwind-leak-test.patch
Patch46: gdb-6.5-missed-trap-on-step-test.patch
Patch47: gdb-6.5-gcore-buffer-limit-test.patch
Patch48: gdb-6.6-threads-static-test.patch
Patch49: gdb-6.3-mapping-zero-inode-test.patch
Patch50: gdb-6.3-focus-cmd-prev-test.patch
Patch51: gdb-6.8-bz442765-threaded-exec-test.patch
Patch52: gdb-6.8-sparc64-silence-memcpy-check.patch
Patch53: gdb-6.5-section-num-fixup-test.patch
Patch54: gdb-6.8-bz436037-reg-no-longer-active.patch
Patch55: gdb-6.8-watchpoint-conditionals-test.patch
Patch56: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch57: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch58: gdb-core-open-vdso-warning.patch
Patch59: gdb-x86_64-i386-syscall-restart.patch
Patch60: gdb-bz533176-fortran-omp-step.patch
Patch61: gdb-follow-child-stale-parent.patch
Patch62: gdb-ccache-workaround.patch
Patch63: gdb-archer-pie-addons.patch
Patch64: gdb-archer-pie-addons-keep-disabled.patch
Patch65: gdb-lineno-makeup-test.patch
Patch66: gdb-ppc-power7-test.patch
Patch67: gdb-bz541866-rwatch-before-run.patch
Patch68: gdb-moribund-utrace-workaround.patch
Patch69: gdb-archer-next-over-throw-cxx-exec.patch
Patch70: gdb-bz601887-dwarf4-rh-test.patch
Patch71: gdb-6.6-buildid-locate-core-as-arg.patch
Patch72: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch73: gdb-test-bt-cfi-without-die.patch
Patch74: gdb-gdb-add-index-script.patch
Patch75: gdb-bz568248-oom-is-error.patch
Patch76: gdb-bz634108-solib_address.patch
Patch77: gdb-test-pid0-core.patch
Patch78: gdb-test-dw2-aranges.patch
Patch79: gdb-test-expr-cumulative-archer.patch
Patch80: gdb-physname-pr11734-test.patch
Patch81: gdb-physname-pr12273-test.patch
Patch82: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
Patch83: gdb-test-ivy-bridge.patch
Patch84: gdb-glibc-vdso-workaround.patch
Patch85: gdb-runtest-pie-override.patch
Patch86: gdb-attach-fail-reasons-5of5.patch
Patch87: gdb-stale-frame_info.patch
Patch88: gdb-glibc-strstr-workaround.patch
Patch89: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch90: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch91: gdb-rhbz1420304-s390x-01of35.patch
Patch92: gdb-rhbz1420304-s390x-02of35.patch
Patch93: gdb-rhbz1420304-s390x-03of35.patch
Patch94: gdb-rhbz1420304-s390x-04of35.patch
Patch95: gdb-rhbz1420304-s390x-05of35.patch
Patch96: gdb-rhbz1420304-s390x-06of35.patch
Patch97: gdb-rhbz1420304-s390x-07of35.patch
Patch98: gdb-rhbz1420304-s390x-08of35.patch
Patch99: gdb-rhbz1420304-s390x-09of35.patch
Patch100: gdb-rhbz1420304-s390x-10of35.patch
Patch101: gdb-rhbz1420304-s390x-11of35.patch
Patch102: gdb-rhbz1420304-s390x-12of35.patch
Patch103: gdb-rhbz1420304-s390x-13of35.patch
Patch104: gdb-rhbz1420304-s390x-14of35.patch
Patch105: gdb-rhbz1420304-s390x-15of35.patch
Patch106: gdb-rhbz1420304-s390x-16of35.patch
Patch107: gdb-rhbz1420304-s390x-17of35.patch
Patch108: gdb-rhbz1420304-s390x-18of35.patch
Patch109: gdb-rhbz1420304-s390x-19of35.patch
Patch110: gdb-rhbz1420304-s390x-20of35.patch
Patch111: gdb-rhbz1420304-s390x-21of35.patch
Patch112: gdb-rhbz1420304-s390x-22of35.patch
Patch113: gdb-rhbz1420304-s390x-23of35.patch
Patch114: gdb-rhbz1420304-s390x-24of35.patch
Patch115: gdb-rhbz1420304-s390x-25of35.patch
Patch116: gdb-rhbz1420304-s390x-26of35.patch
Patch117: gdb-rhbz1420304-s390x-27of35.patch
Patch118: gdb-rhbz1420304-s390x-28of35.patch
Patch119: gdb-rhbz1420304-s390x-29of35.patch
Patch120: gdb-rhbz1420304-s390x-30of35.patch
Patch121: gdb-rhbz1420304-s390x-31of35.patch
Patch122: gdb-rhbz1420304-s390x-32of35.patch
Patch123: gdb-rhbz1420304-s390x-33of35.patch
Patch124: gdb-rhbz1420304-s390x-34of35.patch
Patch125: gdb-rhbz1420304-s390x-35of35.patch
Patch126: gdb-rhbz795424-bitpos-20of25.patch
Patch127: gdb-rhbz795424-bitpos-21of25.patch
Patch128: gdb-rhbz795424-bitpos-22of25.patch
Patch129: gdb-rhbz795424-bitpos-23of25.patch
Patch130: gdb-rhbz795424-bitpos-25of25.patch
Patch131: gdb-rhbz795424-bitpos-25of25-test.patch
Patch132: gdb-rhbz795424-bitpos-lazyvalue.patch
Patch133: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch134: gdb-gnat-dwarf-crash-3of3.patch
Patch135: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch136: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch137: gdb-archer-vla-tests.patch
Patch138: gdb-vla-intel-tests.patch
Patch139: gdb-btrobust.patch
Patch140: gdb-fortran-frame-string.patch
Patch141: gdb-python-gil.patch
Patch142: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch143: gdb-jit-reader-multilib.patch
Patch144: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch145: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch146: gdb-rhbz1350436-type-printers-error.patch
Patch147: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch148: gdb-bz1219747-attach-kills.patch
Patch149: gdb-fedora-libncursesw.patch
Patch150: gdb-opcodes-clflushopt-test.patch
Patch151: gdb-dts-rhel6-python-compat.patch
Patch152: gdb-6.6-buildid-locate-rpm-scl.patch
Patch153: gdb-readline62-ask-more-rh.patch
Patch154: gdb-6.8-attach-signalled-detach-stopped.patch
Patch155: gdb-6.8-quit-never-aborts.patch
Patch156: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch157: gdb-container-rh-pkg.patch
Patch158: gdb-rhbz1325795-framefilters-test.patch
Patch159: gdb-linux_perf-bundle.patch
Patch160: gdb-tls-1of2.patch
Patch161: gdb-tls-2of2.patch
Patch162: gdb-libexec-add-index.patch
Patch163: gdb-add-index-chmod.patch
Patch164: gdb-rhbz1398387-tab-crash-test.patch
Patch165: gdb-testsuite-readline63-sigint.patch
#Fedora Packages end
# libipt support
Patch500: v1.5-libipt-static.patch
Patch501: v1.6.1-implicit-fallthrough.patch
# Upstream patch to fix gcc -Werror
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1003: gdb-pahole-python2.patch
Patch1004: gdb-fix-buf-overflow.diff
Patch1005: gdb-7.10-swo18929.patch
# Backported upstream patches for s390 features
Patch2000: gdb-s390x-8fe09d7.patch
Patch2001: gdb-s390x-96235dc.patch
Patch2002: gdb-s390x-1b63490.patch
Patch2003: gdb-s390x-ad33963.patch
Patch2004: gdb-s390x-289e23a.patch
BuildRequires: bison
BuildRequires: flex
%if 0%{suse_version} > 1110
@ -257,6 +308,14 @@ Requires: python-base
BuildRequires: python-devel
%endif # 0%{!?_without_python:1}
%global have_libipt 0
%if 0%{suse_version} > 1110
%ifarch %{ix86} x86_64
%global have_libipt 1
BuildRequires: cmake
%endif
%endif
# BuildArch would break RHEL-5 by overriding arch and not building noarch.
%if 0%{?el5:1}
ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x
@ -515,13 +574,64 @@ find -name "*.info*"|xargs rm -f
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
%patch130 -p1
%patch131 -p1
%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
%patch139 -p1
%patch140 -p1
%patch141 -p1
%patch142 -p1
%patch143 -p1
%patch144 -p1
%patch145 -p1
%patch146 -p1
%patch147 -p1
%patch148 -p1
%patch149 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch157 -p1
%patch158 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
%patch164 -p1
%patch165 -p1
#Fedora patching end
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
#unpack libipt
%if 0%{have_libipt}
tar xzf %{SOURCE7}
(
cd processor-trace-%{libipt_version}
%patch500 -p1
%patch501 -p1
)
%endif
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
@ -563,6 +673,26 @@ export CFLAGS="$RPM_OPT_FLAGS"
if echo "" | $CC -x c -c - -o /dev/null -Wno-implicit-fallthrough >/dev/null 2>&1; then
CFLAGS="$CFLAGS -Wno-implicit-fallthrough"
fi
%if %{have_libipt}
CFLAGS="$CFLAGS -DPERF_ATTR_SIZE_VER5_BUNDLE"
(
mkdir processor-trace-%{libipt_version}-root
mkdir processor-trace-%{libipt_version}-build
cd processor-trace-%{libipt_version}-build
# -DPTUNIT:BOOL=ON has no effect on ctest.
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPTUNIT:BOOL=OFF \
-DDEVBUILD:BOOL=ON \
../../processor-trace-%{libipt_version}
make VERBOSE=1 %{?_smp_mflags}
ctest -V %{?_smp_mflags}
make install DESTDIR=../processor-trace-%{libipt_version}-root
)
# There is also: --with-libipt-prefix
CFLAGS="$CFLAGS -I$PWD/processor-trace-%{libipt_version}-root%{_includedir}"
LDFLAGS="$LDFLAGS -L$PWD/processor-trace-%{libipt_version}-root%{_libdir}"
%endif
export CXXFLAGS="$CFLAGS"
export LIBRPM=no
@ -646,6 +776,11 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \
--enable-inprocess-agent \
%else
--disable-inprocess-agent \
%endif
%if %{have_libipt}
--with-intel-pt \
%else
--without-intel-pt \
%endif
--with-bugurl=http://bugs.opensuse.org/ \
--with-pkgversion="GDB; %{DIST}" \

22
v1.5-libipt-static.patch Normal file
View File

@ -0,0 +1,22 @@
--- processor-trace-1.5/libipt/CMakeLists.txt-orig 2016-04-07 08:52:14.000000000 +0200
+++ processor-trace-1.5/libipt/CMakeLists.txt 2016-08-17 23:12:23.241109244 +0200
@@ -81,7 +81,7 @@ endif (CMAKE_HOST_WIN32)
set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES})
-add_library(libipt SHARED
+add_library(libipt STATIC
${LIBIPT_FILES}
)
--- processor-trace-1.5/libipt/src/posix/init.c-orig 2016-04-07 08:52:14.000000000 +0200
+++ processor-trace-1.5/libipt/src/posix/init.c 2016-08-23 09:04:11.540176668 +0200
@@ -29,7 +29,7 @@
#include "pt_ild.h"
-static void __attribute__((constructor)) init(void)
+void __libipt_init(void)
{
/* Initialize the Intel(R) Processor Trace instruction decoder. */
pt_ild_init();

View File

@ -0,0 +1,23 @@
gcc-7.1.1-1.fc27.x86_64
/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c: In function pt_blk_proceed_no_event_cached:
/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c:2282:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (bce.isize) {
^
/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c:2328:2: note: here
case ptbq_decode: {
^~~~
diff --git a/libipt/src/pt_block_decoder.c b/libipt/src/pt_block_decoder.c
index 21783a6..91d5bb3 100644
--- a/libipt/src/pt_block_decoder.c
+++ b/libipt/src/pt_block_decoder.c
@@ -2095,6 +2095,9 @@ static int pt_blk_proceed_no_event_cached(struct pt_block_decoder *decoder,
}
/* Fall through to ptbq_decode. */
+#if __GNUC__ >= 7
+ __attribute__ ((fallthrough));
+#endif
case ptbq_decode: {
struct pt_insn_ext iext;

3
v1.6.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:861fd8178414e07ba622b5e40f5ba4d68d62f4712a8302a7ec51997748c4585a
size 250843