Bug 444208 - [remote] Specifing binary in launch config does not work if the name of binary is not same with the name of process
Summary: [remote] Specifing binary in launch config does not work if the name of binar...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-16 03:21 EDT by Ugur Ozdemir CLA
Modified: 2020-09-04 15:21 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ugur Ozdemir CLA 2014-09-16 03:21:21 EDT
To attach to a process remotely, the name of the binary must match the name of the process. Otherwise binary file must be selected for every attach operation even if it is specified in launch config. To reproduce,

1- Specify the binary file name which is different from process name (e.g. <processName>.elf)
2- Start remote debug session and select the process from the process list
3-File dialog is prompted for selecting binary file path.

Binary file path must be selected for every attach operation.

For more information please see https://www.eclipse.org/forums/index.php/t/812603/
Comment 1 Marc Khouzam CLA 2014-09-16 06:41:59 EDT
One approach we could take is that if we don't have a match, we also try to match while ignoring the binary file name's extension.
Comment 2 Ugur Ozdemir CLA 2014-09-25 04:54:23 EDT
Please review the patch

https://git.eclipse.org/r/#/c/33859/
Comment 3 Marc Khouzam CLA 2014-10-07 09:59:57 EDT
(In reply to Ugur Ozdemir from comment #2)
> Please review the patch
> 
> https://git.eclipse.org/r/#/c/33859/

Although the proposed change seems correct at first glance (it actually took me a while to notice the problem), it will break remote debugging.

The code that adds the first element to the map is actually not necessarily related to the process we are currently attaching to.  I guess the code location is very misleading.  My bad.  We should try to move that cod to another location or at least in a method call.

To reproduce the issue:
1- start gdbserver --multi :9999
2- create a "C/C++ attach to application" launch and set it to 'gdbserver'
See the wiki for details:
https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_debug_a_remote_application.3F
under "Remote attach launch")

3- in the main tab of that launch set any binary
4- launch it

You will get a session that is not debugging anything yet but ready to attach to a process

5- from a shell start a process that is *not* the binary specified in the launch
6- in eclipse press the connect button and select the process just started

=> with the proposed change, the binary in the launch will be used when it is not the one that matches the process we are attaching too.

Although it seems like we really should map a process name to a binary as proposed, we cannot do that for the binary provided in the launch as we don't have a process for it.  What we may want to do is to take the name of the binary without the extension part.  Although it is blurry in my mind how that will work on Linux vs Windows, and should be thought through.