• 遇到进程卡死,没有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常用操作学习笔记

    一,弹窗处理(推荐文章:https://blog.csdn.net/huilan_same/article/details/52298460) selenium提供switch_to方法定位弹窗的对话 ...

  2. Linux操作系统的基本介绍

    01 操作系统的概述介绍 操作系统(Operating System,简称OS)是管理计算机硬件与软件资源的计算机程序.操作系统需要处理如管理与配置内存.决定系统资源供需的优先次序.控制输入设备与输出 ...

  3. 实时离线一体化在资产租赁saas服务中使用

    流水查询需求 需求第一期: 基于TB级的在线数据,支持缴费帐单明细在线查询.大家都知道,像银行帐单流水一样,查几年的流水是常有的事. 支持的维度查询:帐期.欠费状态.日期范围.费用科目类型.房屋分类. ...

  4. docker系统化学习图文+视频教程

    1.背景 博客对应的视频课程: 9.9元在线学习:https://study.163.com/course/courseMain.htm?share=2&shareId=40000000033 ...

  5. sql分页 一条语句搞定

    select top 每页条数 * from ( SELECT ROW_NUMBER() OVER (ORDER BY id desc) AS RowNumber,* FROM Article  条件 ...

  6. Dubbo系列之 (七)网络层那些事(2)

    辅助链接 Dubbo系列之 (一)SPI扩展 Dubbo系列之 (二)Registry注册中心-注册(1) Dubbo系列之 (三)Registry注册中心-注册(2) Dubbo系列之 (四)服务订 ...

  7. 10 个 Python 初学者必知编码小技巧

    技巧 #1 字符串翻转 a = "codementor">>> print "Reverse is",a[::-1]翻转后的结果为 rotne ...

  8. java的回收机制

    在java语言中,判断一块内存空间是否符合垃圾收集器收集标准的标准只有两个: 1.给对象赋值为null,以下没有调用过. 2.给对象赋了新的值,重新分配了内存空间.

  9. docker是个啥?

    docker 第一问:什么是容器 容器就是在一个隔离的环境中运行的一个进程.注意关键词,隔离和进程.如果进程停止,那么容器就销毁.因为具有隔离的特点,所以每个容器都拥有自己的文件系统:包括IP地址.主 ...

  10. vue 路劲

    <style scoped src="../assets/css/f_information.css">@import url("../assets/css/ ...