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

fix: support multi level directory search mod #31

Closed
wants to merge 1 commit into from

Conversation

LiusCraft
Copy link

@LiusCraft LiusCraft commented Feb 20, 2024

bug: unable to find the go+project source file for breakpoint, the source file path is relative

The solution to the problem of not being able to locate the go.mod file in multi-level directories has been solved by searching for the go.mod file level by level upwards

@LiusCraft
Copy link
Author

@xushiwei PTAL

@@ -2296,9 +2315,7 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB

if cu.lineInfo != nil {
if imageMod == nil {
if mod, err := gopmod.Load(filepath.Dir(image.Path)); err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gopmod.Load already supports to lookup go.mod. does it have bug?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

work tree:
|cmd
|--gopcomm
|go.mod

command:
cmd/gopcomm: gopdlv debug main.gop

It will not find the go.mod file in the current directory

if mod, err := gopmod.Load(filepath.Dir(image.Path)); err == nil {
imageMod = mod
}
imageMod = getImageMod(image.Path)
Copy link
Member

@xushiwei xushiwei Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gopmod.Load use https://pkg.go.dev/github.com/goplus/mod#FindGoMod to lookup go.mod. has it bugs?

@LiusCraft LiusCraft closed this Mar 13, 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

Successfully merging this pull request may close these issues.

2 participants