Use clion to debug PHP kernel source code on Mac

藏色散人
Release: 2023-04-07 18:24:02
forward
3295 people have browsed it

Operation steps

1. Download source code

2. Install

./configure --prefix = 指定安装路径 --with-config-file-path = 指定配置文件读取路径 --with-iconv = 指定 iconv 安装的路径 --enable-debug
make && make install
Copy after login

3. Use clion to create project

Use clion to debug PHP kernel source code on Mac

4. Modify the automatically generated CMakeLists.txt file. Note that the source code path should be adjusted according to the situation.

  cmake_minimum_required(VERSION 3.14)
    project(php_7_2_4)
    set(CMAKE_CXX_STANDARD 14)
    set(PHP_SOURCE /usr/local/src/php-7.2.4)
    include_directories(${PHP_SOURCE}/main)
    include_directories(${PHP_SOURCE}/Zend)
    include_directories(${PHP_SOURCE}/sapi)
    include_directories(${PHP_SOURCE}/pear)
    include_directories(${PHP_SOURCE}/TSRM)
    include_directories(${PHP_SOURCE})
    add_custom_target(makefile COMMAND make && make install WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
Copy after login

5. Configure running parameters

Use clion to debug PHP kernel source code on Mac

6. Find the main function in the sapi/cli/php_cli.c file and break the point

7. Click debug and then you can debug

Use clion to debug PHP kernel source code on Mac

Problems encountered

iconv is not installed, and after installation it prompts "ld: symbol (s) not found for architecture x86_64"

Solution :

Edit the Makefile under the project root path, modify the EXTRA_LIBS variable, delete - liconv, and add /usr/local/opt/libiconv/lib/libiconv.dylib

The above is the detailed content of Use clion to debug PHP kernel source code on Mac. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template