From 09fbbdde83fa792aa98eee0377971a9c5a7b8be5 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 28 Mar 2024 18:31:33 +0000 Subject: deploy: d5772f62300453d98ad0cfa8334efe0b62a7d157 --- tools/gdb.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tools/gdb.html') 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 <name> inferior <id> Switch to inferior with <id>. +

Shell commands

+
  shell <shell_cmd>
+          Run the shell_cmd and print the output, can also contain a pipeline.
+
+  pipe <gdb_cmd> | <shell_cmd>
+          Evaluate the gdb_cmd and run the shell_cmd which receives the output
+          of the gdb_cmd via stdin.
+

Source file locations

  dir <path>
           Add <path> to the beginning of the searh path for source files.
@@ -381,7 +389,14 @@ thread name <name>
   set logging redirect <on/off>
           on: only log to file.
           off: log to file and tty.
+
+  set logging overwrite <on/off>
+          on: Truncate log file on each run.
+          off: Append to logfile (default).
 
+
+

Logging options should be configured before logging is turned on.

+

Text user interface (TUI)

  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   }
 
+

Shell commands

+
# 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
+

Know Bugs

Workaround command + finish bug

When using finish inside a command block, commands after finish are not -- cgit v1.2.3