diff options
Diffstat (limited to 'tools/gdb.html')
-rw-r--r-- | tools/gdb.html | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/tools/gdb.html b/tools/gdb.html index a5c3459..bd4aae5 100644 --- a/tools/gdb.html +++ b/tools/gdb.html @@ -179,6 +179,8 @@ -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) </code></pre> <h1 id="interactive-usage"><a class="header" href="#interactive-usage">Interactive usage</a></h1> <h2 id="misc"><a class="header" href="#misc">Misc</a></h2> @@ -244,12 +246,37 @@ 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. </code></pre> +<h2 id="catchpoints"><a class="header" href="#catchpoints">Catchpoints</a></h2> +<pre><code class="language-markdown"> 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. +</code></pre> <h2 id="inspection"><a class="header" href="#inspection">Inspection</a></h2> <pre><code class="language-markdown"> info functions [<regex>] List functions matching <regex>. List all functions if no <regex> @@ -258,6 +285,9 @@ 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. </code></pre> <h2 id="signal-handling"><a class="header" href="#signal-handling">Signal handling</a></h2> <pre><code class="language-markdown"> info handle [<signal>] @@ -274,6 +304,33 @@ catch signal <signal> Create a catchpoint for <signal>. </code></pre> +<h2 id="multi-threading"><a class="header" href="#multi-threading">Multi-threading</a></h2> +<pre><code class="language-markdown">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. +</code></pre> +<h2 id="multi-process"><a class="header" href="#multi-process">Multi-process</a></h2> +<pre><code class="language-markdown"> 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>. +</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 <path> Add <path> to the beginning of the searh path for source files. @@ -291,10 +348,6 @@ <pre><code class="language-markdown"> 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. @@ -306,6 +359,9 @@ 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). @@ -316,6 +372,12 @@ on: only log to file. off: log to file and tty. </code></pre> +<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 + stdout/stderr). + C-x o Change focus. +</code></pre> <h1 id="user-commands-macros"><a class="header" href="#user-commands-macros">User commands (macros)</a></h1> <p>Gdb allows to create & document user commands as follows:</p> <pre><code class="language-markdown"> define <cmd> |