ubuntu1804中cmakelist添加命令使得能使用GDB调试

ubuntu1804中cmakelist添加命令使得能使用GDB调试

问题描述:

系统是ubuntu1804c,cmake版本是3.15.4。
在一项开源代码上进行修改,想要对多线程运行部分的段错误(核心已转储)进行调试。

查找资料之后想使用GDB产生core文件确认是哪个数组超限或指针出问题。

尝试了一下在cmake中添加如下命令,使程序能够通过gdb调试并产生core文件
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

此外,还ulimit -c unlimited使core文件能够产生。
但是gdb rpba后,显示如下:

GNU gdb (Ubuntu 10.2-0ubuntu1~18.04~2) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from rpba...

一个是Reading symbols from rpba 后没有done
另一个是 gdb rpba corefile不会产生core文件

请问需要如何操作才能使用gdb调试这个可执行文件rpba,或者有其他方法来调试其中的多线程报错

help