[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Setting environment variables in gdb process programattically
|
I was setting the environment variable as expected. The problem was that I didn't realize I needed a writable copy of the project description and that I needed to call CoreModel.getDefault().setProjectDescription() to actually make the change.
Once I did this my problem was solved.
Thanks
Dave
---- Marc Khouzam <marc.khouzam@xxxxxxxxxxxx> wrote:
> The environment used by GDB is computed by
> org.eclipse.cdt.dsf.gdb.launching.LaunchUtils.getLaunchEnvironment(config);
>
> This call is made in GDBBackend.launchGDBProcess(String[]);
>
> See if you are setting the environment vars in same place as where they get read.
> ________________________________________
> From: cdt-dev-bounces@xxxxxxxxxxx [cdt-dev-bounces@xxxxxxxxxxx] on behalf of drwootton@xxxxxxxxxx [drwootton@xxxxxxxxxx]
> Sent: July 29, 2015 11:44 AM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Setting environment variables in gdb process programattically
>
> I need to set or modify an environment variable in the gdb process as part of the launch processing for my plugin. I was told I needed to do this by updating the build environment since gdb gets it's environment variables from the build environment, not the debug configuration.
>
> I'm trying to do this in the launch method of my launch configuration delegate which extends GdbLaunchDelegate. I am able to update the C/C++ build variables in the project properties, but it seems like the update does not take effect until the next launch of the debug session. I can see the updates by looking in project properties in the first launch, so I'm wondering if I'm doing this too late or if there's more that I need to be doing.
>
> The code that gets me access to the project properties looks like
>
>
> IEnvironmentVariableManager envManager = CCorePlugin.getDefault()
> .getBuildEnvironmentManager();
> IContributedEnvironment env = envManager.getContributedEnvironment();
> ICProjectDescription projectDescription = CoreModel.getDefault()
> .getProjectDescription(project, false);
> IEnvironmentVariable pythonPath = null;
> ICConfigurationDescription configDescription = projectDescription
> .getActiveConfiguration();
> pythonPath= env.getVariable("PYTHONPATH", configDescription);
> // Update pythonPath
> env.addVariable("PYTHONPATH", pythonPath,
> IEnvironmentVariable.ENVVAR_REPLACE, ":",
> configDescription);
>
> Once I do this I call super.launch() to launch the debug session
>
> Any suggestions what I might be doing wrong?
>
> Thanks.
>
> Dave
>
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev