aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gdb.html6
-rw-r--r--tools/zsh.html23
2 files changed, 27 insertions, 2 deletions
diff --git a/tools/gdb.html b/tools/gdb.html
index 145fc62..d40e26d 100644
--- a/tools/gdb.html
+++ b/tools/gdb.html
@@ -341,6 +341,12 @@ instruction pointer (<code>$rip</code> x86) and format as instruction <code>/i</
# Make existing breakpoint conditional
cond 2 if i == 7
</code></pre>
+<h2 id="set-breakpoint-on-all-threads-except-one"><a class="header" href="#set-breakpoint-on-all-threads-except-one">Set breakpoint on all threads except one</a></h2>
+<p>Create conditional breakpoint using the <code>$_thread</code> <a href="https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Vars.html#Convenience-Vars">convenience
+variable</a>.</p>
+<pre><code class="language-markdown"> # Create conditional breakpoint on all threads except thread 12.
+ b foo if $_thread != 12
+</code></pre>
<h2 id="catch-sigsegv-and-execute-commands"><a class="header" href="#catch-sigsegv-and-execute-commands">Catch SIGSEGV and execute commands</a></h2>
<p>This creates a <code>catchpoint</code> for the <code>SIGSEGV</code> signal and attached the <code>command</code>
to it.</p>
diff --git a/tools/zsh.html b/tools/zsh.html
index 6b5eaab..04cdbde 100644
--- a/tools/zsh.html
+++ b/tools/zsh.html
@@ -378,8 +378,8 @@ blu -- desc for blu
</code></pre>
<p>where <code>SPEC</code> can have one of the following forms:</p>
<ul>
-<li><code>OPT[DESC]:MSG:ACTION</code></li>
-<li><code>N:MSG:ACTION</code></li>
+<li><code>OPT[DESC]:MSG:ACTION</code> for option flags</li>
+<li><code>N:MSG:ACTION</code> for positional arguments</li>
</ul>
<p>Available actions</p>
<pre><code class="language-zsh">(op1 op2) list possible matches
@@ -416,6 +416,25 @@ function _foo() {
esac
}
</code></pre>
+<h3 id="example-with-optional-arguments"><a class="header" href="#example-with-optional-arguments">Example with optional arguments</a></h3>
+<p>For this example we assume that the command <code>foo</code> takes at least three optional
+arguments such as</p>
+<pre><code class="language-zsh">foo arg1 arg2 arg3 [argN..]
+</code></pre>
+<pre><code class="language-zsh">function _foo() {
+ _arguments \
+ &quot;1:opt 1:(a b c)&quot; \
+ &quot;:opt next:(d e f)&quot; \
+ &quot;*:opt all:(u v w)&quot;
+}
+</code></pre>
+<p>Explanation:</p>
+<ul>
+<li><code>1:MSG:ACTION</code> sets completion for the <strong>first</strong> optional argument</li>
+<li><code>:MSG:ACTION</code> sets completion for the <strong>next</strong> optional argument</li>
+<li><code>*:MSG:ACTION</code> sets completion for the optional argument where none of the
+previous rules apply, so in our example for <code>arg3, argN..</code>.</li>
+</ul>
<blockquote>
<p><code>_files</code> is a zsh builtin utility function to complete files/dirs see</p>
<ul>