mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 11:39:26 +08:00
[gdb/testsuite] Introduce supports_scalar_storage_order_attribute
Introduce support test procs: - supports_scalar_storage_order_attribute, and - supports_gnuc and use them in test-case gdb.base/endianity.exp. Tested on x86_64-linux with gcc-7.5.0, gcc-4.8.5, and clang 10.0.1. gdb/testsuite/ChangeLog: 2020-12-19 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (supports_scalar_storage_order_attribute) (supports_gnuc): New proc. * gdb.base/endianity.exp: Define TEST_SSO. Eliminate test_compiler_info calls. Add unsupported message. * gdb.base/endianity.c: Use TEST_SSO.
This commit is contained in:
@ -1,3 +1,11 @@
|
||||
2020-12-19 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* lib/gdb.exp (supports_scalar_storage_order_attribute)
|
||||
(supports_gnuc): New proc.
|
||||
* gdb.base/endianity.exp: Define TEST_SSO. Eliminate
|
||||
test_compiler_info calls. Add unsupported message.
|
||||
* gdb.base/endianity.c: Use TEST_SSO.
|
||||
|
||||
2020-12-19 Hannes Domani <ssbssa@yahoo.de>
|
||||
|
||||
PR exp/27070
|
||||
|
@ -26,7 +26,7 @@ struct otherendian
|
||||
__complex__ float cplx;
|
||||
double d;
|
||||
}
|
||||
#if defined __GNUC__ && (__GNUC__ >= 6)
|
||||
#if TEST_SSO
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
__attribute__( ( scalar_storage_order( "big-endian" ) ) )
|
||||
#else
|
||||
|
@ -15,7 +15,12 @@
|
||||
|
||||
standard_testfile .c
|
||||
|
||||
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
|
||||
set test_sso [expr \
|
||||
[supports_scalar_storage_order_attribute] \
|
||||
&& [supports_gnuc]]
|
||||
|
||||
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
|
||||
[list debug additional_flags=-DTEST_SSO=$test_sso]] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
@ -37,12 +42,12 @@ gdb_test "print o.d = -23.125" "= -23.125"
|
||||
gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25i, d = -23.125}" \
|
||||
"print o after assignment"
|
||||
|
||||
if { ([test_compiler_info {gcc-[0-5]-*}] || ![test_compiler_info gcc*]) } {
|
||||
if { !$test_sso } {
|
||||
# The rest of the testcase requires Scalar Storage Order support.
|
||||
# This compiler does not support it, so skip the rest.
|
||||
unsupported "No scalar storage order support"
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_test "x/x &o.v" "0x04000000"
|
||||
gdb_test "x/xh &o.w" "0x0300"
|
||||
|
||||
|
@ -7669,5 +7669,51 @@ gdb_caching_proc have_fuse_ld_gold {
|
||||
return [gdb_simple_compile $me $src executable $flags]
|
||||
}
|
||||
|
||||
# Return 1 if compiler supports scalar_storage_order attribute, otherwise
|
||||
# return 0.
|
||||
gdb_caching_proc supports_scalar_storage_order_attribute {
|
||||
set me "supports_scalar_storage_order_attribute"
|
||||
set src {
|
||||
#include <string.h>
|
||||
struct sle {
|
||||
int v;
|
||||
} __attribute__((scalar_storage_order("little-endian")));
|
||||
struct sbe {
|
||||
int v;
|
||||
} __attribute__((scalar_storage_order("big-endian")));
|
||||
struct sle sle;
|
||||
struct sbe sbe;
|
||||
int main () {
|
||||
sle.v = sbe.v = 0x11223344;
|
||||
int same = memcmp (&sle, &sbe, sizeof (int)) == 0;
|
||||
int sso = !same;
|
||||
return sso;
|
||||
}
|
||||
}
|
||||
if { ![gdb_simple_compile $me $src executable ""] } {
|
||||
return 0
|
||||
}
|
||||
|
||||
set result [remote_exec target $obj]
|
||||
set status [lindex $result 0]
|
||||
set output [lindex $result 1]
|
||||
if { $output != "" } {
|
||||
return 0
|
||||
}
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
# Return 1 if compiler supports __GNUC__, otherwise return 0.
|
||||
gdb_caching_proc supports_gnuc {
|
||||
set me "supports_gnuc"
|
||||
set src {
|
||||
#ifndef __GNUC__
|
||||
#error "No gnuc"
|
||||
#endif
|
||||
}
|
||||
return [gdb_simple_compile $me $src object ""]
|
||||
}
|
||||
|
||||
# Always load compatibility stuff.
|
||||
load_lib future.exp
|
||||
|
Reference in New Issue
Block a user