Skip to content

Commit

Permalink
chore: strace klib temporary backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rinor committed Jun 7, 2024
1 parent bdeb7c5 commit 95e0dc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cmd/flags_run_local_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"debug/elf"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
"slices"
"strconv"
"strings"
Expand Down Expand Up @@ -45,7 +47,7 @@ func (flags *RunLocalInstanceCommandFlags) MergeToConfig(c *types.Config) error
c.Debugflags = []string{}

if flags.Trace {
c.Debugflags = []string{"trace", "debugsyscalls", "fault"}
c.Debugflags = []string{"trace", "debugsyscalls", "fault", "futex_trace"} // "futex_trace" is just for temporay compatibility
}

if flags.Debug {
Expand Down Expand Up @@ -79,7 +81,9 @@ func (flags *RunLocalInstanceCommandFlags) MergeToConfig(c *types.Config) error
}

if (flags.Trace || flags.SyscallSummary) && !slices.Contains(c.Klibs, "strace") {
c.Klibs = append(c.Klibs, "strace") // debugsyscalls, notrace, tracelist, syscall_summary
if _, err := os.Stat(filepath.Join(c.KlibDir, "strace")); err == nil {
c.Klibs = append(c.Klibs, "strace") // debugsyscalls, notrace, tracelist, syscall_summary
}
}

if flags.MissingFiles {
Expand Down
2 changes: 1 addition & 1 deletion cmd/flags_run_local_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestRunLocalInstanceFlagsMergeToConfig(t *testing.T) {

expected := &types.Config{
BuildDir: "",
Debugflags: []string{"trace", "debugsyscalls", "fault", "syscall_summary"},
Debugflags: []string{"trace", "debugsyscalls", "fault", "futex_trace", "syscall_summary"}, // "futex_trace" is just for temporay compatibility
Force: true,
NoTrace: []string{"a"},
RunConfig: types.RunConfig{
Expand Down

0 comments on commit 95e0dc0

Please sign in to comment.