
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'.
65 lines
1.3 KiB
Go
65 lines
1.3 KiB
Go
package logflags
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
var debugger = false
|
|
var gdbWire = false
|
|
var lldbServerOutput = false
|
|
var suppressedErrors = false
|
|
var debugLineErrors = false
|
|
|
|
// GdbWire returns true if the gdbserial package should log all the packets
|
|
// exchanged with the stub.
|
|
func GdbWire() bool {
|
|
return gdbWire
|
|
}
|
|
|
|
// Debugger returns true if the debugger package should log.
|
|
func Debugger() bool {
|
|
return debugger
|
|
}
|
|
|
|
// LLDBServerOutput returns true if the output of the LLDB server should be
|
|
// redirected to standard output instead of suppressed.
|
|
func LLDBServerOutput() bool {
|
|
return lldbServerOutput
|
|
}
|
|
|
|
// DebugLineErrors returns true if pkg/dwarf/line should log its recoverable
|
|
// errors.
|
|
func DebugLineErrors() bool {
|
|
return debugLineErrors
|
|
}
|
|
|
|
var errLogstrWithoutLog = errors.New("--log-output specified without --log")
|
|
|
|
// Setup sets debugger flags based on the contents of logstr.
|
|
func Setup(log bool, logstr string) error {
|
|
if !log {
|
|
if logstr != "" {
|
|
return errLogstrWithoutLog
|
|
}
|
|
return nil
|
|
}
|
|
if logstr == "" {
|
|
logstr = "debugger"
|
|
}
|
|
v := strings.Split(logstr, ",")
|
|
for _, logcmd := range v {
|
|
switch logcmd {
|
|
case "debugger":
|
|
debugger = true
|
|
case "gdbwire":
|
|
gdbWire = true
|
|
case "lldbout":
|
|
lldbServerOutput = true
|
|
case "debuglineerr":
|
|
debugLineErrors = true
|
|
}
|
|
}
|
|
return nil
|
|
}
|