mirror of
https://github.com/go-delve/delve.git
synced 2025-10-27 20:23:41 +08:00
proc,dwarf/line: support is_stmt and prologue_end flags
Go1.11 uses the is_stmt flag of .debug_line to communicate which assembly instructions are good places for breakpoints, we should respect this flag. These changes were introduced by: * https://go-review.googlesource.com/c/go/+/102435/ Additionally when setting next breakpoints ignore all PC addresses that belong to the same line as the one currently under at the cursor. This matches the behavior of gdb and avoids stopping multiple times at the heading line of a for statement with go1.11. Change: https://go-review.googlesource.com/c/go/+/110416 adds the prologue_end flag to the .debug_line section to communicate the end of the stack-split prologue. We should use it instead of pattern matching the disassembly when available. Fixes #550 type of interfaces 'c7cde8b'.
This commit is contained in:
@ -55,10 +55,14 @@ func grabDebugLineSection(p string, t *testing.T) []byte {
|
||||
}
|
||||
|
||||
const (
|
||||
lineBaseGo14 int8 = -1
|
||||
lineBaseGo18 int8 = -4
|
||||
lineRangeGo14 uint8 = 4
|
||||
lineRangeGo18 uint8 = 10
|
||||
lineBaseGo14 int8 = -1
|
||||
lineBaseGo18 int8 = -4
|
||||
lineRangeGo14 uint8 = 4
|
||||
lineRangeGo18 uint8 = 10
|
||||
versionGo14 uint16 = 2
|
||||
versionGo111 uint16 = 3
|
||||
opcodeBaseGo14 uint8 = 10
|
||||
opcodeBaseGo111 uint8 = 11
|
||||
)
|
||||
|
||||
func testDebugLinePrologueParser(p string, t *testing.T) {
|
||||
@ -70,7 +74,7 @@ func testDebugLinePrologueParser(p string, t *testing.T) {
|
||||
for _, dbl := range debugLines {
|
||||
prologue := dbl.Prologue
|
||||
|
||||
if prologue.Version != uint16(2) {
|
||||
if prologue.Version != versionGo14 && prologue.Version != versionGo111 {
|
||||
t.Fatal("Version not parsed correctly", prologue.Version)
|
||||
}
|
||||
|
||||
@ -94,11 +98,11 @@ func testDebugLinePrologueParser(p string, t *testing.T) {
|
||||
t.Fatal("Line Range not parsed correctly", prologue.LineRange)
|
||||
}
|
||||
|
||||
if prologue.OpcodeBase != uint8(10) {
|
||||
if prologue.OpcodeBase != opcodeBaseGo14 && prologue.OpcodeBase != opcodeBaseGo111 {
|
||||
t.Fatal("Opcode Base not parsed correctly", prologue.OpcodeBase)
|
||||
}
|
||||
|
||||
lengths := []uint8{0, 1, 1, 1, 1, 0, 0, 0, 1}
|
||||
lengths := []uint8{0, 1, 1, 1, 1, 0, 0, 0, 1, 0}
|
||||
for i, l := range prologue.StdOpLengths {
|
||||
if l != lengths[i] {
|
||||
t.Fatal("Length not parsed correctly", l)
|
||||
|
||||
Reference in New Issue
Block a user