Skip to content

Include system environment when debugging core build #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonahgraham
Copy link
Member

When doing a local launch, the only environment passed to the debuggee was the modified variables, typically just PATH. This meant all the other environment was lost.

This change does the same thing as all the other calls to setBuildEnvironment and passes in the initial system environment.

I added a small note to the API of setBuildEnvironment to try to avoid this error in the future.

Note that this fixes the missing incoming environment part of the last point in this comment #1067 (comment)

Copy link

github-actions bot commented Feb 25, 2025

Test Results

   636 files  +   34     636 suites  +34   36m 45s ⏱️ + 22m 54s
11 439 tests +1 217  11 295 ✅ +1 097  144 💤 +120  0 ❌ ±0 
11 449 runs  +1 201  11 307 ✅ +1 083  142 💤 +118  0 ❌ ±0 

Results for commit 2980b60. ± Comparison against base commit e138646.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@betamaxbandit betamaxbandit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is a similar change necessary in the Run equivalent?

org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate.launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)

@jonahgraham
Copy link
Member Author

jonahgraham commented Feb 26, 2025

Q: Is a similar change necessary in the Run equivalent?

org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate.launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)

No, the run already does the correct thing.


@betamaxbandit said in #1095 (comment)

I downloaded your latest PS for this change and applied changes from: #1096 #1097 But when I attempt to launch a debug session on Windows, I get an error:

!MESSAGE Failure to start debug session
!STACK 0
java.util.concurrent.ExecutionException: org.eclipse.core.runtime.CoreException: Failed to execute MI command:
-gdb-set env =:: = ::\\
Error message from debugger back end:
Argument required (environment variable to set).
	at org.eclipse.cdt.dsf.concurrent.Query.get(Query.java:112)
	at org.eclipse.cdt.dsf.gdb.internal.launching.CoreBuildLocalDebugLaunchDelegate.launch(CoreBuildLocalDebugLaunchDelegate.java:149)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:777)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:688)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1054)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$1.run(DebugUIPlugin.java:1257)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.eclipse.core.runtime.CoreException: Failed to execute MI command:
-gdb-set env =:: = ::\\
Error message from debugger back end:
Argument required (environment variable to set).
	... 7 more

This is due the the "special" environment variables on Windows that have no key and should have been excluded.

@jonahgraham
Copy link
Member Author

I am removing this from RC1 consideration - this fix isn't quite right, for the obvious as stated in the above comment, but also because it does too many -gdb-set env - it is doing one for every environment variable, but it should only be doing it for the variables that have different values than in the incoming environment.

@jonahgraham jonahgraham marked this pull request as draft February 26, 2025 02:54
When doing a local launch, the only environment passed to the debuggee
was the modified variables, typically just PATH. This meant all the
other environment was lost.

This change does the same thing as all the other calls to setBuildEnvironment
and passes in the initial system environment.

I added a small note to the API of setBuildEnvironment to try
to avoid this error in the future.
@jonahgraham
Copy link
Member Author

jonahgraham commented Feb 26, 2025

My latest commit saves my current state of work - I think this is correct, but some more thought is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants