Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use gdb to debug php

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today I'll show you how to debug php using gdb. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

Introduction to debugging php with gdb gdb is a code debugging tool for c language

There are four main forms of gdb that can be used to debug php, python, mysql, etc.: after startup, use the attach pid tracker gdb [options] [executable-file [core-file or process-id]] gdb [options]-- args executable-file [inferior-arguments.] gdb [options] [--python |-P] script-file [script-arguments.] Common debug command attach pid

Example: if you debug mysql code to a trace

1. First find mysql to ID:10111.

two。 Then attach 10111 to track mysql

Layout

Show source code / assembly instructions

Layout names are: src: Displays source and command windows. Show the source code asm: Displays disassembly and command windows. Display assembly instructions split: Displays source, disassembly and command windows. Display source code and assembly instruction regs: Displays register window. If existing layout is source/command or assembly/command, the register window is displayed. If the source/assembly/command (split) is displayed, the register window is displayed with the window that has current logical focusbreak

B increase breakpoint

Info b displays breakpoint information

Delete num deletes the specified breakpoint

Continue [num]

C num executes to num breakpoints, num can be left empty = 1 by default

Next [num]

When n num executes to the following num line, num can be left empty with default = 1 and will not enter inside the function.

Step [num]

S num executes to the following num line, num can be left empty with default = 1, and does not enter inside the function.

Backtrace

Bt views the current call stack

Print [value]

P value prints variable information

Help

Help layout to see how commands are used

Debug php code 1. Add a new php file

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report