Linux Debug tools

简介:

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.


本文转自 zhenjing 博客园博客,原文链接: http://www.cnblogs.com/zhenjing/archive/2010/10/27/1862458.html  ,如需转载请自行联系原作者

相关文章
|
6月前
|
Linux 虚拟化
解决VMware 虚拟机中Linux系统时间不准确问题(安装VMware Tools)
解决VMware 虚拟机中Linux系统时间不准确问题(安装VMware Tools)
126 0
|
8月前
|
Linux 虚拟化 C语言
Linux系列——VMware Tools的安装
Linux系列——VMware Tools的安装
Linux系列——VMware Tools的安装
linux下debug与release编译的方法
linux下debug与release编译的方法
|
Ubuntu Linux 虚拟化
Linux(三):VMware Tools安装
Linux(三):VMware Tools安装
255 0
Linux(三):VMware Tools安装
|
Linux 虚拟化
【Linux笔记6.17】如何Ubuntu20.04版本的VMware Tools的安装步骤问题
【Linux笔记6.17】如何Ubuntu20.04版本的VMware Tools的安装步骤问题
129 0
【Linux笔记6.17】如何Ubuntu20.04版本的VMware Tools的安装步骤问题
|
Ubuntu Linux 虚拟化
Linux操作系统中安装VMware Tools
VMware Tools 中包含一系列服务和模块,可在 VMware 产品中实现多种功能,从而使用户能够更好地管理客户机操作系统,以及与客户机操作系统进行无缝交互。
Linux操作系统中安装VMware Tools
|
Linux 虚拟化 Windows
用VMware tools实现windows与Linux中的文件共享
用VMware tools实现windows与Linux中的文件共享 1、Windows下载Vmware tools,并加载到光盘 用WinShare【随意起的一个名字】实现Windows与Linux文件的交互,要用到Vmware tools工具。
1924 0
|
移动开发 网络协议 Linux