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