1
votes

I have kgdb setup using serial port between two VMs(Target is clone of host.) and I am able to set breakpoints in it. But when breakpoint is hit, I try to view source using list command in gdb, but it shows source of kgdb.c instead of my file in which breakpoint is hit as shown below:.

(gdb) l
1713    void kgdb_breakpoint(void)
1714    {
1715            atomic_set(&kgdb_setting_breakpoint, 1);
1716            wmb(); /* Sync point before breakpoint */
1717            arch_kgdb_breakpoint();
1718            wmb(); /* Sync point after breakpoint */
1719            atomic_set(&kgdb_setting_breakpoint, 0);
1720    }
1721    EXPORT_SYMBOL_GPL(kgdb_breakpoint);
1722
(gdb)
1723    static int __init opt_kgdb_wait(char *str)
1724    {
1725            kgdb_break_asap = 1;
1726
1727            if (kgdb_io_module_registered)
1728                    kgdb_initial_breakpoint();
1729
1730            return 0;
1731    }
1732
(gdb)
1733    early_param("kgdbwait", opt_kgdb_wait);
(gdb)
Line number 1734 out of range; kernel/kgdb.c has 1733 lines.
(gdb)

How can I view appropriate source when breakpoint hit?

[EDIT] When I try to list source of functions which are already part of vmlinux(statically compiled kernel), it shows the source of it. But when I try to debug dynamically loaded module and add symbols of it using add-symbol-file, it doesn't show source. This means, something is wrong with my module. Can anybody help me what is wrong with this module?

1

1 Answers

0
votes

Changing gdb version and using directory command under gdb to specify location of source solved the problem of not able to see source code.