Linux Debugging
| Reference | linux_debugging_techniques.ppt |
|---|
In order to support c source code level debugging, it is a must to enable debugging option during compile
mips-openwrt-linux-objdump -g vmlinux | grep -i DW_AT_comp_dir | grep -i indirect | grep '\/'
Its output is like:
<bb2043> DW_AT_comp_dir : (indirect string, offset: 0x171): /disk/fs1/tmp2/openwrt/core/kernel_tree
mips-openwrt-linux-objdump -t vmlinux | grep -w "_text"
Its output in my setup: 60020000 g .text 00000000 _text
mips-openwrt-linux-objdump -f vmlinux
Its output in my setup: start address 0x6002df00
mips-openwrt-linux-nm -n vmlinux | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > System.map
mips-openwrt-linux-objdump -t vmlinux | grep dp_xmit
Suppose below working environment:
| Linux Compilation folder via method | /disk/fs1/tmp2/shaoguoh/project/ugw61_grx500/openwrt/core/kernel_tree |
| vmlinux folder | /disk/fs1/tmp2/shaoguoh/project/ugw61_grx500/openwrt/core/kernel_tree |
| samba mapping folder to windows | X:\tmp2\shaoguoh\project\ugw61_grx500\openwrt\core\kernel_tree |
Lauterbach command:
d.load.elf "X:\tmp2\shaoguoh\project\ugw61_grx500\openwrt\core\kernel_tree\vmlinux" /strippart "/disk/fs1/tmp2" /path "X:\tmp2" /nocode
Note:
Example:
If the location of one file in vmlinux debugging as below:
/disk/fs1/tmp2/shaoguoh/project/ugw61_grx500/openwrt/core/kernel_tree/t.c
After /strippart “/disk/fs1/tmp2”, ie, strip the prefix as specified here, it become:
shaoguoh/project/ugw61_grx500/openwrt/core/kernel_tree/t.c
After /path “X:\tmp2”, ie, add prefix as specified here, it become:
X:\tmp2\shaoguoh/project/ugw61_grx500/openwrt/core/kernel_tree/t.c
With this folder, now debugger can access this file via samba from windows