From 75983cdedc08916cc08875cb8b543ecf6befb35f Mon Sep 17 00:00:00 2001 From: johannst Date: Mon, 24 Jul 2023 21:01:38 +0000 Subject: deploy: 5778d4cb2db3081aa346f66cf3f3b7500b342dc6 --- print.html | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 4 deletions(-) (limited to 'print.html') diff --git a/print.html b/print.html index dbef297..331b940 100644 --- a/print.html +++ b/print.html @@ -1564,6 +1564,8 @@ gpg> save -x <file> execute script <file> before prompt -ex <cmd> execute command <cmd> before prompt --tty <tty> set I/O tty for debugee + --batch run in batch mode, exit after processing options (eg used + for scripting)

Interactive usage

Misc

@@ -1629,12 +1631,37 @@ gpg> save Create a watchpoint for <expr>, will break if <expr> is written to. Watchpoints respect scope of variables, -l can be used to watch the memory location instead. + rwatch ... Sets a read watchpoint, will break if <expr> is read from. + awatch ... Sets an access watchpoint, will break if <expr> is written to or read from. +

Catchpoints

+
  catch load [<regex>]
+          Stop when shared libraries are loaded, optionally specify a <regex>
+          to stop only on matches.
+  catch unload [<regex>]
+          Stop when shared libraries are unloaded, optionally specify a <regex>
+          to stop only on matches.
+
+  catch throw
+          Stop when an exception is thrown.
+  catch rethrow
+          Stop when an exception is rethrown.
+  catch catch
+          Stop when an exception is caught.
+
+  catch fork
+          Stop at calls to fork (also stops at clones, as some systems
+          implement fork via clone).
+
+  catch syscall [<syscall> <syscall> ..]
+          Stop at syscall. If no argument is given, stop at all syscalls.
+          Optionally give a list of syscalls to stop at.
+

Inspection

  info functions [<regex>]
           List functions matching <regex>. List all functions if no <regex>
@@ -1643,6 +1670,9 @@ gpg> save
   info variables [<regex>]
           List variables matching <regex>. List all variables if no <regex>
           provided.
+
+  info register [<reg> <reg> ..]
+          Dump content of all registers or only the specified <reg>ister.
 

Signal handling

  info handle [<signal>]
@@ -1659,6 +1689,33 @@ gpg> save
   catch signal <signal>
           Create a catchpoint for <signal>.
 
+

Multi-threading

+
info thread
+          List all threads.
+
+thread apply <id> [<id>] <command>
+          Run command on all threads listed by <id> (space separated list).
+          When 'all' is specified as <id> the <command> is run on all threads.
+
+thread name <name>
+          The <name> for the current thread.
+
+

Multi-process

+
  set follow-fork-mode <child | parent>
+          Specify which process to follow when debuggee makes a fork(2)
+          syscall.
+
+  set detach-on-frok <on | off>
+          Turn on/off detaching from new child processes (on by default).
+          Turning this off allows to debug multiple processes (inferiors) with
+          one gdb session.
+
+  info inferiors
+          List all processes gdb debugs.
+
+  inferior <id>
+          Switch to inferior with <id>.
+

Source file locations

  dir <path>
           Add <path> to the beginning of the searh path for source files.
@@ -1676,10 +1733,6 @@ gpg> save
 
  set disassembly-flavor <intel | att>
           Set the disassembly style "flavor".
 
-  set follow-fork-mode <child | parent>
-          Specify which process to follow when debuggee makes a fork(2)
-          syscall.
-
   set pagination <on | off>
           Turn on/off gdb's pagination.
 
@@ -1691,6 +1744,9 @@ gpg> save
   set print pretty <on | off>
           Turn on/off pertty printing of structures.
 
+  set style enabled <on | off>
+          Turn on/off styling (eg colored output).
+
   set logging <on | off>
           Enable output logging to file (default gdb.txt).
 
@@ -1701,6 +1757,12 @@ gpg> save
           on: only log to file.
           off: log to file and tty.
 
+

Text user interface (TUI)

+
  C-x a     Toggle UI.
+  C-l       Redraw UI (curses UI can be messed up after the debugee prints to
+            stdout/stderr).
+  C-x o     Change focus.
+

User commands (macros)

Gdb allows to create & document user commands as follows:

  define <cmd>
@@ -2418,16 +2480,24 @@ opts:
 

strace(1)

strace [opts] [prg]
   -f .......... follow child processes on fork(2)
+  -ff ......... follow fork and separate output file per child
   -p <pid> .... attach to running process
   -s <size> ... max string size, truncate of longer (default: 32)
   -e <expr> ... expression for trace filtering
   -o <file> ... log output into <file>
   -c .......... dump syscall statitics at the end
+  -C .......... like -c but dump regular ouput as well
   -k .......... dump stack trace for each syscall
   -P <path> ... only trace syscall accesing path
   -y .......... print paths for FDs
   -tt ......... print absolute timestamp (with us precision)
   -r .......... print relative timestamp
+  -z .......... log only successful syscalls
+  -Z .......... log only failed syscalls
+  -n .......... print syscall numbers
+  -y .......... translate fds (eg file path, socket)
+  -yy ......... translate fds with all information (eg IP)
+  -x .......... print non-ASCII chars as hex string
 
<expr>:
   trace=syscall[,syscall] .... trace only syscall listed
-- 
cgit v1.2.3