diff options
author | Joel Brobecker <brobecker@adacore.com> | 2020-11-15 03:18:35 -0500 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2020-11-15 03:18:35 -0500 |
commit | b74dbc2093191b10f4963f43ee570b54c9593404 (patch) | |
tree | 32f600bc82951ac58ec59e2142f7140174098208 /gdb/testsuite/gdb.dwarf2 | |
parent | 0a12719e51c456a5220f75950ebf9c07457c753b (diff) | |
download | gdb-b74dbc2093191b10f4963f43ee570b54c9593404.zip gdb-b74dbc2093191b10f4963f43ee570b54c9593404.tar.gz gdb-b74dbc2093191b10f4963f43ee570b54c9593404.tar.bz2 |
Add support for fixed-point type comparison operators
This patch adds support for binary comparison operators with
fixed-point type values.
gdb/ChangeLog:
* valarith.c (fixed_point_binop): Add BINOP_EQUAL and BINOP_LESS
handling.
(value_less): Add fixed-point handling.
gdb/testsuite/ChangeLog:
* gdb.ada/fixed_cmp.exp: Add -fgnat-encodings=minimal testing.
* gdb.dwarf2/dw2-fixed-point.c (pck__fp1_var2): New global.
(main): Add reference to pck__fp1_var2.
* gdb.dwarf2/dw2-fixed-point.exp: Add comparison operator testing.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp | 102 |
2 files changed, 109 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c index d9c811c..971a7a8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c @@ -23,6 +23,12 @@ int8_t pck__fp1_var = 4; /* Simulate an Ada variable declared inside package Pck as follow: + type FP1_Type is delta 0.1 range -1.0 .. +1.0; + FP1_Var2 : FP1_Type := 0.50; + Basically, the same as FP1_Var, but with a different value. */ +int8_t pck__fp1_var2 = 8; + +/* Simulate an Ada variable declared inside package Pck as follow: type FP2_Type is delta 0.01 digits 14; FP2_Var : FP2_Type := -0.01; */ int32_t pck__fp2_var = -1; @@ -41,6 +47,7 @@ int main (void) { pck__fp1_var++; + pck__fp1_var2++; pck__fp2_var++; pck__fp3_var++; pck__fp1_range_var++; diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp index 0252195..a82a9af 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp @@ -49,6 +49,15 @@ Dwarf::assemble $asm_file { {external 1 flag} } + DW_TAG_variable { + {DW_AT_name pck__fp1_var2} + {DW_AT_type :$fp1_base_type} + {DW_AT_location { + DW_OP_addr [gdb_target_symbol pck__fp1_var2] + } SPECIAL_expr} + {external 1 flag} + } + fp2_base_type: DW_TAG_base_type { {DW_AT_byte_size 1 DW_FORM_sdata} {DW_AT_encoding @DW_ATE_signed_fixed} @@ -161,6 +170,99 @@ gdb_test "print pck.fp1_range_var - 0.5" \ gdb_test "print -pck.fp1_var" \ " = -0.25" +gdb_test "print pck.fp1_var = pck.fp1_var" \ + " = true" + +gdb_test "print pck.fp1_var = pck.fp1_var2" \ + " = false" + +gdb_test "print pck.fp1_var /= pck.fp1_var" \ + " = false" + +gdb_test "print pck.fp1_var /= pck.fp1_var2" \ + " = true" + +gdb_test "print pck.fp1_var < pck.fp1_var" \ + " = false" + +gdb_test "print pck.fp1_var < pck.fp1_var2" \ + " = true" + +gdb_test "print pck.fp1_var <= pck.fp1_var2" \ + " = true" + +gdb_test "print pck.fp1_var <= pck.fp1_var" \ + " = true" + +gdb_test "print pck.fp1_var > pck.fp1_var2" \ + " = false" + +gdb_test "print pck.fp1_var2 > pck.fp1_var" \ + " = true" + +gdb_test "print pck.fp1_var >= pck.fp1_var" \ + " = true" + +gdb_test "print pck.fp1_var >= pck.fp1_var2" \ + " = false" + +# Same as above, but with litterals... + +gdb_test "print pck.fp1_var = 0.25" \ + " = true" + +gdb_test "print pck.fp1_var = 0.5" \ + " = false" + +gdb_test "print pck.fp1_var = 1" \ + " = false" + +gdb_test "print pck.fp1_var /= 0.25" \ + " = false" + +gdb_test "print pck.fp1_var /= 0.5" \ + " = true" + +gdb_test "print pck.fp1_var /= 1" \ + " = true" + +gdb_test "print pck.fp1_var < 0.25" \ + " = false" + +gdb_test "print pck.fp1_var < 0.5" \ + " = true" + +gdb_test "print pck.fp1_var < 1" \ + " = true" + +gdb_test "print pck.fp1_var <= 0.25" \ + " = true" + +gdb_test "print pck.fp1_var <= 0.5" \ + " = true" + +gdb_test "print pck.fp1_var <= 1" \ + " = true" + +gdb_test "print pck.fp1_var > 0.25" \ + " = false" + +gdb_test "print pck.fp1_var > 0.5" \ + " = false" + +gdb_test "print pck.fp1_var > 1" \ + " = false" + +gdb_test "print pck.fp1_var >= 0.25" \ + " = true" + +gdb_test "print pck.fp1_var >= 0.5" \ + " = false" + +gdb_test "print pck.fp1_var >= 1" \ + " = false" + + # Set the language to LANG and do a ptype test on pck__fp1_var, # pck__fp2_var and pck__fp3_var, verifying that the output matches # FP1_RE, FP2_RE, FP2_RE (resp.). |