* [review] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
@ 2019-11-27 22:22 ` Simon Marchi (Code Review)
2019-12-03 21:34 ` Tom Tromey (Code Review)
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi (Code Review) @ 2019-11-27 22:22 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Patch Set 1: Code-Review+2
LGTM.
When reading this, I wondered if you could arbitrarily nest structures with big and little endianness. I tested with:
#include <stdio.h>
struct gros
{
unsigned int a;
} __attribute__((scalar_storage_order("big-endian")));
struct petit
{
struct gros g;
unsigned int b;
} __attribute__((scalar_storage_order("little-endian")));
struct gros2
{
struct petit p;
unsigned int c;
} __attribute__((scalar_storage_order("big-endian")));
int main() {
struct gros2 g2;
g2.c = 256;
g2.p.b = 257;
g2.p.g.a = 258;
printf("%d %d %d\n", g2.c, g2.p.b, g2.p.g.a);
return 0;
}
It correctly prints this when you run it:
$ /tmp/a.out
256 257 258
But GDB prints:
(gdb) p g2
$1 = {p = {g = {a = 258}, b = 16842752}, c = 256}
It's not really the point of this patch though.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Wed, 27 Nov 2019 22:22:05 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
2019-11-27 22:22 ` Simon Marchi (Code Review)
@ 2019-12-03 21:34 ` Tom Tromey (Code Review)
2019-12-04 14:34 ` Tom Tromey (Code Review)
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-03 21:34 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Patch Set 1:
[...]
> But GDB prints:
>
> (gdb) p g2
> $1 = {p = {g = {a = 258}, b = 16842752}, c = 256}
>
> It's not really the point of this patch though.
My feeling is that this has to be a GCC bug, and it should emit the DWARF
differently. However I didn't look into this case in detail.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 03 Dec 2019 21:34:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
2019-11-27 22:22 ` Simon Marchi (Code Review)
2019-12-03 21:34 ` Tom Tromey (Code Review)
@ 2019-12-04 14:34 ` Tom Tromey (Code Review)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-04 14:34 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Patch Set 1:
> Patch Set 1: Code-Review+2
>
> LGTM.
>
> When reading this, I wondered if you could arbitrarily nest structures with big and little endianness. I tested with:
I looked at the DWARF for this test case, and it seems fine, so now I'm
debugging gdb to see if there's something wrong there.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 04 Dec 2019 14:34:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
` (2 preceding siblings ...)
2019-12-04 14:34 ` Tom Tromey (Code Review)
@ 2019-12-04 14:36 ` Tom Tromey (Code Review)
2019-12-04 14:36 ` [review] " Tom Tromey (Code Review)
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-04 14:36 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Add bit-field test for scalar_storage_order
This adds a bit-field test for scalar_storage_order.
gdb/testsuite/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct other) <x>: New field.
(main): Initialize it.
* gdb.base/endianity.exp: Update.
Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/endianity.c
M gdb/testsuite/gdb.base/endianity.exp
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3ba3692..2d45592 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2019-12-04 Tom Tromey <tromey@adacore.com>
+ * gdb.base/endianity.c (struct other) <x>: New field.
+ (main): Initialize it.
+ * gdb.base/endianity.exp: Update.
+
+2019-12-04 Tom Tromey <tromey@adacore.com>
+
* gdb.ada/scalar_storage/storage.adb: New file.
* gdb.ada/scalar_storage/pck.adb: New file.
* gdb.ada/scalar_storage/pck.ads: New file.
diff --git a/gdb/testsuite/gdb.base/endianity.c b/gdb/testsuite/gdb.base/endianity.c
index 42ee9ae..17e5035 100644
--- a/gdb/testsuite/gdb.base/endianity.c
+++ b/gdb/testsuite/gdb.base/endianity.c
@@ -21,6 +21,7 @@
{
int v;
short w;
+ unsigned x : 3;
float f;
__complex__ float cplx;
double d;
@@ -42,7 +43,7 @@
int
main (void)
{
- struct otherendian o = {3, 2, 23.5, 1.25 + 7.25i, 75};
+ struct otherendian o = {3, 2, 7, 23.5, 1.25 + 7.25i, 75};
do_nothing (&o); /* START */
}
diff --git a/gdb/testsuite/gdb.base/endianity.exp b/gdb/testsuite/gdb.base/endianity.exp
index 4277c1f..e4f6bc3 100644
--- a/gdb/testsuite/gdb.base/endianity.exp
+++ b/gdb/testsuite/gdb.base/endianity.exp
@@ -25,11 +25,12 @@
return -1
}
-gdb_test "print o" "= {v = 3, w = 2, f = 23.5, cplx = 1.25 \\+ 7.25 \\* I, d = 75}" \
+gdb_test "print o" "= {v = 3, w = 2, x = 7, f = 23.5, cplx = 1.25 \\+ 7.25 \\* I, d = 75}" \
"print o before assignment"
gdb_test "print o.v = 4" "= 4"
gdb_test "print o.w = 3" "= 3"
+gdb_test "print o.x = 2" "= 2"
gdb_test "print o.f = 1.5" "= 1.5"
gdb_test "print o.d = -23.125" "= -23.125"
@@ -40,5 +41,5 @@
gdb_test "x/x &o.v" "0x04000000"
gdb_test "x/xh &o.w" "0x0300"
-gdb_test "print o" "= {v = 4, w = 3, f = 1.5, cplx = 1.25 \\+ 7.25 \\* I, d = -23.125}" \
+gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25 \\* I, d = -23.125}" \
"print o after assignment"
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
` (3 preceding siblings ...)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
@ 2019-12-04 14:36 ` Tom Tromey (Code Review)
2019-12-04 15:46 ` [review v2] " Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-04 14:36 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Patch Set 1:
> Patch Set 1:
>
> > Patch Set 1: Code-Review+2
> >
> > LGTM.
> >
> > When reading this, I wondered if you could arbitrarily nest structures with big and little endianness. I tested with:
>
> I looked at the DWARF for this test case, and it seems fine, so now I'm
> debugging gdb to see if there's something wrong there.
I guess I tried the wrong version of gdb, because this test case works fine
with this series.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 04 Dec 2019 14:36:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
` (4 preceding siblings ...)
2019-12-04 14:36 ` [review] " Tom Tromey (Code Review)
@ 2019-12-04 15:46 ` Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi (Code Review) @ 2019-12-04 15:46 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Patch Set 2: Code-Review+2
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 04 Dec 2019 15:46:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pushed] Add bit-field test for scalar_storage_order
2019-11-27 18:48 [review] Add bit-field test for scalar_storage_order Tom Tromey (Code Review)
` (5 preceding siblings ...)
2019-12-04 15:46 ` [review v2] " Simon Marchi (Code Review)
@ 2019-12-04 16:41 ` Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-04 16:41 UTC (permalink / raw)
To: Tom Tromey, gdb-patches; +Cc: Simon Marchi
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/731
......................................................................
Add bit-field test for scalar_storage_order
This adds a bit-field test for scalar_storage_order.
gdb/testsuite/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct other) <x>: New field.
(main): Initialize it.
* gdb.base/endianity.exp: Update.
Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.base/endianity.c
M gdb/testsuite/gdb.base/endianity.exp
3 files changed, 11 insertions(+), 3 deletions(-)
Approvals:
Simon Marchi: Looks good to me, approved
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3ba3692..2d45592 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2019-12-04 Tom Tromey <tromey@adacore.com>
+ * gdb.base/endianity.c (struct other) <x>: New field.
+ (main): Initialize it.
+ * gdb.base/endianity.exp: Update.
+
+2019-12-04 Tom Tromey <tromey@adacore.com>
+
* gdb.ada/scalar_storage/storage.adb: New file.
* gdb.ada/scalar_storage/pck.adb: New file.
* gdb.ada/scalar_storage/pck.ads: New file.
diff --git a/gdb/testsuite/gdb.base/endianity.c b/gdb/testsuite/gdb.base/endianity.c
index 42ee9ae..17e5035 100644
--- a/gdb/testsuite/gdb.base/endianity.c
+++ b/gdb/testsuite/gdb.base/endianity.c
@@ -21,6 +21,7 @@
{
int v;
short w;
+ unsigned x : 3;
float f;
__complex__ float cplx;
double d;
@@ -42,7 +43,7 @@
int
main (void)
{
- struct otherendian o = {3, 2, 23.5, 1.25 + 7.25i, 75};
+ struct otherendian o = {3, 2, 7, 23.5, 1.25 + 7.25i, 75};
do_nothing (&o); /* START */
}
diff --git a/gdb/testsuite/gdb.base/endianity.exp b/gdb/testsuite/gdb.base/endianity.exp
index 4277c1f..e4f6bc3 100644
--- a/gdb/testsuite/gdb.base/endianity.exp
+++ b/gdb/testsuite/gdb.base/endianity.exp
@@ -25,11 +25,12 @@
return -1
}
-gdb_test "print o" "= {v = 3, w = 2, f = 23.5, cplx = 1.25 \\+ 7.25 \\* I, d = 75}" \
+gdb_test "print o" "= {v = 3, w = 2, x = 7, f = 23.5, cplx = 1.25 \\+ 7.25 \\* I, d = 75}" \
"print o before assignment"
gdb_test "print o.v = 4" "= 4"
gdb_test "print o.w = 3" "= 3"
+gdb_test "print o.x = 2" "= 2"
gdb_test "print o.f = 1.5" "= 1.5"
gdb_test "print o.d = -23.125" "= -23.125"
@@ -40,5 +41,5 @@
gdb_test "x/x &o.v" "0x04000000"
gdb_test "x/xh &o.w" "0x0300"
-gdb_test "print o" "= {v = 4, w = 3, f = 1.5, cplx = 1.25 \\+ 7.25 \\* I, d = -23.125}" \
+gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25 \\* I, d = -23.125}" \
"print o after assignment"
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Gerrit-Change-Number: 731
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 8+ messages in thread