Source string Read only

(itstool) path: note/para
660/6600
Context English State
<prompt>#</prompt> <userinput>make installkernel KERNCONF=MYKERNEL</userinput>
Reboot.
If <varname>KERNCONF</varname> is not included, the <filename>GENERIC</filename> kernel will instead be built and installed.
The <citerefentry><refentrytitle>make</refentrytitle><manvolnum>1</manvolnum></citerefentry> process will have built two kernels. <filename>/usr/obj/usr/src/sys/MYKERNEL/kernel</filename> and <filename>/usr/obj/usr/src/sys/MYKERNEL/kernel.debug</filename>. <filename>kernel</filename> was installed as <filename>/boot/kernel/kernel</filename>, while <filename>kernel.debug</filename> can be used as the source of debugging symbols for <citerefentry><refentrytitle>kgdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
To capture a crash dump, edit <filename>/etc/rc.conf</filename> and set <literal>dumpdev</literal> to point to either the swap partition or <literal>AUTO</literal>. This will cause the <citerefentry><refentrytitle>rc</refentrytitle><manvolnum>8</manvolnum></citerefentry> scripts to use the <citerefentry><refentrytitle>dumpon</refentrytitle><manvolnum>8</manvolnum></citerefentry> command to enable crash dumps. This command can also be run manually. After a panic, the crash dump can be recovered using <citerefentry><refentrytitle>savecore</refentrytitle><manvolnum>8</manvolnum></citerefentry>; if <literal>dumpdev</literal> is set in <filename>/etc/rc.conf</filename>, the <citerefentry><refentrytitle>rc</refentrytitle><manvolnum>8</manvolnum></citerefentry> scripts will run <citerefentry><refentrytitle>savecore</refentrytitle><manvolnum>8</manvolnum></citerefentry> automatically and put the crash dump in <filename>/var/crash</filename>.
FreeBSD crash dumps are usually the same size as physical RAM. Therefore, make sure there is enough space in <filename>/var/crash</filename> to hold the dump. Alternatively, run <citerefentry><refentrytitle>savecore</refentrytitle><manvolnum>8</manvolnum></citerefentry> manually and have it recover the crash dump to another directory with more room. It is possible to limit the size of the crash dump by using <literal>options MAXMEM=N</literal> where <replaceable>N</replaceable> is the size of kernel's memory usage in KBs. For example, for 1 GB of RAM, limit the kernel's memory usage to 128 MB, so that the crash dump size will be 128 MB instead of 1 GB.
Once the crash dump has been recovered , get a stack trace as follows:
<prompt>%</prompt> <userinput>kgdb /usr/obj/usr/src/sys/MYKERNEL/kernel.debug /var/crash/vmcore.0</userinput>
<prompt>(kgdb)</prompt> <userinput>backtrace</userinput>
Note that there may be several screens worth of information. Ideally, use <citerefentry><refentrytitle>script</refentrytitle><manvolnum>1</manvolnum></citerefentry> to capture all of them. Using the unstripped kernel image with all the debug symbols should show the exact line of kernel source code where the panic occurred. The stack trace is usually read from the bottom up to trace the exact sequence of events that lead to the crash. <citerefentry><refentrytitle>kgdb</refentrytitle><manvolnum>1</manvolnum></citerefentry> can also be used to print out the contents of various variables or structures to examine the system state at the time of the crash.
If a second computer is available, <citerefentry><refentrytitle>kgdb</refentrytitle><manvolnum>1</manvolnum></citerefentry> can be configured to do remote debugging, including setting breakpoints and single-stepping through the kernel code.
If <literal>DDB</literal> is enabled and the kernel drops into the debugger, a panic and a crash dump can be forced by typing <literal>panic</literal> at the <literal>ddb</literal> prompt. It may stop in the debugger again during the panic phase. If it does, type <literal>continue</literal> and it will finish the crash dump.

Loading…

None

New source string

FreeBSD Doc / books_faqEnglish

New source string 3 months ago
Browse all component changes

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: note/para
Labels
No labels currently set.
Flags
read-only
Source string location
book.translate.xml:6230
Source string age
3 months ago
Translation file
, string 1011