Use crash to show the code line of a backtrace entry like "ocfs2_truncate_file+0x127/0x6c0"
2016-09-01 00:00
429 查看
摘要: kdump crash backtrace code line
###1. Problem
I am debugging a hung issue of ocfs2 (a cluster filesystem in linux kernel). This hung is
caused by a ocfs2 testcase named "mmap_truncate". Naturally, I show the status of this process
and cat the processes's stack as below:
What if I want to know the code line of a function where it hung up? For example:
ocfs2_truncate_file+0x127
###2. Howto
Install kernel debuginfo and debugsource packages,etc. I'm using SUSE linux:
Install ocfs2 kernel module debuginfo package if you're using SLES, while openSUSE is not needed to do so.
uncompress
invoke crash to analyze living system. You'd better get a overview of crash from
show if ocfs2 module is loaded by
load ocfs2 module
show the code line of ocfs2_truncate_file+0x127, and search the output for the offset near 0x127==295
Jump to the line of source code!
and we got it!
down_write(&OCFS2_I(inode)->ip_alloc_sem);
感谢来自亚马逊的于鹏给予的帮助!
###1. Problem
I am debugging a hung issue of ocfs2 (a cluster filesystem in linux kernel). This hung is
caused by a ocfs2 testcase named "mmap_truncate". Naturally, I show the status of this process
and cat the processes's stack as below:
# pgrep -a mmap_truncate 24250 mmap_truncate -c 20 -s 300 /mnt/ocfs2//mmaptruncate.txt # cat /proc/24250/stack [<ffffffff8131b373>] call_rwsem_down_write_failed+0x13/0x20 [<ffffffffa0545717>] ocfs2_truncate_file+0x127/0x6c0 [ocfs2] [<ffffffffa05481a8>] ocfs2_setattr+0x698/0xa90 [ocfs2] [<ffffffffa05403f3>] ocfs2_inode_unlock+0x33/0x80 [ocfs2] [<ffffffff8121574e>] notify_change+0x1ae/0x380 [<ffffffff811f8ade>] do_truncate+0x5e/0x90 [<ffffffff811f8e38>] do_sys_ftruncate.constprop.11+0x108/0x160 [<ffffffff815e126e>] entry_SYSCALL_64_fastpath+0x12/0x6d
What if I want to know the code line of a function where it hung up? For example:
ocfs2_truncate_file+0x127
###2. Howto
Install kernel debuginfo and debugsource packages,etc. I'm using SUSE linux:
zypper install kernel-default-debuginfo kernel-default-debugsource
Install ocfs2 kernel module debuginfo package if you're using SLES, while openSUSE is not needed to do so.
zypper in ocfs2-kmp-default-debuginfo
uncompress
vmlinux-${uname -r}.gzimg
#gunzip /boot/vmlinux-4.4.19-60-default.gz
invoke crash to analyze living system. You'd better get a overview of crash from
man crash
crash /boot/vmlinux-4.4.19-60-default
show if ocfs2 module is loaded by
mod, and
help modfor more info
crash> mod ffffffffa04d8440 ocfs2_stackglue 20480 (not loaded) [CONFIG_KALLSYMS] ffffffffa04ecf40 ocfs2_nodemanager 225280 (not loaded) [CONFIG_KALLSYMS] ffffffffa05e1c80 ocfs2 1019904 (not loaded) [CONFIG_KALLSYMS]
load ocfs2 module
crash> mod -s ocfs2 MODULE NAME SIZE OBJECT FILE ffffffffa05e1c80 ocfs2 1019904 /lib/modules/4.4.19-60-default/kernel/fs/ocfs2/ocfs2.ko
show the code line of ocfs2_truncate_file+0x127, and search the output for the offset near 0x127==295
crash> dis -l ocfs2_truncate_file ... /usr/src/debug/kernel-default-4.4.19/linux-4.4/linux-obj/../fs/ocfs2/file.c: 483 0xffffffffa0545717 <ocfs2_truncate_file+295>: mov 0x18(%rsp),%rax 0xffffffffa054571c <ocfs2_truncate_file+300>: lea 0x278(%r12),%rsi 0xffffffffa0545724 <ocfs2_truncate_file+308>: lea 0x230(%rax),%rdi 0xffffffffa054572b <ocfs2_truncate_file+315>: callq 0xffffffffa0568480 <ocfs2_resv_discard> ...
Jump to the line of source code!
vi /usr/src/debug/kernel-default-4.4.19/linux-4.4/linux-obj/../fs/ocfs2/file.c +483
and we got it!
down_write(&OCFS2_I(inode)->ip_alloc_sem);
感谢来自亚马逊的于鹏给予的帮助!
相关文章推荐
- The only thing I can think of is to use something like "http://www.dyndns.org/cgi-bin/check_ip.cgi" others may have a be
- How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
- The best manual of how to use "The easiest Xdebug" addon for Firefox
- Visual Studio Code 提示"use the 'php.validate.executablePath'setting to configure the location of 'php
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- The document has been modified outside of Code Composer. Would you like to reload the file
- niagara编译错误:using type arguments to access generic types requires the use of "-source 1.5"
- CodeIgniter报错: You must use the "set" method to update an entry
- use java code to cheng the layout of the UI
- 【iOS】CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
- iOS报错 - If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variabl
- The target assembly contains no service types. You may need to adjust the Code Access Security policy of this assembly." 目标程序集不包含服务类型。可能需要调整此程序集的代码访问安全策略。
- How to use Reflector to see the code of .net framework
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- How to use "man" effectively in the development of Linux
- 苹果官方解释可以忽略『CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE...』报错的帖子
- JavaScript code to let users double-click to move back to the top of the page
- CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.