Home Backend Development PHP Tutorial Summary of common commands based on Linux debugging tools strace and gdb_PHP tutorial

Summary of common commands based on Linux debugging tools strace and gdb_PHP tutorial

Jul 21, 2016 pm 03:09 PM
gdb linux and Order and based on tool Commonly used Summarize yes of debug

strace and gdb are two commonly used debugging tools in the Linux environment. Here is a personal summary of the common parameters of these two tools during use, which is reserved for future review.
strace debugging tool
The strace tool is used to track system calls and received signals during process execution, including parameters, return values, and execution time. In Linux, if a user program wants to access system devices, it must switch from user mode to kernel mode, which is initiated and completed through system calls.
Strace common parameters:
-c Count the execution time, number of calls, and number of errors for each system call, and give a report when the program exits
-p pid Track the specified process, you can use multiple -p to track multiple processes at the same time
-o filename strace outputs to stdout by default, -o can write the output to the specified file
-f Track generated by fork System calls of sub-processes
-ff Often used with the -o option, system calls generated by different processes (sub-processes) are output to each filename.pid file
-F Try to track vfork sub-process system calls, please note : When used together with -f, vfork will not be traced
-e expr Output filter expression, you can filter out strace results that you do not want to output
-e trace=set Specify the system calls in the trace set
- e trace=network Trace all system calls related to the network
-e strace=signal Trace all system calls related to system signals
-e trace=ipc Trace all system calls related to process communication
- e signal=set Specify the signal in the tracking set
-e read=set Output the data read from the specified file, for example -e read=3,5
-e write=set Output written to the specified file The data in, for example -e write=1
-r Print the relative time of each system call
-t Add time information before each line in the output
-tt Place each line in the output Add time information before each line, the time is accurate to the microsecond level
-ttt Add time information before each line in the output, and the output is relative time
-s Specify the length of each line of output string (default is 32 )
Example of using strace:
strace -t whoami #Trace the whoami executable program and print the execution time before each line of output results
strace -p 17151 -p 17152 -p 17153 #Trace processes 17151, 17152, 17153 at the same time
strace -f -e trace=read,write -p 17151 -o log #Trace the read and write system calls in process 17151 and child processes, output to log file
gdb debugging tool
GDB is a powerful program debugging tool under UNIX released by the GNU open source organization. Adding the -g parameter when compiling gcc can add gdb debugging information to the executable program.
(1) info
Abbreviation: i, lists information about gdb subcommands, such as info break, info variables, info stack, etc.
(2) list [file:]function
Abbreviation: l, view the context of the current line, the default is 10 lines, you can also set the source code to be listed at a certain function.
(3) edit [file:]function
Abbreviation: e, edit the current line or the source code of a function.
(4) break [file:]function
Abbreviation: b, set a breakpoint, which can be set at a certain line or function.
(5) run [arglist]
Abbreviation: r, run the program to the breakpoint and stop. After the run command, you can add the parameters required for debugging the program.
(6) next
Abbreviation: n, single statement execution.
(7) continue
Abbreviation: c, continue running the program to the next breakpoint.
(8) print
Abbreviation: p, prints the value of the variable.
(9) bt
View function stack information.
(10) enter
Enter key to repeat the last debugging command.
(11) help [name]
Displays help information for the specified gdb command.
(12) quit
Abbreviation: q, exit gdb.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327282.htmlTechArticlestrace and gdb are two commonly used debugging tools in the Linux environment. Here is a personal review of these two tools during use. A summary of the commonly used parameters of each tool is reserved for future review. strace debugging tool...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
What kind of software is a digital currency app? Top 10 Apps for Digital Currencies in the World What kind of software is a digital currency app? Top 10 Apps for Digital Currencies in the World Apr 30, 2025 pm 07:06 PM

With the popularization and development of digital currency, more and more people are beginning to pay attention to and use digital currency apps. These applications provide users with a convenient way to manage and trade digital assets. So, what kind of software is a digital currency app? Let us have an in-depth understanding and take stock of the top ten digital currency apps in the world.

Quantitative Exchange Ranking 2025 Top 10 Recommendations for Digital Currency Quantitative Trading APPs Quantitative Exchange Ranking 2025 Top 10 Recommendations for Digital Currency Quantitative Trading APPs Apr 30, 2025 pm 07:24 PM

The built-in quantization tools on the exchange include: 1. Binance: Provides Binance Futures quantitative module, low handling fees, and supports AI-assisted transactions. 2. OKX (Ouyi): Supports multi-account management and intelligent order routing, and provides institutional-level risk control. The independent quantitative strategy platforms include: 3. 3Commas: drag-and-drop strategy generator, suitable for multi-platform hedging arbitrage. 4. Quadency: Professional-level algorithm strategy library, supporting customized risk thresholds. 5. Pionex: Built-in 16 preset strategy, low transaction fee. Vertical domain tools include: 6. Cryptohopper: cloud-based quantitative platform, supporting 150 technical indicators. 7. Bitsgap:

Is the digital currency app formal? Top 10 formal and legal virtual currency trading apps in the world Is the digital currency app formal? Top 10 formal and legal virtual currency trading apps in the world Apr 30, 2025 pm 07:09 PM

Recommended cryptocurrency trading platforms include: 1. Binance: the world's largest trading volume, supports 1,400 currencies, FCA and MAS certification. 2. OKX: Strong technical strength, supports 400 currencies, approved by the Hong Kong Securities Regulatory Commission. 3. Coinbase: The largest compliance platform in the United States, suitable for beginners, SEC and FinCEN supervision. 4. Kraken: a veteran European brand, ISO 27001 certified, holds a US MSB and UK FCA license. 5. Gate.io: The most complete currency (800), low transaction fees, and obtained a license from multiple countries. 6. Huobi Global: an old platform that provides a variety of services, and holds Japanese FSA and Hong Kong TCSP licenses. 7. KuCoin

Is there a future for digital currency apps? Apple mobile digital currency trading platform app download TOP10 Is there a future for digital currency apps? Apple mobile digital currency trading platform app download TOP10 Apr 30, 2025 pm 07:00 PM

The prospects of digital currency apps are broad, which are specifically reflected in: 1. Technology innovation-driven function upgrades, improving user experience through the integration of DeFi and NFT and AI and big data applications; 2. Regulatory compliance trends, global framework improvements and stricter requirements for AML and KYC; 3. Function diversification and service expansion, integrating lending, financial management and other services and optimizing user experience; 4. User base and global expansion, and the user scale is expected to exceed 1 billion in 2025.

How to download the Hong Kong Digital Currency Exchange app? The top ten digital currency exchange apps are included How to download the Hong Kong Digital Currency Exchange app? The top ten digital currency exchange apps are included Apr 30, 2025 pm 07:12 PM

The methods to download the Hong Kong Digital Currency Exchange APP include: 1. Select a compliant platform, such as OSL, HashKey or Binance HK, etc.; 2. Download through official channels, iOS users download on the App Store, Android users download through Google Play or official website; 3. Register and verify their identity, use Hong Kong mobile phone number or email address to upload identity and address certificates; 4. Set security measures, enable two-factor authentication and regularly check account activities.

What are the typical use cases for Linux versus Windows? What are the typical use cases for Linux versus Windows? May 03, 2025 am 12:01 AM

Linuxisidealforcustomization,development,andservermanagement,whileWindowsexcelsineaseofuse,softwarecompatibility,andgaming.Linuxoffershighconfigurabilityfordevelopersandserversetups,whereasWindowsprovidesauser-friendlyinterfaceandbroadsoftwaresupport

Linux Operations: Understanding the Core Functionality Linux Operations: Understanding the Core Functionality May 03, 2025 am 12:09 AM

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

Docker and Linux: Building Portable Applications Docker and Linux: Building Portable Applications May 03, 2025 am 12:17 AM

How to build portable applications with Docker and Linux? First, use Dockerfile to containerize the application, and then manage and deploy the container in a Linux environment. 1) Write a Dockerfile and package the application and its dependencies into a mirror. 2) Build and run containers on Linux using dockerbuild and dockerrun commands. 3) Manage multi-container applications through DockerCompose and define service dependencies. 4) Optimize the image size and resource configuration, enhance security, and improve application performance and portability.

See all articles