Software Archive
Read-only legacy content

Eclipse Remote Debugging

Rob_L_
Beginner
2,650 Views

I am following the instructions to get native remote debugging working in Eclipse.  I've had to modifiy them a bit because I am using MPSS 2.1 and the instructions are for ComposerXE.  A quick summary:

  1. Successfully setup a remote system connection to mic0 (steps 1 & 2 in the guide).
  2. Transfer gdbserver by running
    scp /usr/linux-k1om-4.7/linux-k1om/usr/bin/ mic0:/tmp/gdbserver
    As noted in the instructions for this section, I had to modify this command to use the gdbserver provided by MPSS, which if found further up in the instructions.
  3. Setup Eclipse debugging profile.  The only change I made from the instructions (aside from specifying my app) is setting the GDB debugger (under Debugger -> Main) to /opt/intel/mic/bin/gdb, where /opt/intel/mic is the root directory of my MPSS 2.1 installation.

Running the debug profile, the executable gets copied to the MIC and gdbserver starts running (on the MIC), but Eclipse gives the following error:

Error in final launch sequence
Failed to execute MI command:
-file-exec-and-symbols /hpc/shared/home/rjlewis/git/MicSensor/Release/MicSensor
Error message from debugger back end:
Architecture of file not recognized.
Architecture of file not recognized.

A quick google search on the phrase "Architecture of file not recognized." lead to this StackOverflow which states: "this happens if the gdb client ( inside eclipse ) is not compiled for the same architecture as the gdb server. setting the correct gdb in eclipse debugging solved this issue"

Is it possible I'm using the wrong version of GDB in Eclipse?  Any help/tips/pointers would be greatly appreaciated.

0 Kudos
1 Solution
Georg_Z_Intel
Employee
2,650 Views

Hello,

I just saw that the path is incorrect. The GDB executable to use is not <mpss_root>/bin/gdb but it should be:

/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gdb

The other GDB binary is only for the host part required for debugging offload enabled applications. It will be used by the Eclipse* IDE plug-in for offload enabled applications.

I'll correct this in the article. Thank you for pointing that out!

Best regards,

Georg Zitzlsberger

View solution in original post

0 Kudos
7 Replies
Georg_Z_Intel
Employee
2,650 Views

Hello,

it seems you missed one last and final step: The path to GDBServer on the coprocessor needs to be specified in tab Debugger/Gdbserver.
As you copied it up to mic0:/tmp/, you just need to specify /tmp/gdbserver in the text field as I did here: http://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host#Configure%20Native%20Debugging; very last picture

Does this help?

Best regards,

Georg Zitzlsberger

 

 

0 Kudos
Rob_L_
Beginner
2,650 Views

Greg,

I have specified the gdbserver as you mentioned.  My post was a little unclear in step 3 because I was trying to save on some typing.  I followed all the instructions in setting up the Eclipse debug profile.  The only way my profile differs from the instructions is my specified application and the path to gdb (/opt/intel/mic/bin/gdb).  Let me know if this is still a little vague.  I could post some screenshots if that would help.

-Rob

0 Kudos
Georg_Z_Intel
Employee
2,651 Views

Hello,

I just saw that the path is incorrect. The GDB executable to use is not <mpss_root>/bin/gdb but it should be:

/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gdb

The other GDB binary is only for the host part required for debugging offload enabled applications. It will be used by the Eclipse* IDE plug-in for offload enabled applications.

I'll correct this in the article. Thank you for pointing that out!

Best regards,

Georg Zitzlsberger

0 Kudos
Rob_L_
Beginner
2,650 Views

Georg,

Over the weekend I upgraded to MPSS 3.1 and am now using the gdbserver (copied to the Phi) from /usr/linux-k1om-4.7/linux-k1om/usr/bin/gdbserver and the gdb from /opt/mpss/3.1.2/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux/k1om-mpss-linux-gdb and was able to get the debugger to break on main(), however I'm still running into two issues.

1.) It appears that the sftp command has been removed.  I am not able to sftp files to the Phi w/ MPSS 3.1 via the command line, and when logged onto the Phi the sftp command is not found.  This is in contrast to the Phi's still running MPSS 2.1 where these issues are not present.  I am currently working around this in Eclipse by moving the file manually.  Here is the output of trying to connect from the host box to the connect Phi with MPSS 3.1

[rjlewis@weiss micHome]$ sftp -v mic0
Connecting to mic0...
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to mic0 [172.31.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/rjlewis/.ssh/id_rsa type 1
debug1: identity file /home/rjlewis/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'mic0' is known and matches the RSA host key.
debug1: Found key in /home/rjlewis/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /home/rjlewis/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=ibus
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2368, received 2448 bytes, in 0.0 seconds
Bytes per second: sent 121517.5, received 125622.8
debug1: Exit status 127
Connection closed

2.) I'm getting many shared library mismatches, but I don't see anything in the docs about setting up shared libraries.

No symbol table is loaded.  Use the warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
The target endianness is set automatically (currently little endian)
warning: `/lib64/libpthread.so.0': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: `/lib64/librt.so.1': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: .dynamic section for "/lib64/librt.so.1" is not at the expected address (wrong library or version mismatch?)
warning: `/lib64/libm.so.6': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: `/usr/lib64/libstdc++.so.6': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: .dynamic section for "/usr/lib64/libstdc++.so.6" is not at the expected address (wrong library or version mismatch?)
warning: `/lib64/libgcc_s.so.1': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: .dynamic section for "/lib64/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
warning: `/lib64/libc.so.6': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: .dynamic section for "/lib64/libc.so.6" is not at the expected address (wrong library or version mismatch?)
warning: `/lib64/libdl.so.2': Shared library architecture i386:x86-64 is not compatible with target architecture k1om.
warning: Could not load shared library symbols for /lib64/ld-linux-k1om.so.2.
Do you need "set solib-search-path" or "set sysroot"?

Any thoughts would be greatly appreciated.

-Rob

0 Kudos
Rob_L_
Beginner
2,650 Views

Edit: Removed double post.

0 Kudos
Rob_L_
Beginner
2,650 Views

I forgot to mention that using /usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gdb on a Phi with MPSS 2.1 did solve my problem.  If the issues around getting 3.1 working are major, I will likely just revert all the devices to 2.1.

0 Kudos
Georg_Z_Intel
Employee
2,650 Views

Hello,

the first problem is because /usr/libexec/sftp-server is not available on the coprocessor and hence cannot do sftp. This is only true for MPSS 3.1.2 because there's no mpss-3.1.2-k1om.tar which contains tools like this.
The second problem is that GNU* GDB sysroot was not set to the MPSS sysroot.

I've more clearly documented both in the article now:
http://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host

To solve the first problem, you can download the mpss-3.1.1-k1om.tar (MPSS 3.1.1) and install openssh-sftp-server-5.9p1-r3.k1om.rpm.

The second problem can be solved by adding:
set sysroot /opt/mpss/3.1.2/sysroots/k1om-mpss-linux/
...in a command file (e.g. .gdbinit) to be executed before the debug session.

Best regards,

Georg Zitzlsberger

0 Kudos
Reply