Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] how to set PORT when launching C debug session programmatically

Thanks Shaiju for your reply.

I can have 2 different launches for Core_1 and Core_2. As earlier core_1 works fine. Now in case of 2nd instance, though ILaunchConfiguration instance store new value of port, uses the port value for Core_1. 

ILaunchConfigurationType[] types = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
ILaunchConfigurationType confType = null;
for(int i=0;i<types.length;i++){
if(types[i].getName().equals("XYZ C/C++ Debugger"))
confType = types[i];//System.out.println(types[i].getName());
}
ILaunchConfiguration config_4 = confType.newInstance(null, "Core_2");
ILaunchConfigurationWorkingCopy wc = config_4.getWorkingCopy();
Saving attributes like debug_mode, verbose_mode, hostname, port, etc. to wc.
config_4 = wc.doSave();
config_4.launch(ILaunchManager.DEBUG_MODE, new SubProgressMonitor(monitor, 50));

launch method here takes care of new debug session, setting runtime options, new target and new process as shown below

if ( process != null ) { iprocess = DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ), getDefaultProcessMap() ); } CDIDebugModel.newDebugTarget( launch, project.getProject(), targets[i], renderTargetLabel( debugConfig ), iprocess, exeFile, true, false, stopSymbol, true );

But still for some reason its taking port value for core_1. Please suggest if I'm missing anything obvious here.

Thanks in advance,
Vrushali.


From: Shaiju Nair <shaijupnairp@xxxxxxxxxxx>
To: vrush_com@xxxxxxxxx
Sent: Tue, January 18, 2011 1:46:10 PM
Subject: Re: [cdt-dev] how to set PORT when launching C debug session programmatically

Generally speaking about multi-core launch :
First of all your launch configuration should be capable of  storing  gdb port that correspoding to each core.
 
config_2.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT,
newValueOfPort);
is storing only one gdb port per launch  , which should be changed to store  multiple . See  the methods in ILaunchConfigurations which allows to store list  and maps.
 
Then you  can take the  respective gdb port for  each debug session .  (Just like gdb port the application can also be different on different core) .
 
Now you can look at the MITargetSelect command and see where  from that command is being used in your launch session (look for createLaunchSession.)  You can modify your code to use  the port number based on your session.
 
Shaiju.P
 



From: vrushali babar <vrush_com@xxxxxxxxx>
To: cdt-dev@xxxxxxxxxxx
Sent: Tue, 18 January, 2011 1:17:59 PM
Subject: [cdt-dev] how to set PORT when launching C debug session programmatically

Hi,

I've extended launch configuration to make it launch 2 debug
session simultaneousness to make it suitable for multi core debugging. With
CDT's debug options I can launch 2 debug sessions varying gdb_init and port.
I could launch 2 debug session with two different gdb_init but can't vary port
number.

In the launchDelegate which extends AbstractCLaunchDelegate
- I'm launching 1st debug sessions with ILaunchConfiguration with all the debug
debug attributes set...which runs perfectly
- For the 2nd debug session,
config_2 = config.getWorkingCopy();
config_2.removeAttribute("org.eclipse.cdt.debug.mi.core.PORT");
config_2.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT,
newValueOfPort);
config_2.doSave();
((ILaunchConfiguration)config_2).launch(launch.getLaunchMode(), new
SubProgressMonitor(monitor, 50));

But still it takes old/default port number leaving 2nd debug sessions with
errors like target not responding, etc.

Please let me know if I'm missing anything here. Stuck badly. Please provide
some pointers.

Thanks a lot in advance,
Vrushali.


     
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top