Skip to content

Commit

Permalink
proc: fixes concerning call injection on freebsd and rr (#3000)
Browse files Browse the repository at this point in the history
* Upgrade FreeBSD version

* proc: fixes concerning call injection on freebsd and rr

On FreeBSD it seems we have problems restoring and setting floating
point registers, since at least restoring is necessary for call
injection to function properly fully disable call injection on FreeBSD.

On rr the same problem exists, however due to the fact that we are
acting on a recording and ending a diversion will restore register
values anyway simply disable the floatsum test.

See also: rr-debugger/rr#3208

Updates #3001
  • Loading branch information
aarzilli authored May 5, 2022
1 parent 10332d6 commit 51090f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ env:
GOFLAGS: -mod=vendor

freebsd_instance:
image: freebsd-11-3-stable-amd64-v20200402
image_family: freebsd-12-3

test_task:
install_script: pkg install -y go gcc git
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (t *Target) Valid() (bool, error) {
// Currently only non-recorded processes running on AMD64 support
// function calls.
func (t *Target) SupportsFunctionCalls() bool {
return t.Process.BinInfo().Arch.Name == "amd64" || t.Process.BinInfo().Arch.Name == "arm64"
return (t.Process.BinInfo().Arch.Name == "amd64" && t.Process.BinInfo().GOOS != "freebsd") || t.Process.BinInfo().Arch.Name == "arm64"
}

// ClearCaches clears internal caches that should not survive a restart.
Expand Down
4 changes: 4 additions & 0 deletions pkg/proc/test/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ func MustSupportFunctionCalls(t *testing.T, testBackend string) {
t.Skip("this backend does not support function calls")
}

if runtime.GOOS == "freebsd" {
t.Skip("freebsd backend has problems with changing and restoring XMM registers")
}

if runtime.GOOS == "darwin" && os.Getenv("TRAVIS") == "true" && runtime.GOARCH == "amd64" {
t.Skip("function call injection tests are failing on macOS on Travis-CI (see #1802)")
}
Expand Down
5 changes: 5 additions & 0 deletions service/test/variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,11 @@ func TestCallFunction(t *testing.T) {

if goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) {
for _, tc := range testcases117 {
if strings.Contains(tc.expr, "floatsum") && testBackend == "rr" {
// Can not set floating point registers with RR.
// See: https://github.com/rr-debugger/rr/issues/3208
continue
}
testCallFunction(t, p, tc)
}
}
Expand Down

0 comments on commit 51090f0

Please sign in to comment.