-
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
delve: add ppc64le support #2963
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "textflag.h" | ||
|
||
TEXT ·asmFunc(SB),0,$0-16 | ||
MOVD arg+0(FP), R5 | ||
MOVD (R5), R5 | ||
MOVD R5, ret+8(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package regnum | ||
|
||
import "fmt" | ||
|
||
// The mapping between hardware registers and DWARF registers is specified | ||
// in the 64-Bit ELF V2 ABI Specification of the Power Architecture in section | ||
// 2.4 DWARF Definition | ||
// https://openpowerfoundation.org/specifications/64bitelfabi/ | ||
|
||
const ( | ||
alexsaezm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// General Purpose Registers: from R0 to R31 | ||
PPC64LE_FIRST_GPR = 0 | ||
PPC64LE_R0 = PPC64LE_FIRST_GPR | ||
PPC64LE_LAST_GPR = 31 | ||
// Floating point registers: from F0 to F31 | ||
PPC64LE_FIRST_FPR = 32 | ||
PPC64LE_F0 = PPC64LE_FIRST_FPR | ||
PPC64LE_LAST_FPR = 63 | ||
// Vector (Altivec/VMX) registers: from V0 to V31 | ||
PPC64LE_FIRST_VMX = 64 | ||
PPC64LE_V0 = PPC64LE_FIRST_VMX | ||
PPC64LE_LAST_VMX = 95 | ||
// Vector Scalar (VSX) registers: from VS0 to VS63 | ||
PPC64LE_FIRST_VSX = 96 | ||
PPC64LE_VS0 = PPC64LE_FIRST_VSX | ||
PPC64LE_LAST_VSX = 160 | ||
// Condition Registers: from CR0 to CR7 | ||
PPC64LE_CR0 = 0 | ||
// Special registers | ||
PPC64LE_SP = 1 // Stack frame pointer: Gpr[1] | ||
PPC64LE_PC = 12 // The documentation refers to this as the CIA (Current Instruction Address) | ||
PPC64LE_LR = 65 // Link register | ||
) | ||
|
||
func PPC64LEToName(num uint64) string { | ||
switch { | ||
case num == PPC64LE_SP: | ||
return "SP" | ||
case num == PPC64LE_PC: | ||
return "PC" | ||
case num == PPC64LE_LR: | ||
return "LR" | ||
case isGPR(num): | ||
return fmt.Sprintf("r%d", int(num-PPC64LE_FIRST_GPR)) | ||
case isFPR(num): | ||
return fmt.Sprintf("f%d", int(num-PPC64LE_FIRST_FPR)) | ||
case isVMX(num): | ||
return fmt.Sprintf("v%d", int(num-PPC64LE_FIRST_VMX)) | ||
case isVSX(num): | ||
return fmt.Sprintf("vs%d", int(num-PPC64LE_FIRST_VSX)) | ||
default: | ||
return fmt.Sprintf("unknown%d", num) | ||
} | ||
} | ||
|
||
// PPC64LEMaxRegNum is 172 registers in total, across 4 categories: | ||
// General Purpose Registers or GPR (32 GPR + 9 special registers) | ||
// Floating Point Registers or FPR (32 FPR + 1 special register) | ||
// Altivec/VMX Registers or VMX (32 VMX + 2 special registers) | ||
// VSX Registers or VSX (64 VSX) | ||
// Documentation: https://lldb.llvm.org/cpp_reference/RegisterContextPOSIX__ppc64le_8cpp_source.html | ||
func PPC64LEMaxRegNum() uint64 { | ||
return 172 | ||
} | ||
|
||
func isGPR(num uint64) bool { | ||
return num < PPC64LE_LAST_GPR | ||
} | ||
|
||
func isFPR(num uint64) bool { | ||
return num >= PPC64LE_FIRST_FPR && num <= PPC64LE_LAST_FPR | ||
} | ||
|
||
func isVMX(num uint64) bool { | ||
return num >= PPC64LE_FIRST_VMX && num <= PPC64LE_LAST_VMX | ||
} | ||
|
||
func isVSX(num uint64) bool { | ||
return num >= PPC64LE_FIRST_VSX && num <= PPC64LE_LAST_VSX | ||
} | ||
|
||
var PPC64LENameToDwarf = func() map[string]int { | ||
r := make(map[string]int) | ||
|
||
r["nip"] = PPC64LE_PC | ||
r["sp"] = PPC64LE_SP | ||
r["bp"] = PPC64LE_SP | ||
derekparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
r["link"] = PPC64LE_LR | ||
|
||
// General Purpose Registers: from R0 to R31 | ||
for i := 0; i <= 31; i++ { | ||
r[fmt.Sprintf("r%d", i)] = PPC64LE_R0 + i | ||
} | ||
|
||
// Floating point registers: from F0 to F31 | ||
for i := 0; i <= 31; i++ { | ||
r[fmt.Sprintf("f%d", i)] = PPC64LE_F0 + i | ||
} | ||
|
||
// Vector (Altivec/VMX) registers: from V0 to V31 | ||
for i := 0; i <= 31; i++ { | ||
r[fmt.Sprintf("v%d", i)] = PPC64LE_V0 + i | ||
} | ||
|
||
// Vector Scalar (VSX) registers: from VS0 to VS63 | ||
for i := 0; i <= 63; i++ { | ||
r[fmt.Sprintf("vs%d", i)] = PPC64LE_VS0 + i | ||
} | ||
|
||
// Condition Registers: from CR0 to CR7 | ||
for i := 0; i <= 7; i++ { | ||
r[fmt.Sprintf("cr%d", i)] = PPC64LE_CR0 + i | ||
} | ||
return r | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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's a bunch of test failures in CI, I think this might be what's causing them.
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 think it was the TestGeneratedDoc. It should be fix now
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 are right: this isn't even running currently in CI because other failures (TestStaticcheck) are causing the script to exit before this is even executed. However I don't think it's going to work. The
export GOARCH=ppc64le
makesgo run
produce a ppc64le binary for make.go, which won't run.I think the way to do this is to do
GOARCH=ppc64le go build -tags exp.linuxppc64le github.com/go-delve/delve/cmd/dlv
directly.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 tests now pass, this line however is never executed because of the exit above.