Comments (8)
You can use step-instruction (si) three times. As for making delve do this, it looks complicated.
from delve.
I use plugin for GoLand, and do not have step-instruction (si) command.
from delve.
The GoLand UI is not something we develop.
from delve.
I tried this, add three StepInstruction
after Step
when next three instructions is ADRP
ADD
JMP
. It seems ok.
pkg/proc/target_exec.go
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
from delve.
This is the wrong approach, it will break if a breakpoint is encountered during step
, or a manual stop, or the process exit, or if the three instructions happen to be ADRP+ADD+JMP but they aren't a trampoline for a CALL instruction.
from delve.
I check if topframe.Current.Fn == nil
.
Or I can add that code after s
command failed.
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
}
from delve.
Make second s
command ok.
(dlv) s
Stopped at: 0x11c0e72b0
=> 1: no source available
(dlv) s // !!! this !!!
Stopped at: 0x11c0e72b0
=> 1: no source available
Command failed: no source for PC 0x11c0e72b0
from delve.
This is the wrong approach, it will break if a breakpoint is encountered during
step
, or a manual stop, or the process exit, or if the three instructions happen to be ADRP+ADD+JMP but they aren't a trampoline for a CALL instruction.
I see, is there any other way?
from delve.
Related Issues (20)
- panic when data length is greater than memCache size
- Unable to find escape variables when using Delve HOT 7
- Fail to set watchpoint after clearing one of four HOT 3
- Dwarf parsing infinite loop causes OOM HOT 1
- Feature request: restart the current function HOT 6
- Seeing a warning that delve is too old for the latest Go version 1.22.5 HOT 1
- align the output of vars with 'expresson' spec
- Delve Fails to Locate Source Files Across All Projects on Apple M1 Pro (macOS) with "no source available" Error HOT 1
- Improper string representation of Google uuid.UUID type HOT 1
- Inconsistent go and delve expression results
- DW_FORM_strx with no .debug_str_offsets section HOT 23
- starlark: named constant values of derived integer types always get converted to 0
- MacOS M3 could not launch process: stub exited while waiting for connection: exit status 0 HOT 2
- 'Locals' subcommand panic when executed in range-over-func body frame HOT 4
- Navigating the stack in a coredump resulting from a stack overflow is slow HOT 5
- Xcode 16 tool chain (associated with macOS 15) appears to break delve ability to access debug data. HOT 2
- Can't debugging on macOS Sequoia HOT 12
- Can't debugging on macOS Sequoia with intel mac HOT 2
- Support request - Unix socket support when running as DAP Client HOT 2
- Adding Telemetry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delve.