Skip to content
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

Smoother debug program default for Windows OS #152

Merged
merged 1 commit into from
Oct 15, 2018

Conversation

Boereck
Copy link
Contributor

@Boereck Boereck commented Oct 15, 2018

Unfortunately this does not fix the Problem that rust does not ship a working version of the rust-gdb wrapper for Windows, but this is a more difficult issue and I am not convinced a workaround should be put into Corrosion.

  • Computing the default executable path on Windows now returns a path
    with the ".exe" suffix. This heuristic approach falls short when a
    rust toolchain for a different platform is selected (for cross-
    compilation). In future the location could be determined by the
    currently selected rust toolchain.

  • Added a null-check to prevent a NullPointerException on non-existent
    workspace resources. This exception would silently be swallowed
    without feedback to the user.

Signed-off-by: Max Bureck [email protected]

Copy link
Contributor

@mickaelistria mickaelistria left a comment

Choose a reason for hiding this comment

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

The copyright part needs to be fixed before I can merge.
Other comments are optional and not blockers.

@@ -0,0 +1,43 @@
/*********************************************************************
* Copyright (c) 2018 Red Hat Inc. and others.
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as know, you're not working for Red Hat, so the copyright here is invalid.
I guess it should mention Fraunhofer (if you do it in the scope of your employment) or your name (if you do it on your own and your work contract allows you to keep IP on this).

*/
class DebugUtil {

public static final boolean IS_WINDOWS = Platform.getOS().equals(Platform.OS_WIN32);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see it used any place else, so it should be private.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, there is only one occurence of this, so it doesn't seem profitable to declare it and it could as well be directly inlined on line 40.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should be private, but inlining would cause the evaluation on every call which seems to be unnecessary, especially since the OS won't change between calls.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, it retains the memory size of a boolean permanently for an operation that user runs not so frequently. So it's a matter of preference. Given that memory consumption is more visible than an extra string comparison on every run (not perceivable by end-user as cost of UI rendering >>> cost of a string compare), I'd favor the re-evaluation over the storage.
But that's nitpicking ;)

* Computing the default executable path on Windows now returns a path
  with the ".exe" suffix. This heuristic approach falls short when a
  rust toolchain for a different platform is selected (for cross-
  compilation). In future the location could be determined by the
  currently selected rust toolchain.

* Added a null-check to prevent a NullPointerException on non-existent
  workspace resources. This exception would silently be swallowed
  without feedback to the user.

Signed-off-by: Max Bureck <[email protected]>
@mickaelistria mickaelistria merged commit 75e001d into eclipse-corrosion:master Oct 15, 2018
@mickaelistria
Copy link
Contributor

Thank you!

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