Home PHP Framework Swoole What to use to debug swoole program

What to use to debug swoole program

Feb 12, 2020 pm 02:01 PM
swoole tool debug

What to use to debug swoole program

What to use to debug the swoole program

You can use GDB to debug the swoole program. gdb is the abbreviation of GNU debugger, which is a programming debugging tool.

Function of gdb:

1. Start the program and run the program as you like according to user-defined requirements.

2. The debugged program can be stopped at the debugging breakpoint specified by the user (the breakpoint can be a conditional expression).

3. When the program stops, you can check what happened in the program at this time. For example, you can print the value of a variable.

4. Dynamically change the execution environment of the variable program.

Recommended learning: swoole tutorial

How to use gdb to debug swoole:

Enter gdb

gdb php test.php
Copy after login

gdbinit

(gdb) source /path/to/swoole-src/gdbinit
Copy after login

Set breakpoints

For example, co::sleep function

(gdb) b zim_swoole_coroutine_util_sleep
Copy after login

Print all coroutines and status of the current progress

(gdb) co_list 
coroutine 1 SW_CORO_YIELD
coroutine 2 SW_CORO_RUNNING
Copy after login

Print the current run The call stack of the current coroutine

(gdb) co_bt 
coroutine cid:[2]
[0x7ffff148a100] Swoole\Coroutine->sleep(0.500000) [internal function]
[0x7ffff148a0a0] {closure}() /home/shiguangqi/php/swoole-src/examples/coroutine/exception/test.php:7 
[0x7ffff141e0c0] go(object[0x7ffff141e110]) [internal function]
[0x7ffff141e030] (main) /home/shiguangqi/php/swoole-src/examples/coroutine/exception/test.php:10
Copy after login

Print the call stack of the specified coroutine ID

(gdb) co_bt 1
[0x7ffff1487100] Swoole\Coroutine->sleep(0.500000) [internal function]
[0x7ffff14870a0] {closure}() /home/shiguangqi/php/swoole-src/examples/coroutine/exception/test.php:3 
[0x7ffff141e0c0] go(object[0x7ffff141e110]) [internal function]
[0x7ffff141e030] (main) /home/shiguangqi/php/swoole-src/examples/coroutine/exception/test.php:10
Copy after login

Print the status of the serial coroutine

(gdb) co_status 
     stack_size: 2097152
     call_stack_size: 1
     active: 1
     coro_num: 2
     max_coro_num: 3000
     peak_coro_num: 2
Copy after login

The above is the detailed content of What to use to debug swoole program. For more information, please follow other related articles on the PHP Chinese website!

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
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
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
1670
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
How reliable is Binance Plaza? How reliable is Binance Plaza? May 07, 2025 pm 07:18 PM

Binance Square is a social media platform provided by Binance Exchange, aiming to provide users with a space to communicate and share information related to cryptocurrencies. This article will explore the functions, reliability and user experience of Binance Plaza in detail to help you better understand this platform.

How to register in the ok exchange in China? ok trading platform registration and use guide for beginners in mainland China How to register in the ok exchange in China? ok trading platform registration and use guide for beginners in mainland China May 08, 2025 pm 10:51 PM

In the cryptocurrency market, choosing a reliable trading platform is crucial. As a world-renowned digital asset exchange, the OK trading platform has attracted a large number of novice users in mainland China. This guide will introduce in detail how to register and use it on the OK trading platform to help novice users get started quickly.

Top 10 cryptocurrency platforms in the world that support multi-chain transactions are authoritatively released in 2025 Top 10 cryptocurrency platforms in the world that support multi-chain transactions are authoritatively released in 2025 May 08, 2025 pm 07:15 PM

According to the latest evaluations and industry trends from authoritative institutions in 2025, the following are the top ten cryptocurrency platforms in the world that support multi-chain transactions, combining transaction volume, technological innovation, compliance and user reputation comprehensive analysis:

Top 10 digital virtual currency trading apps in 2025 Summary of the top 10 digital currency exchange apps Top 10 digital virtual currency trading apps in 2025 Summary of the top 10 digital currency exchange apps May 08, 2025 pm 05:24 PM

Ranking of the top ten digital virtual currency trading apps in 2025: 1. Binance: Leading the world, providing efficient transactions and a variety of financial products. 2. OKX: It is innovative and diverse, supporting a variety of transaction types. 3. Huobi: Stable and reliable, with high-quality service. 4. Coinbase: Be friendly for beginners and simple interface. 5. Kraken: The first choice for professional traders, with powerful tools. 6. Bitfinex: efficient trading, rich trading pairs. 7. Bittrex: Safety compliance, regulatory cooperation.

TOP10 futures trading platforms: Perpetual contracts and options trading TOP10 futures trading platforms: Perpetual contracts and options trading May 08, 2025 pm 07:12 PM

In the cryptocurrency market, futures trading platforms play an important role, especially in perpetual contracts and options trading. Here are the top ten highly respected futures trading platforms in the market, and provide detailed introduction to their characteristics and advantages in perpetual contract and option trading.

Top 10 cryptocurrency exchanges rankings Top 10 digital currency trading platforms latest rankings Top 10 cryptocurrency exchanges rankings Top 10 digital currency trading platforms latest rankings May 08, 2025 pm 05:03 PM

Top 10 cryptocurrency exchanges rankings: 1. Binance: Leading the world, providing efficient trading and a variety of financial products. 2. OKX: It is innovative and diverse, supporting a variety of transaction types. 3. Huobi: Stable and reliable, with high-quality service. 4. Coinbase: Be friendly for beginners and simple interface. 5. Kraken: The first choice for professional traders, with powerful tools. 6. Bitfinex: efficient trading, rich trading pairs. 7. Bittrex: Safety compliance, regulatory cooperation. 8. Poloniex and so on.

Top 10 cryptocurrency exchanges in the currency circle, the latest ranking of the top 10 digital currency trading platforms in 2025 Top 10 cryptocurrency exchanges in the currency circle, the latest ranking of the top 10 digital currency trading platforms in 2025 May 08, 2025 pm 10:45 PM

Ranking of the top ten cryptocurrency exchanges in the currency circle: 1. Binance: Leading the world, providing efficient trading and a variety of financial products. 2. OKX: It is innovative and diverse, supporting a variety of transaction types. 3. Huobi: Stable and reliable, with high-quality service. 4. Coinbase: Be friendly for beginners and simple interface. 5. Kraken: The first choice for professional traders, with powerful tools. 6. Bitfinex: efficient trading, rich trading pairs. 7. Bittrex: Safety compliance, regulatory cooperation. 8. Poloniex and so on.

What kind of disk-viewing software is used in the currency circle? What kind of disk-viewing software is used in the currency circle? May 08, 2025 pm 04:57 PM

In the currency circle, commonly used market viewing software include TradingView, Binance, Coinbase and CryptoWatch, each providing real-time market monitoring and technical analysis tools, suitable for the needs of different investors.

See all articles