Shell Scripts
  Home
  Introduction
  Getting KGDB
  Documentation
  Using KGDB
  Credits
  Miscellaneous
  Troubleshooting
  FAQ
  Support
  About KGDB
  KGDB Pronew

 

loadmodule.sh

This script loads a module in the test machine. The script takes a single argument. The argument specifies the name of the module to be loaded. Please refer to module loading requirements page for more information on using the script.

disasfun.sh

This script disassembles specified function from an object file. The script requires two arguments: names of an object file and a function. An example of using the function is shown below.

C code for function d_rehash is as follows
void d_rehash(struct dentry * entry)
{
        struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
        if (!list_empty(&entry->d_hash)) BUG();
        spin_lock(&dcache_lock);
        list_add(&entry->d_hash, list);
        spin_unlock(&dcache_lock);
}

disasfun.sh script disassembles the function with c code statemnts corresponding to code sections inserted inbetween. Part of the output of the script is as follows:

[amit@askii-pc linux-2.4.6-kgdb]$ disasfun.sh vmlinux d_rehash

vmlinux:     file format elf32-i386

Disassembly of section .text:

c0146fd8 <d_rehash>:
 * Adds a dentry to the hash according to its name.
 */

void d_rehash(struct dentry * entry)
{
c0146fd8:       55                      push   %ebp
c0146fd9:       89 e5                   mov    %esp,%ebp

..........

c0146ffc:       23 05 d8 2a 31 c0       and    0xc0312ad8,%eax
 * list_empty - tests whether a list is empty
 * @head: the list to test.
 */
static __inline__ int list_empty(struct list_head *head)
{
c0147002:       8d 5f 10                lea    0x10(%edi),%ebx
c0147005:       8d 34 c2                lea    (%edx,%eax,8),%esi
        struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
        if (!list_empty(&entry->d_hash)) BUG();
c0147008:       39 5f 10                cmp    %ebx,0x10(%edi)
c014700b:       74 13                   je     c0147020 <d_rehash+0x48>
c014700d:       68 2d 2f 26 c0          push   $0xc0262f2d
c0147012:       68 12 2f 26 c0          push   $0xc0262f12
c0147017:       e8 30 dd fc ff          call   c0114d4c <printk>
c014701c:       cc                      int3
c014701d:       8d 76 00                lea    0x0(%esi),%esi
printk("eip: %p\n", &&here);
                BUG();
        }
#endif

.........

c0147047:       89 ec                   mov    %ebp,%esp
c0147049:       5d                      pop    %ebp
c014704a:       c3                      ret
Disassembly of section .text.lock:
Disassembly of section .text.init:
[amit@askii-pc linux-2.4.6-kgdb]$