aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
AgeCommit message (Collapse)AuthorFilesLines
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_cplus_tests and allow_stl_testsTom Tromey1-1/+1
This changes skip_cplus_tests to invert the sense, and renames it to allow_cplus_tests. This one also converts skip_stl_tests to allow_stl_tests, as that was convenient to do at the same time.
2023-01-13Use require !skip_cplus_testsTom Tromey1-1/+1
This changes some tests to use "require !skip_cplus_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-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-25[gdb/testsuite] Minimize gdb restartsTom de Vries1-1/+1
Minimize gdb restarts, applying the following rules: - don't use prepare_for_testing unless necessary - don't use clean_restart unless necessary Also, if possible, replace build_for_executable + clean_restart with prepare_for_testing for brevity. Touches 68 test-cases. Tested on x86_64-linux.
2021-04-07gdb: allow casting to rvalue reference in more casesAndrew Burgess1-0/+9
It is not currently possible to cast some values to an rvaule reference. This happens when simple scalar values are cast to an rvalue reference of the same type, e.g.: int global_var; Then in GDB: (gdb) p static_cast<int&&> (global_var) Attempt to take address of value not located in memory. Which is clearly silly. The problem is that as part of the cast an intermediate value is created within GDB that becomes an lval_none rather than the original lval_memory. The casting logic basically goes like this: The call tree that leads to the error looks like this: value_cast value_cast value_ref value_addr error The first value_cast call is casting the value for 'global_var' to type 'int&&'. GDB spots that the target type is a reference, and so calls value_cast again, this time casting 'global_var' to type 'int'. We then call value_ref to convert the result of the second value_cast into a reference. Unfortunately, the second cast results in the value (for global_var) changing from an lval_memory to an lval_none. This is because int to int casting calls extract_unsigned_integer and then value_from_longest. In theory value_cast has a check at its head that should help in this case, the code is: if (value_type (arg2) == type) return arg2; However, this only works in some cases. In our case 'value_type (arg2)' will be an objfile owned type, while the type from the expression parser 'int&&' will be gdbarch owned. The pointers will not be equal, but the meaning of the type will be equal. I did consider making the int to int casting case smarter, but this obviously is only one example. We must also consider things like float to float, or pointer to pointer.... So, I instead decided to try and make the initial check smarter. Instead of a straight pointer comparison, I now propose that we use types_deeply_equal. If this is true then we are casting something back to its current type, in which case we can preserve the lval setting by using value_copy. gdb/ChangeLog: * valops.c (value_cast): Call value_deeply_equal before performing any cast. gdb/testsuite/ChangeLog: * gdb.cp/rvalue-ref-params.cc (f3): New function. (f4): New function. (global_int): New global variable. (global_float): Likeiwse. (main): Call both new functions. * gdb.cp/rvalue-ref-params.exp: Add new tests.
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-03-07[gdb/testsuite] Fix testing build_executable resultTom de Vries1-1/+1
When running with target board unix/-feliminate-dwarf2-dups, we run into these FAILs: ... FAIL: gdb.cp/rvalue-ref-params.exp: print value of f1 on Child&& in f2 FAIL: gdb.cp/ref-params.exp: print value of f1 on Child in main FAIL: gdb.cp/ref-params.exp: print value of f2 on Child in main FAIL: gdb.cp/ref-params.exp: print value of f1 on Child& in f2 FAIL: gdb.cp/ref-params.exp: print mf1(MQ) FAIL: gdb.cp/ref-params.exp: print mf2(MQ) FAIL: gdb.cp/ref-params.exp: print f1(MQR) FAIL: gdb.cp/ref-params.exp: print mf1(MQR) FAIL: gdb.cp/ref-params.exp: print mf2(MQR) ... This is due to comparing the result of build_executable to 1, while build_executable returns either 0 for success, or -1 for failure. Fix this by comparing with -1 instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-03-07 Tom de Vries <tdevries@suse.de> * gdb.cp/ref-params.exp: Compare build_executable result with -1. * gdb.cp/rvalue-ref-params.exp: Same.
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-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-04-27Fix overload resolution involving rvalue references and cv qualifiers.Keith Seitz1-1/+0
The following patch fixes several outstanding overload resolution problems with rvalue references and cv qualifiers in the test suite. The tests for these problems typically passed with one compiler version and failed with another. This behavior occurs because of the ordering of the overloaded functions in the debug info. So the first best match "won out" over the a subsequent better match. One of the bugs addressed by this patch is the failure of rank_one_type to account for type equality of two overloads based on CV qualifiers. This was leading directly to problems evaluating rvalue reference overload quality, but it is also highlighted in gdb.cp/oranking.exp, where two test KFAIL as a result of this shortcoming. I found the overload resolution code committed with the rvalue reference patch (f9aeb8d49) needlessly over-complicated, and I have greatly simplified it. This fixes some KFAILing tests in gdb.exp/rvalue-ref-overload.exp. gdb/ChangeLog * gdbtypes.c (LVALUE_REFERENCE_TO_RVALUE_BINDING_BADNESS) DIFFERENT_REFERENCE_TYPE_BADNESS): Remove. (CV_CONVERSION_BADNESS): Define. (rank_one_type): Remove overly restrictive rvalue reference rank checks. Add cv-qualifier checks and subranks for type equality. * gdbtypes.h (REFERENCE_CONVERSION_RVALUE, REFERENCE_CONVERSION_CONST_LVALUE, CV_CONVERSION_BADNESS, CV_CONVERSION_CONST, CV_CONVERSION_VOLATILE): Declare. gdb/testsuite/ChangeLog * gdb.cp/oranking.cc (test15): New function. (main): Call test15 and declare additional variables for testing. * gdb.cp/oranking.exp: Remove kfail status for "p foo4(&a)" and "p foo101('abc')" tests. * gdb.cp/rvalue-ref-overloads.exp: Remove kfail status for "lvalue reference overload" test. * gdb.cp/rvalue-ref-params.exp: Remove kfail status for "print value of f1 on Child&& in f2" test.
2017-03-20Add rvalue reference tests and docsArtemiy Volkov1-0/+69
This patch adds tests for the initial rvalue reference support patchset. All of the new tests are practically mirrored regular references tests and, except for the demangler ones, are introduced in new files, which are set to be compiled with -std=gnu++11. Tested are printing of rvalue reference types and values, rvalue reference parameters in function overloading, demangling of function names containing rvalue reference parameters, casts to rvalue reference types, application of the sizeof operator to rvalue reference types and values, and support for rvalue references within the gdb python module. gdb/ChnageLog PR gdb/14441 * NEWS: Mention support for rvalue references in GDB and python. * doc/gdb.texinfo (C Plus Plus Expressions): Mention that GDB supports both lvalue and rvalue references. gdb/testsuite/ChangeLog PR gdb/14441 * gdb.cp/demangle.exp: Add rvalue reference tests. * gdb.cp/rvalue-ref-casts.cc: New file. * gdb.cp/rvalue-ref-casts.exp: New file. * gdb.cp/rvalue-ref-overload.cc: New file. * gdb.cp/rvalue-ref-overload.exp: New file. * gdb.cp/rvalue-ref-params.cc: New file. * gdb.cp/rvalue-ref-params.exp: New file. * gdb.cp/rvalue-ref-sizeof.cc: New file. * gdb.cp/rvalue-ref-sizeof.exp: New file. * gdb.cp/rvalue-ref-types.cc: New file. * gdb.cp/rvalue-ref-types.exp: New file. * gdb.python/py-rvalue-ref-value-cc.cc: New file. * gdb.python/py-rvalue-ref-value-cc.exp: New file.