-
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
ARM64 call method which relative offset is out of range of CALL instruction. #3628
Comments
You can use step-instruction (si) three times. As for making delve do this, it looks complicated. |
The GoLand UI is not something we develop. |
I tried this, add three
err = grp.Continue()
if err != nil {
return err
}
if grp.Selected.Process.BinInfo().Arch.Name == "arm64" {
selg := grp.Selected.SelectedGoroutine()
curthread := grp.Selected.CurrentThread()
topframe, _, _ := topframe(grp.Selected, selg, curthread)
if topframe.Current.Fn != nil {
return nil
}
registers, _ := grp.Selected.currentThread.Registers()
pc := registers.PC()
mem := make([]byte, 12)
n, _ := grp.Selected.Process.Memory().ReadMemory(mem, pc)
if n == 12 {
i0 := binary.LittleEndian.Uint32(mem[0:])
i1 := binary.LittleEndian.Uint32(mem[4:])
i2 := binary.LittleEndian.Uint32(mem[8:])
i0ADRP := (i0 & 0b1_00_11111_0000000000000000000_00000) == 0b1_00_10000_0000000000000000000_00000
i1ADD := (i1 & 0b1001000100_000000000000_00000_00000) == 0b1001000100_000000000000_00000_00000
i2JMP := (i2 & 0b1101011000011111000000_0000011111) == 0b1101011000011111000000_00000_00000
if i0ADRP && i1ADD && i2JMP {
err = grp.StepInstruction()
if err != nil {
return err
}
err = grp.StepInstruction()
if err != nil {
return err
}
return grp.StepInstruction()
}
}
}
return err |
This is the wrong approach, it will break if a breakpoint is encountered during |
I check if Or I can add that code after if err = next(grp.Selected, true, false); err != nil {
selg := grp.Selected.SelectedGoroutine()
curthread := grp.Selected.CurrentThread()
topframe, _, _ := topframe(grp.Selected, selg, curthread)
if topframe.Current.Fn == nil && grp.Selected.Process.BinInfo().Arch.Name == "arm64" {
// ...
return err
}
_ = grp.Selected.ClearSteppingBreakpoints()
return err
} |
Make second
|
I see, is there any other way? |
ARM64
CALL
instruction (BL <label>
)So go compiler use another
JMP
instruction when calling method which relative offset is out of range of CALL instruction.Here is my own program debug session breaking on a method call.
Note that last CALL instruction.
Then I use step command, it will run to
0x11c0e72b0
and showno source available
.Then I disassemble
0x11c0e72b0
.Can Delve step into target method directly (or use another
s
Command) in this situation ?dlv version
)?go version
)?The text was updated successfully, but these errors were encountered: