diff options
author | Sverker Eriksson <[email protected]> | 2014-10-02 16:05:47 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-10-02 16:05:47 +0200 |
commit | 3a865c0cd9a97aedc20c70f69a60fcc23eb4b4d0 (patch) | |
tree | 643171326352c6fb5ef1b76ab47c4047fcaa345f /erts/etc/unix/etp-commands.in | |
parent | 65e91d8572d674f9d501ad7061b386506e8c0870 (diff) | |
parent | 8aa3475bba30fed67c1d886fc4bb5910a196db6c (diff) | |
download | otp-3a865c0cd9a97aedc20c70f69a60fcc23eb4b4d0.tar.gz otp-3a865c0cd9a97aedc20c70f69a60fcc23eb4b4d0.tar.bz2 otp-3a865c0cd9a97aedc20c70f69a60fcc23eb4b4d0.zip |
Merge branch 'maint'
Diffstat (limited to 'erts/etc/unix/etp-commands.in')
-rw-r--r-- | erts/etc/unix/etp-commands.in | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in index ee27770e51..1a723ad936 100644 --- a/erts/etc/unix/etp-commands.in +++ b/erts/etc/unix/etp-commands.in @@ -3561,6 +3561,39 @@ document etp-carrier-blocks %--------------------------------------------------------------------------- end +define etp-address-to-beam-opcode + set $etp_i = 0 + set $etp_min_diff = ((UWord)1 << (sizeof(UWord)*8 - 1)) + set $etp_min_opcode = -1 + set $etp_addr = (UWord) ($arg0) + + while $etp_i < num_instructions && $etp_min_diff > 0 + if ($etp_addr - (UWord)beam_ops[$etp_i]) < $etp_min_diff + set $etp_min_diff = $etp_addr - (UWord)beam_ops[$etp_i] + set $etp_min_opcode = $etp_i + end + set $etp_i = $etp_i + 1 + end + if $etp_min_diff == 0 + printf "Address %p is start of '%s'\n", $etp_addr, opc[$etp_min_opcode].name + else + if $etp_min_opcode >= 0 + printf "Address is %ld bytes into opcode '%s' at %p\n", $etp_min_diff, opc[$etp_min_opcode].name, beam_ops[$etp_min_opcode] + else + printf "Invalid opcode address\n" + end + end +end + +document etp-address-to-beam-opcode +%--------------------------------------------------------------------------- +% Get beam opcode from a native instruction address (within process_main()) +% Arg: Instructon pointer value +% +% Does not work with NO_JUMP_TABLE +%--------------------------------------------------------------------------- +end + ############################################################################ # Toolbox parameter handling |