컴파일을 위해 cmake와 함께 Point Cloud Library를 사용하고 있으며 디버그 모드에서 빌드했지만 내 프로그램이 예상대로 오류를 분류하거나 중단하지 않습니다.
특히 다음과 같은 메시지가 표시됩니다.
(gdb) run bunny
Starting program: debug/our_cvfh bunny
libc++abi.dylib: terminating
[New Thread 0x170b of process 80178]
Program received signal SIGABRT, Aborted.
0x00007fff88c6f866 in ?? ()
(gdb) bt
#0 0x00007fff88c6f866 in ?? ()
#1 0x00007fff8bb5235c in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) break rec/registered_views_source.h:305
Cannot access memory at address 0x961d60
이 경우 오류가 어디에 있는지 알고 있지만 역 추적하여이 경우 함수를 호출 한 것을 볼 수 있기를 바랍니다.
PCL이 다른 스레드를 생성하고 있으므로 역 추적 할 수 없습니까? 지금은 시각화를 수행하고 있지 않으므로 스레딩을 사용하는 이유를 알 수 없습니다.
또한 소스 루트 디렉터리 대신 디버그 디렉터리에서 프로그램을 실행 해 보았습니다. 작동하지 않는 또 다른 예는 다음과 같습니다.
$ gdb our_cvfh
GNU gdb (GDB) 7.7
Copyright (C) 2014 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-apple-darwin13.1.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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 our_cvfh...done.
run (gdb) run
Starting program: /Users/jwoods/Projects/lidargl/fpfh/debug/our_cvfh
[New Thread 0x170b of process 33571]
Program received signal SIGSEGV, Segmentation fault.
0x000000010016cdec in ?? ()
(gdb) bt
#0 0x000000010016cdec in ?? ()
#1 0x00007fff5fbfbd08 in ?? ()
#2 0x00007fff5fbfbcc0 in ?? ()
#3 0x00007fff5fbfbcc8 in ?? ()
#4 0x00007fff5fbfbcc8 in ?? ()
#5 0x00007fff5fbfbcc8 in ?? ()
#6 0xffffffffffffffff in ?? ()
#7 0x00007fff5fbfbcc8 in ?? ()
#8 0x00007fff5fbfbcc8 in ?? ()
#9 0x00007fff5fbfbcc0 in ?? ()
#10 0x00007fff5fbfbcc0 in ?? ()
#11 0x00007fff5fbfbcc8 in ?? ()
#12 0x00007fff5fbfbcc8 in ?? ()
#13 0x00007fff5fbfbcc8 in ?? ()
#14 0x00007fff5fbff4a8 in ?? ()
#15 0x00007fff5fbff4d8 in ?? ()
#16 0x00007fff5fbff420 in ?? ()
#17 0x00007fff5fbff4d8 in ?? ()
#18 0x0000000000000000 in ?? ()
(gdb)
gdb는 CMake를 사용하지 않을 때 잘 작동하므로 CMake와 관련이 있다고 생각합니다. 이것은 다른 누구에게도 문제를 일으키지 않는 것 같습니다. Mac OS X에서 CMake를 사용하고 있다는 사실과도 관련이있을 수 있습니다.
정상적인 GDB 동작을 어떻게 얻습니까?
최신 정보
dsymutil my_output_binary
디버깅 기호를 생성하기 위해 실행할 수 있습니다 (다음 make
). 이것은 해결 방법입니다. 자동으로 수행되기를 바라며 왜 그렇지 않은지 잘 모르겠습니다. 이 dsymutil
전략은 대부분의 segfault에서 작동하지만 SIGABRT의 일부 경우에는 작동하지 않습니다. 다음은 출력입니다.
Calling compute <--- normal std::cerr output of my program, single-threaded
Assertion failed: (index >= 0 && index < size()), function operator[], file /usr/local/Cellar/eigen/3.2.1/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h, line 378.
[New Thread 0x170b of process 64108]
Program received signal SIGABRT, Aborted.
0x00007fff84999866 in ?? ()
(gdb) bt
#0 0x00007fff84999866 in ?? ()
#1 0x00007fff862c335c in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) info threads
Id Target Id Frame
2 Thread 0x170b of process 64108 0x00007fff8499a662 in ?? ()
* 1 Thread 0x1503 of process 64108 0x00007fff84999866 in ?? ()
(gdb)
내 프로그램은 그 자체가 다중 스레드가 아니지만 스레드를 생성하는 라이브러리를 사용하는 것 같습니다. 또는 적어도 gdb 출력에서 수집 한 것입니다.
PCL에서 사용하는 Eigen으로 스레딩을 비활성화 해 보았습니다.
흥미롭게도 lldb
역 추적을 생성 할 수 있지만 GDB가 할 수없는 이유가 궁금합니다.
단순히 GDB 대신 LLDB를 사용하는 것 외에는 스레드를 디버깅하는 방법을 찾지 못했습니다.
그러나 디버깅 기호를 자동으로 생성하는 방법을 알아 냈습니다! 만세.
세 개의 파일이 필요합니다.
프로젝트의 cmake/Modules/
디렉토리 에 넣으십시오 .
에서는 CMakeLists.txt
프로젝트 선언 후 다음 줄이 필요합니다.
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")
if (APPLE) # this if statement is optional, but you definitely need the include()
include(UseDebugSymbols)
endif (APPLE)
적절한 위치에서 찾을 수 있습니다.
동시에 내 프로젝트에 또 다른 변경 사항을 적용했으며 이는 여러분에게도 유용 할 수 있습니다. 내 add_executable
줄에서 대상 이름 바로 뒤에 MACOSX_BUNDLE
. 이 플래그는 .app
정규 바이너리 대신 컴파일되도록합니다 . 내 프로젝트의 예는 다음과 같습니다.
add_executable(pose MACOSX_BUNDLE pose.cpp rec/global_nn_recognizer_cvfh.cpp rec/global_nn_recognizer_cvfh.hpp rec/render_views_tesselated_sphere.cpp)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다