-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Breakpoints in plugins are not working if set before plugin is loaded #1653
Comments
Is there an error or any odd output when you put a breakpoint in the plugin code? |
I'd like to see output of |
@aarzilli you are right I am setting breakpoints before starting the application. Are the arguments you mention for dlv? |
Yes. IIRC there's an option to get those logs from GoLand, I think maybe somewhere under the help menu? |
I will get the log later (did not find it this option anywhere in GoLand btw). Meanwhile, it appears that even after the module loaded I am unable to set breakpoints via IDE, I've set a breakpoint right before call to BTW, the second screenshot is from Mac, so not sure if plugin debugging is even supposed to work there, I can only try again on Linux later, where I can also try to get logs from debugger. |
To get this log from IDE I had to make a wrapped bash in place of dlv binary that calls actual dlv binary with extra arguments :heavy_sigh: Found that in both cases whether I try to create breakpoint before starting application or wait until plugin is loaded it shows same exact error:
However the file is most definitely there:
Also on Darwin, when i create breakpoint before running application, it automagically pops an Assembly file in editor "paused" on a RET instruction (same does not happen on Linux): |
@aarzilli fair enough, I’ve sorted of expected this on Mac since it seems support for it lagging on all fronts. I’ll re-test tomorrow with logging on Linux and follow up here. |
Tested on Linux and it appears that if I set breakpoints before start application, then it skips them with same error: There is one major issue with this though -- if I restart process the breakpoint inside plugin is no longer working. Now sure if this is possible to detect from delve, but I would imagine "re-evaluating" breakpoints when detecting plugins being loaded should fix this issue? (re-evaluating here means check if all attempted breakpoints were successfully set, if not all, then check if any of unsuccessful are referring to loaded plugin, if they are -- set them at this point of time) |
Also I think this is independent from #1628 which refers to specifically Darwin platform where debugging does not work at all. |
Filed an issue for GoLand: https://youtrack.jetbrains.com/issue/GO-7957. Maybe we can fix it without changes in Delve. E.g. to set a invisible breakpoint inside the |
@nd I don't think this has anything to do with GoLand itself. From how Delve sets breakpoints the logic GoLand follows looks fine. GoLand would not know about those details, it passes breakpoint information to Delve, which in turn should be able to handle it. Also GoLand is not the only IDE, but Delve is basically only debugger that works for Go. |
Hmm would it generally be possible for delve to "remember" breakpoints it has no reference to (executable does not contain debug information for file /somefile.go) and re-evaluates these breakpoints if/after a plugin load has occurred ? |
Yes but there is no existing code for either: (a) deferring a breakpoint creation, (b) catching a plugin load as soon as it happens |
I also hit this issue when trying to debug a plugin, but in my case, it happened in vs code. @aarzilli I would be interested in implementing the needed features if there is an agreed path. |
It would probably have to be something like this:
|
Thanks for outlining the tasks. However, It has become apparent that I will not have much time to work on this the following months, hopefully someone else can give it a try. |
is there any documentation available or tips you can provide for debugging plugin code in mac? |
See golang/go#25841, not possible on mac atm afaik. |
Adds a LogicalBreakpoint type to represent logical breakpoints explicitly. Until now logical breakpoints were constructed implicitly by grouping physical breakpoints together by their LogicalID. Having logical breakpoints represented explicitly allows for a simpler implementation of disabled breakpoints, as well as allowing a simple implementation of delayed breakpoints (go-delve#1653, go-delve#2551) and in general of breakpoints spanning multiple processes if we implement debugging process trees (go-delve#2551). Updates go-delve#1653 Updates go-delve#2551
Adds a LogicalBreakpoint type to represent logical breakpoints explicitly. Until now logical breakpoints were constructed implicitly by grouping physical breakpoints together by their LogicalID. Having logical breakpoints represented explicitly allows for a simpler implementation of disabled breakpoints, as well as allowing a simple implementation of delayed breakpoints (go-delve#1653, go-delve#2551) and in general of breakpoints spanning multiple processes if we implement debugging process trees (go-delve#2551). Updates go-delve#1653 Updates go-delve#2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Adds a LogicalBreakpoint type to represent logical breakpoints explicitly. Until now logical breakpoints were constructed implicitly by grouping physical breakpoints together by their LogicalID. Having logical breakpoints represented explicitly allows for a simpler implementation of disabled breakpoints, as well as allowing a simple implementation of delayed breakpoints (go-delve#1653, go-delve#2551) and in general of breakpoints spanning multiple processes if we implement debugging process trees (go-delve#2551). Updates go-delve#1653 Updates go-delve#2551
Adds a LogicalBreakpoint type to represent logical breakpoints explicitly. Until now logical breakpoints were constructed implicitly by grouping physical breakpoints together by their LogicalID. Having logical breakpoints represented explicitly allows for a simpler implementation of disabled breakpoints, as well as allowing a simple implementation of delayed breakpoints (#1653, #2551) and in general of breakpoints spanning multiple processes if we implement debugging process trees (#2551). Updates #1653 Updates #2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Saves information on how the breakpoint was originally set so that it can be used when the breakpoint is restored, either after a restart or when a breakpoint is re-enabled after being disabled. This will also allow implementing delayed breakpoints for plugins or multi-process debugging. Updates go-delve#1653, go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Changes FindLocation to support multiple targets and adds an AddrPid member to api.Breakpoint so that clients can set breakpoints by address when multiple targets are connected (but at them moment this field is ignored). Updates go-delve#1653 Updates go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Changes FindLocation to support multiple targets and adds an AddrPid member to api.Breakpoint so that clients can set breakpoints by address when multiple targets are connected (but at them moment this field is ignored). Updates go-delve#1653 Updates go-delve#2551
Changes FindLocation to support multiple targets and adds an AddrPid member to api.Breakpoint so that clients can set breakpoints by address when multiple targets are connected (but at them moment this field is ignored). Updates go-delve#1653 Updates go-delve#2551
Changes FindLocation to support multiple targets and adds an AddrPid member to api.Breakpoint so that clients can set breakpoints by address when multiple targets are connected (but at them moment this field is ignored). Updates go-delve#1653 Updates go-delve#2551
Adds field to breakpoint struct to track how a breakpoint was originally set, moves the logic for disabling and enabling a breakpoint to proc. This will allow creating suspended breakpoints that are automatically enabled when a plugin is loaded. When follow exec mode is implemented it will also be possible to automatically enable breakpoints (whether or not they were suspended) on new child processes, as they are spawned. It also improves breakpoint restore after a restart, before this after a restart breakpoints would be re-enabled using their file:line position, for breakpoints set using a function name or a location expression this could be the wrong location after a recompile. Updates go-delve#1653 Updates go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Adds field to breakpoint struct to track how a breakpoint was originally set, moves the logic for disabling and enabling a breakpoint to proc. This will allow creating suspended breakpoints that are automatically enabled when a plugin is loaded. When follow exec mode is implemented it will also be possible to automatically enable breakpoints (whether or not they were suspended) on new child processes, as they are spawned. It also improves breakpoint restore after a restart, before this after a restart breakpoints would be re-enabled using their file:line position, for breakpoints set using a function name or a location expression this could be the wrong location after a recompile. Updates go-delve#1653 Updates go-delve#2551
Adds field to breakpoint struct to track how a breakpoint was originally set, moves the logic for disabling and enabling a breakpoint to proc. This will allow creating suspended breakpoints that are automatically enabled when a plugin is loaded. When follow exec mode is implemented it will also be possible to automatically enable breakpoints (whether or not they were suspended) on new child processes, as they are spawned. It also improves breakpoint restore after a restart, before this after a restart breakpoints would be re-enabled using their file:line position, for breakpoints set using a function name or a location expression this could be the wrong location after a recompile. Updates #1653 Updates #2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Allows setting suspended breakpoints and try to enable them automatically after every time a plugin is loaded. Fixes go-delve#1653 Updates go-delve#2551
Please answer the following before submitting your issue:
Version: 1.2.0 Build: dd4fd5dc9cf5d45092f97f2ba376f3e69d7a5a8e
go version go1.12.7 linux/amd64
linux x86_64
Attempt to debug plugin from Goland. Using i.e. https://github.com/vladimirvivien/go-plugin-example.git (compile all plugins with
-gcflags='all=-N -l'
). Place breakpoints inside functions of plugin and inside main application functions.Breakpoints of main application work. Breakpoints inside plugins work.
Breakpoints of main application work. Plugin breakpoints are ignored.
The text was updated successfully, but these errors were encountered: