File 6751-ms_transform-allow-caller_line-and-current_stacktrac.patch of Package erlang

From 86a5137544b933dcdcaae8ca12fb072b1dbd7a66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= <gomoripeti@gmail.com>
Date: Sun, 26 Feb 2023 01:09:52 +0100
Subject: [PATCH] ms_transform: allow caller_line and current_stacktrace action
 functions

caller_line/0 was added in https://github.com/erlang/otp/pull/5305,
while current_stacktrace/0,/1 were added in
https://github.com/erlang/otp/pull/6628
---
 lib/stdlib/src/ms_transform.erl        |  3 +++
 lib/stdlib/test/ms_transform_SUITE.erl | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl
index ba3a5c42bf..40b8dc9948 100644
--- a/lib/stdlib/src/ms_transform.erl
+++ b/lib/stdlib/src/ms_transform.erl
@@ -1017,6 +1017,9 @@ action_function(set_tcw,1) -> true;
 action_function(silent,1) -> true;
 action_function(trace,2) -> true;
 action_function(trace,3) -> true;
+action_function(caller_line,0) -> true;
+action_function(current_stacktrace,0) -> true;
+action_function(current_stacktrace,1) -> true;
 action_function(_,_) -> false.
 
 bool_operator('and',2) ->
diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl
index f13f3d99e3..5e8e6076ae 100644
--- a/lib/stdlib/test/ms_transform_SUITE.erl
+++ b/lib/stdlib/test/ms_transform_SUITE.erl
@@ -859,6 +859,16 @@ action_function(Config) when is_list(Config) ->
 	    "silent(true), "
 	    "trace([send], [procs]), "
 	    "trace(Y, [procs], [send])  end)">>),
+    [{['$1','$2'],
+             [],
+             [{caller_line},
+              {current_stacktrace},
+              {current_stacktrace,3}]}] =
+        compile_and_run
+          (<<"dbg:fun2ms(fun([X,Y]) -> "
+             "caller_line(),"
+             "current_stacktrace(),"
+             "current_stacktrace(3) end)">>),
     ok.
 
 
-- 
2.35.3

openSUSE Build Service is sponsored by