* [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets
@ 2016-01-23 12:34 Marcin Kościelnicki
2016-01-23 13:22 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Kościelnicki @ 2016-01-23 12:34 UTC (permalink / raw)
To: gdb-patches; +Cc: Marcin Kościelnicki
The test constructs fake DWARF info for a C structure involving bitfields.
DWARF bitfields are always counted from LSB, while the order in which
bitfields are allocated in a C struct depends on the target endianness -
thus the generated DWARF marks different bitfields as unavailable when
target is big endian. Accordingly, we need different expected outputs.
Tested on s390 and s390x, no regression on x86_64.
gdb/testsuite/ChangeLog:
* gdb.trace/unavailable-dwarf-piece.exp: Fix bitfield handling on big
endian targets.
---
Not sure if that's the kosher way to get target endianness. I looked for
an endian function in the test library, but didn't find one.
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 19 ++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8f7dc6d..8ee2efa 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-23 Marcin KoÅcielnicki <koriakin@0x04.net>
+
+ * gdb.trace/unavailable-dwarf-piece.exp: Fix bitfield handling on big
+ endian targets.
+
2016-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
index 60820dd..e511915 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
@@ -325,10 +325,23 @@ with_test_prefix "tracing bar" {
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
gdb_test_no_output "tstop"
+ gdb_test_multiple "show endian" "show endian" {
+ -re ".* (big|little) endian.*$gdb_prompt $" {
+ set endian $expect_out(1,string)
+ pass "endianness: $endian"
+ }
+ }
+
gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
- gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
- gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = <unavailable>, f = 0, g = 0, h = 0, i = 0, j = 0}"
- gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
+ if { $endian == "little" } {
+ gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = <unavailable>, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
+ } else {
+ gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
+ gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = <unavailable>, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ }
gdb_test "tfind none" "No longer looking at any trace frame.*"
}
--
2.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets
2016-01-23 12:34 [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets Marcin Kościelnicki
@ 2016-01-23 13:22 ` Pedro Alves
2016-01-23 13:59 ` Marcin Kościelnicki
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2016-01-23 13:22 UTC (permalink / raw)
To: Marcin Kościelnicki, gdb-patches
On 01/23/2016 12:34 PM, Marcin KoÅcielnicki wrote:
> diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
> index 60820dd..e511915 100644
> --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
> +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
> @@ -325,10 +325,23 @@ with_test_prefix "tracing bar" {
> gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
> gdb_test_no_output "tstop"
>
> + gdb_test_multiple "show endian" "show endian" {
> + -re ".* (big|little) endian.*$gdb_prompt $" {
> + set endian $expect_out(1,string)
> + pass "endianness: $endian"
> + }
> + }
Do:
set endian ""
gdb_test_multiple "show endian" "show endian" {
...
Otherwise if that gdb_test_multiple fails, $endian doesn't exist,
and the if below throws a tcl error.
OK with that change.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets
2016-01-23 13:22 ` Pedro Alves
@ 2016-01-23 13:59 ` Marcin Kościelnicki
0 siblings, 0 replies; 3+ messages in thread
From: Marcin Kościelnicki @ 2016-01-23 13:59 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
On 23/01/16 14:22, Pedro Alves wrote:
> On 01/23/2016 12:34 PM, Marcin KoÅcielnicki wrote:
>
>> diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
>> index 60820dd..e511915 100644
>> --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
>> +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
>> @@ -325,10 +325,23 @@ with_test_prefix "tracing bar" {
>> gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
>> gdb_test_no_output "tstop"
>>
>> + gdb_test_multiple "show endian" "show endian" {
>> + -re ".* (big|little) endian.*$gdb_prompt $" {
>> + set endian $expect_out(1,string)
>> + pass "endianness: $endian"
>> + }
>> + }
>
> Do:
>
> set endian ""
> gdb_test_multiple "show endian" "show endian" {
> ...
>
> Otherwise if that gdb_test_multiple fails, $endian doesn't exist,
> and the if below throws a tcl error.
>
> OK with that change.
>
Thanks, fixed and pushed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-23 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-23 12:34 [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets Marcin Kościelnicki
2016-01-23 13:22 ` Pedro Alves
2016-01-23 13:59 ` Marcin Kościelnicki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox