What i am doing basically is building shared library and linking it to my executable. Project build and runs just fine. But when it come to debugging i can't do it (---If i debugging executable alone, there not problems, i can debug and everything works). Problem appears when i am launching debbuger. This is output with logging:
=thread-group-added,id="i1"
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 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:
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".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
1: (930) <-1012-exec-run
1: (934) ->=thread-group-started,id="i1",pid="12605"
1: (934) ->=thread-created,id="1",group-id="i1"
1: (940) ->=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
1: (949) ->1012^running
1: (949) ->running,thread-id="all"
1: (951) ->(gdb)
1: (953) ->~"Stopped due to shared library event (no libraries added or removed)\n"
1: (954) ->stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1"
1: (1007) <-1013-thread-info 1
1: (1010) ->1013^done,threads=[{id="1",target-id="process 12605",name="TestYolo4Video",frame={level="0",addr="0x00007ffff7dda96a",func="dl_main",args=[{name="phdr",value="
1: (1010) ->(gdb)
1: (1041) 1012: elapsed time 110
Stopped due to shared library event (no libraries added or removed)
1: (1122) 1013: elapsed time 114
1: (1124) <-1014-interpreter-exec console "shell echo -e \\033c 1>&2"
1: (1126) ->1014^done
1: (1126) ->(gdb)
1: (1186) 1014: elapsed time 61
1: (1187) <-1015-gdb-set stop-on-solib-events 0
1: (1188) ->1015^done
1: (1188) ->(gdb)
1: (1190) 1015: elapsed time 3
1: (1250) <-1016-interpreter-exec console "info sharedlibrary"
1: (1251) ->~"From To Syms Read Shared Object Library\n"
1: (1251) ->~"0x00007ffff7dd7ac0 0x00007ffff7df5850 Yes /lib64/ld-linux-x86-64.so.2\n"
1: (1252) ->1016^done
1: (1252) ->(gdb)
1: (1267) 1016: elapsed time 16
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
1: (1304) <--exec-continue
1: (1305) ->^running
1: (1305) ->running,thread-id="all"
1: (1306) ->(gdb)
1: (1306) ->~"[Inferior 1 (process 12605) exited with code 0177]\n"
1: (1306) ->=thread-exited,id="1",group-id="i1"
1: (1306) ->=thread-group-exited,id="i1",exit-code="0177"
1: (1306) ->stopped,reason="exited",exit-code="0177"
[Inferior 1 (process 12605) exited with code 0177]
1: (1351) <--gdb-exit
1: (1352) ->^exit
The program '/home/rytis/Desktop/DeepLearningSampleRemake/build/TestYolo4Video/TestYolo4Video' has exited with code 177 (0x000000b1).
My launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/TestYolo4Video/TestYolo4Video",
"additionalSOLibSearchPath": "${workspaceFolder}/build/YoloDetector/",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"logging": { "engineLogging": true },
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Should i include my library (*.so) file to 'launch.json'? or am i doing something not correctly?
(Generated with -g flag)
Your program, TestYolo4Video is existing with 0x000000b1. Can you tell me what that error code is? Is it relying on some environment variables that are missing when being run under the debugger?
Hi, I have the same problem, exiting with error 0177 as some DLL are missing. I would like to know how do I specify in the launch configuration where the additionals DLL can be found?
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
[Inferior 1 (process 14564) exited with code 0177]
My launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch Test Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/libcarla_test_debug",
"targetArchitecture": "x64",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Additional libs for gdb",
"text": "set solib-search-path /media/ajianu/SSD/linux/carla/Build/llvm-5.0-install/lib"
}
]
}
]
}
PS: Developing under Linux (Ubuntu x64 16.04)
Never mind, I found solution, don't know if is the best but work:
replace
"text": "set solib-search-path /media/ajianu/SSD/linux/carla/Build/llvm-5.0-install/lib"
with:
"text": "set env LD_LIBRARY_PATH=${workspaceFolder}/Build/llvm-5.0-install/lib"
@iFuSiiOnzZ I have tried the way you suggested above but I still have te same error. I also tried ""text": "set set solib-search-path /usr/lib/x86_64-linux-gnu/" using this. I have attached my launch.json file. Could somebody help me here?
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/app/apps/2d_wanne/pandas.bin",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Additional libs for gdb",
"text": "set env LD_LIBRARY_PATH=${workspaceFolder}/x86_64-linux-gnu/",
"ignoreFailures": true
}
]
}
]
}
Most helpful comment
Never mind, I found solution, don't know if is the best but work:
replace
"text": "set solib-search-path /media/ajianu/SSD/linux/carla/Build/llvm-5.0-install/lib"with:
"text": "set env LD_LIBRARY_PATH=${workspaceFolder}/Build/llvm-5.0-install/lib"