aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-12-16 10:32:28 +0100
committerBjörn Gustavsson <[email protected]>2011-01-17 15:23:22 +0100
commit6ce5ab74806d044070768175f48605bab7fa079d (patch)
tree5be617825d4e878c6d5dd4b48dd7b1d2feada2b0 /erts/emulator/beam
parent1d82ce2e4466980e5c360b54722952a30bc3ae50 (diff)
downloadotp-6ce5ab74806d044070768175f48605bab7fa079d.tar.gz
otp-6ce5ab74806d044070768175f48605bab7fa079d.tar.bz2
otp-6ce5ab74806d044070768175f48605bab7fa079d.zip
Add erts_debug:instructions/0 for listing all specific instructions
erts_debug:instructions/0 is useful for finding which specific instructions that are not used at all.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/beam_debug.c19
-rw-r--r--erts/emulator/beam/bif.tab1
2 files changed, 20 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index b0bf14b94f..6f2a21b50a 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -157,6 +157,25 @@ void debug_dump_code(BeamInstr *I, int num)
}
#endif
+BIF_RETTYPE
+erts_debug_instructions_0(BIF_ALIST_0)
+{
+ int i = 0;
+ Uint needed = num_instructions * 2;
+ Eterm* hp;
+ Eterm res = NIL;
+
+ for (i = 0; i < num_instructions; i++) {
+ needed += 2*strlen(opc[i].name);
+ }
+ hp = HAlloc(BIF_P, needed);
+ for (i = num_instructions-1; i >= 0; i--) {
+ Eterm s = erts_bld_string_n(&hp, 0, opc[i].name, strlen(opc[i].name));
+ res = erts_bld_cons(&hp, 0, s, res);
+ }
+ return res;
+}
+
Eterm
erts_debug_disassemble_1(Process* p, Eterm addr)
{
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 60b4b1946b..d9dd80fa8b 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -660,6 +660,7 @@ bif erts_debug:display/1
bif 'erl.system.debug':display/1 ebif_erts_debug_display_1
bif erts_debug:dist_ext_to_term/2
bif 'erl.system.debug':dist_ext_to_term/2 ebif_erts_debug_dist_ext_to_term_2
+bif erts_debug:instructions/0
#
# Monitor testing bif's...