Add new filter mechanism: Exclude list of function symbols

This commit is contained in:
2026-08-05 19:05:47 +02:00
parent 68a86206d7
commit e067310dce
2 changed files with 100 additions and 5 deletions
+52 -5
View File
@@ -94,6 +94,39 @@ my %CONFIGS = (
},
);
# All entries are functions part of the native call chain
my @NATIVE_CALL_FUNCS = (
'aot_invoke_native', # imported-function dispatch (AOT)
'aot_call_indirect', # call_indirect dispatch (AOT)
'wasm_interp_call_func_native', # native dispatch (Interp)
'wasm_runtime_invoke_native', # common
'invokeNative', # common
# Imported functions:
'host_fail_start_trace',
'host_fail_stop_trace',
'host_fail_marker_positive',
'host_fail_marker_negative',
'host_fail_marker_detected',
'host_print',
);
$CONFIGS{no_native_call_instr} = {
label => "Exclude WAMR native call chain (instr)",
regions => [
map { { func => $_, col => 'p.injection_instr_absolute' } }
@NATIVE_CALL_FUNCS
],
};
$CONFIGS{no_native_call_data} = {
label => "Exclude WAMR native call chain (data)",
regions => [
map { { func => $_, col => 'g.data_physical_address' } }
@NATIVE_CALL_FUNCS
],
};
# Those will be executed automatically by runner.pl (+ no filter at all)
# my @DEFAULT_CONFIGS = ('no_aot_data');
my @DEFAULT_CONFIGS = ();
@@ -117,12 +150,26 @@ sub build_filter_clause {
return ""
unless defined $experiment_dir && -f "$experiment_dir/system.elf";
my $elf = "$experiment_dir/system.elf";
my @filters;
for my $pair (@$regions) {
my ( $start_sym, $end_sym, $col ) = @$pair;
my $start =
Util::elf_sym_addr( "$experiment_dir/system.elf", $start_sym );
my $end = Util::elf_sym_addr( "$experiment_dir/system.elf", $end_sym );
for my $region (@$regions) {
my ( $start, $end, $col );
if ( ref($region) eq 'HASH' ) {
# Single-function form: resolve [start, end) via symbol + size.
$col = $region->{col};
( $start, $end ) = Util::elf_sym_range( $elf, $region->{func} );
}
else {
# Linker-range form: [start_sym, end_sym, col].
my ( $start_sym, $end_sym );
( $start_sym, $end_sym, $col ) = @$region;
$start = Util::elf_sym_addr( $elf, $start_sym );
$end = Util::elf_sym_addr( $elf, $end_sym );
}
next unless defined $start && defined $end && $end > $start;
push @filters, "$col NOT BETWEEN $start AND @{[$end - 1]}";
}