binutils-gdb/gdb/testsuite/gdb.guile
Tom de Vries 22589c4996 [gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8
With gcc 7.5.0, I get:
...
(gdb) guile (print (type-range (field-type (type-field (value-type \
  (value-dereference f)) "items"))))^M
= (0 0)^M
(gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \
  on flexible array member: $cmd
...
but with gcc 4.8.5, I get instead:
...
(gdb) guile (print (type-range (field-type (type-field (value-type \
  (value-dereference f)) "items"))))^M
= (0 -1)^M
(gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \
  on flexible array member: $cmd
...

There's a difference in debug info.  With gcc 4.8.5, we have:
...
 <2><224>: Abbrev Number: 15 (DW_TAG_member)
    <225>   DW_AT_name        : items
    <22b>   DW_AT_type        : <0x231>
 <1><231>: Abbrev Number: 4 (DW_TAG_array_type)
    <232>   DW_AT_type        : <0x105>
 <2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type)
    <23b>   DW_AT_type        : <0x11a>
    <23f>   DW_AT_upper_bound : 0xffffffffffffffff
...
and with gcc 7.5.0, we have instead:
...
 <2><89f>: Abbrev Number: 12 (DW_TAG_member)
    <8a0>   DW_AT_name        : items
    <8a6>   DW_AT_type        : <0x8ac>
 <1><8ac>: Abbrev Number: 17 (DW_TAG_array_type)
    <8ad>   DW_AT_type        : <0x29d>
 <2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type)
 <2><8b6>: Abbrev Number: 0
...

As mentioned in commit 858c8f2c1b "gdb/testsuite: adjust
gdb.python/flexible-array-member.exp expected pattern":
...
Ideally, GDB would present a consistent and documented value for an
array member declared with size 0, regardless of how the debug info
looks like.
...

As in gdb.python/flexible-array-member.exp, change the test to accept the two
values.

Tested on x86_64-linux.
2021-10-07 18:00:08 +02:00
..
guile.exp
scm-arch.c
scm-arch.exp
scm-block.c
scm-block.exp
scm-breakpoint.c
scm-breakpoint.exp
scm-cmd.c
scm-cmd.exp
scm-disasm.c
scm-disasm.exp
scm-equal.c
scm-equal.exp
scm-error-1.scm
scm-error-2.scm
scm-error.exp
scm-frame-args.c
scm-frame-args.exp
scm-frame-args.scm
scm-frame-inline.c
scm-frame-inline.exp
scm-frame.c
scm-frame.exp
scm-gsmob.exp
scm-iterator.c
scm-iterator.exp
scm-lazy-string.c
scm-lazy-string.exp
scm-math.c
scm-math.exp
scm-objfile-script-gdb.in
scm-objfile-script.c
scm-objfile-script.exp
scm-objfile.c
scm-objfile.exp
scm-parameter.exp
scm-ports.c
scm-ports.exp
scm-pretty-print.c
scm-pretty-print.exp
scm-pretty-print.scm
scm-progspace.c
scm-progspace.exp
scm-section-script.c
scm-section-script.exp
scm-section-script.scm
scm-symbol.c
scm-symbol.exp
scm-symtab-2.c
scm-symtab.c
scm-symtab.exp
scm-type.c
scm-type.exp
scm-value-cc.cc
scm-value-cc.exp
scm-value.c
scm-value.exp
source2.scm
types-module.cc
types-module.exp