dart-sdk/tests/ffi
Daco Harkes f21b7cafbc [vm/ffi] Adds param number in trampoline null error
Before: `NoSuchMethodError: The method 'FfiTrampoline' was called on
null.`
After: `Invalid argument(s): argument value for ':ffi_param2' is null`.

Makes the ArgumentNullError RTE lookup the name of the argument in the
code source map when reporting a null argument.

Makes the FFI call arguments and FFI callbacks use kArgumentError
instead of the default kNoSuchMethod so that we target this RTE instead.

This changes the Error type from `NoSuchMethodError` to `ArgumentError`.
Because `Error`s should not be caught [1], this is fine.

Since FFI trampolines are created from type arguments, the arguments do
not have names. The arguments are assigned names programmatically. See
the related bug.

Also, this CL cleans up the SourcePosition of the `CheckNullOptimized`,
it was never passed.

[1] https://dart.dev/guides/language/effective-dart/usage#dont-explicitly-catch-error-or-types-that-implement-it

TEST=tests/ffi/function_test.dart

Closes: https://github.com/dart-lang/sdk/issues/47094
Bug: https://github.com/dart-lang/sdk/issues/36780

Change-Id: I15e7de4d026e034bde0eda3ba7fe3785f0da5057
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212462
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-09-04 07:22:03 +00:00
..
generator [vm] Fix gcc build. 2021-06-17 16:05:02 +00:00
aliasing_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
all_positive.dart [vm/ffi] Fuchsia FFI testing package 2020-12-10 12:15:17 +00:00
allocator_test.dart [vm/ffi] Introduce Allocator API 2021-01-13 17:04:08 +00:00
analysis_options.yaml [vm/ffi] regression test for 37511 2019-08-21 08:10:34 +00:00
callback_tests_utils.dart [VM/FFI] Adds FFI leaf calls. 2021-05-21 11:12:02 +00:00
calloc_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
coordinate.dart [vm/ffi] Migrate off .addressOf in tests 2021-01-28 21:40:15 +00:00
coordinate_nnbd_workaround.dart [vm/ffi] Migrate off .addressOf in tests 2021-01-28 21:40:15 +00:00
data_not_asan_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
data_test.dart [vm/ffi] Change Pointer.elementAt and sizeOf to use static type 2021-02-17 11:39:42 +00:00
dylib_isolates_test.dart [vm/ffi] Fix prepare_flutter_bundle.dart 2020-10-28 21:33:35 +00:00
dylib_utils.dart [vm/ffi] Fuchsia FFI testing package 2020-12-10 12:15:17 +00:00
expando_test.dart Rereland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos" 2021-04-14 12:07:18 +00:00
extension_methods_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
external_typed_data_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
ffi.status [vm/concurrency] Enable more isolate tests, remove outdated TODOs, fix 2 tests 2021-07-16 07:51:58 +00:00
ffi_native_test.dart [VM] Moves FfiNative fields to function parent. 2021-08-09 09:13:38 +00:00
ffi_test_helpers.dart [vm/ffi] Remove Pointer.offsetBy. 2019-10-10 15:44:27 +00:00
function_callbacks_many_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
function_callbacks_structs_by_value_generated_test.dart [vm/ffi] Update tests to cover MacOS arm64 after-struct alignment 2021-06-11 12:00:26 +00:00
function_callbacks_structs_by_value_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
function_callbacks_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
function_callbacks_very_many_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
function_structs_by_value_generated_test.dart [vm/ffi] Update tests to cover MacOS arm64 after-struct alignment 2021-06-11 12:00:26 +00:00
function_structs_test.dart [VM/FFI] Adds FFI leaf calls. 2021-05-21 11:12:02 +00:00
function_test.dart [vm/ffi] Adds param number in trampoline null error 2021-09-04 07:22:03 +00:00
function_very_many_test.dart [vm/ffi] Add tests with very many arguments 2020-01-22 15:21:32 +00:00
hardfp_test.dart [vm/ffi] Add tests with very many arguments 2020-01-22 15:21:32 +00:00
has_symbol_test.dart [vm/ffi] Add providesSymbol to DynamicLibrary 2021-06-02 16:01:43 +00:00
inline_array_multi_dimensional_test.dart [vm/ffi] Support multi-dimensional inline arrays 2021-03-09 10:50:17 +00:00
inline_array_test.dart [vm/ffi] Support multi-dimensional inline arrays 2021-03-09 10:50:17 +00:00
native_effect_test.dart [vm] Native effects 2021-04-09 16:45:13 +00:00
negative_function_test.dart [vm/ffi] Change asFunction and lookFunction to extension methods 2020-02-14 15:46:37 +00:00
regress_37254_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
regress_39044_test.dart [vm] Do not fuse constants with different representations 2019-10-23 12:59:28 +00:00
regress_39063_test.dart [vm/ffi] Support moves with temp in ffi call 2019-10-23 17:42:41 +00:00
regress_39885_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
regress_40537_test.dart [vm/ffi] Fix sign extension for small int arguments on x64 Linux/MacOS 2020-02-10 17:05:14 +00:00
regress_43016_test.dart [vm/ffi] Add fields to Structs which should not be empty 2021-01-15 12:24:13 +00:00
regress_43693_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
regress_44985_test.dart [cfe/ffi] Fix Struct invalid field crashes 2021-02-19 15:50:44 +00:00
regress_44986_test.dart [cfe/ffi] Fix Struct invalid field crashes 2021-02-19 15:50:44 +00:00
regress_45189_test.dart [vm/ffi] Array range error message 2021-03-30 00:12:49 +00:00
regress_45198_test.dart [vm/ffi] Fix Array<Pointer> loads and stores 2021-03-18 12:26:38 +00:00
regress_45507_test.dart [analyzer/ffi] Inline array annotation const dimensions 2021-03-30 00:28:57 +00:00
regress_45988_test.dart [vm/ffi] Union transform fix offsets 2021-05-12 09:50:00 +00:00
regress_46004_test.dart [cfe/ffi] Fix user-defined getters 2021-05-20 13:12:22 +00:00
regress_46085_test.dart [vm/ffi] Fix CFE crash on missing Array sizes 2021-05-26 11:02:22 +00:00
regress_46127_test.dart [vm/ffi] Fix ia32 struct by value return with no arguments 2021-05-26 13:37:32 +00:00
regress_flutter79441_test.dart [vm/ffi] Fix representation of value for 8-bit and 16-bit FFI loads and stores 2021-04-06 21:11:23 +00:00
regress_jump_to_frame_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
sizeof_test.dart [vm/ffi] Fix test sizeOf struct on arm32 2021-02-03 10:21:08 +00:00
snapshot_test.dart [vm] Remove --experimental-enable-isolate-groups-jit, only guard via --enable-isolate-groups 2021-07-16 09:13:28 +00:00
stacktrace_regress_37910_test.dart [vm/ffi] Fix crashes on stacktraces and debugging with force-optimized frames. 2019-08-26 10:18:34 +00:00
structs_nested_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
structs_nnbd_workaround_test.dart Reland "[vm/ffi] Remove deprecated Struct.addressOf getter" 2021-03-01 19:20:30 +00:00
structs_packed_test.dart [vm/ffi] Support packed Structs 2021-03-19 15:34:42 +00:00
structs_test.dart Reland "[vm/ffi] Remove deprecated Struct.addressOf getter" 2021-03-01 19:20:30 +00:00
unaligned_test.dart [vm/ffi] Exercise unaligned reads/writes 2021-03-16 20:17:31 +00:00
variance_function_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
very_large_struct.dart [vm/ffi] NNBD use external fields for structs 2020-05-18 12:22:50 +00:00
vmspecific_dynamic_library_test.dart [vm/ffi] Split out tests which use nulls 2020-01-20 16:01:08 +00:00
vmspecific_enable_ffi_test.dart Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
vmspecific_function_callbacks_exit_test.dart [vm/ffi] Add tests with very many arguments 2020-01-22 15:21:32 +00:00
vmspecific_function_callbacks_negative_test.dart [vm/ffi] Split up function_callbacks_test 2019-12-12 16:48:40 +00:00
vmspecific_function_callbacks_test.dart [vm] Remove --experimental-enable-isolate-groups-jit, only guard via --enable-isolate-groups 2021-07-16 09:13:28 +00:00
vmspecific_function_gc_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
vmspecific_function_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00
vmspecific_handle_dynamically_linked_test.dart [vm] Native API: Make Dart_NewWeakPersistentHandle not auto delete 2020-11-03 10:27:44 +00:00
vmspecific_handle_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
vmspecific_highmem_32bit_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00
vmspecific_leaf_call_test.dart [VM/FFI] Adds FFI leaf calls. 2021-05-21 11:12:02 +00:00
vmspecific_object_gc_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00
vmspecific_regress_37100_test.dart [vm/ffi] Migrate to empty Structs to Opaque 2021-01-15 10:52:53 +00:00
vmspecific_regress_37511_callbacks_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
vmspecific_regress_37511_test.dart [vm] Removes FLAG_enable_testing_pragmas from native_api_impl 2021-05-21 07:04:37 +00:00
vmspecific_regress_37780_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00
vmspecific_regress_38993_test.dart [vm/ffi] Add fields to Structs which should not be empty 2021-01-15 12:24:13 +00:00
vmspecific_send_port_id_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00
vmspecific_static_checks_test.dart [VM/FFI] Adds FFI leaf calls. 2021-05-21 11:12:02 +00:00
vmspecific_variance_function_checks_test.dart [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific 2019-12-04 15:56:08 +00:00