Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » DSF-GDB Remote Debug - Attach To process- Always ask to select binary file(While attaching a process after selecting the process it always asks binary file path)
DSF-GDB Remote Debug - Attach To process- Always ask to select binary file [message #1424186] Mon, 15 September 2014 16:05 Go to next message
Ugur Ozdemir is currently offline Ugur OzdemirFriend
Messages: 7
Registered: September 2014
Junior Member
Hi,

I try to debug a process with gdb remote connection. I successfully launch the "Attach to Application" config. But after selecting the process (from Select Processes dialog) it always asks the binary file path although it is specified in launch config. I have debugged DSF code and found something. But not sure it is related or not.
if (fProcessNameToBinaryMap.isEmpty()) {
    IPath binaryPath = backend.getProgramPath();
    if (binaryPath != null && !binaryPath.isEmpty()) {
        fProcessNameToBinaryMap.put(binaryPath.lastSegment(), binaryPath.toOSString());
    }
}

This code is from GdbConnectCommand file line 497-502. Binary file name is put as a key into fProcessNameToBinaryMap but it is gotten by process name in PromptAndAttachToProcessJob.runInUIThread method.
String binaryPath = fProcessNameToBinaryMap.get(fProcName);

In my case binary file name and process name are different from each other. e.g. binary file name is <processName>.elf and process name is <processName>. Since binary file name and process name are different it cannot find in map and it always prompts a file dialog for binary file name. Is it a bug or am I doing something wrong?

Eclipse Luna (4.4.0) + CDT 8.4.0.201406111759 + org.eclipse.cdt.dsf.gdb.ui.2.4.0.201406111759

Win XP + cygwin

Thanks.
Re: DSF-GDB Remote Debug - Attach To process- Always ask to select binary file [message #1424196 is a reply to message #1424186] Mon, 15 September 2014 16:20 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
Yes, right now the name of the binary must match the name of the process for DSF-GDB to know they are the same. It is not a very good technique, but I'm not sure what else we could do. One thing we could add, based on your situation, is that we could ignore extensions to file names in the comparison.

Please open a bug in bugzilla

Thanks
Re: DSF-GDB Remote Debug - Attach To process- Always ask to select binary file [message #1424621 is a reply to message #1424196] Tue, 16 September 2014 07:31 Go to previous messageGo to next message
Ugur Ozdemir is currently offline Ugur OzdemirFriend
Messages: 7
Registered: September 2014
Junior Member
Thanks Marc for your fast reply. I have submitted a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=444208

Also I have tried something and it has worked for me but not sure it will ok for all cases. Changed part is below
IPath processPath = new Path(process.getName());
String processShortName = processPath.lastSegment();
if (fProcessNameToBinaryMap.isEmpty()) {
     IPath binaryPath = backend.getProgramPath();
     if (binaryPath != null && !binaryPath.isEmpty()) {
         fProcessNameToBinaryMap.put(processShortName, binaryPath.toOSString());
     }
}

I have just used process name as a key for the map.
Re: DSF-GDB Remote Debug - Attach To process- Always ask to select binary file [message #1424857 is a reply to message #1424621] Tue, 16 September 2014 14:15 Go to previous message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
Thanks Ugur,

can you submit a patch using CDT's Gerrit? I cannot accept code directly from the forum due to copyright issues.
https://wiki.eclipse.org/CDT/git#Using_Gerrit_for_CDT

We can continue this discussion on the bug you opened.

Marc
Previous Topic:Help setting CDT Indexer include path programmatically
Next Topic: installing eclipse for java and c++ on windows 8
Goto Forum:
  


Current Time: Wed Apr 24 15:30:54 GMT 2024

Powered by FUDForum. Page generated in 0.03501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top