aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada/assign_arr
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-03-15Fix bug in Ada aggregate assignmentTom Tromey3-0/+38
The expression rewrite caused a regression in the internal AdaCore test suite. The bug was that I had dropped a bit of code from aggregate assignment -- assign_aggregate used to return the container, which I thought was redundant, but which can actually change during the call. There was no test for this case in the tree, so I've added one. gdb/ChangeLog 2021-03-15 Tom Tromey <tromey@adacore.com> * ada-lang.c (ada_aggregate_operation::assign_aggregate): Return container. (ada_assign_operation::evaluate): Update. * ada-exp.h (class ada_aggregate_operation) <assign_aggregate>: Change return type. gdb/testsuite/ChangeLog 2021-03-15 Tom Tromey <tromey@adacore.com> * gdb.ada/assign_arr/target_wrapper.ads (IArray, Put, Do_Nothing): Declare. * gdb.ada/assign_arr/target_wrapper.adb: New file. * gdb.ada/assign_arr/main_p324_051.adb (IValue): New variable. Call Put. * gdb.ada/assign_arr.exp: Update.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker2-2/+2
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 Brobecker2-2/+2
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker2-2/+2
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-12-27Fix gdb.ada/assign_arr.exp by using more unique names.Philippe Waroquiers2-2/+2
The test fails (timeout) due to conflict between var 'input' and s-ststop.adb 'input': (gdb) print input.u2 := (0.25,0.5,0.75) Multiple matches for input [0] cancel [1] system.strings.stream_ops.storage_array_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return system.storage_elements.storage_array at s-ststop.adb:127 [2] system.strings.stream_ops.stream_element_array_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return ada.streams.stream_element_array at s-ststop.adb:127 [3] system.strings.stream_ops.string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return string at s-ststop.adb:127 [4] system.strings.stream_ops.wide_string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return wide_string at s-ststop.adb:127 [5] system.strings.stream_ops.wide_wide_string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return wide_wide_string at s-ststop.adb:127 [6] target_wrapper.input at /bd/home/philippe/gdb/git/info_t/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads:24 > FAIL: gdb.ada/assign_arr.exp: print input.u2 := (0.25,0.5,0.75) (timeout) gdb/testsuite/ChangeLog 2018-12-26 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to Assign_Arr_Input. main_p324_051.adb: Update accordingly. gdb.ada/assign_arr.exp: Likewise.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker2-2/+2
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-17(Ada) crash assigning to record component which is an arrayJoel Brobecker2-0/+47
Consider the following code, which declares a variabled called "input" of type "parameter", which is a record with one component called "u2", where the type of that component is a simple 3-element array of floating point values: type Float_Array_3 is array (1 .. 3) of Float; type parameters is record u2 : Float_Array_3; end record; input : parameters; Trying to assign a value to input.u2 causes GDB to crash: (gdb) p input.u2 := (0.25,0.5,0.75) [1] 20228 segmentation fault (core dumped) [...]/gdb The crash occurs because input.u2 is described in the debugging info as a typedef of an array. Indeed, input's type is: <1><ae9>: Abbrev Number: 7 (DW_TAG_structure_type) <aea> DW_AT_name : (indirect string, offset: 0x1045): target_wrapper__parameters [...] <2><af5>: Abbrev Number: 8 (DW_TAG_member) <af6> DW_AT_name : u2 [...] <afb> DW_AT_type : <0xaca> and, looking at DIE 0xaca to get input.u2's type, we see: <1><aca>: Abbrev Number: 4 (DW_TAG_typedef) <acb> DW_AT_name : (indirect string, offset: 0x1060): target_wrapper__float_array_3 [...] <ad1> DW_AT_type : <0xad5> We can also confirm, following the DW_AT_type attribute (0xad5), that it's a typedef of our array: <1><ad5>: Abbrev Number: 5 (DW_TAG_array_type) <ad6> DW_AT_name : (indirect string, offset: 0x1060): target_wrapper__float_array_3 [...] In fact, this scenario uncovered 2 areas where typedef handling is missing, thus causing a crash. The first happens inside assign_aggregate: if (ada_is_direct_array_type (lhs_type)) { lhs = ada_coerce_to_simple_array (lhs); lhs_type = value_type (lhs); low_index = TYPE_ARRAY_LOWER_BOUND_VALUE (lhs_type); high_index = TYPE_ARRAY_UPPER_BOUND_VALUE (lhs_type); } Here, lhs_type is a TYPE_CODE_TYPEDEF. ada_is_direct_array_type knows how to handle it, but TYPE_ARRAY_LOWER_BOUND_VALUE assumes that the given type is a TYPE_CODE_ARRAY. As such, it ends up accessing some fields in lhs_type which it shouldn't, and kaboom. We fixed this issue by making sure that the TYPE_CODE_TYPEDEF layer gets stripped. Once this is done, we hit a different kind of error, also leading to a SEGV, this time in assign_component. The code looks like this: if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY) [...] else [...] Because once again lhs is a TYPE_CODE_TYPEDEF, the check fail, and we end up assuming that lhs is a struct, executing the "else" block, which is: else { elt = ada_index_struct_field (index, lhs, 0, value_type (lhs)); elt = ada_to_fixed_value (elt); } Since lhs is not a struct, ada_index_struct_field returns NULL, which ada_to_fixed_value does not handle well, hence another crash. This patch fixes this other issue the same way, by stripping TYPE_CODE_TYPEDEF layers. gdb/ChangeLog: * ada-lang.c (assign_component): Strip any TYPE_CODE_TYPEDEF layer from lhs' type. (assign_aggregate): Likewise. gdb/testsuite: * gdb.ada/assign_arr: New testcase. Tested on x86_64-linux.