-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[WIP] Windows support #276
Conversation
Great! |
A quick update on progress:
A few of the known remaining work items:
However, at this point it is worth starting to get more eyes on this code and discussing if/when this should be merged into master. /cc @derekparker |
if err != nil { | ||
return err | ||
} | ||
_, err = t.dbp.trapWait(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. @aarzilli is there a test for that? If not we should add one, because for now let's simply not use trapWait here, but shortly after this and some other PRs land I'd like to look into ensuring that trapWait is safe to call in that situation. Either way I'd like to prevent that as a regression in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#259 has TestIssue262
which does catch this on linux and OS X, however it's highly dependent on what the compiler does.
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
@lukehoban sorry for the delay, have gotten really busy lately. I will be taking another look tomorrow. How is the work going to finish implementing features and get all tests to pass? |
@lukehoban do you plan on 100% parity with this PR or to get an initial implementation? Because I'm fine with merging a solid implementation that doesn't have 100% parity, as long as we have issues to track the other features that must be implemented. |
My note about the |
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
@derekparker Apologies for the delay getting back to you. I do think this is close to ready to merge in with a discrete set of known issues we can track in the issue tracker. There is only one truly "incorrect" thing I am aware of in the current implementation, which is the issue mentioned in https://github.com/derekparker/delve/pull/276#discussion_r45100529. Other than that, the remaining points from https://github.com/derekparker/delve/pull/276#issuecomment-155274585 are places where there is not yet 100% parity, but what does work works correctly. I'm happy to work on these as issues after merging this PR. Certainly, merging this in with the CI turned on will help to make sure the Windows support doesn't regress going forward. On the singleStep issue, I'll try to find some time to look at that in the next few days, and to bring this branch up to date with master. Once I have an update on that, we can decide whether to merge this in. |
Hey, I'm just trying to build this to test it out on my windows setup. Having a few problems getting things running. Should I be building on windows or cross compiling from linux to windows? When attempting to build on windows, it moans about lacking a gcc install and when on linux, it complains about |
Yeah - Delve uses cgo heavily, and cgo on Windows requires a GCC toolchain. I've been compiling on Windows with the MinGW64 tools. The appveyor.yml has one particular toolchain configuration that works and is being used in the CI toolchain: Locally I've used a slightly different MinGW version: |
|
||
// Attach to an existing process with the given PID. | ||
func Attach(pid int) (*Process, error) { | ||
fmt.Println("Attach") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this and just return the error.
@lukehoban Could you ping me directly when the PR will be merged, please. |
// in this case, one for each thread, so we should only handle the BP hit | ||
// on the thread that the debugger was evented on. | ||
|
||
err := trapthread.SetCurrentBreakpoint() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rewrite as return trapthread.SetCurrentBreakpoint()
@lukehoban https://github.com/derekparker/delve/pull/351 has landed, fixing the single step behavior. |
return false | ||
} | ||
switch fn.Name { | ||
case "runtime.kevent", "runtime.mach_semaphore_wait", "runtime.usleep": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can definitely remove "runtime.mach_semaphore_wait" from this list.
@lukehoban also, let's just go ahead and add the Appveyor badge to the README in the PR, since CI is already setup there it seems. That way it'll just be there when this lands. |
I've addressed all the code review feedback in the latest commits.
Great. I've updated the windows branch to align with this (actually just removing some code).
I think you'll need to set up an AppVeyor project to track |
Just merged this branch, will now start creating issues to track outstanding work that needs to be done, and I will get AppVeyor setup as well. Thank you @lukehoban for all your work on this! |
⚡ |
This is very cool! |
congrats! |
@derekparker looks like this article https://blog.gopheracademy.com/advent-2015/debugging-with-delve/ should be updated with new info about Windows support. ) |
resume loops in continueOnce moved to a OS specific resume function, this makes the problem easier to deal with and seems to be more appropriate to a windows port given what transpired from discussion of Pull Request go-delve#276
Initial work on porting Delve to support Windows.
There's a lot more to do before this is ready to be merged, but most of the core infrastructure for Windows support is in place, and some basic Delve scenarios are working in simple scenarios (launching, setting breakpoints, continuing, breaking on breakpoints, inspecting registers, seeing sources, inspecting locals, exiting, etc.).
Fixes #198.