aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gdb.html
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2024-03-28 18:31:33 +0000
committerjohannst <johannst@users.noreply.github.com>2024-03-28 18:31:33 +0000
commit09fbbdde83fa792aa98eee0377971a9c5a7b8be5 (patch)
tree8ffcb846477fbe2535b2741d5f2c55ee08d42b17 /tools/gdb.html
parentda792f6afb36c4a03f51e618b64e6bd5e27fb3fd (diff)
downloadnotes-09fbbdde83fa792aa98eee0377971a9c5a7b8be5.tar.gz
notes-09fbbdde83fa792aa98eee0377971a9c5a7b8be5.zip
deploy: d5772f62300453d98ad0cfa8334efe0b62a7d157
Diffstat (limited to 'tools/gdb.html')
-rw-r--r--tools/gdb.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/gdb.html b/tools/gdb.html
index c8e3f09..80e38dd 100644
--- a/tools/gdb.html
+++ b/tools/gdb.html
@@ -341,6 +341,14 @@ thread name &lt;name&gt;
inferior &lt;id&gt;
Switch to inferior with &lt;id&gt;.
</code></pre>
+<h2 id="shell-commands"><a class="header" href="#shell-commands">Shell commands</a></h2>
+<pre><code class="language-markdown"> shell &lt;shell_cmd&gt;
+ Run the shell_cmd and print the output, can also contain a pipeline.
+
+ pipe &lt;gdb_cmd&gt; | &lt;shell_cmd&gt;
+ Evaluate the gdb_cmd and run the shell_cmd which receives the output
+ of the gdb_cmd via stdin.
+</code></pre>
<h2 id="source-file-locations"><a class="header" href="#source-file-locations">Source file locations</a></h2>
<pre><code class="language-markdown"> dir &lt;path&gt;
Add &lt;path&gt; to the beginning of the searh path for source files.
@@ -381,7 +389,14 @@ thread name &lt;name&gt;
set logging redirect &lt;on/off&gt;
on: only log to file.
off: log to file and tty.
+
+ set logging overwrite &lt;on/off&gt;
+ on: Truncate log file on each run.
+ off: Append to logfile (default).
</code></pre>
+<blockquote>
+<p>Logging options should be configured before logging is turned on.</p>
+</blockquote>
<h1 id="text-user-interface-tui"><a class="header" href="#text-user-interface-tui">Text user interface (TUI)</a></h1>
<pre><code class="language-markdown"> C-x a Toggle UI.
C-l Redraw UI (curses UI can be messed up after the debugee prints to
@@ -558,6 +573,21 @@ New value = 3
set (s=0x7fffffffe594, v=3) at test.c:5
5 }
</code></pre>
+<h2 id="shell-commands-1"><a class="header" href="#shell-commands-1">Shell commands</a></h2>
+<pre><code class="language-markdown"># Run shell commands.
+
+(gdb) shell zcat /proc/config.gz | grep CONFIG_KVM=
+CONFIG_KVM=m
+
+# Pipe gdb command to shell command.
+
+(gdb) pipe info proc mapping | grep libc
+ 0x7ffff7a1a000 0x7ffff7a42000 0x28000 0x0 r--p /usr/lib/libc.so.6
+ 0x7ffff7a42000 0x7ffff7b9d000 0x15b000 0x28000 r-xp /usr/lib/libc.so.6
+ 0x7ffff7b9d000 0x7ffff7bf2000 0x55000 0x183000 r--p /usr/lib/libc.so.6
+ 0x7ffff7bf2000 0x7ffff7bf6000 0x4000 0x1d7000 r--p /usr/lib/libc.so.6
+ 0x7ffff7bf6000 0x7ffff7bf8000 0x2000 0x1db000 rw-p /usr/lib/libc.so.6
+</code></pre>
<h1 id="know-bugs"><a class="header" href="#know-bugs">Know Bugs</a></h1>
<h2 id="workaround-command--finish-bug"><a class="header" href="#workaround-command--finish-bug">Workaround <code>command + finish</code> bug</a></h2>
<p>When using <code>finish</code> inside a <code>command</code> block, commands after <code>finish</code> are not