aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-07-02 10:10:20 +0200
committerBjörn Gustavsson <[email protected]>2015-07-02 12:27:18 +0200
commit0d69dcf52f190c29ba1778bc61f030e6379f4379 (patch)
treeb2ef8e071b72c61aad3ee5da643b7302ad6447d9
parent92a0cf0cafb20181982554d9a95247c86f9db4e4 (diff)
downloadotp-0d69dcf52f190c29ba1778bc61f030e6379f4379.tar.gz
otp-0d69dcf52f190c29ba1778bc61f030e6379f4379.tar.bz2
otp-0d69dcf52f190c29ba1778bc61f030e6379f4379.zip
Correct disassembly of the i_get_map_elements instruction
The emulator would crash.
-rw-r--r--erts/emulator/beam/beam_debug.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index c756de8c8e..8a35ad17c6 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -669,7 +669,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
case op_new_map_dII:
case op_update_map_assoc_jsdII:
case op_update_map_exact_jsdII:
- case op_i_get_map_elements_fsI:
{
int n = unpacked[-1];
@@ -693,6 +692,32 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
+ case op_i_get_map_elements_fsI:
+ {
+ int n = unpacked[-1];
+
+ while (n > 0) {
+ if (n % 3 == 1) {
+ erts_print(to, to_arg, " %X", ap[0]);
+ } else if (!is_header(ap[0])) {
+ erts_print(to, to_arg, " %T", (Eterm) ap[0]);
+ } else {
+ switch ((ap[0] >> 2) & 0x03) {
+ case R_REG_DEF:
+ erts_print(to, to_arg, " x(0)");
+ break;
+ case X_REG_DEF:
+ erts_print(to, to_arg, " x(%d)", ap[0] >> 4);
+ break;
+ case Y_REG_DEF:
+ erts_print(to, to_arg, " y(%d)", ap[0] >> 4);
+ break;
+ }
+ }
+ ap++, size++, n--;
+ }
+ }
+ break;
}
erts_print(to, to_arg, "\n");