Skip to content

ssh gdb remote debug error #120

Closed
Closed

Description

@uli2k

I'm going to do remote debugging in SSH mode. I wrote a very simple program, but the program stopped where there was no breakpoint. Continue operation will be reported wrong.

Tip: unable to open "strlen.S": cannot find file: /home/build/eglibc-SvCtMH/eglibc-2.19/sysdeps/x86_64/strlen.S.

this is launch.json:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "C++ (remote)",
			"type": "gdb",
			"request": "launch",
			"target": "${relativeFile}",
			"cwd": "${workspaceRoot}",
			"ssh": {
				"host": "127.0.0.1",
				"user": "uli2k",
				"keyfile": "/home/uli2k/.ssh/id_rsa",
				"cwd": "/home/uli2k/hello"
			}
		}
	]
}

2017-08-10 11 55 58
2017-08-10 11 56 35

Activity

  1. changed the title [-]ssh dbgremote debug[/-] [+]ssh gdb remote debug error[/+] on Aug 10, 2017
  2. uli2k commented on Aug 10, 2017

    @uli2k
    Author

    I downloaded the eglibc library, put it in /home/build, and run to strlen.S, 106 line, the following error occurred
    2017-08-10 15 25 10

  3. WebFreak001 commented on Aug 10, 2017

    @WebFreak001
    Owner

    is the source on both sides (locally and remotely) the same and did you recompile it on the ssh side?

  4. uli2k commented on Aug 11, 2017

    @uli2k
    Author

    Yes, in order to verify this problem, I connect to local with SSH,The remote and local are actually the same executable file. but it's OK to use local debugging.

  5. uli2k commented on Aug 11, 2017

    @uli2k
    Author

    Sorry, I made a mistake. The correct test program source is this.

    #include "ros/ros.h"
    
    int main(int argc, char *argv[])
    {
    	for (int i = 0; i < argc; i++)
    		printf("%s\n", argv[i]);
    	ros::init(argc, argv, "hello_node");     // ROS is a library for robot development
    	return 0;
    }

    There is a stack trace error after entering ros:: init function in SSH remote debug mode, but the local gdb debugging is OK.

  6. uli2k commented on Aug 12, 2017

    @uli2k
    Author

    I found this might be GDB's Bug.There is a problem with the MI2 mode command, but the CLI mode is OK.
    this is log.

    MI2 MODE:

    uli2k@uli2k-T430:~/hello/devel/lib/hello$ gdb -q --interpreter=mi2
    =thread-group-added,id="i1"
    (gdb) 
    1-gdb-set target-async on
    1^done
    (gdb) 
    2-environment-directory "/home/uli2k/hello"
    2^done,source-path="/home/uli2k/hello:$cdir:$cwd"
    (gdb) 
    3-file-exec-and-symbols "/home/uli2k/hello/devel/lib/hello/hello"
    3^done
    (gdb) 
    4-environment-cd "/home/uli2k/hello"
    4^done
    (gdb) 
    5-break-delete
    5^done
    (gdb) 
    6-break-insert -f "/home/uli2k/hello/src/hello/src/hello.cpp:7"
    6^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000401041",func="main(int, char**)",file="/home/uli2k/hello/src/hello/src/hello.cpp",fullname="/home/uli2k/hello/src/hello/src/hello.cpp",line="7",thread-groups=["i1"],times="0",original-location="/home/uli2k/hello/src/hello/src/hello.cpp:7"}
    (gdb) 
    7-exec-run
    =thread-group-started,id="i1",pid="3096"
    =thread-created,id="1",group-id="i1"
    7^running
    *running,thread-id="all"
    =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"
    (gdb) 
    =library-loaded,id="/opt/ros/indigo/lib/libroscpp.so",target-name="/opt/ros/indigo/lib/libroscpp.so",host-name="/opt/ros/indigo/lib/libroscpp.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",target-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",host-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libgcc_s.so.1",target-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",host-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/librosconsole.so",target-name="/opt/ros/indigo/lib/librosconsole.so",host-name="/opt/ros/indigo/lib/librosconsole.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/libroscpp_serialization.so",target-name="/opt/ros/indigo/lib/libroscpp_serialization.so",host-name="/opt/ros/indigo/lib/libroscpp_serialization.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/librostime.so",target-name="/opt/ros/indigo/lib/librostime.so",host-name="/opt/ros/indigo/lib/librostime.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/libxmlrpcpp.so",target-name="/opt/ros/indigo/lib/libxmlrpcpp.so",host-name="/opt/ros/indigo/lib/libxmlrpcpp.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/libcpp_common.so",target-name="/opt/ros/indigo/lib/libcpp_common.so",host-name="/opt/ros/indigo/lib/libcpp_common.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0",target-name="/usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0",host-name="/usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0",target-name="/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0",host-name="/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libpthread.so.0",target-name="/lib/x86_64-linux-gnu/libpthread.so.0",host-name="/lib/x86_64-linux-gnu/libpthread.so.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0",target-name="/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0",host-name="/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libm.so.6",target-name="/lib/x86_64-linux-gnu/libm.so.6",host-name="/lib/x86_64-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/librosconsole_log4cxx.so",target-name="/opt/ros/indigo/lib/librosconsole_log4cxx.so",host-name="/opt/ros/indigo/lib/librosconsole_log4cxx.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/opt/ros/indigo/lib/librosconsole_backend_interface.so",target-name="/opt/ros/indigo/lib/librosconsole_backend_interface.so",host-name="/opt/ros/indigo/lib/librosconsole_backend_interface.so",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/liblog4cxx.so.10",target-name="/usr/lib/liblog4cxx.so.10",host-name="/usr/lib/liblog4cxx.so.10",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libboost_regex.so.1.54.0",target-name="/usr/lib/x86_64-linux-gnu/libboost_regex.so.1.54.0",host-name="/usr/lib/x86_64-linux-gnu/libboost_regex.so.1.54.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/librt.so.1",target-name="/lib/x86_64-linux-gnu/librt.so.1",host-name="/lib/x86_64-linux-gnu/librt.so.1",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.2",target-name="/usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.2",host-name="/usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.2",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libaprutil-1.so.0",target-name="/usr/lib/x86_64-linux-gnu/libaprutil-1.so.0",host-name="/usr/lib/x86_64-linux-gnu/libaprutil-1.so.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libapr-1.so.0",target-name="/usr/lib/x86_64-linux-gnu/libapr-1.so.0",host-name="/usr/lib/x86_64-linux-gnu/libapr-1.so.0",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libicuuc.so.52",target-name="/usr/lib/x86_64-linux-gnu/libicuuc.so.52",host-name="/usr/lib/x86_64-linux-gnu/libicuuc.so.52",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libicui18n.so.52",target-name="/usr/lib/x86_64-linux-gnu/libicui18n.so.52",host-name="/usr/lib/x86_64-linux-gnu/libicui18n.so.52",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libcrypt.so.1",target-name="/lib/x86_64-linux-gnu/libcrypt.so.1",host-name="/lib/x86_64-linux-gnu/libcrypt.so.1",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libexpat.so.1",target-name="/lib/x86_64-linux-gnu/libexpat.so.1",host-name="/lib/x86_64-linux-gnu/libexpat.so.1",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libuuid.so.1",target-name="/lib/x86_64-linux-gnu/libuuid.so.1",host-name="/lib/x86_64-linux-gnu/libuuid.so.1",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/lib/x86_64-linux-gnu/libdl.so.2",target-name="/lib/x86_64-linux-gnu/libdl.so.2",host-name="/lib/x86_64-linux-gnu/libdl.so.2",symbols-loaded="0",thread-group="i1"
    =library-loaded,id="/usr/lib/x86_64-linux-gnu/libicudata.so.52",target-name="/usr/lib/x86_64-linux-gnu/libicudata.so.52",host-name="/usr/lib/x86_64-linux-gnu/libicudata.so.52",symbols-loaded="0",thread-group="i1"
    ~"[Thread debugging using libthread_db enabled]\n"
    ~"Using host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n"
    /home/uli2k/hello/devel/lib/hello/hello
    =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000401041",func="main(int, char**)",file="/home/uli2k/hello/src/hello/src/hello.cpp",fullname="/home/uli2k/hello/src/hello/src/hello.cpp",line="7",thread-groups=["i1"],times="1",original-location="/home/uli2k/hello/src/hello/src/hello.cpp:7"}
    *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000401041",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdde8"}],file="/home/uli2k/hello/src/hello/src/hello.cpp",fullname="/home/uli2k/hello/src/hello/src/hello.cpp",line="7"},thread-id="1",stopped-threads="all",core="3"
    8-stack-list-frames 0 20
    8^done,stack=[frame={level="0",addr="0x0000000000401041",func="main",file="/home/uli2k/hello/src/hello/src/hello.cpp",fullname="/home/uli2k/hello/src/hello/src/hello.cpp",line="7"}]
    (gdb) 
    9-stack-list-variables --thread 1 --frame 0 --simple-values
    9^done,variables=[{name="argc",arg="1",type="int",value="1"},{name="argv",arg="1",type="char **",value="0x7fffffffdde8"}]
    (gdb) 
    10-exec-next
    10^running
    *running,thread-id="1"
    (gdb)                          !!!!!!!!!!!!!!!!!!!!!!attention here!!!!!!!!!!!!!!!!!!!!!!!!!!
    *stopped,reason="end-stepping-range",frame={addr="0x0000000000401093",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdde8"}],file="/home/uli2k/hello/src/hello/src/hello.cpp",fullname="/home/uli2k/hello/src/hello/src/hello.cpp",line="8"},thread-id="1",stopped-threads="all",core="0"
    quit
    &"quit\n"
    =thread-exited,id="1",group-id="i1"
    =thread-group-exited,id="i1"
    

    CLI MODE:

    uli2k@uli2k-T430:~/hello/devel/lib/hello$ gdb
    GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
    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-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".
    (gdb) file /home/uli2k/hello/devel/lib/hello/hello
    Reading symbols from /home/uli2k/hello/devel/lib/hello/hello...done.
    (gdb) break /home/uli2k/hello/src/hello/src/hello.cpp:7
    Breakpoint 1 at 0x401041: file /home/uli2k/hello/src/hello/src/hello.cpp, line 7.
    (gdb) r
    Starting program: /home/uli2k/hello/devel/lib/hello/hello 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    /home/uli2k/hello/devel/lib/hello/hello
    
    Breakpoint 1, main (argc=1, argv=0x7fffffffddd8)
        at /home/uli2k/hello/src/hello/src/hello.cpp:7
    7		ros::init(argc, argv, "hello_node");        !!!!!!!!!!!!!!!!!!!!!!attention here. It is OK!!!!!!!!!!!!!!!!!!!!!!!!!!
    (gdb) n
    8		for (int i = 0; i < argc; i++)
    (gdb) n
    9			printf("%s\n", argv[i]);
    (gdb) n
    /home/uli2k/hello/devel/lib/hello/hello
    8		for (int i = 0; i < argc; i++)
    (gdb) n
    10		return 0;
    (gdb) c
    Continuing.
    [Inferior 1 (process 3714) exited normally]
    (gdb) q
    
  7. uli2k commented on Aug 12, 2017

    @uli2k
    Author

    My program must run in Bash login mode. Is it logon mode when using the SSH connection?

  8. WebFreak001 commented on Aug 12, 2017

    @WebFreak001
    Owner

    it should use your default shell but I don't think it can receive any input from stdin, try attaching instead of launching over ssh if you need that

  9. uli2k commented on Aug 12, 2017

    @uli2k
    Author

    The ros:init function just takes all the environment variables of bash,no stdio.What should I do?

  10. WebFreak001 commented on Aug 12, 2017

    @WebFreak001
    Owner

    over ssh it does get environment variables, you just won't have those that setup because of some commands you run when you login.

  11. GitMensch commented on Mar 2, 2022

    @GitMensch
    Collaborator

    The ssh issues should be solved already.
    Setting of the "main" breakpoint will also be able through the new settings stopAtConnect and stopAtEntry with the 0.26 release and setting of breakpoints in general should be improved with #313 (also target for 0.26).

    As this is an old issue and already seems to be fixed -> closing. Feel free to update if you still see issues with the recent version and we can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions