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

Using the gopsutil package causes the goland debugger to not work properly (random jumps) #1602

Open
fushengbin opened this issue Mar 1, 2024 · 0 comments

Comments

@fushengbin
Copy link

fushengbin commented Mar 1, 2024

Describe the bug
程序很简单,在aa()调用的地方打断点,goland调试运行到aa()断点生效,点击步入,就会进入func aa()方法,点击步过,就会跳转到其他地方(经过排查就是因为gopsutil导致的,实在没找到解决办法),参见下面的截图:

The program is very simple. Break the point where aa() is called. Goland debugs and runs until the aa() breakpoint takes effect. Click Step to enter the func aa() method. Click Step to jump to other places. (After investigation, it was caused by gopsutil, and no solution was found). See the screenshot below:

image

To Reproduce

package main

import (
	"fmt"
	"github.com/shirou/gopsutil/process"
	"os"
)

func main(){
	pid := os.Getpid()

	p, err := process.NewProcess(int32(pid))
	if err != nil {
		fmt.Println(err)
	}
	_ = p
	aa()
}

func aa(){
	fmt.Println("test dlv")
}

Expected behavior
mac环境使用了gopsutil导致无法使用goland调试go程序,因为调试过程中跳转的代码位置不正确。

The mac environment uses gopsutil, which makes it impossible to use goland to debug go programs because the code location jumped during the debugging process is incorrect.

Environment (please complete the following information):
ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71

Darwin fushengbindeMacBook-Pro.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:10 PST 2023; root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64

Additional context
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/fushengbin/Library/Caches/go-build"
GOENV="/Users/fushengbin/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/fushengbin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/fushengbin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.19.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.19.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gf/bdfrq_nn62n1zgxg2pr3x1qr0000gn/T/go-build2919649744=/tmp/go-build -gno-record-gcc-switches -fno-common"

@Lomanic Lomanic changed the title 使用 gopsutil 包导致 goland 调试程序不能正常使用(乱跳转) Using the gopsutil package causes the goland debugger to not work properly (random jumps) #1602 Mar 2, 2024
@Lomanic Lomanic changed the title Using the gopsutil package causes the goland debugger to not work properly (random jumps) #1602 Using the gopsutil package causes the goland debugger to not work properly (random jumps) May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant