aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-05-03 20:33:13 +0200
committerSverker Eriksson <[email protected]>2017-05-04 16:18:25 +0200
commitf95094d67e56a51bbdaadaf18625bb01c584bf2d (patch)
tree2f736408d9e248f9008c935860c7a072fd2c5b92 /erts/emulator
parente01b87f45486330561d5673fd109a6b6e40828b2 (diff)
downloadotp-f95094d67e56a51bbdaadaf18625bb01c584bf2d.tar.gz
otp-f95094d67e56a51bbdaadaf18625bb01c584bf2d.tar.bz2
otp-f95094d67e56a51bbdaadaf18625bb01c584bf2d.zip
erts: Fix code:is_module_native for local trace
Local trace on first function in module made code:is_module_native/1 return true. Use new erts_is_function_native() to make a proper check.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_load.c9
-rw-r--r--erts/emulator/test/trace_local_SUITE.erl1
2 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 2763d8a38e..4f5c68d29a 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -5685,12 +5685,11 @@ erts_is_module_native(BeamCodeHeader* code_hdr)
if (code_hdr != NULL) {
num_functions = code_hdr->num_functions;
for (i=0; i<num_functions; i++) {
- BeamInstr* func_info = (BeamInstr *) code_hdr->functions[i];
- Eterm name = (Eterm) func_info[3];
- if (is_atom(name)) {
- return func_info[1] != 0;
+ ErtsCodeInfo* ci = code_hdr->functions[i];
+ if (is_atom(ci->mfa.function)) {
+ return erts_is_function_native(ci);
}
- else ASSERT(is_nil(name)); /* ignore BIF stubs */
+ else ASSERT(is_nil(ci->mfa.function)); /* ignore BIF stubs */
}
}
return 0;
diff --git a/erts/emulator/test/trace_local_SUITE.erl b/erts/emulator/test/trace_local_SUITE.erl
index 5b65889f4a..1cbe6201c3 100644
--- a/erts/emulator/test/trace_local_SUITE.erl
+++ b/erts/emulator/test/trace_local_SUITE.erl
@@ -298,6 +298,7 @@ basic_test() ->
setup([call]),
NumMatches = erlang:trace_pattern({?MODULE,'_','_'},[],[local]),
NumMatches = erlang:trace_pattern({?MODULE,'_','_'},[],[local]),
+ false = code:is_module_native(?MODULE), % got fooled by local trace
erlang:trace_pattern({?MODULE,slave,'_'},false,[local]),
[1,1,1,997] = apply_slave(?MODULE,exported_wrap,[1]),
?CT(?MODULE,exported_wrap,[1]),