aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_debug.c
diff options
context:
space:
mode:
authorNikolaos S. Papaspyrou <[email protected]>2014-03-14 11:32:46 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-11-17 14:45:45 +0100
commit8d02ad60c88aa060ff83ff3179bc8c0ab66868ee (patch)
tree3368a591afaa2d23c9d7b38d70f80dc42785ccbb /erts/emulator/beam/beam_debug.c
parent7141fa8e4534ab7e4dcc3cad6c46872efa0e6e66 (diff)
downloadotp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.tar.gz
otp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.tar.bz2
otp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.zip
Add machinery to enable SHCOPY dynamically
This commit is just for debugging purposes, will probably be reverted. It comes with a the erts_debug:copy_shared/1 BIF. If SHCOPY_DISABLE is defined, SHCOPY starts disabled and is dynamically enabled the first time that the BIF is called.
Diffstat (limited to 'erts/emulator/beam/beam_debug.c')
-rw-r--r--erts/emulator/beam/beam_debug.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index 40e3f4db4e..36f3cfabbc 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -89,6 +89,32 @@ erts_debug_size_shared_1(BIF_ALIST_1)
}
BIF_RETTYPE
+erts_debug_copy_shared_1(BIF_ALIST_1)
+{
+ Process* p = BIF_P;
+ Eterm term = BIF_ARG_1;
+ Uint size;
+ Eterm* hp;
+ Eterm copy;
+ shcopy_info info;
+#ifdef SHCOPY_DISABLE
+ extern int disable_copy_shared;
+#endif
+ INITIALIZE_INFO(info);
+
+ size = copy_shared_calculate(term, &info, 0);
+ if (size > 0) {
+ hp = HAlloc(p, size);
+ }
+ copy = copy_shared_perform(term, size, &info, &hp, &p->off_heap, 0);
+ DESTROY_INFO(info);
+#ifdef SHCOPY_DISABLE
+ disable_copy_shared = 0;
+#endif
+ BIF_RET(copy);
+}
+
+BIF_RETTYPE
erts_debug_breakpoint_2(BIF_ALIST_2)
{
Process* p = BIF_P;