Can't step into library code.

I am not able to step into shared library functions, and I get the following message in the gdb console even though the file in question does exist.

No source file named /Users/jonathonl/Developer/ClionProjects/myproject/src/btree_node.cpp


I'm guessing that it has something to do with how my project is structured. I'm outputing the binaries to a project directory instead of the default build directory. My CMakeLists.txt files are below.

- myproject/CMakeLists.txt

 
cmake_minimum_required(VERSION 2.8.4)
project(myproject)
include_directories(include)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)
set(HEADER_FILES include/btree_node.hpp)
set(SOURCE_FILES src/btree_node.cpp)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
add_library(myproject SHARED ${SOURCE_FILES} ${HEADER_FILES})
add_subdirectory(tests/index-test)


- myproject/tests/index-test/CMakeLIsts.txt

 
cmake_minimum_required(VERSION 2.8.4)
project(index-test)
include_directories(../../include)
link_directories(../../lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
add_executable(index-test main.cpp)
target_link_libraries(index-test myproject)


1. Does anyone know how to fix this gdb issue?
2. Is there a better way to structure library projects to include test executables with CMake/CLion?

1
2 comments
Avatar
Permanently deleted user

Same issue here. Trying to debug a mysql plugin (shared library is loaded on server startup) and I am getting:

I have enabled #com.jetbrains.cidr.execution.debugger in log settings and this is what I am getting:

2015-11-03 14:15:38,647 [ 674377]  DEBUG - brains.cidr.execution.debugger - <=library-loaded,id="/home/luis/mysql_repo/5.5.46/lib/plugin/adt_null.so",target-name="/home/luis/mysql_repo/5.5.46/lib/plugin/adt_null.so",host-name="/home/luis/mysql_repo/5.5.46/lib/plugin/adt_null.so",symbols-loaded="0",thread-group="i1"
2015-11-03 14:15:38,846 [ 674576]  DEBUG - brains.cidr.execution.debugger - <=library-loaded,id="/lib/x86_64-linux-gnu/libnss_files.so.2",target-name="/lib/x86_64-linux-gnu/libnss_files.so.2",host-name="/lib/x86_64-linux-gnu/libnss_files.so.2",symbols-loaded="0",thread-group="i1"
2015-11-03 14:15:54,623 [ 690353]  DEBUG - brains.cidr.execution.debugger - <~"\nProgram received signal "
2015-11-03 14:15:54,643 [ 690373]  DEBUG - brains.cidr.execution.debugger - <~"SIGINT, Interrupt.\n"
2015-11-03 14:15:54,664 [ 690394]  DEBUG - brains.cidr.execution.debugger - <~"0x00007ffff6c0c8dd in poll () from /lib/x86_64-linux-gnu/libc.so.6\n"
2015-11-03 14:15:54,684 [ 690414]  DEBUG - brains.cidr.execution.debugger - <*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={addr="0x00007ffff6c0c8dd",func="poll",args=[],from="/lib/x86_64-linux-gnu/libc.so.6"},thread-id="1",stopped-threads="all",core="2"
2015-11-03 14:15:54,706 [ 690436]  DEBUG - brains.cidr.execution.debugger - <(gdb)
2015-11-03 14:15:54,706 [ 690436]  DEBUG - brains.cidr.execution.debugger - >-break-insert -f "/home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc:70"
2015-11-03 14:15:54,726 [ 690456]  DEBUG - brains.cidr.execution.debugger - <&"No source file named /home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc.\n"
2015-11-03 14:15:54,747 [ 690477]  DEBUG - brains.cidr.execution.debugger - <^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc:70",times="0",original-location="/home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc:70"}


The file does exists:

ls -lrth /home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc
-rw-r--r-- 1 luis luis 4,4K oct 30 20:17 /home/luis/mysql_repo/5.5.46/src/mysql-5.5.46/plugin/audit_null/audit_null.cc


Any hint ?

Thanks,
Luis
0
Avatar
Permanently deleted user

In my case it turned out that warning, returned by gdb (<&), was erroneous and was followed by successful confirmation message:

2018-06-09 10:58:11,176 [  67765]  DEBUG - brains.cidr.execution.debugger - >-break-insert -f  "/home/menato/foo/bar/dumper2.cpp:221"
2018-06-09 10:58:11,179 [  67768]  DEBUG - brains.cidr.execution.debugger - <&"No source file named /home/menato/foo/bar/dumper2.cpp.\n"
2018-06-09 10:58:11,179 [  67768]  DEBUG - brains.cidr.execution.debugger - <^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/menato/foo/bar/dumper2.cpp:221",times="0",original-location="/home/menato/foo/bar/dumper2.cpp:221"}
2018-06-09 10:58:11,184 [  67773]  DEBUG - brains.cidr.execution.debugger - <(gdb)

0

Please sign in to leave a comment.