pkg,service: remove unnecessary convertions (#3564)
This commit is contained in:
parent
e6fdc1052a
commit
938cb6e9d8
@ -167,8 +167,8 @@ func (b *Builder) Attr(attr dwarf.Attr, val interface{}) dwarf.Offset {
|
|||||||
binary.Write(&b.loc, binary.LittleEndian, uint64(0))
|
binary.Write(&b.loc, binary.LittleEndian, uint64(0))
|
||||||
|
|
||||||
for _, locentry := range x {
|
for _, locentry := range x {
|
||||||
binary.Write(&b.loc, binary.LittleEndian, uint64(locentry.Lowpc))
|
binary.Write(&b.loc, binary.LittleEndian, locentry.Lowpc)
|
||||||
binary.Write(&b.loc, binary.LittleEndian, uint64(locentry.Highpc))
|
binary.Write(&b.loc, binary.LittleEndian, locentry.Highpc)
|
||||||
binary.Write(&b.loc, binary.LittleEndian, uint16(len(locentry.Loc)))
|
binary.Write(&b.loc, binary.LittleEndian, uint16(len(locentry.Loc)))
|
||||||
b.loc.Write(locentry.Loc)
|
b.loc.Write(locentry.Loc)
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ func DecodeSigned(buf Reader) (int64, uint32) {
|
|||||||
}
|
}
|
||||||
length++
|
length++
|
||||||
|
|
||||||
result |= int64((int64(b) & 0x7f) << shift)
|
result |= (int64(b) & 0x7f) << shift
|
||||||
shift += 7
|
shift += 7
|
||||||
if b&0x80 == 0 {
|
if b&0x80 == 0 {
|
||||||
break
|
break
|
||||||
|
@ -132,16 +132,16 @@ func parseDebugLinePrologue(dbl *DebugLineInfo, buf *bytes.Buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.Length = binary.LittleEndian.Uint32(buf.Next(4))
|
p.Length = binary.LittleEndian.Uint32(buf.Next(4))
|
||||||
p.MinInstrLength = uint8(buf.Next(1)[0])
|
p.MinInstrLength = buf.Next(1)[0]
|
||||||
if p.Version >= 4 {
|
if p.Version >= 4 {
|
||||||
p.MaxOpPerInstr = uint8(buf.Next(1)[0])
|
p.MaxOpPerInstr = buf.Next(1)[0]
|
||||||
} else {
|
} else {
|
||||||
p.MaxOpPerInstr = 1
|
p.MaxOpPerInstr = 1
|
||||||
}
|
}
|
||||||
p.InitialIsStmt = uint8(buf.Next(1)[0])
|
p.InitialIsStmt = buf.Next(1)[0]
|
||||||
p.LineBase = int8(buf.Next(1)[0])
|
p.LineBase = int8(buf.Next(1)[0])
|
||||||
p.LineRange = uint8(buf.Next(1)[0])
|
p.LineRange = buf.Next(1)[0]
|
||||||
p.OpcodeBase = uint8(buf.Next(1)[0])
|
p.OpcodeBase = buf.Next(1)[0]
|
||||||
|
|
||||||
p.StdOpLengths = make([]uint8, p.OpcodeBase-1)
|
p.StdOpLengths = make([]uint8, p.OpcodeBase-1)
|
||||||
binary.Read(buf, binary.LittleEndian, &p.StdOpLengths)
|
binary.Read(buf, binary.LittleEndian, &p.StdOpLengths)
|
||||||
|
@ -423,7 +423,7 @@ func (sm *StateMachine) next() error {
|
|||||||
|
|
||||||
func execSpecialOpcode(sm *StateMachine, instr byte) {
|
func execSpecialOpcode(sm *StateMachine, instr byte) {
|
||||||
var (
|
var (
|
||||||
opcode = uint8(instr)
|
opcode = instr
|
||||||
decoded = opcode - sm.dbl.Prologue.OpcodeBase
|
decoded = opcode - sm.dbl.Prologue.OpcodeBase
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ func (rdr *Dwarf2Reader) oneAddr() uint64 {
|
|||||||
}
|
}
|
||||||
return uint64(addr)
|
return uint64(addr)
|
||||||
case 8:
|
case 8:
|
||||||
addr := uint64(binary.LittleEndian.Uint64(rdr.read(rdr.ptrSz)))
|
addr := binary.LittleEndian.Uint64(rdr.read(rdr.ptrSz))
|
||||||
return addr
|
return addr
|
||||||
default:
|
default:
|
||||||
panic("bad address size")
|
panic("bad address size")
|
||||||
|
@ -208,7 +208,7 @@ func callframecfa(opcode Opcode, ctxt *context) error {
|
|||||||
if ctxt.CFA == 0 {
|
if ctxt.CFA == 0 {
|
||||||
return errors.New("could not retrieve CFA for current PC")
|
return errors.New("could not retrieve CFA for current PC")
|
||||||
}
|
}
|
||||||
ctxt.stack = append(ctxt.stack, int64(ctxt.CFA))
|
ctxt.stack = append(ctxt.stack, ctxt.CFA)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ func pick(opcode Opcode, ctxt *context) error {
|
|||||||
default:
|
default:
|
||||||
panic("internal error")
|
panic("internal error")
|
||||||
}
|
}
|
||||||
idx := len(ctxt.stack) - 1 - int(uint8(n))
|
idx := len(ctxt.stack) - 1 - int(n)
|
||||||
if idx < 0 || idx >= len(ctxt.stack) {
|
if idx < 0 || idx >= len(ctxt.stack) {
|
||||||
return ErrStackIndexOutOfBounds
|
return ErrStackIndexOutOfBounds
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ func New(w WriteCloserSeeker, fhdr *elf.FileHeader) *Writer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// e_ident
|
// e_ident
|
||||||
r.Write([]byte{0x7f, 'E', 'L', 'F', byte(fhdr.Class), byte(fhdr.Data), byte(fhdr.Version), byte(fhdr.OSABI), byte(fhdr.ABIVersion), 0, 0, 0, 0, 0, 0, 0})
|
r.Write([]byte{0x7f, 'E', 'L', 'F', byte(fhdr.Class), byte(fhdr.Data), byte(fhdr.Version), byte(fhdr.OSABI), fhdr.ABIVersion, 0, 0, 0, 0, 0, 0, 0})
|
||||||
|
|
||||||
r.u16(uint16(fhdr.Type)) // e_type
|
r.u16(uint16(fhdr.Type)) // e_type
|
||||||
r.u16(uint16(fhdr.Machine)) // e_machine
|
r.u16(uint16(fhdr.Machine)) // e_machine
|
||||||
|
@ -311,7 +311,7 @@ func (loc *AddrLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalSc
|
|||||||
addr, _ := constant.Uint64Val(v.Value)
|
addr, _ := constant.Uint64Val(v.Value)
|
||||||
return []api.Location{{PC: addr}}, "", nil
|
return []api.Location{{PC: addr}}, "", nil
|
||||||
case reflect.Func:
|
case reflect.Func:
|
||||||
fn := scope.BinInfo.PCToFunc(uint64(v.Base))
|
fn := scope.BinInfo.PCToFunc(v.Base)
|
||||||
pc, err := proc.FirstPCAfterPrologue(t, fn, false)
|
pc, err := proc.FirstPCAfterPrologue(t, fn, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
|
@ -150,7 +150,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {
|
|||||||
// switches from the goroutine stack to the system stack.
|
// switches from the goroutine stack to the system stack.
|
||||||
// Since we are unwinding the stack from callee to caller we have to switch
|
// Since we are unwinding the stack from callee to caller we have to switch
|
||||||
// from the system stack to the goroutine stack.
|
// from the system stack to the goroutine stack.
|
||||||
off, _ := readIntRaw(it.mem, uint64(it.regs.SP()+amd64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) // reads "offset of SP from StackHi" from where runtime.asmcgocall saved it
|
off, _ := readIntRaw(it.mem, it.regs.SP()+amd64cgocallSPOffsetSaveSlot, int64(it.bi.Arch.PtrSize())) // reads "offset of SP from StackHi" from where runtime.asmcgocall saved it
|
||||||
oldsp := it.regs.SP()
|
oldsp := it.regs.SP()
|
||||||
it.regs.Reg(it.regs.SPRegNum).Uint64Val = uint64(int64(it.stackhi) - off)
|
it.regs.Reg(it.regs.SPRegNum).Uint64Val = uint64(int64(it.stackhi) - off)
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {
|
|||||||
// entering the system stack
|
// entering the system stack
|
||||||
it.regs.Reg(it.regs.SPRegNum).Uint64Val = it.g0_sched_sp
|
it.regs.Reg(it.regs.SPRegNum).Uint64Val = it.g0_sched_sp
|
||||||
// reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack
|
// reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack
|
||||||
it.g0_sched_sp, _ = readUintRaw(it.mem, uint64(it.regs.SP()), int64(it.bi.Arch.PtrSize()))
|
it.g0_sched_sp, _ = readUintRaw(it.mem, it.regs.SP(), int64(it.bi.Arch.PtrSize()))
|
||||||
it.top = false
|
it.top = false
|
||||||
callFrameRegs, ret, retaddr := it.advanceRegs()
|
callFrameRegs, ret, retaddr := it.advanceRegs()
|
||||||
frameOnSystemStack := it.newStackframe(ret, retaddr)
|
frameOnSystemStack := it.newStackframe(ret, retaddr)
|
||||||
@ -409,7 +409,7 @@ func formatX87Reg(b []byte) string {
|
|||||||
return fmt.Sprintf("%#x", b)
|
return fmt.Sprintf("%#x", b)
|
||||||
}
|
}
|
||||||
mantissa := binary.LittleEndian.Uint64(b[:8])
|
mantissa := binary.LittleEndian.Uint64(b[:8])
|
||||||
exponent := uint16(binary.LittleEndian.Uint16(b[8:]))
|
exponent := binary.LittleEndian.Uint16(b[8:])
|
||||||
|
|
||||||
var f float64
|
var f float64
|
||||||
fset := false
|
fset := false
|
||||||
|
@ -174,7 +174,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
|||||||
// Entering the system stack.
|
// Entering the system stack.
|
||||||
it.regs.Reg(callFrameRegs.SPRegNum).Uint64Val = it.g0_sched_sp
|
it.regs.Reg(callFrameRegs.SPRegNum).Uint64Val = it.g0_sched_sp
|
||||||
// Reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack.
|
// Reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack.
|
||||||
it.g0_sched_sp, _ = readUintRaw(it.mem, uint64(it.regs.SP()+prevG0schedSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize()))
|
it.g0_sched_sp, _ = readUintRaw(it.mem, it.regs.SP()+prevG0schedSPOffsetSaveSlot, int64(it.bi.Arch.PtrSize()))
|
||||||
it.top = false
|
it.top = false
|
||||||
callFrameRegs, ret, retaddr := it.advanceRegs()
|
callFrameRegs, ret, retaddr := it.advanceRegs()
|
||||||
frameOnSystemStack := it.newStackframe(ret, retaddr)
|
frameOnSystemStack := it.newStackframe(ret, retaddr)
|
||||||
@ -195,7 +195,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
|||||||
// switches from the goroutine stack to the system stack.
|
// switches from the goroutine stack to the system stack.
|
||||||
// Since we are unwinding the stack from callee to caller we have to switch
|
// Since we are unwinding the stack from callee to caller we have to switch
|
||||||
// from the system stack to the goroutine stack.
|
// from the system stack to the goroutine stack.
|
||||||
off, _ := readIntRaw(it.mem, uint64(it.regs.SP()+arm64cgocallSPOffsetSaveSlot),
|
off, _ := readIntRaw(it.mem, it.regs.SP()+arm64cgocallSPOffsetSaveSlot,
|
||||||
int64(it.bi.Arch.PtrSize()))
|
int64(it.bi.Arch.PtrSize()))
|
||||||
oldsp := it.regs.SP()
|
oldsp := it.regs.SP()
|
||||||
newsp := uint64(int64(it.stackhi) - off)
|
newsp := uint64(int64(it.stackhi) - off)
|
||||||
@ -239,20 +239,20 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
|||||||
bpoff = 22
|
bpoff = 22
|
||||||
lroff = 23
|
lroff = 23
|
||||||
}
|
}
|
||||||
newsp, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*24), int64(it.bi.Arch.PtrSize()))
|
newsp, _ := readUintRaw(it.mem, it.regs.SP()+8*24, int64(it.bi.Arch.PtrSize()))
|
||||||
newbp, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*bpoff), int64(it.bi.Arch.PtrSize()))
|
newbp, _ := readUintRaw(it.mem, it.regs.SP()+8*bpoff, int64(it.bi.Arch.PtrSize()))
|
||||||
newlr, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*lroff), int64(it.bi.Arch.PtrSize()))
|
newlr, _ := readUintRaw(it.mem, it.regs.SP()+8*lroff, int64(it.bi.Arch.PtrSize()))
|
||||||
if it.regs.Reg(it.regs.BPRegNum) != nil {
|
if it.regs.Reg(it.regs.BPRegNum) != nil {
|
||||||
it.regs.Reg(it.regs.BPRegNum).Uint64Val = uint64(newbp)
|
it.regs.Reg(it.regs.BPRegNum).Uint64Val = newbp
|
||||||
} else {
|
} else {
|
||||||
reg, _ := it.readRegisterAt(it.regs.BPRegNum, it.regs.SP()+8*bpoff)
|
reg, _ := it.readRegisterAt(it.regs.BPRegNum, it.regs.SP()+8*bpoff)
|
||||||
it.regs.AddReg(it.regs.BPRegNum, reg)
|
it.regs.AddReg(it.regs.BPRegNum, reg)
|
||||||
}
|
}
|
||||||
it.regs.Reg(it.regs.LRRegNum).Uint64Val = uint64(newlr)
|
it.regs.Reg(it.regs.LRRegNum).Uint64Val = newlr
|
||||||
if linux {
|
if linux {
|
||||||
it.regs.Reg(it.regs.SPRegNum).Uint64Val = uint64(newbp)
|
it.regs.Reg(it.regs.SPRegNum).Uint64Val = newbp
|
||||||
} else {
|
} else {
|
||||||
it.regs.Reg(it.regs.SPRegNum).Uint64Val = uint64(newsp)
|
it.regs.Reg(it.regs.SPRegNum).Uint64Val = newsp
|
||||||
}
|
}
|
||||||
it.pc = newlr
|
it.pc = newlr
|
||||||
return true
|
return true
|
||||||
@ -299,7 +299,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
|||||||
// switches from the goroutine stack to the system stack.
|
// switches from the goroutine stack to the system stack.
|
||||||
// Since we are unwinding the stack from callee to caller we have to switch
|
// Since we are unwinding the stack from callee to caller we have to switch
|
||||||
// from the system stack to the goroutine stack.
|
// from the system stack to the goroutine stack.
|
||||||
off, _ := readIntRaw(it.mem, uint64(callFrameRegs.SP()+arm64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize()))
|
off, _ := readIntRaw(it.mem, callFrameRegs.SP()+arm64cgocallSPOffsetSaveSlot, int64(it.bi.Arch.PtrSize()))
|
||||||
oldsp := callFrameRegs.SP()
|
oldsp := callFrameRegs.SP()
|
||||||
newsp := uint64(int64(it.stackhi) - off)
|
newsp := uint64(int64(it.stackhi) - off)
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
|||||||
callFrameRegs.Reg(callFrameRegs.SPRegNum).Uint64Val = it.g0_sched_sp
|
callFrameRegs.Reg(callFrameRegs.SPRegNum).Uint64Val = it.g0_sched_sp
|
||||||
// reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack
|
// reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack
|
||||||
|
|
||||||
it.g0_sched_sp, _ = readUintRaw(it.mem, uint64(callFrameRegs.SP()+prevG0schedSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize()))
|
it.g0_sched_sp, _ = readUintRaw(it.mem, callFrameRegs.SP()+prevG0schedSPOffsetSaveSlot, int64(it.bi.Arch.PtrSize()))
|
||||||
it.systemstack = true
|
it.systemstack = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func resolveCallArgARM64(inst *arm64asm.Inst, instAddr uint64, currentGoroutine
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case arm64asm.PCRel:
|
case arm64asm.PCRel:
|
||||||
pc = uint64(instAddr) + uint64(arg)
|
pc = instAddr + uint64(arg)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -914,7 +914,7 @@ func (bi *BinaryInfo) AddImage(path string, addr uint64) error {
|
|||||||
|
|
||||||
// moduleDataToImage finds the image corresponding to the given module data object.
|
// moduleDataToImage finds the image corresponding to the given module data object.
|
||||||
func (bi *BinaryInfo) moduleDataToImage(md *moduleData) *Image {
|
func (bi *BinaryInfo) moduleDataToImage(md *moduleData) *Image {
|
||||||
fn := bi.PCToFunc(uint64(md.text))
|
fn := bi.PCToFunc(md.text)
|
||||||
if fn != nil {
|
if fn != nil {
|
||||||
return bi.funcToImage(fn)
|
return bi.funcToImage(fn)
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ func (t *Target) setBreakpointInternal(logicalID int, addr uint64, kind Breakpoi
|
|||||||
return bp, nil
|
return bp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
f, l, fn := t.BinInfo().PCToLine(uint64(addr))
|
f, l, fn := t.BinInfo().PCToLine(addr)
|
||||||
|
|
||||||
fnName := ""
|
fnName := ""
|
||||||
if fn != nil {
|
if fn != nil {
|
||||||
|
@ -340,7 +340,7 @@ func (t *thread) Breakpoint() *proc.BreakpointState {
|
|||||||
|
|
||||||
// ThreadID returns the ID for this thread.
|
// ThreadID returns the ID for this thread.
|
||||||
func (t *thread) ThreadID() int {
|
func (t *thread) ThreadID() int {
|
||||||
return int(t.th.pid())
|
return t.th.pid()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registers returns the current value of the registers for this thread.
|
// Registers returns the current value of the registers for this thread.
|
||||||
|
@ -186,10 +186,10 @@ func (m *MemoryRange) ReadMemory(buf []byte, addr uint64) (int, error) {
|
|||||||
if len(buf) == 0 {
|
if len(buf) == 0 {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
if (uint64(addr) < m.Addr) || (uint64(addr)+uint64(len(buf)) > m.Addr+uint64(len(m.Data))) {
|
if (addr < m.Addr) || (addr+uint64(len(buf)) > m.Addr+uint64(len(m.Data))) {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
copy(buf, m.Data[uint64(addr)-m.Addr:])
|
copy(buf, m.Data[addr-m.Addr:])
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ func disassemble(memrw MemoryReadWriter, regs Registers, breakpoints *Breakpoint
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
r := make([]AsmInstruction, 0, len(mem)/int(bi.Arch.MaxInstructionLength()))
|
r := make([]AsmInstruction, 0, len(mem)/bi.Arch.MaxInstructionLength())
|
||||||
pc := startAddr
|
pc := startAddr
|
||||||
|
|
||||||
var curpc uint64
|
var curpc uint64
|
||||||
|
@ -65,10 +65,10 @@ func newFakeMemory(base uint64, contents ...interface{}) *fakeMemory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mem *fakeMemory) ReadMemory(data []byte, addr uint64) (int, error) {
|
func (mem *fakeMemory) ReadMemory(data []byte, addr uint64) (int, error) {
|
||||||
if uint64(addr) < mem.base {
|
if addr < mem.base {
|
||||||
return 0, fmt.Errorf("read out of bounds %d %#x", len(data), addr)
|
return 0, fmt.Errorf("read out of bounds %d %#x", len(data), addr)
|
||||||
}
|
}
|
||||||
start := uint64(addr) - mem.base
|
start := addr - mem.base
|
||||||
end := uint64(len(data)) + start
|
end := uint64(len(data)) + start
|
||||||
if end > uint64(len(mem.data)) {
|
if end > uint64(len(mem.data)) {
|
||||||
panic(fmt.Errorf("read out of bounds %d %#x", len(data), addr))
|
panic(fmt.Errorf("read out of bounds %d %#x", len(data), addr))
|
||||||
@ -78,10 +78,10 @@ func (mem *fakeMemory) ReadMemory(data []byte, addr uint64) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mem *fakeMemory) WriteMemory(addr uint64, data []byte) (int, error) {
|
func (mem *fakeMemory) WriteMemory(addr uint64, data []byte) (int, error) {
|
||||||
if uint64(addr) < mem.base {
|
if addr < mem.base {
|
||||||
return 0, fmt.Errorf("write out of bounds %d %#x", len(data), addr)
|
return 0, fmt.Errorf("write out of bounds %d %#x", len(data), addr)
|
||||||
}
|
}
|
||||||
start := uint64(addr) - mem.base
|
start := addr - mem.base
|
||||||
end := uint64(len(data)) + start
|
end := uint64(len(data)) + start
|
||||||
if end > uint64(len(mem.data)) {
|
if end > uint64(len(mem.data)) {
|
||||||
panic(fmt.Errorf("write out of bounds %d %#x", len(data), addr))
|
panic(fmt.Errorf("write out of bounds %d %#x", len(data), addr))
|
||||||
@ -217,7 +217,7 @@ func TestDwarfExprComposite(t *testing.T) {
|
|||||||
|
|
||||||
mainfn := bi.LookupFunc()["main.main"][0]
|
mainfn := bi.LookupFunc()["main.main"][0]
|
||||||
|
|
||||||
mem := newFakeMemory(fakeCFA(), uint64(0), uint64(0), uint16(testCases["pair.v"]), []byte(stringVal))
|
mem := newFakeMemory(fakeCFA(), uint64(0), uint64(0), testCases["pair.v"], []byte(stringVal))
|
||||||
var regs linutil.AMD64Registers
|
var regs linutil.AMD64Registers
|
||||||
regs.Regs = &linutil.AMD64PtraceRegs{}
|
regs.Regs = &linutil.AMD64PtraceRegs{}
|
||||||
regs.Regs.Rax = uint64(len(stringVal))
|
regs.Regs.Rax = uint64(len(stringVal))
|
||||||
|
@ -553,7 +553,7 @@ func (scope *EvalScope) setValue(dstv, srcv *Variable, srcExpr string) error {
|
|||||||
if srcv.Base == 0 && srcv.Len > 0 && srcv.Flags&VariableConstant != 0 {
|
if srcv.Base == 0 && srcv.Len > 0 && srcv.Flags&VariableConstant != 0 {
|
||||||
return errFuncCallNotAllowedStrAlloc
|
return errFuncCallNotAllowedStrAlloc
|
||||||
}
|
}
|
||||||
return dstv.writeString(uint64(srcv.Len), uint64(srcv.Base))
|
return dstv.writeString(uint64(srcv.Len), srcv.Base)
|
||||||
}
|
}
|
||||||
|
|
||||||
// slice assignment (this is not handled by the writeCopy below so that
|
// slice assignment (this is not handled by the writeCopy below so that
|
||||||
@ -564,7 +564,7 @@ func (scope *EvalScope) setValue(dstv, srcv *Variable, srcExpr string) error {
|
|||||||
|
|
||||||
// allow any integer to be converted to any pointer
|
// allow any integer to be converted to any pointer
|
||||||
if t, isptr := dstv.RealType.(*godwarf.PtrType); isptr {
|
if t, isptr := dstv.RealType.(*godwarf.PtrType); isptr {
|
||||||
return dstv.writeUint(uint64(srcv.Children[0].Addr), int64(t.ByteSize))
|
return dstv.writeUint(srcv.Children[0].Addr, t.ByteSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// byte-by-byte copying for everything else, but the source must be addressable
|
// byte-by-byte copying for everything else, but the source must be addressable
|
||||||
@ -1251,7 +1251,7 @@ func (scope *EvalScope) evalTypeCast(op *evalop.TypeCast, stack *evalStack) {
|
|||||||
stack.push(v)
|
stack.push(v)
|
||||||
return
|
return
|
||||||
case reflect.Ptr:
|
case reflect.Ptr:
|
||||||
v.Value = constant.MakeUint64(uint64(argv.Children[0].Addr))
|
v.Value = constant.MakeUint64(argv.Children[0].Addr)
|
||||||
stack.push(v)
|
stack.push(v)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2552,7 +2552,7 @@ func (v *Variable) reslice(low int64, high int64) (*Variable, error) {
|
|||||||
return nil, fmt.Errorf("index out of bounds")
|
return nil, fmt.Errorf("index out of bounds")
|
||||||
}
|
}
|
||||||
|
|
||||||
base := v.Base + uint64(int64(low)*v.stride)
|
base := v.Base + uint64(low*v.stride)
|
||||||
len := high - low
|
len := high - low
|
||||||
|
|
||||||
if high-low < 0 {
|
if high-low < 0 {
|
||||||
|
@ -483,7 +483,7 @@ func funcCallEvalFuncExpr(scope *EvalScope, stack *evalStack, fncall *functionCa
|
|||||||
if fnvar.Base == 0 {
|
if fnvar.Base == 0 {
|
||||||
return errors.New("nil pointer dereference")
|
return errors.New("nil pointer dereference")
|
||||||
}
|
}
|
||||||
fncall.fn = bi.PCToFunc(uint64(fnvar.Base))
|
fncall.fn = bi.PCToFunc(fnvar.Base)
|
||||||
if fncall.fn == nil {
|
if fncall.fn == nil {
|
||||||
return fmt.Errorf("could not find DIE for function %q", exprToString(fncall.expr.Fun))
|
return fmt.Errorf("could not find DIE for function %q", exprToString(fncall.expr.Fun))
|
||||||
}
|
}
|
||||||
@ -558,7 +558,7 @@ func funcCallCopyOneArg(scope *EvalScope, fncall *functionCallState, actualArg *
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
formalArgVar = newVariable(formalArg.name, uint64(formalArg.off+int64(formalScope.Regs.CFA)), formalArg.typ, scope.BinInfo, scope.Mem)
|
formalArgVar = newVariable(formalArg.name, uint64(formalArg.off+formalScope.Regs.CFA), formalArg.typ, scope.BinInfo, scope.Mem)
|
||||||
}
|
}
|
||||||
if err := scope.setValue(formalArgVar, actualArg, actualArg.Name); err != nil {
|
if err := scope.setValue(formalArgVar, actualArg, actualArg.Name); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -684,7 +684,7 @@ func funcCallArgRegABI(fn *Function, bi *BinaryInfo, entry reader.Variable, argn
|
|||||||
|
|
||||||
// alignAddr rounds up addr to a multiple of align. Align must be a power of 2.
|
// alignAddr rounds up addr to a multiple of align. Align must be a power of 2.
|
||||||
func alignAddr(addr, align int64) int64 {
|
func alignAddr(addr, align int64) int64 {
|
||||||
return (addr + int64(align-1)) &^ int64(align-1)
|
return (addr + align - 1) &^ (align - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func escapeCheck(v *Variable, name string, stack stack) error {
|
func escapeCheck(v *Variable, name string, stack stack) error {
|
||||||
@ -733,7 +733,7 @@ func escapeCheck(v *Variable, name string, stack stack) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func escapeCheckPointer(addr uint64, name string, stack stack) error {
|
func escapeCheckPointer(addr uint64, name string, stack stack) error {
|
||||||
if uint64(addr) >= stack.lo && uint64(addr) < stack.hi {
|
if addr >= stack.lo && addr < stack.hi {
|
||||||
return fmt.Errorf("stack object passed to escaping pointer: %s", name)
|
return fmt.Errorf("stack object passed to escaping pointer: %s", name)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -780,7 +780,7 @@ func (p *gdbProcess) Recorded() (bool, string) {
|
|||||||
|
|
||||||
// Pid returns the process ID.
|
// Pid returns the process ID.
|
||||||
func (p *gdbProcess) Pid() int {
|
func (p *gdbProcess) Pid() int {
|
||||||
return int(p.conn.pid)
|
return p.conn.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid returns true if we are not detached
|
// Valid returns true if we are not detached
|
||||||
|
@ -892,7 +892,7 @@ func (conn *gdbConn) queryProcessInfo(pid int) (map[string]string, error) {
|
|||||||
case "name":
|
case "name":
|
||||||
name := make([]byte, len(value)/2)
|
name := make([]byte, len(value)/2)
|
||||||
for i := 0; i < len(value); i += 2 {
|
for i := 0; i < len(value); i += 2 {
|
||||||
n, _ := strconv.ParseUint(string(value[i:i+2]), 16, 8)
|
n, _ := strconv.ParseUint(value[i:i+2], 16, 8)
|
||||||
name[i/2] = byte(n)
|
name[i/2] = byte(n)
|
||||||
}
|
}
|
||||||
pi[key] = string(name)
|
pi[key] = string(name)
|
||||||
|
@ -127,7 +127,7 @@ func newCompositeMemory(mem MemoryReadWriter, arch *Arch, regs op.DwarfRegisters
|
|||||||
cmem.data = append(cmem.data, reg[:piece.Size]...)
|
cmem.data = append(cmem.data, reg[:piece.Size]...)
|
||||||
case op.AddrPiece:
|
case op.AddrPiece:
|
||||||
buf := make([]byte, piece.Size)
|
buf := make([]byte, piece.Size)
|
||||||
mem.ReadMemory(buf, uint64(piece.Val))
|
mem.ReadMemory(buf, piece.Val)
|
||||||
cmem.data = append(cmem.data, buf...)
|
cmem.data = append(cmem.data, buf...)
|
||||||
case op.ImmPiece:
|
case op.ImmPiece:
|
||||||
buf := piece.Bytes
|
buf := piece.Bytes
|
||||||
@ -191,7 +191,7 @@ func (mem *compositeMemory) WriteMemory(addr uint64, data []byte) (int, error) {
|
|||||||
return donesz, err
|
return donesz, err
|
||||||
}
|
}
|
||||||
case op.AddrPiece:
|
case op.AddrPiece:
|
||||||
n, err := mem.realmem.WriteMemory(uint64(piece.Val), pieceMem)
|
n, err := mem.realmem.WriteMemory(piece.Val, pieceMem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return donesz + n, err
|
return donesz + n, err
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ type memRead struct {
|
|||||||
|
|
||||||
func (dm *dummyMem) ReadMemory(buf []byte, addr uint64) (int, error) {
|
func (dm *dummyMem) ReadMemory(buf []byte, addr uint64) (int, error) {
|
||||||
dm.t.Logf("read addr=%#x size=%#x\n", addr, len(buf))
|
dm.t.Logf("read addr=%#x size=%#x\n", addr, len(buf))
|
||||||
dm.reads = append(dm.reads, memRead{uint64(addr), len(buf)})
|
dm.reads = append(dm.reads, memRead{addr, len(buf)})
|
||||||
a := int64(addr) - int64(dm.base)
|
a := int64(addr) - int64(dm.base)
|
||||||
if a < 0 {
|
if a < 0 {
|
||||||
panic("reading below base")
|
panic("reading below base")
|
||||||
|
@ -251,7 +251,7 @@ func (it *stackIterator) Next() bool {
|
|||||||
it.regs = *regs
|
it.regs = *regs
|
||||||
it.top = false
|
it.top = false
|
||||||
if it.g != nil && it.g.ID != 0 {
|
if it.g != nil && it.g.ID != 0 {
|
||||||
it.systemstack = !(uint64(it.regs.SP()) >= it.g.stack.lo && uint64(it.regs.SP()) < it.g.stack.hi)
|
it.systemstack = !(it.regs.SP() >= it.g.stack.lo && it.regs.SP() < it.g.stack.hi)
|
||||||
}
|
}
|
||||||
logflags.StackLogger().Debugf("sigtramp context read")
|
logflags.StackLogger().Debugf("sigtramp context read")
|
||||||
return true
|
return true
|
||||||
|
@ -470,7 +470,7 @@ func sameGoroutineCondition(bi *BinaryInfo, g *G, threadID int) ast.Expr {
|
|||||||
}
|
}
|
||||||
return astutil.Eql(astutil.PkgVar("runtime", "threadid"), astutil.Int(int64(threadID)))
|
return astutil.Eql(astutil.PkgVar("runtime", "threadid"), astutil.Int(int64(threadID)))
|
||||||
}
|
}
|
||||||
return astutil.Eql(astutil.Sel(astutil.PkgVar("runtime", "curg"), "goid"), astutil.Int(int64(g.ID)))
|
return astutil.Eql(astutil.Sel(astutil.PkgVar("runtime", "curg"), "goid"), astutil.Int(g.ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
func frameoffCondition(frame *Stackframe) ast.Expr {
|
func frameoffCondition(frame *Stackframe) ast.Expr {
|
||||||
@ -1316,7 +1316,7 @@ func (t *Target) handleHardcodedBreakpoints(grp *TargetGroup, trapthread Thread,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if bpsize := isHardcodedBreakpoint(thread, pc); bpsize > 0 {
|
if bpsize := isHardcodedBreakpoint(thread, pc); bpsize > 0 {
|
||||||
setPC(thread, pc+uint64(bpsize))
|
setPC(thread, pc+bpsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ func runtimeTypeToDIE(_type *Variable, dataAddr uint64) (typ godwarf.Type, kind
|
|||||||
if md != nil {
|
if md != nil {
|
||||||
so := bi.moduleDataToImage(md)
|
so := bi.moduleDataToImage(md)
|
||||||
if so != nil {
|
if so != nil {
|
||||||
if rtdie, ok := so.runtimeTypeToDIE[uint64(_type.Addr-md.types)]; ok {
|
if rtdie, ok := so.runtimeTypeToDIE[_type.Addr-md.types]; ok {
|
||||||
typ, err := godwarf.ReadType(so.dwarf, so.index, rtdie.offset, so.typeCache)
|
typ, err := godwarf.ReadType(so.dwarf, so.index, rtdie.offset, so.typeCache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("invalid interface type: %v", err)
|
return nil, 0, fmt.Errorf("invalid interface type: %v", err)
|
||||||
@ -189,7 +189,7 @@ func dwarfToRuntimeType(bi *BinaryInfo, mem MemoryReadWriter, typ godwarf.Type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typeAddr = uint64(md.types) + off
|
typeAddr = md.types + off
|
||||||
|
|
||||||
rtyp, err := bi.findType(bi.runtimeTypeTypename())
|
rtyp, err := bi.findType(bi.runtimeTypeTypename())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -959,7 +959,7 @@ func (v *Variable) parseG() (*G, error) {
|
|||||||
SP: uint64(sp),
|
SP: uint64(sp),
|
||||||
BP: uint64(bp),
|
BP: uint64(bp),
|
||||||
LR: uint64(lr),
|
LR: uint64(lr),
|
||||||
Status: uint64(status),
|
Status: status,
|
||||||
WaitSince: waitSince,
|
WaitSince: waitSince,
|
||||||
WaitReason: waitReason,
|
WaitReason: waitReason,
|
||||||
CurrentLoc: Location{PC: uint64(pc), File: f, Line: l, Fn: fn},
|
CurrentLoc: Location{PC: uint64(pc), File: f, Line: l, Fn: fn},
|
||||||
@ -1454,7 +1454,7 @@ func convertToEface(srcv, dstv *Variable) error {
|
|||||||
return srcv.Unreadable
|
return srcv.Unreadable
|
||||||
}
|
}
|
||||||
_type = _type.maybeDereference()
|
_type = _type.maybeDereference()
|
||||||
dstv.writeEmptyInterface(uint64(_type.Addr), data)
|
dstv.writeEmptyInterface(_type.Addr, data)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
typeAddr, typeKind, runtimeTypeFound, err := dwarfToRuntimeType(srcv.bi, srcv.mem, srcv.RealType)
|
typeAddr, typeKind, runtimeTypeFound, err := dwarfToRuntimeType(srcv.bi, srcv.mem, srcv.RealType)
|
||||||
@ -1738,13 +1738,13 @@ func (v *Variable) readComplex(size int64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Variable) writeComplex(real, imag float64, size int64) error {
|
func (v *Variable) writeComplex(real, imag float64, size int64) error {
|
||||||
err := v.writeFloatRaw(real, int64(size/2))
|
err := v.writeFloatRaw(real, size/2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
imagaddr := *v
|
imagaddr := *v
|
||||||
imagaddr.Addr += uint64(size / 2)
|
imagaddr.Addr += uint64(size / 2)
|
||||||
return imagaddr.writeFloatRaw(imag, int64(size/2))
|
return imagaddr.writeFloatRaw(imag, size/2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func readIntRaw(mem MemoryReadWriter, addr uint64, size int64) (int64, error) {
|
func readIntRaw(mem MemoryReadWriter, addr uint64, size int64) (int64, error) {
|
||||||
@ -1781,7 +1781,7 @@ func (v *Variable) writeUint(value uint64, size int64) error {
|
|||||||
case 4:
|
case 4:
|
||||||
binary.LittleEndian.PutUint32(val, uint32(value))
|
binary.LittleEndian.PutUint32(val, uint32(value))
|
||||||
case 8:
|
case 8:
|
||||||
binary.LittleEndian.PutUint64(val, uint64(value))
|
binary.LittleEndian.PutUint64(val, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := v.mem.WriteMemory(v.Addr, val)
|
_, err := v.mem.WriteMemory(v.Addr, val)
|
||||||
@ -1805,7 +1805,7 @@ func readUintRaw(mem MemoryReadWriter, addr uint64, size int64) (uint64, error)
|
|||||||
case 4:
|
case 4:
|
||||||
n = uint64(binary.LittleEndian.Uint32(val))
|
n = uint64(binary.LittleEndian.Uint32(val))
|
||||||
case 8:
|
case 8:
|
||||||
n = uint64(binary.LittleEndian.Uint64(val))
|
n = binary.LittleEndian.Uint64(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
return n, nil
|
return n, nil
|
||||||
@ -1841,7 +1841,7 @@ func (v *Variable) writeFloatRaw(f float64, size int64) error {
|
|||||||
n := float32(f)
|
n := float32(f)
|
||||||
binary.Write(buf, binary.LittleEndian, n)
|
binary.Write(buf, binary.LittleEndian, n)
|
||||||
case 8:
|
case 8:
|
||||||
n := float64(f)
|
n := f
|
||||||
binary.Write(buf, binary.LittleEndian, n)
|
binary.Write(buf, binary.LittleEndian, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1878,7 +1878,7 @@ func (v *Variable) writeSlice(len, cap int64, base uint64) error {
|
|||||||
switch f.Name {
|
switch f.Name {
|
||||||
case sliceArrayFieldName:
|
case sliceArrayFieldName:
|
||||||
arrv, _ := v.toField(f)
|
arrv, _ := v.toField(f)
|
||||||
if err := arrv.writeUint(uint64(base), arrv.RealType.Size()); err != nil {
|
if err := arrv.writeUint(base, arrv.RealType.Size()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case sliceLenFieldName:
|
case sliceLenFieldName:
|
||||||
@ -1897,8 +1897,8 @@ func (v *Variable) writeSlice(len, cap int64, base uint64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Variable) writeString(len, base uint64) error {
|
func (v *Variable) writeString(len, base uint64) error {
|
||||||
writePointer(v.bi, v.mem, uint64(v.Addr), base)
|
writePointer(v.bi, v.mem, v.Addr, base)
|
||||||
writePointer(v.bi, v.mem, uint64(v.Addr)+uint64(v.bi.Arch.PtrSize()), len)
|
writePointer(v.bi, v.mem, v.Addr+uint64(v.bi.Arch.PtrSize()), len)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1931,7 +1931,7 @@ func (v *Variable) readFunctionPtr() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v.Base = val
|
v.Base = val
|
||||||
fn := v.bi.PCToFunc(uint64(v.Base))
|
fn := v.bi.PCToFunc(v.Base)
|
||||||
if fn == nil {
|
if fn == nil {
|
||||||
v.Unreadable = fmt.Errorf("could not find function for %#v", v.Base)
|
v.Unreadable = fmt.Errorf("could not find function for %#v", v.Base)
|
||||||
return
|
return
|
||||||
@ -2406,7 +2406,7 @@ func (v *Variable) registerVariableTypeConv(newtyp string) (*Variable, error) {
|
|||||||
child.Kind = reflect.Uint32
|
child.Kind = reflect.Uint32
|
||||||
n = 4
|
n = 4
|
||||||
case "uint64":
|
case "uint64":
|
||||||
child = newConstant(constant.MakeUint64(uint64(binary.LittleEndian.Uint64(v.reg.Bytes[i:]))), v.mem)
|
child = newConstant(constant.MakeUint64(binary.LittleEndian.Uint64(v.reg.Bytes[i:])), v.mem)
|
||||||
child.Kind = reflect.Uint64
|
child.Kind = reflect.Uint64
|
||||||
n = 8
|
n = 8
|
||||||
case "float32":
|
case "float32":
|
||||||
|
@ -43,23 +43,23 @@ type AMD64Registers struct {
|
|||||||
// struct and the TEB base address of the thread.
|
// struct and the TEB base address of the thread.
|
||||||
func NewAMD64Registers(context *AMD64CONTEXT, TebBaseAddress uint64) *AMD64Registers {
|
func NewAMD64Registers(context *AMD64CONTEXT, TebBaseAddress uint64) *AMD64Registers {
|
||||||
regs := &AMD64Registers{
|
regs := &AMD64Registers{
|
||||||
rax: uint64(context.Rax),
|
rax: context.Rax,
|
||||||
rbx: uint64(context.Rbx),
|
rbx: context.Rbx,
|
||||||
rcx: uint64(context.Rcx),
|
rcx: context.Rcx,
|
||||||
rdx: uint64(context.Rdx),
|
rdx: context.Rdx,
|
||||||
rdi: uint64(context.Rdi),
|
rdi: context.Rdi,
|
||||||
rsi: uint64(context.Rsi),
|
rsi: context.Rsi,
|
||||||
rbp: uint64(context.Rbp),
|
rbp: context.Rbp,
|
||||||
rsp: uint64(context.Rsp),
|
rsp: context.Rsp,
|
||||||
r8: uint64(context.R8),
|
r8: context.R8,
|
||||||
r9: uint64(context.R9),
|
r9: context.R9,
|
||||||
r10: uint64(context.R10),
|
r10: context.R10,
|
||||||
r11: uint64(context.R11),
|
r11: context.R11,
|
||||||
r12: uint64(context.R12),
|
r12: context.R12,
|
||||||
r13: uint64(context.R13),
|
r13: context.R13,
|
||||||
r14: uint64(context.R14),
|
r14: context.R14,
|
||||||
r15: uint64(context.R15),
|
r15: context.R15,
|
||||||
rip: uint64(context.Rip),
|
rip: context.Rip,
|
||||||
eflags: uint64(context.EFlags),
|
eflags: uint64(context.EFlags),
|
||||||
cs: uint64(context.SegCs),
|
cs: uint64(context.SegCs),
|
||||||
fs: uint64(context.SegFs),
|
fs: uint64(context.SegFs),
|
||||||
|
@ -20,7 +20,7 @@ var autoLoadConfig = api.LoadConfig{MaxVariableRecurse: 1, MaxStringLen: 1024, M
|
|||||||
func (env *Env) interfaceToStarlarkValue(v interface{}) starlark.Value {
|
func (env *Env) interfaceToStarlarkValue(v interface{}) starlark.Value {
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
return starlark.Bool(bool(v))
|
return starlark.Bool(v)
|
||||||
case uint8:
|
case uint8:
|
||||||
return starlark.MakeUint64(uint64(v))
|
return starlark.MakeUint64(uint64(v))
|
||||||
case uint16:
|
case uint16:
|
||||||
|
@ -7353,7 +7353,7 @@ func TestFindInstructions(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "request out of bounds",
|
name: "request out of bounds",
|
||||||
args: args{
|
args: args{
|
||||||
addr: uint64(uint64(startPC + 2*(numInstructions-1))),
|
addr: uint64(startPC + 2*(numInstructions-1)),
|
||||||
offset: 1,
|
offset: 1,
|
||||||
count: numInstructions,
|
count: numInstructions,
|
||||||
},
|
},
|
||||||
@ -7512,11 +7512,11 @@ func TestRedirect(t *testing.T) {
|
|||||||
|
|
||||||
// check output
|
// check output
|
||||||
if expectStdout != stdout.String() {
|
if expectStdout != stdout.String() {
|
||||||
t.Errorf("\n got stdout: len:%d\n%s\nwant: len:%d\n%s", stdout.Len(), stdout.String(), len(expectStdout), string(expectStdout))
|
t.Errorf("\n got stdout: len:%d\n%s\nwant: len:%d\n%s", stdout.Len(), stdout.String(), len(expectStdout), expectStdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
if expectStderr != stderr.String() {
|
if expectStderr != stderr.String() {
|
||||||
t.Errorf("\n got stderr: len:%d \n%s\nwant: len:%d\n%s", stderr.Len(), stderr.String(), len(expectStderr), string(expectStderr))
|
t.Errorf("\n got stderr: len:%d \n%s\nwant: len:%d\n%s", stderr.Len(), stderr.String(), len(expectStderr), expectStderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7 >> disconnect, << disconnect
|
// 7 >> disconnect, << disconnect
|
||||||
|
@ -1543,7 +1543,7 @@ func TestSkipPrologue(t *testing.T) {
|
|||||||
findLocationHelper(t, c, "*fn1", false, 1, afunction)
|
findLocationHelper(t, c, "*fn1", false, 1, afunction)
|
||||||
findLocationHelper(t, c, "locationsprog2.go:8", false, 1, afunction)
|
findLocationHelper(t, c, "locationsprog2.go:8", false, 1, afunction)
|
||||||
|
|
||||||
afunction0 := uint64(clientEvalVariable(t, c, "main.afunction").Addr)
|
afunction0 := clientEvalVariable(t, c, "main.afunction").Addr
|
||||||
|
|
||||||
if afunction == afunction0 {
|
if afunction == afunction0 {
|
||||||
t.Fatal("Skip prologue failed")
|
t.Fatal("Skip prologue failed")
|
||||||
@ -1554,21 +1554,21 @@ func TestSkipPrologue(t *testing.T) {
|
|||||||
func TestSkipPrologue2(t *testing.T) {
|
func TestSkipPrologue2(t *testing.T) {
|
||||||
withTestClient2("callme", t, func(c service.Client) {
|
withTestClient2("callme", t, func(c service.Client) {
|
||||||
callme := findLocationHelper(t, c, "main.callme", false, 1, 0)[0]
|
callme := findLocationHelper(t, c, "main.callme", false, 1, 0)[0]
|
||||||
callmeZ := uint64(clientEvalVariable(t, c, "main.callme").Addr)
|
callmeZ := clientEvalVariable(t, c, "main.callme").Addr
|
||||||
findLocationHelper(t, c, "callme.go:5", false, 1, callme)
|
findLocationHelper(t, c, "callme.go:5", false, 1, callme)
|
||||||
if callme == callmeZ {
|
if callme == callmeZ {
|
||||||
t.Fatal("Skip prologue failed")
|
t.Fatal("Skip prologue failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
callme2 := findLocationHelper(t, c, "main.callme2", false, 1, 0)[0]
|
callme2 := findLocationHelper(t, c, "main.callme2", false, 1, 0)[0]
|
||||||
callme2Z := uint64(clientEvalVariable(t, c, "main.callme2").Addr)
|
callme2Z := clientEvalVariable(t, c, "main.callme2").Addr
|
||||||
findLocationHelper(t, c, "callme.go:12", false, 1, callme2)
|
findLocationHelper(t, c, "callme.go:12", false, 1, callme2)
|
||||||
if callme2 == callme2Z {
|
if callme2 == callme2Z {
|
||||||
t.Fatal("Skip prologue failed")
|
t.Fatal("Skip prologue failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
callme3 := findLocationHelper(t, c, "main.callme3", false, 1, 0)[0]
|
callme3 := findLocationHelper(t, c, "main.callme3", false, 1, 0)[0]
|
||||||
callme3Z := uint64(clientEvalVariable(t, c, "main.callme3").Addr)
|
callme3Z := clientEvalVariable(t, c, "main.callme3").Addr
|
||||||
ver, _ := goversion.Parse(runtime.Version())
|
ver, _ := goversion.Parse(runtime.Version())
|
||||||
|
|
||||||
if (ver.Major < 0 || ver.AfterOrEqual(goversion.GoVer18Beta)) && runtime.GOARCH != "386" {
|
if (ver.Major < 0 || ver.AfterOrEqual(goversion.GoVer18Beta)) && runtime.GOARCH != "386" {
|
||||||
|
Loading…
Reference in New Issue
Block a user