GDB cheat sheet

后端 未结 6 1252
别跟我提以往
别跟我提以往 2021-01-30 03:38

Can anyone recommend a good cheat sheet for gbd? I\'m experienced with windbg commands, I\'m looking for gdb equivalents for lml (list loaded modules), ~*k (all threads stack),

6条回答
  •  无人共我
    2021-01-30 03:50

      +========================+==============================+=============================+
      |GDB                     | DBX                          | WINDOWS  ntsd,wdeb386,windbg|
      +========================+==============================+=============================+
      |break line              | stop at line                 |                          F9 |
      |break func              | stop in func                 |bp func                 A-F9 |
      |break *addr             | stopi at addr                |br,ba                   A-F9 |
      |break ... if expr       | stop ... -if expr            |bp f "j cond 'r';'g'"   A-F9 |
      |cond n                  | stop ... -if expr            |                             |
      |tbreak                  | stop ... -temp               |bp f "bc"           F9 F5 F9 |
      |watch expr              | stop expr [slow]             |                             |
      |watch var               | stop modify &var [fast]      |                             |
      |                        | stop change var              |                        A-F9 |
      |catch x                 | intercept x                  |                             |
      |info break              | status                       |bl                      A-F9 |
      |info watch              | status                       |                             |
      |clear                   | clear                        |                             |
      |clear fun               | delete n                     |bc                           |
      |delete                  | delete all                   |bc *                    A-F9 |
      |disable                 | handler -disable all         |bd *                    C-F9 |
      |disable n               | handler -disable n           |                             |
      |enable                  | handler -enable all          |be                           |
      |enable n                | handler -enable n            |                             |
      |ignore n cnt            | handler -count n cnt         |bp n cnt                A-F9 |
      +========================+==============================+=============================+
      |set args                | runargs                      |                         A-F7|
      |run                     | run args                     |g                      C-S-F5|
      |continue                | cont                         |g (go)                   F5  |
      |stepi                   | stepi                        |t                            |
      |step                    | step                         |                         F11 |
      |next                    | next                         |p                        F10 |
      |jump line               | cont at line                 |p =addr / g =addr     R-Mouse|
      |finish                  | step up                      |bp retaddr+4             F12 |
      |return (now)            | pop                          |g =retaddr                   |
      |until line              | stop at line -temp;cont      |bp func;g                    |
      |C-j                     | !!                           | (repeat)                |
      +========================+==============================+=============================+
      |commands n              | when ... { cmds; }           |bp n "cmds"                  |
      |backtrace n             | where n                      |kb ks kv                     |
      |frame n                 | frame n                      |                             |
      |info reg reg            | print $reg                   |r                            |
      |signal num              | cont sig num                 |                             |
      |set var=expr            | assign var=expr              |e (enter bytes),f (fill)     |
      |x/fmt addr              | x addr/fmt                   |d[abcw] addr (display)    A-6|
      |disassem addr           | dis addr                     |u                   C-F11,A-8|
      |shell cmd               | sh cmd [if needed]           |                             |
      |info func regex         | funcs regexp                 |X (ntsd)                     |
      |ptype type              | whatis -t type               |                             |
      |define cmd              | function cmd                 |zs,zl,zd (default cmd)       |
      |handle sig              | stop sig sig                 |                             |
      |info signals            | status; catch                |di (display IDT)             |
      |attach pid              | debug - pid                  |                             |
      |attach pid              | debug a.out pid              |                             |
      |file file               | [unnecessary]                |                             |
      |exec file               | debug file                   |                             |
      |core file               | debug a.out corefile         |                             |
      |set editing on          | set -o emacs                 |                             |
      |set language x          | language x                   |                             |
      |set prompt x            | PS1=x                        |                             |
      |set history size x      | HISTSIZE=x                   |                             |
      |set print object on     | dbxenv output_dynamic_type on|                             |
      |show commands           | history                      |                             |
      |dir name                | pathmap name                 |                             |
      |show dir                | pathmap                      |lm                           |
      |info line 

提交回复
热议问题