mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 09:46:56 +08:00
pkg/proc: simplify code with trivial changes (#3436)
This commit is contained in:
@ -100,10 +100,10 @@ func threadsFromDelveNotes(p *process, notes []*note) (proc.Thread, error) {
|
|||||||
readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind)
|
readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
buf := make([]byte, len)
|
|
||||||
if readerr != nil {
|
if readerr != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
buf := make([]byte, len)
|
||||||
_, readerr = body.Read(buf)
|
_, readerr = body.Read(buf)
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1286,7 +1286,7 @@ func (conn *gdbConn) exec(cmd []byte, context string) ([]byte, error) {
|
|||||||
return conn.recv(cmd, context, false)
|
return conn.recv(cmd, context, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hexdigit = []byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
|
const hexdigit = "0123456789abcdef"
|
||||||
|
|
||||||
func (conn *gdbConn) send(cmd []byte) error {
|
func (conn *gdbConn) send(cmd []byte) error {
|
||||||
if len(cmd) == 0 || cmd[0] != '$' {
|
if len(cmd) == 0 || cmd[0] != '$' {
|
||||||
@ -1344,9 +1344,11 @@ func (conn *gdbConn) recv(cmd []byte, context string, binary bool) (resp []byte,
|
|||||||
if logflags.GdbWire() {
|
if logflags.GdbWire() {
|
||||||
out := resp
|
out := resp
|
||||||
partial := false
|
partial := false
|
||||||
if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 && !binary {
|
if !binary {
|
||||||
out = resp[:idx]
|
if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 {
|
||||||
partial = true
|
out = resp[:idx]
|
||||||
|
partial = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(out) > gdbWireMaxLen {
|
if len(out) > gdbWireMaxLen {
|
||||||
out = out[:gdbWireMaxLen]
|
out = out[:gdbWireMaxLen]
|
||||||
|
|||||||
Reference in New Issue
Block a user