• 遇到进程卡死,没有gdb 符号表;只能strace 跟踪处理分析

排查过程:

1、ps -aux 查看卡死进程pid

2、strace -T -tt -e trace=all -p 查看卡死进程系统调用信息  

  此时卡在read 系统调用上, read 的第一个参数为句柄

3、ls -l  /proc/pid/fd

可以看到fd的指向的是哪个socket 或者文件以及innode

4、cat  /proc/net/tcp 可以查看inode 信息

5、lsof 查看文件相关信息

就可以根据fd 找到对应的连接

dynamic debug动态打印
printk_once , 只打印一次。 有些情况下,需要kernel运行时动态打印与否,dynamic debug就派上用场了。 具体用法可以参考: kernel/Documentationdynamic-debug-howto.txt 使用步骤: // 打印 echo 'file nand.c line 4210 +p' > /sys/kernel/debug/dynamic_debug/control // 不打印
echo 'file nand.c line 4210 -p' > /sys/kernel/debug/dynamic_debug/control // 使用例子 pr_debug(" dynamic debug \n");

kprobe:

* specify pre_handler address
*/
kp.pre_handler=handler_pre;
/* specify post_handler address
*/
kp.post_handler=handler_post;
/* specify fault_handler address
*/
kp.fault_handler=handler_fault;
/* specify the address/offset where you want to insert probe.
* You can get the address using one of the methods described above.
*/
kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_fork");
/* check if the kallsyms_lookup_name() returned the correct value.
*/
if (kp.add == NULL) {
printk("kallsyms_lookup_name could not find address
for the specified symbol name\n");
return 1;
}
/* or specify address directly.
* $grep "do_fork" /usr/src/linux/System.map
* or
* $cat /proc/kallsyms |grep do_fork
* or
* $nm vmlinuz |grep do_fork
*/
kp.addr = (kprobe_opcode_t *) 0xc01441d0;
/* All set to register with Kprobes
*/
register_kprobe(&kp); 然后在 init_moudle 中注册的探测器

Kprobes 的好处有很多。不需要重新编译和重新引导内核就可以插入 printk。为了进行调试可以记录 处理器寄存器的日志,甚至进行修改 —— 不会干扰系统。类似地,同样可以无干扰地记录 Linux 内核数据结构的日志,甚至 进行修改

linux kernel 的 procfs sysfs 对查问题的帮助的更多相关文章

  1. (转)Linux 文件系统:procfs, sysfs, debugfs 用法简介

    网址:http://www.tinylab.org/show-the-usage-of-procfs-sysfs-debugfs/ 1 前言 内核中有三个常用的伪文件系统:procfs,debugfs ...

  2. 深入linux kernel内核配置选项

    ============================================================================== 深入linux kernel内核配置选项 ...

  3. 编译linux kernel及制作initrd ( by quqi99 )

    编译linux kernel及制作initrd ( by quqi99 ) 作者:张华  发表于:2013-01-27    ( http://blog.csdn.net/quqi99 ) 运行一个l ...

  4. Linux Kernel - Debug Guide (Linux内核调试指南 )

    http://blog.csdn.net/blizmax6/article/details/6747601 linux内核调试指南 一些前言 作者前言 知识从哪里来 为什么撰写本文档 为什么需要汇编级 ...

  5. Linux Kernel代码艺术——系统调用宏定义

    我们习惯在SI(Source Insight)中阅读Linux内核,SI会建立符号表数据库,能非常方便地跳转到变量.宏.函数等的定义处.但在处理系统调用的函数时,却会遇到一些麻烦:我们知道系统调用函数 ...

  6. Intel 80x86 Linux Kernel Interrupt(中断)、Interrupt Priority、Interrupt nesting、Prohibit Things Whthin CPU In The Interrupt Off State

    目录 . 引言 . Linux 中断的概念 . 中断处理流程 . Linux 中断相关的源代码分析 . Linux 硬件中断 . Linux 软中断 . 中断优先级 . CPU在关中断状态下编程要注意 ...

  7. Linux Kernel CMPXCHG函数分析

    原文地址:http://blog.csdn.net/penngrove/article/details/44175387 最近看到Linux Kernel cmpxchg的代码,对实现很不理解.上网查 ...

  8. Linux kernel scriptes bin2c "\x"

    /**************************************************************************** * Linux kernel scripte ...

  9. Linux Kernel Schduler History And Centos7.2's Kernel Resource Analysis

    本文分为概述.历史.el7.2代码架构图解三部分. 解决的问题: a.Kernel调度发展过程: b.以架构图的方式,详解el7.2具体调度实现.内核线程模型.调度时间片计算,以及探究整个Kernel ...

随机推荐

  1. selenium元素定位学习笔记

    一,定位原则 稳定 简单灵活 唯一 WebDriver提供了两种方式来定位页面元素,分别是find_element_by_XXX和find_elements_by_XXX.第一种方式的结果是在正常情况 ...

  2. 联赛%你测试10T2:漫无止境的八月

    题意: 思路: 有几个特殊的性质: 在不考虑q里面的单点修改,我们先只判断一个序列是否Yes. 我们注意到每次操作都是对一个长度为k的区间进行区间加减1的操作,所以我们如果将序列里面的数按%k分组,把 ...

  3. Linux ALSA音频库(二) 环境测试+音频合成+语音切换 项目代码分享

    1. 环境测试 alsa_test.c #include <alsa/asoundlib.h> #include <stdio.h> // 官方测试代码, 运行后只要有一堆信息 ...

  4. PHP获取当前毫秒级别时间戳

    PHP提供了一个microtime()函数,调用时不带可选参数,本函数以"msec sec"的格式返回一个字符串,其中 sec 是自 Unix 纪元(0:00:00 January ...

  5. Docker知识总结

    目录 1 安装docker 2 docker基本概念 2.1 Docker是容器化平台 2.2 Docker体系结构 2.3 容器与镜像 3 docker常用命令 3.1 快速安装tomcat 3.1 ...

  6. Ubuntu 18.04 LTS IP 地址设置

    和之前的版本不太一样, Ubuntu 18.04 的 ip地址设置是用netplan管理的     配置文件在: /etc/netplan/50-cloud-init.yaml 示例文件如下: # T ...

  7. java基础第一章

    有一定的基础,但是还是要重新开始,2020.10.6 1.手写Hello World public class HelloWorld{ public static void main(String[] ...

  8. CyclicBarrier(循环栅栏)

    CyclicBarrier public class CyclicBarrierDemo { public static void main(String[] args) { CyclicBarrie ...

  9. Bitmap缩放(三)

    质量压缩 public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle ...

  10. vue 用别名取代路径引用

    在项目开发过程中有可能很多包是没有放在npm上的,许多包需要下载到本地引用,这样一来我们只能通过require的方式来引用文件,但是路径的名字就会很长 例如 import Select from '. ...