aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada/n_arr_bound
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess3-3/+3
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker3-3/+3
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker3-3/+3
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker3-3/+3
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker3-3/+3
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker3-3/+3
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker3-3/+3
gdb/ChangeLog: Update copyright year range in all GDB files
2017-01-01update copyright year range in GDB filesJoel Brobecker3-3/+3
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker3-3/+3
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker3-3/+3
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-11-21Handling of empty Ada ranges with a negative upper bound.Joel Brobecker3-0/+63
Consider the following variable declaration: type Array_Type is array (Integer range <>) of Integer; Var: Array_Type (0 .. -1); "ptype var" prints the wrong upper bound for that array: (gdb) ptype var type = array (0 .. 4294967295) of integer The debugging info for the type of variable "Var" is as follow: <2><cf>: Abbrev Number: 13 (DW_TAG_structure_type) <d0> DW_AT_name : foo__var___PAD <3><db>: Abbrev Number: 14 (DW_TAG_member) <dc> DW_AT_name : F <e0> DW_AT_type : <0xa5> This is just an artifact from code generation, which is just a wrapper that we should ignore. The real type is the type of field "F" in that PAD type, which is described as: <2><a5>: Abbrev Number: 10 (DW_TAG_array_type) <a6> DW_AT_name : foo__TvarS <3><b6>: Abbrev Number: 11 (DW_TAG_subrange_type) <b7> DW_AT_type : <0xc1> <bb> DW_AT_lower_bound : 0 <bc> DW_AT_upper_bound : 0xffffffff Trouble occurs because DW_AT_upper_bound is encoded using a DW_FORM_data4, which is ambiguous regarding signedness. In that case, dwarf2read.c::dwarf2_get_attr_constant_value reads the value as unsigned, which is not what we want in this case. As it happens, we already have code dealing with this situation in dwarf2read.c::read_subrange_type which checks whether the subrange's type is signed or not, and if it is, fixes the bound's value by sign-extending it: if (high.kind == PROP_CONST && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) high.data.const_val |= negative_mask; Unfortunately, what happens in our case is that the base type of the array's subrange type is marked as being unsigned, and so we never get to apply the sign extension. Following the DWARF trail, the range's base type is described as another subrange type... <2><c1>: Abbrev Number: 12 (DW_TAG_subrange_type) <c7> DW_AT_name : foo__TTvarSP1___XDLU_0__1m <cb> DW_AT_type : <0x2d> ... whose base type is, (finally), a basic type (signed): <1><2d>: Abbrev Number: 2 (DW_TAG_base_type) <2e> DW_AT_byte_size : 4 <2f> DW_AT_encoding : 5 (signed) <30> DW_AT_name : integer The reason why GDB thinks that foo__TTvarSP1___XDLU_0__1m (the base type of the array's range type) is an unsigned type is found in gdbtypes.c::create_range_type. We consider that a range type is unsigned iff its lower bound is >= 0: if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0) TYPE_UNSIGNED (result_type) = 1; That is normally sufficient, as one would expect the upper bound to always be greater or equal to the lower bound. But Ada actually allows the declaration of empty range types where the upper bound is less than the lower bound. In this case, the upper bound is negative, so we should not be marking the type as unsigned. This patch fixes the issue by simply checking the upper bound as well as the lower bound, and clears the range type's unsigned flag when it is found to be constant and negative. gdb/ChangeLog: * gdbtypes.c (create_range_type): Unset RESULT_TYPE's flag_unsigned if HIGH_BOUND is constant and negative. gdb/testsuite/ChangeLog: * gdb.ada/n_arr_bound: New testcase. Tested on x86_64-linux.