aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada/mi_string_access.exp
AgeCommit message (Collapse)AuthorFilesLines
2024-09-06Introduce and use foreach_gnat_encodingTom Tromey1-2/+2
gnat-llvm does not support the -fgnat-encodings flag. This patch prepares gdb's Ada tests to handle this situation by introducing a new foreach_gnat_encoding. A subsequent patch may change this to support gnat-llvm; meanwhile this is a little cleaner anyway.
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
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-13Rename to allow_ada_testsTom Tromey1-1/+1
This changes skip_ada_tests to invert the sense, and renames it to allow_ada_tests.
2023-01-13Use require !skip_ada_testsTom Tromey1-1/+1
This changes some tests to use "require !skip_ada_tests".
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
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-07-22gdb/testsuite: give binaries distinct names in Ada testsSimon Marchi1-2/+2
Some Ada tests repeat their test sequence with different gnat-encodings, typically "all" and "minimal". However, they give the same name to both binaries, meaning the second run overwrites the binary of the first run. This makes it difficult and confusing when trying to reproduce problems manually with the test artifacts. Change those tests to use unique names for each pass. Change-Id: Iaa3c9f041241249a7d67392e785c31aa189dcc88
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
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-09-30gdb/testsuite: make runto_main not pass no-message to runtoSimon Marchi1-1/+0
As follow-up to this discussion: https://sourceware.org/pipermail/gdb-patches/2020-August/171385.html ... make runto_main not pass no-message to runto. This means that if we fail to run to main, for some reason, we'll emit a FAIL. This is the behavior we want the majority of (if not all) the time. Without this, we rely on tests logging a failure if runto_main fails, otherwise. They do so in a very inconsisteny mannet, sometimes using "fail", "unsupported" or "untested". The messages also vary widly. This patch removes all these messages as well. Also, remove a few "fail" where we call runto (and not runto_main). by default (without an explicit no-message argument), runto prints a failure already. In two places, gdb.multi/multi-re-run.exp and gdb.python/py-pp-registration.exp, remove "message" passed to runto. This removes a few PASSes that we don't care about (but FAILs will still be printed if we fail to run to where we want to). This aligns their behavior with the rest of the testsuite. Change-Id: Ib763c98c5f4fb6898886b635210d7c34bd4b9023
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
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-11-04Synthesize array descriptors with -fgnat-encodings=minimalTom Tromey1-28/+32
When -fgnat-encodings=minimal, the compiler will avoid the special GNAT-specific "encodings" format, and instead emit ordinary DWARF as much as possible. When emitting DWARF for thick pointers to arrays, the compiler emits something like: <1><11db>: Abbrev Number: 7 (DW_TAG_array_type) <11dc> DW_AT_name : (indirect string, offset: 0x1bb8): string <11e0> DW_AT_data_location: 2 byte block: 97 6 (DW_OP_push_object_address; DW_OP_deref) <11e3> DW_AT_type : <0x1173> <11e7> DW_AT_sibling : <0x1201> <2><11eb>: Abbrev Number: 8 (DW_TAG_subrange_type) <11ec> DW_AT_type : <0x1206> <11f0> DW_AT_lower_bound : 6 byte block: 97 23 8 6 94 4 (DW_OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref; DW_OP_deref_size: 4) <11f7> DW_AT_upper_bound : 8 byte block: 97 23 8 6 23 4 94 4 (DW_OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref; DW_OP_plus_uconst: 4; DW_OP_deref_size: 4) If you read between the lines, the "array" is actually a structure with two elements. One element is a pointer to the array data, and the other structure describes the bounds of the array. However, the compiler doesn't emit this explicitly, but instead hides it behind these location expressions. gdb can print such objects, but currently there is no way to construct one. So, this patch adds some code to the DWARF reader to recognize this construct, and then synthesize an array descriptor. This descriptor is then handled by the existing Ada code. Internally, we've modified GCC to emit the structure type explicitly (we will of course be sending this upstream). In this case, the array still has the DW_AT_data_location, though. This patch also modifies gdb to ignore the data location in this case -- this is preferred because the location only serves to confuse the Ada code that already knows where to find the data. In the future I hope to move some of this handling to the gdb core, so that Ada-specific hacks are not needed; however I have not yet done this. Because parallel types are not emitted with -fgnat-encodings=minimal, some changes to the Ada code were also required. The change ina ada-valprint.c was needed to avoid infinite recursion when trying to print a constrained packed array. And, there didn't seem to be any need for a recursive call here -- the value could simply be returned instead. Finally, gdb.ada/frame_arg_lang.exp no longer works in C mode, because we drop back to the structure approach now. As mentioned earlier, future work should probably fix this again; meanwhile, this doesn't seem to be a big problem, because it is what is currently done (users as a rule don't use -fgnat-encodings=minimal -- which is what I am ultimately trying to fix). Note that a couple of tests have an added KFAIL. Some -fgnat-encodings=minimal changes have landed in GNAT, and you need something very recent to pass all the tests. I'm using git gcc to accomplish this. gdb/ChangeLog 2020-11-04 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (recognize_bound_expression) (quirk_ada_thick_pointer): New functions. (read_array_type): Call quirk_ada_thick_pointer. (set_die_type): Add "skip_data_location" parameter. (quirk_ada_thick_pointer): New function. (process_structure_scope): Call quirk_ada_thick_pointer. * ada-lang.c (ada_is_unconstrained_packed_array_type) (decode_packed_array_bitsize): Handle thick pointers without parallel types. (ada_is_gnat_encoded_packed_array_type): Rename from ada_is_packed_array_type. (ada_is_constrained_packed_array_type): Update. * ada-valprint.c (ada_val_print_gnat_array): Remove. (ada_value_print_1): Use ada_get_decoded_value. gdb/testsuite/ChangeLog 2020-11-04 Tom Tromey <tromey@adacore.com> * gdb.ada/O2_float_param.exp: Test different -fgnat-encodings values. * gdb.ada/access_to_unbounded_array.exp: Test different -fgnat-encodings values. * gdb.ada/big_packed_array.exp: Test different -fgnat-encodings values. * gdb.ada/arr_enum_idx_w_gap.exp: Test different -fgnat-encodings values. * gdb.ada/array_ptr_renaming.exp: Test different -fgnat-encodings values. * gdb.ada/array_of_variable_length.exp: Test different -fgnat-encodings values. * gdb.ada/arrayparam.exp: Test different -fgnat-encodings values. * gdb.ada/arrayptr.exp: Test different -fgnat-encodings values. * gdb.ada/frame_arg_lang.exp: Revert -fgnat-encodings=minimal change. * gdb.ada/mi_string_access.exp: Test different -fgnat-encodings values. * gdb.ada/mod_from_name.exp: Test different -fgnat-encodings values. * gdb.ada/out_of_line_in_inlined.exp: Test different -fgnat-encodings values. * gdb.ada/packed_array.exp: Test different -fgnat-encodings values. * gdb.ada/pckd_arr_ren.exp: Test different -fgnat-encodings values. * gdb.ada/unc_arr_ptr_in_var_rec.exp: Test different -fgnat-encodings values. * gdb.ada/variant_record_packed_array.exp: Test different -fgnat-encodings values.
2020-10-13Eliminate mi_run_to_main, introduce mi_clean_restartPedro Alves1-9/+2
Since we now have mi_runto_main which is like runto_main, eliminate mi_run_to_main, in favor of a new MI clean_restart counterpart -- mi_clean_restart -- and mi_runto_main. This makes MI testcases look a bit more like CLI testcases. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_clean_restart): New. (mi_run_to_main): Delete. All callers adjust to use mi_clean_restart / mi_runto_main. Change-Id: I34920bab4fea1f23fb752928c2969c1f6ad714b6
2020-08-13Add skip_ada_tests to more Ada testcasesPedro Alves1-0/+2
This adds missing skip_ada_tests checks to Ada testcases, using the exact same pattern the existing files that do check it use. gdb/testsuite/ChangeLog: * gdb.ada/access_tagged_param.exp: Check skip_ada_tests. * gdb.ada/access_to_packed_array.exp: Likewise. * gdb.ada/access_to_unbounded_array.exp: Likewise. * gdb.ada/addr_arith.exp: Likewise. * gdb.ada/arr_acc_idx_w_gap.exp: Likewise. * gdb.ada/arr_arr.exp: Likewise. * gdb.ada/arr_enum_idx_w_gap.exp: Likewise. * gdb.ada/array_bounds.exp: Likewise. * gdb.ada/array_of_variable_length.exp: Likewise. * gdb.ada/array_ptr_renaming.exp: Likewise. * gdb.ada/array_subscript_addr.exp: Likewise. * gdb.ada/arraydim.exp: Likewise. * gdb.ada/arrayparam.exp: Likewise. * gdb.ada/arrayptr.exp: Likewise. * gdb.ada/assign_1.exp: Likewise. * gdb.ada/assign_arr.exp: Likewise. * gdb.ada/atomic_enum.exp: Likewise. * gdb.ada/attr_ref_and_charlit.exp: Likewise. * gdb.ada/bad-task-bp-keyword.exp: Likewise. * gdb.ada/bias.exp: Likewise. * gdb.ada/boolean_expr.exp: Likewise. * gdb.ada/bp_c_mixed_case.exp: Likewise. * gdb.ada/bp_enum_homonym.exp: Likewise. * gdb.ada/bp_inlined_func.exp: Likewise. * gdb.ada/bp_on_var.exp: Likewise. * gdb.ada/bp_range_type.exp: Likewise. * gdb.ada/bp_reset.exp: Likewise. * gdb.ada/call_pn.exp: Likewise. * gdb.ada/catch_assert_if.exp: Likewise. * gdb.ada/catch_ex.exp: Likewise. * gdb.ada/catch_ex_std.exp: Likewise. * gdb.ada/char_enum.exp: Likewise. * gdb.ada/char_param.exp: Likewise. * gdb.ada/complete.exp: Likewise. * gdb.ada/cond_lang.exp: Likewise. * gdb.ada/convvar_comp.exp: Likewise. * gdb.ada/dgopt.exp: Likewise. * gdb.ada/disc_arr_bound.exp: Likewise. * gdb.ada/display_nested.exp: Likewise. * gdb.ada/dot_all.exp: Likewise. * gdb.ada/dyn_loc.exp: Likewise. * gdb.ada/dyn_stride.exp: Likewise. * gdb.ada/excep_handle.exp: Likewise. * gdb.ada/expr_delims.exp: Likewise. * gdb.ada/expr_with_funcall.exp: Likewise. * gdb.ada/exprs.exp: Likewise. * gdb.ada/fin_fun_out.exp: Likewise. * gdb.ada/fixed_cmp.exp: Likewise. * gdb.ada/formatted_ref.exp: Likewise. * gdb.ada/frame_arg_lang.exp: Likewise. * gdb.ada/frame_args.exp: Likewise. * gdb.ada/fullname_bp.exp: Likewise. * gdb.ada/fun_addr.exp: Likewise. * gdb.ada/fun_in_declare.exp: Likewise. * gdb.ada/fun_overload_menu.exp: Likewise. * gdb.ada/fun_renaming.exp: Likewise. * gdb.ada/funcall_char.exp: Likewise. * gdb.ada/funcall_param.exp: Likewise. * gdb.ada/funcall_ptr.exp: Likewise. * gdb.ada/funcall_ref.exp: Likewise. * gdb.ada/homonym.exp: Likewise. * gdb.ada/info_addr_mixed_case.exp: Likewise. * gdb.ada/info_auto_lang.exp: Likewise. * gdb.ada/info_exc.exp: Likewise. * gdb.ada/info_types.exp: Likewise. * gdb.ada/int_deref.exp: Likewise. * gdb.ada/interface.exp: Likewise. * gdb.ada/iwide.exp: Likewise. * gdb.ada/lang_switch.exp: Likewise. * gdb.ada/length_cond.exp: Likewise. * gdb.ada/maint_with_ada.exp: Likewise. * gdb.ada/mi_catch_assert.exp: Likewise. * gdb.ada/mi_catch_ex.exp: Likewise. * gdb.ada/mi_catch_ex_hand.exp: Likewise. * gdb.ada/mi_dyn_arr.exp: Likewise. * gdb.ada/mi_ex_cond.exp: Likewise. * gdb.ada/mi_exc_info.exp: Likewise. * gdb.ada/mi_interface.exp: Likewise. * gdb.ada/mi_prot.exp: Likewise. * gdb.ada/mi_ref_changeable.exp: Likewise. * gdb.ada/mi_string_access.exp: Likewise. * gdb.ada/mi_task_arg.exp: Likewise. * gdb.ada/mi_task_info.exp: Likewise. * gdb.ada/mi_var_array.exp: Likewise. * gdb.ada/mi_var_union.exp: Likewise. * gdb.ada/mi_variant.exp: Likewise. * gdb.ada/minsyms.exp: Likewise. * gdb.ada/mod_from_name.exp: Likewise. * gdb.ada/nested.exp: Likewise. * gdb.ada/null_array.exp: Likewise. * gdb.ada/optim_drec.exp: Likewise. * gdb.ada/out_of_line_in_inlined.exp: Likewise. * gdb.ada/packed_array_assign.exp: Likewise. * gdb.ada/packed_tagged.exp: Likewise. * gdb.ada/pp-rec-component.exp: Likewise. * gdb.ada/print_chars.exp: Likewise. * gdb.ada/print_pc.exp: Likewise. * gdb.ada/ptr_typedef.exp: Likewise. * gdb.ada/ptype_arith_binop.exp: Likewise. * gdb.ada/ptype_array.exp: Likewise. * gdb.ada/ptype_field.exp: Likewise. * gdb.ada/ptype_tagged_param.exp: Likewise. * gdb.ada/ptype_union.exp: Likewise. * gdb.ada/py_range.exp: Likewise. * gdb.ada/py_taft.exp: Likewise. * gdb.ada/rdv_wait.exp: Likewise. * gdb.ada/rec_comp.exp: Likewise. * gdb.ada/rec_return.exp: Likewise. * gdb.ada/ref_param.exp: Likewise. * gdb.ada/ref_tick_size.exp: Likewise. * gdb.ada/rename_subscript_param.exp: Likewise. * gdb.ada/repeat_dyn.exp: Likewise. * gdb.ada/same_component_name.exp: Likewise. * gdb.ada/same_enum.exp: Likewise. * gdb.ada/scalar_storage.exp: Likewise. * gdb.ada/set_wstr.exp: Likewise. * gdb.ada/small_reg_param.exp: Likewise. * gdb.ada/str_binop_equal.exp: Likewise. * gdb.ada/str_ref_cmp.exp: Likewise. * gdb.ada/str_uninit.exp: Likewise. * gdb.ada/sub_variant.exp: Likewise. * gdb.ada/sym_print_name.exp: Likewise. * gdb.ada/taft_type.exp: Likewise. * gdb.ada/tagged.exp: Likewise. * gdb.ada/tagged_access.exp: Likewise. * gdb.ada/task_bp.exp: Likewise. * gdb.ada/task_switch_in_core.exp: Likewise. * gdb.ada/tasks.exp: Likewise. * gdb.ada/tick_last_segv.exp: Likewise. * gdb.ada/tick_length_array_enum_idx.exp: Likewise. * gdb.ada/type_coercion.exp: Likewise. * gdb.ada/unc_arr_ptr_in_var_rec.exp: Likewise. * gdb.ada/unchecked_union.exp: Likewise. * gdb.ada/uninitialized_vars.exp: Likewise. * gdb.ada/var_arr_attrs.exp: Likewise. * gdb.ada/var_arr_typedef.exp: Likewise. * gdb.ada/var_rec_arr.exp: Likewise. * gdb.ada/variant-record.exp: Likewise. * gdb.ada/variant.exp: Likewise. * gdb.ada/variant_record_packed_array.exp: Likewise. * gdb.ada/varsize_limit.exp: Likewise. * gdb.ada/whatis_array_val.exp: Likewise. * gdb.ada/widewide.exp: Likewise. * gdb.ada/win_fu_syms.exp: Likewise.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
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-10-18[gdb/testsuite] Fix capitalized test namesTom de Vries1-1/+1
At https://sourceware.org/gdb/wiki/GDBTestcaseCookbook\ #Follow_the_test_name_convention we find: .. Test names should start with a lower case and don't need to end with a period (they are not sentences). ... Fix some capitalized test names. Tested on x86_64-linux. 2018-10-18 Tom de Vries <tdevries@suse.de> * gdb.ada/bp_inlined_func.exp: Fix capitalized test name. * gdb.ada/excep_handle.exp: Same. * gdb.ada/mi_string_access.exp: Same. * gdb.ada/mi_var_union.exp: Same. * gdb.arch/arc-analyze-prologue.exp: Same. * gdb.arch/arc-decode-insn.exp: Same. * gdb.base/readnever.exp: Same. * gdb.fortran/printing-types.exp: Same. * gdb.guile/scm-lazy-string.exp: Same.
2018-09-10(Ada/MI) Fix -var-evaluate-expression for access to unconstrained arraysXavier Roirand1-0/+64
Using this Ada code: type String_Access is access String; type Array_Of_String is array (1 .. 2) of String_Access; Aos : Array_Of_String := (new String'("ab"), new String'("cd")); In GDB/MI mode, create a variable which type is Aos, evaluate it: (gdb) -var-create var1 * Aos ^done,name="var1",numchild="2",value="[2]",type="bar.array_of_string",thread-id="1",has_more="0" Now print it: (gdb) -var-list-children 1 var1 ^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="[2] \"ab\"", type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="[2] \"cd\"", type="bar.string_access",thread-id="1"}],has_more="0" But printed fields "value" are wrong, since it should be: ^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="0x634018",type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="0x634038",type="bar.string_access",thread-id="1"}],has_more="0"^M Print each child of var1: (gdb) -var-evaluate-expression var1.1 ^done,value="[2] \"ab\"" (gdb) -var-evaluate-expression var1.2 ^done,value="[2] \"cd\"" Whereas it should be (gdb) -var-evaluate-expression var1.1 ^done,value="0x635018" (gdb) -var-evaluate-expression var1.2 ^done,value="0x635038" This patch fixes this. gdb/ChangeLog: * ada-lang.c (ada_value_subscript): Handle case when parameter is an array of access to unconstrained array. testsuite/ChangeLog * gdb.ada/mi_string_access.exp: New testcase. * gdb.ada/mi_string_access/bar.adb: New file. * gdb.ada/mi_string_access/pck.adb: New file. * gdb.ada/mi_string_access/pck.asd: New file. Tested on x86_64-linux.