Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Jun 21, 2024
1 parent 8d29d27 commit 4fb0f28
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/profiler/cpu/bpf/maps/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,8 @@ func (m *Maps) setLuaVMInfo(pid int, vmInfo *lua.Info) error {

luaInfo := luaperf.VMInfo{
CurrentLOffset: uint32(vmInfo.CurrentLOffset),
JITBaseOffset: uint32(vmInfo.JITBaseOffset)}
JITBaseOffset: uint32(vmInfo.JITBaseOffset),
}

buf := new(bytes.Buffer)
buf.Grow(int(unsafe.Sizeof(luaInfo)))
Expand Down
13 changes: 13 additions & 0 deletions pkg/profiler/luaperf/headers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2024 The Parca Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package luaperf

type VMInfo struct {
Expand Down
1 change: 0 additions & 1 deletion pkg/runtime/lua/lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type Info struct {
CurrentLOffset uint
JITBaseOffset uint
// yield??

}

func (i *Info) Type() runtime.UnwinderType {
Expand Down
13 changes: 13 additions & 0 deletions pkg/runtime/lua/offsets_arm.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2024 The Parca Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build arm64

package lua
Expand Down
18 changes: 15 additions & 3 deletions pkg/runtime/lua/offsets_x86.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2024 The Parca Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build amd64

package lua
Expand Down Expand Up @@ -72,7 +85,6 @@ which is a dynamic public symbol that should be all binaries of LuaJIT including
0x0000000000016e4d <+205>: jmp 0x16950
*/
func find_offsets(b []byte) (glref_offset, cur_L_offset int, err error) {

Check failure on line 87 in pkg/runtime/lua/offsets_x86.go

View workflow job for this annotation

GitHub Actions / Go Build

named return "glref_offset" with type "int" found (nonamedreturns)

// On statically linked binaries the function starts like this:
// (gdb) disass/r lua_close
// Dump of assembler code for function lua_close:
Expand Down Expand Up @@ -103,7 +115,7 @@ func find_offsets(b []byte) (glref_offset, cur_L_offset int, err error) {
cur_L_offset = int(a0.Disp)
break
}
//if Greg is dest error

if r0, ok := i.Args[0].(x86asm.Reg); ok && sameReg(r0, Greg) {
err = errors.New("parse error, register holding G was clobbered")
return

Check failure on line 121 in pkg/runtime/lua/offsets_x86.go

View workflow job for this annotation

GitHub Actions / Go Build

naked return in func `find_offsets` with 41 lines of code (nakedret)
Expand All @@ -116,7 +128,7 @@ func find_offsets(b []byte) (glref_offset, cur_L_offset int, err error) {
}

// If we're dealing with 32bit values compilers will use R or E prefix
// interchangably (E refs are just zero padded). Needed this for howl.
// interchangeably (E refs are just zero padded). Needed this for howl.
func sameReg(r1, r2 x86asm.Reg) bool {
if r1 == r2 {
return true
Expand Down

0 comments on commit 4fb0f28

Please sign in to comment.