Rework the paragraph about finding the relocation address for kernel

modules; it was repetitive and slightly confused.
This commit is contained in:
Dag-Erling Smørgrav 2001-01-23 12:25:31 +00:00
parent 83ccf63974
commit 805f30d761
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=8722
3 changed files with 24 additions and 39 deletions
en_US.ISO8859-1/books
developers-handbook/kerneldebug
handbook/kerneldebug
en_US.ISO_8859-1/books/handbook/kerneldebug

View file

@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.27 2000/11/15 12:40:05 des Exp $
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.28 2000/11/15 12:42:07 des Exp $
-->
<chapter id="kerneldebug">
@ -598,18 +598,13 @@ Id Refs Address Size Name
10 .text 00007f34 000062d0 000062d0 000062d0 2**2</screen>
<para>The one you want is the <literal>.text</literal> section,
section 10 in the above example. The fourth numerical field
(sixth field overall) is the offset in hex of the text section
within the file (0x62d0 in our example). Add this to the load
address reported by <command>kldstat</command> to obtain the
address of the module text in memory.</para>
<para>Take the load address of the module (as reported by
<command>kldstat</command>) and add the offset of the text
section within the module (0x62d0 + 0xc0adc000 = c0ae22d0 in our
example). This is the address that the module code was
relocated to. Use the <command>add-symbol-file</command>
command in GDB to tell the debugger about the module:</para>
section 10 in the above example. The fourth hexadecimal field
(sixth field overall) is the offset of the text section within
the file. Add this offset to the load address of the module to
obtain the relocation address for the module's code. In our
example, we get 0xc0adc000 + 0x62d0 = 0xc0ae22d0. Use the
<command>add-symbol-file</command> command in GDB to tell the
debugger about the module:</para>
<screen><prompt>(kgdb)</prompt> <userinput>add-symbol-file /sys/modules/linux/linux.ko 0xc0ae22d0</userinput>
add symbol table from file "/sys/modules/linux/linux.ko" at text_addr = 0xc0ae22d0?

View file

@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.27 2000/11/15 12:40:05 des Exp $
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.28 2000/11/15 12:42:07 des Exp $
-->
<chapter id="kerneldebug">
@ -598,18 +598,13 @@ Id Refs Address Size Name
10 .text 00007f34 000062d0 000062d0 000062d0 2**2</screen>
<para>The one you want is the <literal>.text</literal> section,
section 10 in the above example. The fourth numerical field
(sixth field overall) is the offset in hex of the text section
within the file (0x62d0 in our example). Add this to the load
address reported by <command>kldstat</command> to obtain the
address of the module text in memory.</para>
<para>Take the load address of the module (as reported by
<command>kldstat</command>) and add the offset of the text
section within the module (0x62d0 + 0xc0adc000 = c0ae22d0 in our
example). This is the address that the module code was
relocated to. Use the <command>add-symbol-file</command>
command in GDB to tell the debugger about the module:</para>
section 10 in the above example. The fourth hexadecimal field
(sixth field overall) is the offset of the text section within
the file. Add this offset to the load address of the module to
obtain the relocation address for the module's code. In our
example, we get 0xc0adc000 + 0x62d0 = 0xc0ae22d0. Use the
<command>add-symbol-file</command> command in GDB to tell the
debugger about the module:</para>
<screen><prompt>(kgdb)</prompt> <userinput>add-symbol-file /sys/modules/linux/linux.ko 0xc0ae22d0</userinput>
add symbol table from file "/sys/modules/linux/linux.ko" at text_addr = 0xc0ae22d0?

View file

@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.27 2000/11/15 12:40:05 des Exp $
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v 1.28 2000/11/15 12:42:07 des Exp $
-->
<chapter id="kerneldebug">
@ -598,18 +598,13 @@ Id Refs Address Size Name
10 .text 00007f34 000062d0 000062d0 000062d0 2**2</screen>
<para>The one you want is the <literal>.text</literal> section,
section 10 in the above example. The fourth numerical field
(sixth field overall) is the offset in hex of the text section
within the file (0x62d0 in our example). Add this to the load
address reported by <command>kldstat</command> to obtain the
address of the module text in memory.</para>
<para>Take the load address of the module (as reported by
<command>kldstat</command>) and add the offset of the text
section within the module (0x62d0 + 0xc0adc000 = c0ae22d0 in our
example). This is the address that the module code was
relocated to. Use the <command>add-symbol-file</command>
command in GDB to tell the debugger about the module:</para>
section 10 in the above example. The fourth hexadecimal field
(sixth field overall) is the offset of the text section within
the file. Add this offset to the load address of the module to
obtain the relocation address for the module's code. In our
example, we get 0xc0adc000 + 0x62d0 = 0xc0ae22d0. Use the
<command>add-symbol-file</command> command in GDB to tell the
debugger about the module:</para>
<screen><prompt>(kgdb)</prompt> <userinput>add-symbol-file /sys/modules/linux/linux.ko 0xc0ae22d0</userinput>
add symbol table from file "/sys/modules/linux/linux.ko" at text_addr = 0xc0ae22d0?