-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
support linux-loong64 native debug #3685
Conversation
The arch project hasn't been integrated into the upstream yet, so I duplicated it to the vendor and submitted it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just dumping a bunch of changes in vendor that don't exist upstream is unacceptable, the x/arch changes need to be merged there first.
PS. also see test failures. |
@ihuang77 any updates on this based on @aarzilli feedback? |
The x/arch has submitted a PR to support loong64, but it has not yet been merged into the upstream repository. I can provide machines running CI at any time. Thanks. |
That's cool, we'll have to wait for that PR to be merged for this. |
Looks like this has merged. Are you available to pick this work back up? |
Yes, the x/arch has been implemented and we are ready to update the Pr as soon as possible. We can also provide CI machines at any time. |
Hi @derekparker @derekparker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go get -u golang.org/x/arch@master --> go get -u golang.org/x/[email protected]
Thank you. I have completed that task and have created a new PR specifically for submitting the arch update. |
804124e
to
4cb37fa
Compare
Hi @aarzilli @derekparker
The machines are always ready. If possible, could you kindly provide the runners configured as needed? Thank you. |
You can download the agent from https://delve.teamcity.com/agents/overview (also note that there currently are test failures). |
|
Yes, see: https://www.jetbrains.com/help/teamcity/configure-agent-installation.html I have never installed an agent myself so I can not provide any specific guidance there. |
I read the instructions here, but there are no detailed steps. I still don't know how to deal with it. I configured serverUrl=https://delve.teamcity.com/app/dsl-plugins-repository and started the agent, but an error occurred. |
4bf8dcc
to
c9573df
Compare
@aarzilli @derekparker @abner-chenc I'm sorry that I haven't worked here for a long time because I've been working on other things recently. I modified the build and test failures today and pushed the code here. Please review the code when your time permits. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several merge conflicts.
} | ||
} | ||
|
||
func loong64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryInfo) *frame.FrameContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this function, and loong64SwitchStack I'd rather have them be empty than mindlessly copypasted from the amd64 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for patiently reviewing the code in this PR. Delve is a powerful, user-friendly, yet complex debugger. My knowledge in this area is relatively limited, and some parts of the implementation, such as loong64FixFrameUnwindContext
, are not done well. However, I will continue to deepen my understanding in this area and work to improve it as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You marked this comment as resolved but did nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified the loong64SwitchStack function.
The loong64FixFrameUnwindContext function is implemented with reference to arm64 and based on the LoongArch specific DWARF definition.
As I said before, delve is a complex and powerful debugging tool. Although I am working hard to learn its related knowledge, there are still some blind spots in my knowledge. I hope you can point out my mistakes more specifically and I will correct them in time. Thank you very much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is: why is there anything at all here? This function is about stack unwinding with cgo and with exceptions, I see that many (all?) tests relating to this piece of code are disabled so why is this here at all? Why is this function not just empty? Is there any code here that actually works?
The same goes for loong64SwitchStack
below. Is there anything besides the first if switch, in that function, that works? Can we delete all of it except the first if and the default branch of the first switch?
29ec15f
to
9a6f0f1
Compare
@aarzilli Can you please take another look at this patch? Thanks a lot. |
14e9755
to
1a72c85
Compare
Hi, @aarzilli Can this Pr be merged? When I use delve on different machines to debug Go programs on loong64 machines, I need to download this Pr to the local machine and compile it separately each time. I think if this Pr can be merged, I will have a better experience when using delve. Thanks |
} | ||
} | ||
|
||
func loong64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryInfo) *frame.FrameContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is: why is there anything at all here? This function is about stack unwinding with cgo and with exceptions, I see that many (all?) tests relating to this piece of code are disabled so why is this here at all? Why is this function not just empty? Is there any code here that actually works?
The same goes for loong64SwitchStack
below. Is there anything besides the first if switch, in that function, that works? Can we delete all of it except the first if and the default branch of the first switch?
pkg/proc/loong64_disasm.go
Outdated
@@ -0,0 +1,180 @@ | |||
// TODO: disassembler support should be compiled in unconditionally, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment.
@@ -372,7 +372,7 @@ func (dbp *nativeProcess) initialize(path string, debugInfoDirs []string) (*proc | |||
// with gdb once AsyncPreempt was enabled. While implementing the port, | |||
// few tests failed while it was enabled, but cannot be warrantied that | |||
// disabling it fixed the issues. | |||
DisableAsyncPreempt: runtime.GOOS == "windows" || (runtime.GOOS == "linux" && runtime.GOARCH == "arm64") || (runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le"), | |||
DisableAsyncPreempt: runtime.GOOS == "windows" || (runtime.GOOS == "linux" && runtime.GOARCH == "arm64") || (runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le") || (runtime.GOOS == "linux" && runtime.GOARCH == "loong64"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every other architecture has an explanation for why asyncpreempt is disabled in the preceding comment, loong64 should also do this. I imagine the reason is the same as linux/arm64.
pkg/proc/native/proc.go
Outdated
@@ -382,7 +382,7 @@ func (dbp *nativeProcess) initialize(path string, debugInfoDirs []string) (*proc | |||
if err != nil { | |||
return nil, err | |||
} | |||
if dbp.bi.Arch.Name == "arm64" || dbp.bi.Arch.Name == "ppc64le" || dbp.bi.Arch.Name == "riscv64" { | |||
if dbp.bi.Arch.Name == "arm64" || dbp.bi.Arch.Name == "ppc64le" || dbp.bi.Arch.Name == "riscv64" || dbp.bi.Arch.Name == "loong64"{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run gofmt
on the files you have changed.
LoongArch is a new RISC ISA, which is independently designed by Loongson Technology. LoongArch includes a reduced 32-bit version (LA32R), a standard 32-bit version (LA32S) and a 64-bit version (LA64), and loong64 is the 64-bit version of LoongArch. LoongArch documentation: https://github.com/loongson/LoongArch-Documentation.git
LoongArch is a new RISC ISA, which is independently designed by Loongson Technology.
LoongArch includes a reduced 32-bit version (LA32R), a standard 32-bit version (LA32S) and a 64-bit version (LA64), and loong64 is the 64-bit version of LoongArch.
LoongArch documentation: https://github.com/loongson/LoongArch-Documentation.git
Since version 1.19, golang upstream support for the LA architecture has been maintained.