博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux Debug tools
阅读量:6449 次
发布时间:2019-06-23

本文共 2758 字,大约阅读时间需要 9 分钟。

1. gdb attach [pid] -- debug a running process

2. valgrind-- a suite of tools for debugging and profiling programs

Very powerful tool to debug linux program,just for x86 platform

3. strace -trace system calls and signals

In the simplest case strace runs thespecified command until it exits.  It intercepts  and records  the system calls which are called by a process and the signalswhich are received by a process.  The name of each system call, itsarguments and its return value are printed on standard error or to the file specifiedwith the -o option.

4. pstack -print a stack trace of a running process

It's often used to check the stack of hungprocess.

5. mtrace, muntrace - malloc debugging

The  function  mtrace() installs  handlers for malloc(), realloc() and free().  The functionmuntrace() disables these handlers.

The environment variable MALLOC_TRACE defines a file where mtrace() writes itsoutput.  This  file  must be writable to the user or mtrace()will do nothing.  If the file is not empty it will be truncated.

Usage: call the two function before andafter the code you want to pay attention on.

6. dmesg -print or control the kernel ring buffer

Check the error message of all kind ofprogram, especail for third-party program.

7. binutils-- a tools set

* ld - the GNU linker.

* as - the GNU assembler.

* addr2line - Converts addresses intofilenames and line numbers.

* ar - A utility for creating, modifyingand extracting from archives.

* c+filt - Filter to demangle encoded C+symbols.

* gprof - Displays profiling information.

* nlmconv - Converts object code into anNLM.

* nm - Lists symbols from object files.

* objcopy - Copys and translates objectfiles.

* objdump - Displays information fromobject files.

* ranlib - Generates an index to thecontents of an archive.

* readelf - Displays information from anyELF format object file.

* size - Lists the section sizes of anobject or archive file.

* strings - Lists printable strings fromfiles.

* strip - Discards symbols.

* windres - A compiler for Windows resourcefiles.

8. ldd -print shared library dependencies

9. ld.so, ld-linux.so* - dynamic linker/loader

---------------------------------------------------

10.lsof -list open files

Very useful to check if fd leak.

11. netstat  -  Print network connections, routing tables, interfacestatistics, masquerade connections, and multicast memberships

12. iostat  -  Report  Central  Processing Unit (CPU) statisticsand input/output statistics for devices and partitions.

13. vmstat -Report virtual memory statistics

14. time - time a simple command or give resource usage. System time depend on system status, User time is the real time of your program used.

 

注:因经验有限,大体就知道这些。欢迎各位补充。

作者: 
出处: 
未注明转载的文章,版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

你可能感兴趣的文章
jvm垃圾收集(标记-清除,复制,标记-整理,分代)算法
查看>>
正则表达式学习(十一)前后查找lookaround
查看>>
dubbo配置文件详解
查看>>
Apache与Tomcat有什么关系和区别
查看>>
[!] repo master does not exist
查看>>
隐藏实现
查看>>
mac java反编译工具
查看>>
Android客户端性能测试
查看>>
2016年终总结,不慌不忙不急不躁的一年
查看>>
Linux文件夹对比并提取的差分文件技巧-rsync的妙用
查看>>
非常不错的一个jquery写的三级横向导航菜单
查看>>
综合金融集团旗下IT公司紧急招聘资深DBA
查看>>
xxl-job学习
查看>>
iOS国际化和genstrings所有子目录本地化字符串
查看>>
spring boot 源码分析(二) 配置文件加载2
查看>>
DataOutput 中一坑
查看>>
Windows下 RabbitMQ的安装与配置
查看>>
并发编程之生产者消费者模式
查看>>
php写shell脚本
查看>>
nfs服务器在centos6.7 64Bit下的搭建
查看>>