-
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
Support for OSX #3
Comments
Thanks for checking it out! You're correct, OSX support is not implemented yet. That is definitely the next major task I'd like to accomplish. |
@derekparker I think a lot of people are waiting for OSX support... You have more fans than you know, Derek! :) |
Could readline issues on OSX be addressed with https://github.com/bobappleyard/readline ? |
@datasaur looks promising -- I'll take a look at it and work on integrating it. Thanks for the link. |
IIRC I used it somewhere else with a similar issue - but can't find at the moment. The other build problem appears to be Linux specific files in proctl/ (?) |
Yeah, and that's not going to be as simple a solution. OS X has limited a lot of what the ptrace family of syscalls can do -- so a lot of Mach kernel specific stuff needs to happen there. |
not sure how fancy your readline has to be but this one is pure go and should cross-compile fine. |
there's also this one: https://github.com/peterh/liner |
+1 on this! |
Not sure if you want +1s, but I would definitely be very interested in OS X support. |
For a small cross platform pure go readline replacement with autocomplete support have a look at golang.org/x/crypto/ssh/terminal. |
Patching the readline module is relatively easy, the proctl module is a bit harder. Many of the syscall functions aren't working. A simple
|
@gillesdemey yes - proctl currently relies heavily on the Ptrace family of syscalls which are extremely limited on Darwin. Most Ptrace specific code will have to be modified to use Darwin specific syscalls for Delve to build on OS X. |
+1 also a sublime text plugin would be nice |
To update this issue: I've been working on isolating any Linux specific code into Along the lines of that last sentence, another thing I've been thinking about is: on Linux, notification of new threads can happen through the Ptrace API and new threads will be automatically be traced upon creation. I've been looking for something similar on OS X, maybe a mach port or something that can notify Delve of new threads, but haven't found anything. Mostly it looks like GDB and LLDB poll and check to see if any new threads have been created, and taking action at that point. Maybe somebody more familiar with Mach internals could give some insight into this. Another interesting challenge is codesigning. I believe Delve will need an info.Plist file compiled into custom section of the binary, and currently the only way to achieve that would be gccgo. I've been working recently towards OS X support and would love to have it in as soon as possible. If anybody has any insights into the above issues, please feel free to share them. Lastly, if anybody wants to hack on OS X support, these links should prove helpful: http://os-tres.net/blog/2010/02/17/mac-os-x-and-task-for-pid-mach-call/ |
Some time ago I tried to create an interface to |
@neelance that looks interesting, however the issue is still that the codesign tool is going to look in the binary for the Info.plist section. See: https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html What caught my eye there was:
If |
@neelance actually I was wrong(-ish). We can embed the Info.plist into the binary without using gccgo by using cgo and C variable attributes. This will allow us to use the normal Go toolchain + codesign on OS X. |
I don't think we have to. The
It seems like that you don't need an Info.plist file or section if you pass the data via command line args. I'll give it a try. |
Yeah I was going to say that I don't think GDB has one (I haven't explicitly looked at the code though...) https://sourceware.org/gdb/wiki/BuildingOnDarwin and http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5#Codesigning_gdb. |
GDB embeds one in |
I still don't see why we need it. I just tried |
Right, |
@neelance did you try it specifically with delve?
And
I think what it's really used for in this context is the This is also present in GDB's Info.plist. Note I haven't looked at delve's source to see what APIs it uses, so I could be wrong. |
Yeah seems like you are right. The identifier, signature and requirements are stored by |
I found manually codesigning gdb on OSX Yosemite to be painful. Any improvements would be appreciated by many -- I'm sure. |
Update on this issue: The branch If anyone else happens to be working on OS X support in their own free time, please base your work off of the |
keep rocking it derek |
Yet another update: I now have Delve compiling in OS X using a bunch of unimplemented stub functions. The good news is that it compiles, which means all Linux specific stuff has been sorted out and moved to the correct place. The next step is to fill in the stub functions, most of which I already have a clear idea of what the Linux -> Mach translation looks like. Hoping to have all stubs implemented and all tests passing as soon as possible. The other nagging issue has been resolved, so basically 100% of my efforts are focused of OS X support at the moment. |
👍 great |
You deserve a beer! |
👍 from the 🔢 |
YESSSS! |
I have just merged initial support for OS X into master. I plan on making an actual announcement tomorrow, but I'd like to give a chance for anybody watching this thread to check it out and flush out any major issues before then, if there is any. Please note that Delve is still in beta, so there may well be general issues, however the major thing here is OS X support. |
@derekparker Awesome stuff, Thank you! Had a small issue with the |
This is great, thank you! |
@nowk thanks, fixed. |
looking forward to it. |
great job derek, i'll be sure to try it. |
Wow, I can't wait to give this a shot. :) |
* start moving mm7 * add change docker-compose * fix go mod vendor + path package * fix error kdb * fix rabbit library so mm7 can run * Remove unused stuff * fix vendor * move middleware to lib + update dependency related to logger and recovery * add short description to the services Co-authored-by: Sam <sam@burstsms.com>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) go-delve#1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) go-delve#2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) go-delve#3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) go-delve#4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) go-delve#5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) go-delve#6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) go-delve#1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) go-delve#2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) go-delve#3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) go-delve#4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) go-delve#5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) go-delve#6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) #1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) #2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) #3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) #4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) #5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) #6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) #7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) #8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) #9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) go-delve#1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) go-delve#2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) go-delve#3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) go-delve#4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) go-delve#5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) go-delve#6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
Notable changes: * OS X support * Pure Go readline library * Fixes issues debugged cgo enabled programs * Substantial refactoring / code cleanup Fixes go-delve#3 go-delve#29 go-delve#70
Thanks for working on this!
I just wanted to try it out, but it seems like OSX is not supported yet?
The text was updated successfully, but these errors were encountered: