Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on gdb. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/gdb.e> # or at <http://angg.twu.net/e/gdb.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # Note: there are some more interesting (and recent) things at: # (find-es "anatocc") # Other stuff: # «.invoking_gdbk» (to "invoking_gdbk") # «.zcatinfo-gdb» (to "zcatinfo-gdb") # «.gdb-source» (to "gdb-source") # «.online-help» (to "online-help") # «.gdb-6.5-on-sarge» (to "gdb-6.5-on-sarge") # «.gdb-6.6-on-etch» (to "gdb-6.6-on-etch") # «.C-types» (to "C-types") # «.mailing-lists» (to "mailing-lists") # «.urdb» (to "urdb") # «.gdb-squeeze» (to "gdb-squeeze") # «.lua-gdb-helper» (to "lua-gdb-helper") # «.main-commands» (to "main-commands") # «.macros» (to "macros") # «.python» (to "python") # «.gud» (to "gud") # «.realgud» (to "realgud") # (find-zsh "installeddebs | sort | grep gdb") # (find-zsh "availabledebs | sort | grep gdb") # (find-status "gdb") # (find-vldifile "gdb.list") # (find-udfile "gdb/") # (find-status "gdb-doc") # (find-vldifile "gdb-doc.list") # (find-udfile "gdb-doc/") # (find-node "(gdb)") # (find-node "(gcc)") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) apti gdb gdb-doc ##### # # invoking gdb (links to e-scripts that use gdb in interesting ways) # 2001jan21 # ##### # «invoking_gdbk» (to ".invoking_gdbk") # (find-es "anatocc" "dlopen") # (find-es "mktclapp" "debugging_.sos") # (find-es "expect") # (find-es "tcl" "8.3-src") #* # The most powerful -- and less trivial -- way to call invoke gdb/gdbk # on a running program is this one: the program runs normally on a # terminal, and when M-g is pressed a lurking Expect makes Emacs # attach a gdb on it. # (find-es "lynx" "debug_lynx") expect -c ' spawn /usr/src/lynx-2.8.3/lynx set pid [exp_pid] interact "\033p" {send_user "\n$pid\n"} \ "\033g" { set gdbkstr "/usr/src/lynx-2.8.3/lynx $pid" set lispcode "(gdbk-gdb nil \"$gdbkstr\")" catch {exec gnudoit $lispcode} } ' #* GNUCLIENT=no expect -c ' spawn [set f /usr/src/emacs-21.0.93/src/emacs] -nw $env(HOME)/CRIM/014ideas interact "\033g" {catch {exec gnudoit "(gdbk-gdb nil \"$f [exp_pid]\")"}} ' #* ##### # # gdb and eev # 2000jan10 # ##### # (find-angg "eev-extras.el" "gdbk-mode") # (find-es "anatocc" "dlopen") # (find-es "mktclapp" "debugging_.sos") # (find-fline "~/.gdbinit") # (find-fline "~/GDB/") ##### # # searching the gdb info docs # 2000sep09 # ##### # «zcatinfo-gdb» (to ".zcatinfo-gdb") # (find-status "gdb") # (find-vldifile "gdb.list") # (find-fline "/usr/doc/gdb/") # (find-angg ".zshrc" "zcatinfo") #* zcatinfo /usr/info/gdb > /tmp/gdb.info grep -i 'virtual function' /tmp/gdb.info #* # (find-fline "/tmp/gdb.info") ##### # # gdb internals # ##### # (find-node "(gdbint)Top" "Partial Symbol Tables") # (find-fline "/usr/doc/binutils/bfd/") # (find-node "(gprof)Compiling") # (find-node "(gcc)Option Summary" "-pg") # (find-node "(gcc)Debugging Options" "-pg") # (find-node "(gcc)Debugging Options" "-a") # (find-node "(gdb)Backtrace") ##### # # gdb source (potato) # 2001jan21 # ##### # «gdb-source» (to ".gdb-source") # (find-es "expect" "dejagnu") #* pdsc $SDEBIAN/dists/potato/main/source/devel/gdb_4.18.19990928-1.dsc cd /usr/src/gdb-4.18.19990928/ debian/rules config |& tee odrc #* cd /usr/src/gdb-4.18.19990928/gdb/testsuite/ make check |& tee omc #* # (find-gdbfile "") # (find-gdbfile "debian/") # (find-gdbtsfile "") # (find-gdbtsfile "Makefile") # (find-gdbtsfile "Makefile" "$(RUNTEST) $(RUNTESTFLAGS)") # (find-gdbtsfile "gdb.base/") # (find-gdbtsfile "gdb.base/echo.exp") # (find-gdbtsfile "omc") # (find-gdbtsfile "gdb.log") # (find-node "(dejagnu)Invoking runtest") # (find-gdbfile "opcodes/dis-buf.c") # (find-gdbfile "opcodes/disassemble.c") # (find-gdbfile "opcodes/i386-dis.c") # (find-gdbfile "bfd/bfd-in2.h") # (find-gdbfile "bfd/bfd.c" "dynamic_reloc") # (find-gdbfile "bfd/elf-bfd.h") # (find-gdbfile "bfd/elf.c" "Dynamic linking") # (find-gdbfile "bfd/elf32-i386.c") # (find-gdbfile "bfd/elflink.h") # (find-gdbfile "bfd/bfd.c" "<<typedef bfd>>") # (find-gdbfile "bfd/doc/") apti binutils-dev # (find-vldifile "binutils-dev.list") # (find-fline "/usr/doc/binutils-dev/") # (find-node "(bfd)Top") # (find-node "(bfd)How It Works" "To use the library,") # (find-node "(gdbint)Top") # (find-node "(gdb)Auto Display") # (find-node "(gdb)Set Breaks") # (find-node "(gdb)Files" "`info share'") # (find-node "(gdb)Working Directory") # (find-node "(gdb)Mode Options" "`-tty DEVICE'") ##### # # online help in gdb # 2006jul06 # ##### # «online-help» (to ".online-help") # (find-node "(gdb)Help") # (find-node "(gdb)Mode Options" "`-batch'") # (find-node "(zsh)Process Substitution" "If =(...) is used") # (find-zsh "gdb -batch -x =(echo 'help breakpoints')") # (find-zsh "gdb -batch -x =(echo 'help tbreak')") # (find-node "(gdb)Index") # (find-node "(gdb)Set Breaks" "`tbreak ARGS'") ##### # # gdb-6.5 on sarge # 2006jul07 # ##### # «gdb-6.5-on-sarge» (to ".gdb-6.5-on-sarge") # (find-status "gdb") # (find-vldifile "gdb.list") # (find-udfile "gdb/") # http://ftp.gnu.org/gnu/gdb/gdb-6.5.tar.gz # (code-c-d "gdb" "~/bigsrc/gdb-6.5/") # (find-gdbfile "") #* rm -Rv ~/bigsrc/gdb-6.5/ tar -C ~/bigsrc/ -xvzf $S/http/ftp.gnu.org/gnu/gdb/gdb-6.5.tar.gz cd ~/bigsrc/gdb-6.5/ ./configure |& tee oc make |& tee om #* # (find-gdbfile "gdb/" " gdb") # (find-gdbfile "") Pergunta: serĂ¡ que esse gdb se liga com o libdbthreads nova ou com a default? Acho que ela nao e' mais uma lib separada. Why: (find-es "ruby" "ruby-postgres-gdb" "info share") ##### # # gdb-6.6 # 2007jul04 # ##### # «gdb-6.6-on-etch» (to ".gdb-6.6-on-etch") # This is from unstable, recompiled on stable=etch. # Rici's ldb requires a gdb that recognize that "command"s start blocks. # The patch that fixes that only went into the trunk in gdb-6.6. # (find-ldbfile "apicheck/ldb.gdb") # http://ftp.debian.org/debian/pool/main/g/gdb/ # http://ftp.debian.org/debian/pool/main/g/gdb/gdb_6.6.dfsg-1.dsc # http://ftp.debian.org/debian/pool/main/g/gdb/gdb_6.6.dfsg-1.diff.gz # http://ftp.debian.org/debian/pool/main/g/gdb/gdb_6.6.dfsg.orig.tar.gz #* rm -Rv ~/bigsrc/gdb/ mkdir ~/bigsrc/gdb/ cd $S/http/ftp.debian.org/debian/pool/main/g/gdb/ cp -v gdb_6.6.dfsg* ~/bigsrc/gdb/ cd ~/bigsrc/gdb/ dpkg-source -sn -x gdb_6.6.dfsg-1.dsc cd ~/bigsrc/gdb/gdb-6.6.dfsg/ dpkg-buildpackage -us -uc -b -rfakeroot |& tee odb #* # (code-c-d "gdb66" "~/bigsrc/gdb/gdb-6.6.dfsg/") # (find-gdb66file "") # (find-gdb66file "gdb/") # (find-gdb66file "gdb/c-exp.y" "int (foo::bar::baz::bizzle::*)") # (find-gdb66file "gdb/c-typeprint.c") # (find-gdb66file "gdb/c-valprint.c") ##### # # C types # 2007aug02 # ##### # «C-types» (to ".C-types") # (find-node "(gdb)Symbols" "`ptype [ARG]'") # (find-node "(gdb)Expressions") # More notes at: # (find-es "davinci" "peek.lua:doc") # I often use GDB to inspect C types - expanding #defines mentally on # the source files as I read them is clumsy sometimes, and using "gcc # -E" too - but my notes about that, and about e-scripting GDB, are # scattered around at several other e-script files... ##### # # mailing lists # 2007aug18 # ##### # «mailing-lists» (to ".mailing-lists") # http://lists.gnu.org/archive/html/bug-gdb/ # http://lists.gnu.org/archive/html/gdb/ # http://lists.gnu.org/archive/html/ ##### # # urdb (for reversible debugging) # 2009oct28 # ##### # «urdb» (to ".urdb") # (find-es "hol" "dmtcp") # http://urdb.sourceforge.net/ # http://arxiv.org/abs/0910.5046v1 # (find-node "(gdb)Reverse Execution") ##### # # gdb on squeeze # 2011nov20 # ##### # «gdb-squeeze» (to ".gdb-squeeze") # (find-es "emacs" "gdb-mi") # (find-angg ".emacs" "gdb") # (find-status "gdb") # (find-vldifile "gdb.list") # (find-udfile "gdb/") # (find-status "gdb-doc") # (find-vldifile "gdb-doc.list") # (find-udfile "gdb-doc/") # (find-fline "/etc/gdb/gdbinit") # To do: fix the way "find-node"-links are htmlized by blogme3... # (find-blogme3 "angglisp.lua" "find_node") # http://www.gnu.org/software/gdb/ # (find-node "(gdb)Top") # (find-node "(gdb)TUI") # (find-node "(gdb)GDB/MI") # http://sourceware.org/gdb/download/onlinedocs/gdb/index.html # http://sourceware.org/gdb/download/onlinedocs/gdb/TUI.html # http://sourceware.org/gdb/download/onlinedocs/gdb/GDB_002fMI.html <edrx> hello - if I understand correctly, if I run gdb with "-i=mi" in Emacs <edrx> then gdb takes care to distinguish outputs from GDB itself, e.g., the outputs of "print"s and "ptype"s issued on the command line <edrx> from outputs from the program being run... <edrx> but that makes things harder to use from my default (and highly non-standard) way of scripting GDB, which is through scripts in a separate buffer, like what is shown here: <edrx> http://angg.twu.net/eev-videos/video4-eepitch.mp4 <edrx> so - question: <edrx> 1) is there a way to make the GDB output and the program output both be treated as "GDB interaction", and thus appear in the GDB interaction buffer? <edrx> (oops, I forgot something: a way compatible with -i=mi) <edrx> 2) I'd like to learn more about the -i=mi protocol... any starting points you'd recommend <edrx> ? <edrx> thanks! =) # (find-node "(gdb)List") ##### # # lua-gdb-helper # 2013jan09 # ##### # «lua-gdb-helper» (to ".lua-gdb-helper") # (find-es "lua5" "lua-datatypes-gdb") # https://github.com/mkottman/lua-gdb-helper # https://github.com/mkottman/lua-gdb-helper/blob/master/luagdb.txt ##### # # GDB's main commands # 2013jan09 # ##### # «main-commands» (to ".main-commands") # (find-es "lua5" "lua-datatypes-gdb") # (find-gdbnode "Index") # (find-gdbnode "Data" "`print EXPR'") # (find-gdbnode "Symbols" "`ptype [ARG]'") # (find-gdbnode "Symbols" "`whatis [ARG]'") # (find-gdbnode "List" "`list'") # (find-gdbnode "Machine Code" "`info line LINESPEC'") # (find-gdbnode "Continuing and Stepping" "`next [COUNT]'") # (find-gdbnode "Continuing and Stepping" "`step'") # (find-gdbnode "Continuing and Stepping" "`step COUNT'") # (find-gdbnode "Continuing and Stepping" "`until'") # (find-gdbnode "Macros") # (find-gdbnode "Auto Display") # (find-gdbnode "Convenience Vars") # (find-gdbnode "Frames") # (find-gdbnode "Backtrace") http://sourceware.org/gdb/download/onlinedocs/gdb/Machine-Code.html http://sourceware.org/gdb/download/onlinedocs/gdb/Specify-Location.html ##### # # Support for C macros # 2013jan11 # ##### # «macros» (to ".macros") # (find-gdbnode "Macros") # (find-gdbnode "Compilation" "`-gdwarf-2'" "`-g3'") # (find-gccnode "Debugging Options" "`-gdwarf-2'") # (find-gccnode "Debugging Options" "`-g3'") # (find-gdbnode "Macros" "#define M 42") # http://stackoverflow.com/questions/10496195/gdb-macro-symbols-not-present-even-when-using-g3-or-ggdb3-or-gdwarf-4 ##### # # Scripting GDB using Python # 2013jan09 # ##### # «python» (to ".python") # (find-gdbnode "Python") ##### # # gud # 2019sep20 # ##### # «gud» (to ".gud") ##### # # realgud # 2019sep20 # ##### # «realgud» (to ".realgud") # https://github.com/realgud/realgud # https://github.com/realgud/realgud/wiki/Debuggers-Available # https://github.com/realgud/realgud/wiki https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-08/msg00922.html (gdb) source /path/to/emacs/src/.gdbinit (gdb) frame 3 (gdb) print window (gdb) xwindow (gdb) print XWINDOW(window)->contents (gdb) xbuffer (gdb) print selected_window (gdb) xwindow (gdb) print XWINDOW(selected_window)->contents (gdb) xbuffer # (find-zsh "availabledebs | sort | grep gdb") # A thread on the error # "Failed to read a valid object file image from memory": # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401482 # (find-node "(tramp)Remote processes" "Running a debugger on a remote host") # On the new interface for GUD, the one with 5 windows: # http://users.snap.net.nz/~nickrob/ https://github.com/cyrus-and/gdb-dashboard https://stackoverflow.com/search?q=user:1442050+[gdb] https://news.ycombinator.com/item?id=30737509 Debugging with GDB (sourceware.org) - rr *** https://lists.gnu.org/archive/html/emacs-devel/2023-03/msg01059.html Re: Debugging M-x gdb # Local Variables: # coding: utf-8-unix # End: