How to use Name method of prog Package

Best Syzkaller code snippet using prog.Name

asm.go

Source:asm.go Github

copy

Full Screen

...68 }69}70// validSymbol checks that addr represents a valid name for a pseudo-op.71func (p *Parser) validSymbol(pseudo string, addr *obj.Addr, offsetOk bool) bool {72 if addr.Sym == nil || addr.Name != obj.NAME_EXTERN && addr.Name != obj.NAME_STATIC || addr.Scale != 0 || addr.Reg != 0 {73 p.errorf("%s symbol %q must be a symbol(SB)", pseudo, symbolName(addr))74 return false75 }76 if !offsetOk && addr.Offset != 0 {77 p.errorf("%s symbol %q must not be offset from SB", pseudo, symbolName(addr))78 return false79 }80 return true81}82// evalInteger evaluates an integer constant for a pseudo-op.83func (p *Parser) evalInteger(pseudo string, operands []lex.Token) int64 {84 addr := p.address(operands)85 return p.getConstantPseudo(pseudo, &addr)86}87// validImmediate checks that addr represents an immediate constant.88func (p *Parser) validImmediate(pseudo string, addr *obj.Addr) bool {89 if addr.Type != obj.TYPE_CONST || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {90 p.errorf("%s: expected immediate constant; found %s", pseudo, obj.Dconv(&emptyProg, addr))91 return false92 }93 return true94}95// asmText assembles a TEXT pseudo-op.96// TEXT runtime·sigtramp(SB),4,$0-097func (p *Parser) asmText(operands [][]lex.Token) {98 if len(operands) != 2 && len(operands) != 3 {99 p.errorf("expect two or three operands for TEXT")100 return101 }102 // Labels are function scoped. Patch existing labels and103 // create a new label space for this TEXT.104 p.patch()105 p.labels = make(map[string]*obj.Prog)106 // Operand 0 is the symbol name in the form foo(SB).107 // That means symbol plus indirect on SB and no offset.108 nameAddr := p.address(operands[0])109 if !p.validSymbol("TEXT", &nameAddr, false) {110 return111 }112 name := symbolName(&nameAddr)113 next := 1114 // Next operand is the optional text flag, a literal integer.115 var flag = int64(0)116 if len(operands) == 3 {117 flag = p.evalInteger("TEXT", operands[1])118 next++119 }120 // Next operand is the frame and arg size.121 // Bizarre syntax: $frameSize-argSize is two words, not subtraction.122 // Both frameSize and argSize must be simple integers; only frameSize123 // can be negative.124 // The "-argSize" may be missing; if so, set it to objabi.ArgsSizeUnknown.125 // Parse left to right.126 op := operands[next]127 if len(op) < 2 || op[0].ScanToken != '$' {128 p.errorf("TEXT %s: frame size must be an immediate constant", name)129 return130 }131 op = op[1:]132 negative := false133 if op[0].ScanToken == '-' {134 negative = true135 op = op[1:]136 }137 if len(op) == 0 || op[0].ScanToken != scanner.Int {138 p.errorf("TEXT %s: frame size must be an immediate constant", name)139 return140 }141 frameSize := p.positiveAtoi(op[0].String())142 if negative {143 frameSize = -frameSize144 }145 op = op[1:]146 argSize := int64(objabi.ArgsSizeUnknown)147 if len(op) > 0 {148 // There is an argument size. It must be a minus sign followed by a non-negative integer literal.149 if len(op) != 2 || op[0].ScanToken != '-' || op[1].ScanToken != scanner.Int {150 p.errorf("TEXT %s: argument size must be of form -integer", name)151 return152 }153 argSize = p.positiveAtoi(op[1].String())154 }155 p.ctxt.InitTextSym(nameAddr.Sym, int(flag))156 prog := &obj.Prog{157 Ctxt: p.ctxt,158 As: obj.ATEXT,159 Pos: p.pos(),160 From: nameAddr,161 To: obj.Addr{162 Type: obj.TYPE_TEXTSIZE,163 Offset: frameSize,164 // Argsize set below.165 },166 }167 nameAddr.Sym.Func.Text = prog168 prog.To.Val = int32(argSize)169 p.append(prog, "", true)170}171// asmData assembles a DATA pseudo-op.172// DATA masks<>+0x00(SB)/4, $0x00000000173func (p *Parser) asmData(operands [][]lex.Token) {174 if len(operands) != 2 {175 p.errorf("expect two operands for DATA")176 return177 }178 // Operand 0 has the general form foo<>+0x04(SB)/4.179 op := operands[0]180 n := len(op)181 if n < 3 || op[n-2].ScanToken != '/' || op[n-1].ScanToken != scanner.Int {182 p.errorf("expect /size for DATA argument")183 return184 }185 szop := op[n-1].String()186 sz, err := strconv.Atoi(szop)187 if err != nil {188 p.errorf("bad size for DATA argument: %q", szop)189 }190 op = op[:n-2]191 nameAddr := p.address(op)192 if !p.validSymbol("DATA", &nameAddr, true) {193 return194 }195 name := symbolName(&nameAddr)196 // Operand 1 is an immediate constant or address.197 valueAddr := p.address(operands[1])198 switch valueAddr.Type {199 case obj.TYPE_CONST, obj.TYPE_FCONST, obj.TYPE_SCONST, obj.TYPE_ADDR:200 // OK201 default:202 p.errorf("DATA value must be an immediate constant or address")203 return204 }205 // The addresses must not overlap. Easiest test: require monotonicity.206 if lastAddr, ok := p.dataAddr[name]; ok && nameAddr.Offset < lastAddr {207 p.errorf("overlapping DATA entry for %s", name)208 return209 }210 p.dataAddr[name] = nameAddr.Offset + int64(sz)211 switch valueAddr.Type {212 case obj.TYPE_CONST:213 switch sz {214 case 1, 2, 4, 8:215 nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Offset)216 default:217 p.errorf("bad int size for DATA argument: %d", sz)218 }219 case obj.TYPE_FCONST:220 switch sz {221 case 4:222 nameAddr.Sym.WriteFloat32(p.ctxt, nameAddr.Offset, float32(valueAddr.Val.(float64)))223 case 8:224 nameAddr.Sym.WriteFloat64(p.ctxt, nameAddr.Offset, valueAddr.Val.(float64))225 default:226 p.errorf("bad float size for DATA argument: %d", sz)227 }228 case obj.TYPE_SCONST:229 nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Val.(string))230 case obj.TYPE_ADDR:231 if sz == p.arch.PtrSize {232 nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Sym, valueAddr.Offset)233 } else {234 p.errorf("bad addr size for DATA argument: %d", sz)235 }236 }237}238// asmGlobl assembles a GLOBL pseudo-op.239// GLOBL shifts<>(SB),8,$256240// GLOBL shifts<>(SB),$256241func (p *Parser) asmGlobl(operands [][]lex.Token) {242 if len(operands) != 2 && len(operands) != 3 {243 p.errorf("expect two or three operands for GLOBL")244 return245 }246 // Operand 0 has the general form foo<>+0x04(SB).247 nameAddr := p.address(operands[0])248 if !p.validSymbol("GLOBL", &nameAddr, false) {249 return250 }251 next := 1252 // Next operand is the optional flag, a literal integer.253 var flag = int64(0)254 if len(operands) == 3 {255 flag = p.evalInteger("GLOBL", operands[1])256 next++257 }258 // Final operand is an immediate constant.259 addr := p.address(operands[next])260 if !p.validImmediate("GLOBL", &addr) {261 return262 }263 // log.Printf("GLOBL %s %d, $%d", name, flag, size)264 p.ctxt.Globl(nameAddr.Sym, addr.Offset, int(flag))265}266// asmPCData assembles a PCDATA pseudo-op.267// PCDATA $2, $705268func (p *Parser) asmPCData(operands [][]lex.Token) {269 if len(operands) != 2 {270 p.errorf("expect two operands for PCDATA")271 return272 }273 // Operand 0 must be an immediate constant.274 key := p.address(operands[0])275 if !p.validImmediate("PCDATA", &key) {276 return277 }278 // Operand 1 must be an immediate constant.279 value := p.address(operands[1])280 if !p.validImmediate("PCDATA", &value) {281 return282 }283 // log.Printf("PCDATA $%d, $%d", key.Offset, value.Offset)284 prog := &obj.Prog{285 Ctxt: p.ctxt,286 As: obj.APCDATA,287 Pos: p.pos(),288 From: key,289 To: value,290 }291 p.append(prog, "", true)292}293// asmPCAlign assembles a PCALIGN pseudo-op.294// PCALIGN $16295func (p *Parser) asmPCAlign(operands [][]lex.Token) {296 if len(operands) != 1 {297 p.errorf("expect one operand for PCALIGN")298 return299 }300 // Operand 0 must be an immediate constant.301 key := p.address(operands[0])302 if !p.validImmediate("PCALIGN", &key) {303 return304 }305 prog := &obj.Prog{306 Ctxt: p.ctxt,307 As: obj.APCALIGN,308 From: key,309 }310 p.append(prog, "", true)311}312// asmFuncData assembles a FUNCDATA pseudo-op.313// FUNCDATA $1, funcdata<>+4(SB)314func (p *Parser) asmFuncData(operands [][]lex.Token) {315 if len(operands) != 2 {316 p.errorf("expect two operands for FUNCDATA")317 return318 }319 // Operand 0 must be an immediate constant.320 valueAddr := p.address(operands[0])321 if !p.validImmediate("FUNCDATA", &valueAddr) {322 return323 }324 // Operand 1 is a symbol name in the form foo(SB).325 nameAddr := p.address(operands[1])326 if !p.validSymbol("FUNCDATA", &nameAddr, true) {327 return328 }329 prog := &obj.Prog{330 Ctxt: p.ctxt,331 As: obj.AFUNCDATA,332 Pos: p.pos(),333 From: valueAddr,334 To: nameAddr,335 }336 p.append(prog, "", true)337}338// asmJump assembles a jump instruction.339// JMP R1340// JMP exit341// JMP 3(PC)342func (p *Parser) asmJump(op obj.As, cond string, a []obj.Addr) {343 var target *obj.Addr344 prog := &obj.Prog{345 Ctxt: p.ctxt,346 Pos: p.pos(),347 As: op,348 }349 switch len(a) {350 case 0:351 if p.arch.Family == sys.Wasm {352 target = &obj.Addr{Type: obj.TYPE_NONE}353 break354 }355 p.errorf("wrong number of arguments to %s instruction", op)356 return357 case 1:358 target = &a[0]359 case 2:360 // Special 2-operand jumps.361 target = &a[1]362 prog.From = a[0]363 case 3:364 if p.arch.Family == sys.PPC64 {365 // Special 3-operand jumps.366 // First two must be constants; a[1] is a register number.367 target = &a[2]368 prog.From = obj.Addr{369 Type: obj.TYPE_CONST,370 Offset: p.getConstant(prog, op, &a[0]),371 }372 reg := int16(p.getConstant(prog, op, &a[1]))373 reg, ok := p.arch.RegisterNumber("R", reg)374 if !ok {375 p.errorf("bad register number %d", reg)376 return377 }378 prog.Reg = reg379 break380 }381 if p.arch.Family == sys.MIPS || p.arch.Family == sys.MIPS64 {382 // 3-operand jumps.383 // First two must be registers384 target = &a[2]385 prog.From = a[0]386 prog.Reg = p.getRegister(prog, op, &a[1])387 break388 }389 if p.arch.Family == sys.S390X {390 // 3-operand jumps.391 target = &a[2]392 prog.From = a[0]393 if a[1].Reg != 0 {394 // Compare two registers and jump.395 prog.Reg = p.getRegister(prog, op, &a[1])396 } else {397 // Compare register with immediate and jump.398 prog.SetFrom3(a[1])399 }400 break401 }402 if p.arch.Family == sys.ARM64 {403 // Special 3-operand jumps.404 // a[0] must be immediate constant; a[1] is a register.405 if a[0].Type != obj.TYPE_CONST {406 p.errorf("%s: expected immediate constant; found %s", op, obj.Dconv(prog, &a[0]))407 return408 }409 prog.From = a[0]410 prog.Reg = p.getRegister(prog, op, &a[1])411 target = &a[2]412 break413 }414 fallthrough415 default:416 p.errorf("wrong number of arguments to %s instruction", op)417 return418 }419 switch {420 case target.Type == obj.TYPE_BRANCH:421 // JMP 4(PC)422 prog.To = obj.Addr{423 Type: obj.TYPE_BRANCH,424 Offset: p.pc + 1 + target.Offset, // +1 because p.pc is incremented in append, below.425 }426 case target.Type == obj.TYPE_REG:427 // JMP R1428 prog.To = *target429 case target.Type == obj.TYPE_MEM && (target.Name == obj.NAME_EXTERN || target.Name == obj.NAME_STATIC):430 // JMP main·morestack(SB)431 prog.To = *target432 case target.Type == obj.TYPE_INDIR && (target.Name == obj.NAME_EXTERN || target.Name == obj.NAME_STATIC):433 // JMP *main·morestack(SB)434 prog.To = *target435 prog.To.Type = obj.TYPE_INDIR436 case target.Type == obj.TYPE_MEM && target.Reg == 0 && target.Offset == 0:437 // JMP exit438 if target.Sym == nil {439 // Parse error left name unset.440 return441 }442 targetProg := p.labels[target.Sym.Name]443 if targetProg == nil {444 p.toPatch = append(p.toPatch, Patch{prog, target.Sym.Name})445 } else {446 p.branch(prog, targetProg)447 }448 case target.Type == obj.TYPE_MEM && target.Name == obj.NAME_NONE:449 // JMP 4(R0)450 prog.To = *target451 // On the ppc64, 9a encodes BR (CTR) as BR CTR. We do the same.452 if p.arch.Family == sys.PPC64 && target.Offset == 0 {453 prog.To.Type = obj.TYPE_REG454 }455 case target.Type == obj.TYPE_CONST:456 // JMP $4457 prog.To = a[0]458 case target.Type == obj.TYPE_NONE:459 // JMP460 default:461 p.errorf("cannot assemble jump %+v", target)462 return463 }464 p.append(prog, cond, true)465}466func (p *Parser) patch() {467 for _, patch := range p.toPatch {468 targetProg := p.labels[patch.label]469 if targetProg == nil {470 p.errorf("undefined label %s", patch.label)471 return472 }473 p.branch(patch.prog, targetProg)474 }475 p.toPatch = p.toPatch[:0]476}477func (p *Parser) branch(jmp, target *obj.Prog) {478 jmp.To = obj.Addr{479 Type: obj.TYPE_BRANCH,480 Index: 0,481 }482 jmp.To.Val = target483}484// asmInstruction assembles an instruction.485// MOVW R9, (R10)486func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) {487 // fmt.Printf("%s %+v\n", op, a)488 prog := &obj.Prog{489 Ctxt: p.ctxt,490 Pos: p.pos(),491 As: op,492 }493 switch len(a) {494 case 0:495 // Nothing to do.496 case 1:497 if p.arch.UnaryDst[op] || op == obj.ARET || op == obj.AGETCALLERPC {498 // prog.From is no address.499 prog.To = a[0]500 } else {501 prog.From = a[0]502 // prog.To is no address.503 }504 if p.arch.Family == sys.PPC64 && arch.IsPPC64NEG(op) {505 // NEG: From and To are both a[0].506 prog.To = a[0]507 prog.From = a[0]508 break509 }510 case 2:511 if p.arch.Family == sys.ARM {512 if arch.IsARMCMP(op) {513 prog.From = a[0]514 prog.Reg = p.getRegister(prog, op, &a[1])515 break516 }517 // Strange special cases.518 if arch.IsARMFloatCmp(op) {519 prog.From = a[0]520 prog.Reg = p.getRegister(prog, op, &a[1])521 break522 }523 } else if p.arch.Family == sys.ARM64 && arch.IsARM64CMP(op) {524 prog.From = a[0]525 prog.Reg = p.getRegister(prog, op, &a[1])526 break527 } else if p.arch.Family == sys.MIPS || p.arch.Family == sys.MIPS64 {528 if arch.IsMIPSCMP(op) || arch.IsMIPSMUL(op) {529 prog.From = a[0]530 prog.Reg = p.getRegister(prog, op, &a[1])531 break532 }533 }534 prog.From = a[0]535 prog.To = a[1]536 case 3:537 switch p.arch.Family {538 case sys.MIPS, sys.MIPS64:539 prog.From = a[0]540 prog.Reg = p.getRegister(prog, op, &a[1])541 prog.To = a[2]542 case sys.ARM:543 // Special cases.544 if arch.IsARMSTREX(op) {545 /*546 STREX x, (y), z547 from=(y) reg=x to=z548 */549 prog.From = a[1]550 prog.Reg = p.getRegister(prog, op, &a[0])551 prog.To = a[2]552 break553 }554 if arch.IsARMBFX(op) {555 // a[0] and a[1] must be constants, a[2] must be a register556 prog.From = a[0]557 prog.SetFrom3(a[1])558 prog.To = a[2]559 break560 }561 // Otherwise the 2nd operand (a[1]) must be a register.562 prog.From = a[0]563 prog.Reg = p.getRegister(prog, op, &a[1])564 prog.To = a[2]565 case sys.AMD64:566 prog.From = a[0]567 prog.SetFrom3(a[1])568 prog.To = a[2]569 case sys.ARM64:570 // ARM64 instructions with one input and two outputs.571 if arch.IsARM64STLXR(op) {572 prog.From = a[0]573 prog.To = a[1]574 if a[2].Type != obj.TYPE_REG {575 p.errorf("invalid addressing modes for third operand to %s instruction, must be register", op)576 return577 }578 prog.RegTo2 = a[2].Reg579 break580 }581 if arch.IsARM64TBL(op) {582 prog.From = a[0]583 if a[1].Type != obj.TYPE_REGLIST {584 p.errorf("%s: expected list; found %s", op, obj.Dconv(prog, &a[1]))585 }586 prog.SetFrom3(a[1])587 prog.To = a[2]588 break589 }590 prog.From = a[0]591 prog.Reg = p.getRegister(prog, op, &a[1])592 prog.To = a[2]593 case sys.I386:594 prog.From = a[0]595 prog.SetFrom3(a[1])596 prog.To = a[2]597 case sys.PPC64:598 if arch.IsPPC64CMP(op) {599 // CMPW etc.; third argument is a CR register that goes into prog.Reg.600 prog.From = a[0]601 prog.Reg = p.getRegister(prog, op, &a[2])602 prog.To = a[1]603 break604 }605 // Arithmetic. Choices are:606 // reg reg reg607 // imm reg reg608 // reg imm reg609 // If the immediate is the middle argument, use From3.610 switch a[1].Type {611 case obj.TYPE_REG:612 prog.From = a[0]613 prog.Reg = p.getRegister(prog, op, &a[1])614 prog.To = a[2]615 case obj.TYPE_CONST:616 prog.From = a[0]617 prog.SetFrom3(a[1])618 prog.To = a[2]619 default:620 p.errorf("invalid addressing modes for %s instruction", op)621 return622 }623 case sys.S390X:624 prog.From = a[0]625 if a[1].Type == obj.TYPE_REG {626 prog.Reg = p.getRegister(prog, op, &a[1])627 } else {628 prog.SetFrom3(a[1])629 }630 prog.To = a[2]631 default:632 p.errorf("TODO: implement three-operand instructions for this architecture")633 return634 }635 case 4:636 if p.arch.Family == sys.ARM {637 if arch.IsARMBFX(op) {638 // a[0] and a[1] must be constants, a[2] and a[3] must be registers639 prog.From = a[0]640 prog.SetFrom3(a[1])641 prog.Reg = p.getRegister(prog, op, &a[2])642 prog.To = a[3]643 break644 }645 if arch.IsARMMULA(op) {646 // All must be registers.647 p.getRegister(prog, op, &a[0])648 r1 := p.getRegister(prog, op, &a[1])649 r2 := p.getRegister(prog, op, &a[2])650 p.getRegister(prog, op, &a[3])651 prog.From = a[0]652 prog.To = a[3]653 prog.To.Type = obj.TYPE_REGREG2654 prog.To.Offset = int64(r2)655 prog.Reg = r1656 break657 }658 }659 if p.arch.Family == sys.AMD64 {660 prog.From = a[0]661 prog.RestArgs = []obj.Addr{a[1], a[2]}662 prog.To = a[3]663 break664 }665 if p.arch.Family == sys.ARM64 {666 prog.From = a[0]667 prog.Reg = p.getRegister(prog, op, &a[1])668 prog.SetFrom3(a[2])669 prog.To = a[3]670 break671 }672 if p.arch.Family == sys.PPC64 {673 if arch.IsPPC64RLD(op) {674 prog.From = a[0]675 prog.Reg = p.getRegister(prog, op, &a[1])676 prog.SetFrom3(a[2])677 prog.To = a[3]678 break679 } else if arch.IsPPC64ISEL(op) {680 // ISEL BC,RB,RA,RT becomes isel rt,ra,rb,bc681 prog.SetFrom3(a[2]) // ra682 prog.From = a[0] // bc683 prog.Reg = p.getRegister(prog, op, &a[1]) // rb684 prog.To = a[3] // rt685 break686 }687 // Else, it is a VA-form instruction688 // reg reg reg reg689 // imm reg reg reg690 // Or a VX-form instruction691 // imm imm reg reg692 if a[1].Type == obj.TYPE_REG {693 prog.From = a[0]694 prog.Reg = p.getRegister(prog, op, &a[1])695 prog.SetFrom3(a[2])696 prog.To = a[3]697 break698 } else if a[1].Type == obj.TYPE_CONST {699 prog.From = a[0]700 prog.Reg = p.getRegister(prog, op, &a[2])701 prog.SetFrom3(a[1])702 prog.To = a[3]703 break704 } else {705 p.errorf("invalid addressing modes for %s instruction", op)706 return707 }708 }709 if p.arch.Family == sys.S390X {710 if a[1].Type != obj.TYPE_REG {711 p.errorf("second operand must be a register in %s instruction", op)712 return713 }714 prog.From = a[0]715 prog.Reg = p.getRegister(prog, op, &a[1])716 prog.SetFrom3(a[2])717 prog.To = a[3]718 break719 }720 p.errorf("can't handle %s instruction with 4 operands", op)721 return722 case 5:723 if p.arch.Family == sys.PPC64 && arch.IsPPC64RLD(op) {724 // Always reg, reg, con, con, reg. (con, con is a 'mask').725 prog.From = a[0]726 prog.Reg = p.getRegister(prog, op, &a[1])727 mask1 := p.getConstant(prog, op, &a[2])728 mask2 := p.getConstant(prog, op, &a[3])729 var mask uint32730 if mask1 < mask2 {731 mask = (^uint32(0) >> uint(mask1)) & (^uint32(0) << uint(31-mask2))732 } else {733 mask = (^uint32(0) >> uint(mask2+1)) & (^uint32(0) << uint(31-(mask1-1)))734 }735 prog.SetFrom3(obj.Addr{736 Type: obj.TYPE_CONST,737 Offset: int64(mask),738 })739 prog.To = a[4]740 break741 }742 if p.arch.Family == sys.AMD64 {743 prog.From = a[0]744 prog.RestArgs = []obj.Addr{a[1], a[2], a[3]}745 prog.To = a[4]746 break747 }748 if p.arch.Family == sys.S390X {749 prog.From = a[0]750 prog.RestArgs = []obj.Addr{a[1], a[2], a[3]}751 prog.To = a[4]752 break753 }754 p.errorf("can't handle %s instruction with 5 operands", op)755 return756 case 6:757 if p.arch.Family == sys.ARM && arch.IsARMMRC(op) {758 // Strange special case: MCR, MRC.759 prog.To.Type = obj.TYPE_CONST760 x0 := p.getConstant(prog, op, &a[0])761 x1 := p.getConstant(prog, op, &a[1])762 x2 := int64(p.getRegister(prog, op, &a[2]))763 x3 := int64(p.getRegister(prog, op, &a[3]))764 x4 := int64(p.getRegister(prog, op, &a[4]))765 x5 := p.getConstant(prog, op, &a[5])766 // Cond is handled specially for this instruction.767 offset, MRC, ok := arch.ARMMRCOffset(op, cond, x0, x1, x2, x3, x4, x5)768 if !ok {769 p.errorf("unrecognized condition code .%q", cond)770 }771 prog.To.Offset = offset772 cond = ""773 prog.As = MRC // Both instructions are coded as MRC.774 break775 }776 fallthrough777 default:778 p.errorf("can't handle %s instruction with %d operands", op, len(a))779 return780 }781 p.append(prog, cond, true)782}783// newAddr returns a new(Addr) initialized to x.784func newAddr(x obj.Addr) *obj.Addr {785 p := new(obj.Addr)786 *p = x787 return p788}789// symbolName returns the symbol name, or an error string if none if available.790func symbolName(addr *obj.Addr) string {791 if addr.Sym != nil {792 return addr.Sym.Name793 }794 return "<erroneous symbol>"795}796var emptyProg obj.Prog797// getConstantPseudo checks that addr represents a plain constant and returns its value.798func (p *Parser) getConstantPseudo(pseudo string, addr *obj.Addr) int64 {799 if addr.Type != obj.TYPE_MEM || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {800 p.errorf("%s: expected integer constant; found %s", pseudo, obj.Dconv(&emptyProg, addr))801 }802 return addr.Offset803}804// getConstant checks that addr represents a plain constant and returns its value.805func (p *Parser) getConstant(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {806 if addr.Type != obj.TYPE_MEM || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {807 p.errorf("%s: expected integer constant; found %s", op, obj.Dconv(prog, addr))808 }809 return addr.Offset810}811// getImmediate checks that addr represents an immediate constant and returns its value.812func (p *Parser) getImmediate(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {813 if addr.Type != obj.TYPE_CONST || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {814 p.errorf("%s: expected immediate constant; found %s", op, obj.Dconv(prog, addr))815 }816 return addr.Offset817}818// getRegister checks that addr represents a register and returns its value.819func (p *Parser) getRegister(prog *obj.Prog, op obj.As, addr *obj.Addr) int16 {820 if addr.Type != obj.TYPE_REG || addr.Offset != 0 || addr.Name != 0 || addr.Index != 0 {821 p.errorf("%s: expected register; found %s", op, obj.Dconv(prog, addr))822 }823 return addr.Reg824}...

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println(p.Name)4}5import "fmt"6func main() {7 fmt.Println(p.Name)8 fmt.Println(p.Name)9}10import "fmt"11func main() {12 fmt.Println(p.Name)13 fmt.Println(p.Name)14 fmt.Println(p.Name)15}16import "fmt"17func main() {18 fmt.Println(p.Name)19 fmt.Println(p.Name)20 fmt.Println(p.Name)21 fmt.Println(p.Name)22}23import "fmt"24func main() {25 fmt.Println(p.Name)26 fmt.Println(p.Name)27 fmt.Println(p.Name)28 fmt.Println(p.Name)29 fmt.Println(p.Name)30}31import "fmt"32func main() {33 fmt.Println(p.Name)34 fmt.Println(p.Name)35 fmt.Println(p.Name)36 fmt.Println(p.Name)37 fmt.Println(p.Name)

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 p := prog{ "Go", 5, true }4 fmt.Println(p.Name())5}6import "fmt"7func main() {8 p := prog{ "Go", 5, true }9 fmt.Println(p.Name())10}11import "fmt"12func main() {13 p := prog{ "Go", 5, true }14 fmt.Println(p.Name())15}16import "fmt"17func main() {18 p := prog{ "Go", 5, true }19 fmt.Println(p.Name())20}21import "fmt"22func main() {23 p := prog{ "Go", 5, true }24 fmt.Println(p.Name())25}26import "fmt"27func main() {28 p := prog{ "Go", 5, true }29 fmt.Println(p.Name())30}31import "fmt"32func main() {33 p := prog{ "Go", 5, true }34 fmt.Println(p.Name())35}36import "fmt"37func main() {38 p := prog{ "Go", 5, true }39 fmt.Println(p.Name())40}41import "fmt"42func main() {43 p := prog{ "Go", 5, true }44 fmt.Println(p.Name())45}46import "fmt"47func main() {48 p := prog{ "Go", 5, true }49 fmt.Println(p.Name())50}51import "fmt"52func main() {53 p := prog{ "Go

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(stringutil.MyName)4}5import (6func main() {7 fmt.Println(icomefromalaska.BearName)8}9import (10func main() {11 fmt.Println(stringutil.Reverse("!oG ,olleH"))12}13import (14func main() {15 fmt.Println(icomefromalaska.Reverse("kcah a si sihT"))16}17import (18func main() {19 fmt.Println(stringutil.MyName)20 fmt.Println(stringutil.Reverse("!oG ,olleH"))21}22import (23func main() {24 fmt.Println(icomefromalaska.BearName)25 fmt.Println(icomefromalaska.Reverse("kcah a si sihT"))26}27import (28func main() {29 fmt.Println(stringutil.MyName)30 fmt.Println(stringutil.Reverse("!oG ,olleH"))31 fmt.Println(icomefromalaska.BearName)32 fmt.Println(icomefromalaska.Reverse("kcah a si sihT"))33}34import (

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main(){3 fmt.Println(p.Name)4}5import "fmt"6func main(){7 fmt.Println(p.Name)8}9import "fmt"10func main(){11 fmt.Println(p.Name)12}13import "fmt"14func main(){15 fmt.Println(p.Name)16}17import "fmt"18func main(){19 fmt.Println(p.Name)20}21import "fmt"22func main(){23 fmt.Println(p.Name)24}25import "fmt"26func main(){27 fmt.Println(p.Name)28}29import "fmt"30func main(){31 fmt.Println(p.Name)32}33import "fmt"34func main(){35 fmt.Println(p.Name)36}37import "fmt"38func main(){

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(prog.Name)4}5import (6func main() {7 fmt.Println(prog.Name)8}9import (10func main() {11 fmt.Println(prog.Name)12}13import (14func main() {15 fmt.Println(prog.Name)16}17import (18func main() {19 fmt.Println(prog.Name)20}21import (22func main() {23 fmt.Println(prog.Name)24}25import (26func main() {27 fmt.Println(prog.Name)28}29import (30func main() {31 fmt.Println(prog.Name)32}33import (34func main() {35 fmt.Println(prog.Name)36}

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(p.Name)4}5type Prog struct {6}7type Prog struct {8}9func (p Prog) Name() string {10}11func (p Prog) SetName(name string) {12}13type Prog struct {14}15func (p *Prog) Name() string {16}17func (p *Prog) SetName(name string) {18}19type Prog struct {20}21func (p *Prog) Name() string {22}23func (p *Prog) SetName(name string) {24}25func (p *Prog) SetName2(name string) {26}27import (28func main() {29 fmt.Println(p.Name)30}31type Prog struct {32}33type Prog struct {34}35func (p Prog) Name() string {36}37func (p Prog) SetName(name string) {38}39type Prog struct {40}41func (p *Prog) Name() string {42}43func (p *Prog) SetName(name string) {44}45type Prog struct {46}47func (p *Prog) Name() string {48}

Full Screen

Full Screen

Name

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println("Hello, playground")4 p := prog{"Go", "Golang", 2009}5 fmt.Println(p.Name())6}7type prog struct {8}9func (p prog) Name() string {10}11func (p prog) Desc() string {12}13func (p prog) Year() int {14}15func main() {16 fmt.Println("Hello, playground")17 p := prog{"Go", "Golang", 2009}18 fmt.Println(p.Name())19}20type prog struct {21}22func (p prog) Name() string {23}24func (p prog) Desc() string {25}26func (p prog) Year() int {27}28import "fmt"29func main() {30 fmt.Println("Hello, playground")31 p := prog{"Go", "Golang", 2009}32 fmt.Println(p.Name())33}34type prog struct {35}36func (p prog) Name() string {37}38func (p prog) Desc() string {39}40func (p prog) Year() int {41}42import "fmt"43func main() {44 fmt.Println("Hello, playground")45 p := prog{"Go", "Golang", 2009}46 fmt.Println(p.Name())47}48type prog struct {49}50func (p prog) Name() string {51}52func (p prog) Desc() string {53}54func (p prog) Year() int {55}56import "fmt"57func main() {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Syzkaller automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful