File 0371-otp-Improve-tutorial-documentation.patch of Package erlang
From c7a7579ac490df4c9cc93fcc7a93945506c75a5f Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 28 Jun 2023 18:17:49 +0200
Subject: [PATCH 1/2] otp: Improve tutorial documentation
---
system/doc/tutorial/complex6.erl | 4 ++--
system/doc/tutorial/debugging.xml | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/system/doc/tutorial/complex6.erl b/system/doc/tutorial/complex6.erl
index 05aa8e68f1..19e10dc01e 100644
--- a/system/doc/tutorial/complex6.erl
+++ b/system/doc/tutorial/complex6.erl
@@ -7,6 +7,6 @@ init() ->
ok = erlang:load_nif("./complex6_nif", 0).
foo(_X) ->
- exit(nif_library_not_loaded).
+ erlang:nif_error(nif_library_not_loaded).
bar(_Y) ->
- exit(nif_library_not_loaded).
+ erlang:nif_error(nif_library_not_loaded).
diff --git a/system/doc/tutorial/debugging.xml b/system/doc/tutorial/debugging.xml
index 4439bc6d19..ce78c92eba 100644
--- a/system/doc/tutorial/debugging.xml
+++ b/system/doc/tutorial/debugging.xml
@@ -49,9 +49,27 @@
have indicated which specific buggy NIF/driver that caused the corruption
may be long gone.
</p>
+ <p>
+ Another kind of bugs that are hard to find are <em>memory
+ leaks</em>. They may go unnoticed and not cause problem until a
+ deployed system has been running for a long time.
+ </p>
+ <p>
+ The following sections describe tools that make it easier to both detect
+ and find the root cause of bugs like this. These tools are actively
+ used during development, testing and troubleshooting of the Erlang runtime
+ system itself.
+ </p>
+ <list type="bulleted">
+ <item><seeguide marker="#debug">Debug emulator</seeguide></item>
+ <item><seeguide marker="#asan">Address Sanitizer</seeguide></item>
+ <item><seeguide marker="#valgrind">Valgrind</seeguide></item>
+ <item><seeguide marker="#rr">rr - Record and Replay</seeguide></item>
+ </list>
</section>
<section>
- <title>The debug emulator</title>
+ <marker id="debug"/>
+ <title>Debug emulator</title>
<p>
One way to make debugging easier is to run an emulator built with target
<c>debug</c>. It will
@@ -143,6 +161,7 @@ or
</p>
</section>
<section>
+ <marker id="asan"/>
<title>Address Sanitizer</title>
<p>
<url href="https://clang.llvm.org/docs/AddressSanitizer.html">
@@ -218,6 +237,7 @@ Eshell V13.0.2 (abort with ^G)
</p>
</section>
<section>
+ <marker id="valgrind"/>
<title>Valgrind</title>
<p>
An even more heavy weight debugging tool is <url
@@ -257,6 +277,7 @@ Eshell V13.0.2 (abort with ^G)
</pre>
</section>
<section>
+ <marker id="rr"/>
<title>rr - Record and Replay</title>
<p>
Last but not least, the fantastic interactive debugging tool <url
--
2.35.3