]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/debugscripts/dot.gdbinit
This commit was generated by cvs2svn to compensate for changes in r151970,
[FreeBSD/FreeBSD.git] / tools / debugscripts / dot.gdbinit
1 # $FreeBSD$
2 # .gdbinit file for remote serial debugging.
3 # see gdbinit(9) for further details.
4 #
5 # XXX Do not use this file directly.  It contains parameters which are
6 # XXX substituted by the kernel Makefile when you do a 'make gdbinit'.
7 # XXX This also removes lines starting with '# XXX'.
8 # XXX
9 # To debug kernels, do:
10 #
11 #  cd /usr/src/sys/GENERIC   (or kernel build directory)
12 #  make gdbinit
13 #  gdb -k kernel.debug
14 #
15 # Read gdb(4) for more details.
16
17 # The following lines (down to "***** End" comment) may need to be changed
18
19 # Bit rate for serial link.  Due to problems in the interface,
20 # this may not work well above 9600 bps.
21 set remotebaud 9600             
22
23 set output-radix 16
24 set height 70
25 set width 120
26 set remotetimeout 1
27 set complaints 1
28 set print pretty
29 dir ../../..
30
31 # ***** End of things you're likely to need to change.
32
33 # Connect to remote target via a serial port.
34 define tr
35 # Remote debugging port
36 target remote $arg0
37 end
38
39 document tr
40 Debug a remote system via serial or firewire interface.  For example, specify 'tr /dev/cuad0' to use first serial port, or 'tr localhost:5556' for default firewire port.  See also tr0, tr1 and trf commands.
41 end
42
43 # Convenience functions.  These call tr.
44 # debug via cuad0
45 define tr0
46 tr /dev/cuad0
47 end
48 define tr1
49 tr /dev/cuad1
50 end
51 # Firewire
52 define trf
53 tr localhost:5556
54 end
55
56 document tr0
57 Debug a remote system via serial interface /dev/cuad0.  See also tr, tr1 and trf commands.
58 end
59 document tr1
60 Debug a remote system via serial interface /dev/cuad1.  See also tr, tr0 and trf commands.
61 end
62 document trf
63 Debug a remote system via firewire interface at default port 5556.  See also tr, tr0 and tr1 commands.
64 end
65
66 # Get symbols from klds.  Unfortunately, there are a number of
67 # landmines involved here:
68 #
69 # When debugging the same machine (via /dev/mem), we can get the
70 # script to call kldstat and pass the info on to asf(8).  This won't
71 # work for crashes or remote debugging, of course, because we'd get
72 # the information for the wrong system.  Instead, we use the macro
73 # "kldstat", which extracts the information from the "dump".  The
74 # trouble here is that it's a pain to use, since gdb doesn't have the
75 # capability to pass data to scripts, so we have to mark it and paste
76 # it into the script.  This makes it silly to use this method for
77 # debugging the local system.  Instead, we have two scripts:
78 #
79 # getsyms uses the information in the "dump", and you have to paste it.
80 # kldsyms uses the local kld information.
81
82 # Improvements in gdb should make this go away some day.
83 #
84 define kldsyms
85 # This will be replaced by the path of the real modules directory.
86 shell asf -f -k MODPATH
87 source .asf
88 end
89 document kldsyms
90 Read in the symbol tables for the debugging machine.  This only makes sense when debugging /dev/mem; use the 'getsyms' macro for remote debugging.
91 end
92
93 # Remote system
94 define getsyms
95 kldstat
96 echo Select the list above with the mouse, paste into the screen\n
97 echo and then press ^D.  Yes, this is annoying.\n
98 # This will be replaced by the path of the real modules directory.
99 shell asf -f MODPATH
100 source .asf
101 end
102
103 document getsyms
104 Display kldstat information for the target machine and invite user to paste it back in.  This causes the symbols for the KLDs to be loaded.  When doing memory debugging, use the command kldsyms instead.
105 end
106
107 source gdbinit.kernel
108 source gdbinit.machine
109
110 echo Ready to go.  Enter 'tr' to connect to the remote target\n
111 echo with /dev/cuad0, 'tr /dev/cuad1' to connect to a different port\n
112 echo or 'trf portno' to connect to the remote target with the firewire\n
113 echo interface.  portno defaults to 5556.\n
114 echo \n
115 echo Type 'getsyms' after connection to load kld symbols.\n
116 echo \n
117 echo If you're debugging a local system, you can use 'kldsyms' instead\n
118 echo to load the kld symbols.  That's a less obnoxious interface.\n