diff options
author | Björn Gustavsson <[email protected]> | 2010-12-16 10:32:28 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-01-17 15:23:22 +0100 |
commit | 6ce5ab74806d044070768175f48605bab7fa079d (patch) | |
tree | 5be617825d4e878c6d5dd4b48dd7b1d2feada2b0 /erts/emulator/beam/beam_debug.c | |
parent | 1d82ce2e4466980e5c360b54722952a30bc3ae50 (diff) | |
download | otp-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/beam_debug.c')
-rw-r--r-- | erts/emulator/beam/beam_debug.c | 19 |
1 files changed, 19 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) { |