aboutsummaryrefslogtreecommitdiffhomepage
path: root/print.html
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2024-11-09 10:42:31 +0000
committerjohannst <johannst@users.noreply.github.com>2024-11-09 10:42:31 +0000
commit07dda6914ac1354b53da50d1b43cf439102c1bcc (patch)
tree716ce644a38715e36b6fa22e2b884839e06ef1c0 /print.html
parent76d0ea3113933da30c1251e8c8b7016a677dfa42 (diff)
downloadnotes-07dda6914ac1354b53da50d1b43cf439102c1bcc.tar.gz
notes-07dda6914ac1354b53da50d1b43cf439102c1bcc.zip
deploy: 3d599bcbf6771def1076c3e9561bc748956dfc94
Diffstat (limited to 'print.html')
-rw-r--r--print.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/print.html b/print.html
index 792c807..3f180a5 100644
--- a/print.html
+++ b/print.html
@@ -2760,11 +2760,25 @@ renice -n 5 -p PID
-o &lt;file&gt; ... log output into &lt;file&gt;
-l &lt;filter&gt; . show who calls into lib matched by &lt;filter&gt;
-C .......... demangle
+ -x &lt;filter&gt; . which symbol table entry points to trace
+ (can be of form sym_pattern@lib_pattern)
</code></pre>
<h1 id="example-5"><a class="header" href="#example-5">Example</a></h1>
<p>List which program/libs call into <code>libstdc++</code>:</p>
<pre><code class="language-bash">ltrace -l '*libstdc++*' -C -o ltrace.log ./main
</code></pre>
+<p>Trace symbols from <code>dlopen(3)</code>ed libraries.</p>
+<pre><code class="language-bash"># Assume libfoo.so would be dynamically loaded via dlopen.
+ltrace -x '@libfoo.so'
+
+# Trace all dlopened symbols.
+ltrace -x '*'
+# Trace all symbols from dlopened libraries which name match the
+# pattern "liby*".
+ltrace -x '@liby*'
+# Trace symbol "foo" from all dlopened libraries matching the pattern.
+ltrace -x 'foo@liby*'
+</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="perf1"><a class="header" href="#perf1">perf(1)</a></h1>
<pre><code>perf list show supported hw/sw events &amp; metrics
-v ........ print longer event descriptions
@@ -3319,11 +3333,18 @@ thread name &lt;name&gt;
on: Truncate log file on each run.
off: Append to logfile (default).
+ set trace-commands &lt;on | off&gt;
+ on: Echo comamands executed (good with logging).
+ off: Do not echo commands executedt (default).
+
set history filename &lt;fname&gt;
Change file where to save and restore command history to and from.
set history &lt;on | off&gt;
Enable or disable saving of command history.
+
+ set exec-wrapper &lt;cli&gt;
+ Set an exec wrapper which sets up the env and execs the debugee.
</code></pre>
<blockquote>
<p>Logging options should be configured before logging is turned on.</p>
@@ -3534,6 +3555,34 @@ executed. To workaround that bug one can create a wrapper function which calls
handler
end
</code></pre>
+<h2 id="launch-debuggee-through-an-exec-wrapper"><a class="header" href="#launch-debuggee-through-an-exec-wrapper">Launch debuggee through an exec wrapper</a></h2>
+<pre><code class="language-markdown">&gt; cat test.c
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+
+int main() {
+ const char* env = getenv("MOOSE");
+ printf("$MOOSE=%s\n", env ? env : "&lt;nullptr&gt;");
+}
+
+&gt; cat test.sh
+#!/bin/bash
+
+echo "running test.sh wapper"
+export MOOSE=moose
+exec ./test
+
+&gt; gcc -g -o test test.c
+
+&gt; gdb test
+(gdb) r
+$MOOSE=&lt;nullptr&gt;
+
+(gdb) set exec-wrapper bash test.sh
+(gdb) r
+running test.sh wapper
+$MOOSE=moose
+</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="gdbserver1"><a class="header" href="#gdbserver1">gdbserver(1)</a></h1>
<h1 id="cli-1"><a class="header" href="#cli-1">CLI</a></h1>
<pre><code class="language-markdown"> gdbserver [opts] comm prog [args]