File 4761-erts-Add-code_ix-arguments-to-some-etp-commands.patch of Package erlang
From b481283cc6c1ee9d020d2d9428b08850308104b2 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Fri, 11 Nov 2022 15:25:18 +0100
Subject: [PATCH 1/2] erts: Add code_ix arguments to some etp commands
---
erts/etc/unix/etp-commands.in | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in
index 64d8de67df..0e764c2430 100644
--- a/erts/etc/unix/etp-commands.in
+++ b/erts/etc/unix/etp-commands.in
@@ -1159,12 +1159,19 @@ document etp-mfa
end
define etp-export-get
- # Args: Eterm Eterm Uint
+ # Args: M F A [code_ix]
set $etp_h = (((Eterm)$arg0 >> 6) * ((Eterm)$arg1 >> 6)) ^ (Uint)$arg2
+ if $argc == 3
+ set $etp_code_ix = the_active_code_index.counter
+ end
+ if $argc == 4
+ set $etp_code_ix = $arg3
+ end
+
#hash_get_slot
- set $etp_t = &export_tables[the_active_code_index.counter].htable
+ set $etp_t = &export_tables[$etp_code_ix].htable
set $etp_h ^= $etp_h >> $etp_t->shift
if $etp_arch64
set $etp_h = (11400714819323198485UL * $etp_h) >> $etp_t->shift
@@ -1188,9 +1195,10 @@ end
document etp-export-get
%---------------------------------------------------------
-% etp-export-get module function arity
+% etp-export-get module function arity [code_ix]
%
% Lookup and print pointer to Export entry.
+% code_ix is optional, default is the_active_code_index
% Example:
% (gdb) etp-string-to-atom "erlang"
% $1 = 13323
@@ -1207,8 +1215,15 @@ define etp-module-get
set $etp_ix = ((Eterm)$arg0 >> 6)
set $etp_h = $etp_ix
+ if $argc == 1
+ set $etp_code_ix = the_active_code_index.counter
+ end
+ if $argc == 2
+ set $etp_code_ix = $arg1
+ end
+
#hash_get_slot
- set $etp_t = &module_tables[the_active_code_index.counter].htable
+ set $etp_t = &module_tables[$etp_code_ix].htable
set $etp_h ^= $etp_h >> $etp_t->shift
if $etp_arch64
set $etp_h = (11400714819323198485UL * $etp_h) >> $etp_t->shift
@@ -1232,9 +1247,10 @@ end
document etp-module-get
%---------------------------------------------------------
-% etp-module-get module
+% etp-module-get module [code_ix]
%
% Lookup and print pointer to Module entry.
+% code_ix is optional, default is the_active_code_index
% Example:
% (gdb) etp-string-to-atom "erlang"
% $1 = 13323
@@ -1250,7 +1266,7 @@ define etp-cp-func-info-1
# Non-reentrant, takes cp, sets $etp_cp_p to MFA in func_info
#
set $etp_cp = (Eterm)($arg0)
- set $etp_ranges = &r[(int)the_active_code_index]
+ set $etp_ranges = &r[(int)the_active_code_index.counter]
set $etp_cp_low = $etp_ranges->modules
set $etp_cp_high = $etp_cp_low + $etp_ranges->n
set $etp_cp_mid = (Range*)$etp_ranges->mid
--
2.35.3