CLion use (a): Remote Debugging

A, CLion official website

https://www.jetbrains.com/clion/

CLion can be downloaded from the official website, which is a cross-platform programming IDE

Two, CLion remote debugging

Reference website:

https://coding3min.com/CLion_cplusplus/

http://www.beesfun.com/2018/07/19/%E3%80%90note%E3%80%91clion%E8%BF%9C%E7%A8%8B%E8%B0%83%E8%AF%95/

Here remote debugging linux (centos) executable programs on windows.

1, centos need to install some program:

yum install -y gcc gcc-c++ make cmake gdb gdb-gdbserve

2, modify CMakeList.txt file (Windows) in CLion project

The project is necessary, modify the file CMakeList.txt

# Make 最低版本号要求
cmake_minimum_required(VERSION 2.8)

# 项目信息
project(hello)

# 指定源文件
set(SOURCE_FILES main.cpp)

set(CMAKE_SOURCE_DIR .)

# 配置gdb调试
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g3 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

# 指定生成目标
add_executable(hello ${SOURCE_FILES})

3, Clion Configuration Deployment

With specific reference to a Reference Site

file->setings

 

Then Tools-> Deployment-> Automatic Upload

4, the project Clion uploaded to the corresponding path centos

Right-click the project test-> Deployment-> Upload

5, on Centos compile the project and run gdbserver

mkdir build
cd build
cmake .. 
make
gdbserver :1234 ./test

6, CentOS project will be updated to CLion project, and configure GDB Remote Debug

Right-click the project test-> Deployment-> Download

 

7. Click Next to step 6 of bugs, you can be the next breakpoint debugging

Reference Site may refer to the second step on pit tour

Published 155 original articles · won praise 15 · views 160 000 +

Guess you like

Origin blog.csdn.net/wangdamingll/article/details/102665866