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

Add support for FreeBSD #213

Closed
tsgan opened this issue Aug 19, 2015 · 15 comments
Closed

Add support for FreeBSD #213

tsgan opened this issue Aug 19, 2015 · 15 comments

Comments

@tsgan
Copy link

tsgan commented Aug 19, 2015

go get -u github.com/derekparker/delve/cmd/dlv
# github.com/derekparker/delve/proc
../../../github.com/derekparker/delve/proc/proc.go:43: undefined: OSProcessDetails
@derekparker
Copy link
Member

Unfortunately FreeBSD is not a supported platform at the moment.

@derekparker
Copy link
Member

Actually, let me rename and reopen for adding FreeBSD support.

@derekparker derekparker reopened this Aug 19, 2015
@derekparker derekparker changed the title go get fails in FreeBSD Add support for FreeBSD Aug 19, 2015
@tpltnt
Copy link

tpltnt commented Feb 17, 2016

For completeness sake, retrieving the dependencies fails like this:

% go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
github.com/peterh/liner (download)
github.com/derekparker/delve (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag main.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
Fetching https://golang.org/x/debug/dwarf?go-get=1
Parsing meta tags from https://golang.org/x/debug/dwarf?go-get=1 (status code 200)
get "golang.org/x/debug/dwarf": found meta tag main.metaImport{Prefix:"golang.org/x/debug", VCS:"git", RepoRoot:"https://go.googlesource.com/debug"} at https://golang.org/x/debug/dwarf?go-get=1
get "golang.org/x/debug/dwarf": verifying non-authoritative meta tag
Fetching https://golang.org/x/debug?go-get=1
Parsing meta tags from https://golang.org/x/debug?go-get=1 (status code 200)
golang.org/x/debug (download)
Fetching https://rsc.io/x86/x86asm?go-get=1
Parsing meta tags from https://rsc.io/x86/x86asm?go-get=1 (status code 200)
get "rsc.io/x86/x86asm": found meta tag main.metaImport{Prefix:"rsc.io/x86", VCS:"git", RepoRoot:"https://github.com/rsc/x86"} at https://rsc.io/x86/x86asm?go-get=1
get "rsc.io/x86/x86asm": verifying non-authoritative meta tag
Fetching https://rsc.io/x86?go-get=1
Parsing meta tags from https://rsc.io/x86?go-get=1 (status code 200)
rsc.io/x86 (download)
github.com/spf13/cobra (download)
github.com/spf13/pflag (download)
gopkg.in/yaml.v2
github.com/peterh/liner
github.com/derekparker/delve/dwarf/util
github.com/derekparker/delve/dwarf/frame
github.com/derekparker/delve/dwarf/line
github.com/derekparker/delve/dwarf/op
golang.org/x/debug/dwarf
github.com/derekparker/delve/config
rsc.io/x86/x86asm
github.com/derekparker/delve/dwarf/reader
github.com/spf13/pflag
github.com/derekparker/delve/proc
# github.com/derekparker/delve/proc
../../go/src/github.com/derekparker/delve/proc/proc.go:54: undefined: OSProcessDetails
../../go/src/github.com/derekparker/delve/proc/threads.go:23: undefined: WaitStatus
github.com/spf13/cobra

The issue seems to be:

# github.com/derekparker/delve/proc
../../go/src/github.com/derekparker/delve/proc/proc.go:54: undefined: OSProcessDetails
../../go/src/github.com/derekparker/delve/proc/threads.go:23: undefined: WaitStatus

Cheers,
tpltnt

@NanXiao
Copy link
Contributor

NanXiao commented Jul 11, 2016

@aarzilli : It seems only need to extend content in /proc directory of delve to support FreeBSD. Is it right?

@aarzilli
Copy link
Member

@NanXiao yes.

@ghost
Copy link

ghost commented Nov 3, 2017

Can we also throw in a request for OpenBSD since I'm seeing a similar issue?

$ go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv 
github.com/peterh/liner (download)
github.com/derekparker/delve (download)
github.com/derekparker/delve/vendor/gopkg.in/yaml.v2
github.com/derekparker/delve/pkg/goversion
github.com/derekparker/delve/pkg/dwarf/util
github.com/derekparker/delve/pkg/dwarf/op
github.com/derekparker/delve/pkg/dwarf/godwarf
github.com/derekparker/delve/pkg/dwarf/frame
github.com/derekparker/delve/pkg/dwarf/line
github.com/derekparker/delve/pkg/dwarf/reader
github.com/derekparker/delve/vendor/golang.org/x/arch/x86/x86asm
github.com/derekparker/delve/pkg/config
github.com/derekparker/delve/vendor/github.com/peterh/liner
github.com/derekparker/delve/pkg/version
github.com/derekparker/delve/vendor/github.com/spf13/pflag
github.com/derekparker/delve/pkg/proc
github.com/derekparker/delve/vendor/github.com/spf13/cobra
github.com/derekparker/delve/service/api
github.com/derekparker/delve/pkg/proc/core
github.com/derekparker/delve/service
github.com/derekparker/delve/pkg/proc/gdbserial
github.com/derekparker/delve/pkg/proc/native
# github.com/derekparker/delve/pkg/proc/native
src/github.com/derekparker/delve/pkg/proc/native/threads.go:16:28: undefined: WaitStatus
src/github.com/derekparker/delve/pkg/proc/native/threads.go:24:18: undefined: OSSpecificDetails
# github.com/derekparker/delve/pkg/proc/gdbserial
src/github.com/derekparker/delve/pkg/proc/gdbserial/gdbserver.go:418:21: undefined: backgroundSysProcAttr
src/github.com/derekparker/delve/pkg/proc/gdbserial/gdbserver.go:468:21: undefined: backgroundSysProcAttr
src/github.com/derekparker/delve/pkg/proc/gdbserial/rr.go:58:22: undefined: backgroundSysProcAttr

@asomers
Copy link

asomers commented Nov 6, 2017

It's actually worse than just /proc stuff. None of the ptrace definitions are in place for FreeBSD. I'll take a stab at adding them.

@krytarowski
Copy link

I might help with NetBSD, but currently we are in the process of improving our debugging interfaces and this must wait.

@asomers
Copy link

asomers commented Dec 9, 2017

Status update: my patched delve compiles on FreeBSD. I can start it and run a few commands before it aborts due to an array overflow in Go. I'll keep working as time permits.

@aarzilli
Copy link
Member

aarzilli commented Dec 9, 2017

@asomers that's pretty cool.

@jasin
Copy link

jasin commented Feb 3, 2018

@asomers where is your repository?

@asomers
Copy link

asomers commented Feb 5, 2018

Sorry to say that I'm out of time to work on this. Perhaps somebody else can continue where I left off. My main repository is at [email protected]:asomers/delve.git and I'm working in the fbsd branch. I also had to make a few changes to golang. Those are in [email protected]:asomers/sys in the ptrace_fbsd branch. They're also already imported into the vendor area of my delve branch.

The biggest challenge to porting Delve to FreeBSD is in the different threading model. On Linux a thread is just a weird process, and ptrace works more or less identically on threads and processes. However, on FreeBSD threads are a first-class concept and ptrace works primarily on processes, using a set of special requests to for thread-related stuff. That difference has exposed some Linuxisms that got accidentally assumed in Delve. I expect that there are more to follow.

I apologize in advance for any problems with my code. This is both my first experience with Go and my first experience with ptrace, so it's a little rough. Good luck to all.

@krytarowski
Copy link

I have got slides (bit dated, but good as a reference) of mine explaining a bit the differences between BSD's ptrace(2) and the Linux's one.
http://netbsd.org/~kamil/ptrace-netbsd/presentation.html

@derekparker
Copy link
Member

derekparker commented Jul 13, 2019

Implemented via #1480

@justinclift
Copy link
Contributor

justinclift commented Jul 13, 2019

Oh fantastic. Can likely change back to a decent OS for developing on. 😉

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

No branches or pull requests

9 participants