id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c180300 | = true
case "omitzero":
omitzero = true
}
}
return Tag{
Name: name,
Omitempty: omitempty,
Omitzero: omitzero,
}
} | |
c180301 | {
return objconv.NewEncoder(NewEmitter(w))
} | |
c180302 | {
return objconv.NewStreamEncoder(NewEmitter(w))
} | |
c180303 | {
return objconv.NewEncoder(NewPrettyEmitter(w))
} | |
c180304 | {
return objconv.NewStreamEncoder(NewPrettyEmitter(w))
} | |
c180305 |
if err = (objconv.Encoder{Emitter: m}).Encode(v); err == nil {
b = make([]byte, m.b.Len())
copy(b, m.b.Bytes())
}
marshalerPool.Put(m)
return
} | |
c180306 | {
panic("objconv: the emitter is nil")
}
return &Encoder{Emitter: e}
} | |
c180307 | e.Emitter.EmitArrayNext(); err != nil {
return
}
}
switch err = f(e); err {
case nil:
case End:
break encodeArray
default:
return
}
}
return e.Emitter.EmitArrayEnd()
} | |
c180308 | Encoder{Emitter: e.Emitter, SortMapKeys: e.SortMapKeys, key: true},
)
// Because internal calls don't use the exported methods they may not
// reset this flag to false when expected, forcing the value here.
e.key = false
switch err {
case nil:
case End:
break encodeMap
default:
return
}
}
return e.Emitter.EmitMapEnd()
} | |
c180309 | emitter is nil")
}
return &StreamEncoder{Emitter: e}
} | |
c180310 | e.opened = true
if !e.oneshot {
e.err = e.Emitter.EmitArrayBegin(n)
}
}
return e.err
} | |
c180311 |
if !e.oneshot {
e.err = e.Emitter.EmitArrayEnd()
}
}
return e.err
} | |
c180312 | (Encoder{
Emitter: e.Emitter,
SortMapKeys: e.SortMapKeys,
}).Encode(v)
if e.cnt++; e.max >= 0 && e.cnt >= e.max {
e.Close()
}
}
return e.err
} | |
c180313 |
continue
}
sf := makeStructField(ft, c)
if sf.name == "-" { // skip
continue
}
s.fields = append(s.fields, sf)
s.fieldsByName[sf.name] = &s.fields[len(s.fields)-1]
}
return s
} | |
c180314 | synchronization logic required to solve this edge
// case.
s = newStructType(t, map[reflect.Type]*structType{})
cache.mutex.Lock()
cache.store[t] = s
cache.mutex.Unlock()
}
return
} | |
c180315 | delete(cache.store, typ)
}
cache.mutex.Unlock()
} | |
c180316 | = fmt.Errorf("objconv: %d overflows the maximum value of %d for %s", v, max, t)
}
return
} | |
c180317 | 0 && uint64(v) > max {
err = fmt.Errorf("objconv: %d overflows the maximum value of %d for %s", v, max, t)
}
return
} | |
c180318 | {
panic("objconv: the parser is nil")
}
return &Decoder{Parser: p}
} | |
c180319 | == reflect.Ptr {
// In most cases the method receives a pointer, but we may also have to
// support types that aren't pointers but implement ValueDecoder, or
// types that have got adapters set.
// If we're not in either of those cases the code will likely panic when
// the value is set because it won't be addressable.
to = to.Elem()
}
_, err := d.decode(to)
return err
} | |
c180320 | typ, err = d.Parser.ParseType(); err != nil {
return
}
err = d.decodeArrayImpl(typ, f)
return
} | |
c180321 | if typ, err = d.Parser.ParseType(); err != nil {
return
}
err = d.decodeMapImpl(typ, f)
return
} | |
c180322 | nil {
panic("objconv: the parser is nil")
}
return &StreamDecoder{Parser: p}
} | |
c180323 |
}
if d.typ == Unknown {
if d.init() != nil {
return 0
}
}
return d.max - d.cnt
} | |
c180324 | return nil
}
return d.err
} | |
c180325 | err = dec.Parser.ParseArrayEnd(cnt)
} else if cnt != 0 {
err = dec.Parser.ParseArrayNext(cnt)
}
}
if err == nil {
if cnt == max {
err = End
} else {
switch err = dec.Decode(v); err {
case nil:
cnt++
case End:
cnt++
max = cnt
default:
if max < 0 && dec.Parser.ParseArrayEnd(cnt) == nil {
err = End
}
}
}
}
d.err = err
d.cnt = cnt
d.max = max
return err
} | |
c180326 |
if typ, err = d.Parser.ParseType(); err == nil {
enc = NewStreamEncoder(e)
enc.oneshot = typ != Array
}
return
} | |
c180327 | defaultFlags |= Llongfile
case "shortfile":
defaultFlags |= Lshortfile
}
}
} | |
c180328 | "error", "err":
return LevelError, true
case "critical", "crt":
return LevelCritical, true
case "off":
return LevelOff, true
default:
return LevelInfo, false
}
} | |
c180329 | for _, o := range opts {
o(b)
}
return b
} | |
c180330 | 0; i-- {
if os.IsPathSeparator(file[i]) {
short = file[i+1:]
break
}
}
file = short
}
return file, line
} | |
c180331 | line)
buf := bytes.NewBuffer(*bytebuf)
fmt.Fprintln(buf, args...)
*bytebuf = buf.Bytes()
b.mu.Lock()
b.w.Write(*bytebuf)
b.mu.Unlock()
recycleBuffer(bytebuf)
} | |
c180332 | &slog{LevelInfo, subsystemTag, b}
} | |
c180333 | l.b.print("TRC", l.tag, args...)
}
} | |
c180334 |
l.b.printf("TRC", l.tag, format, args...)
}
} | |
c180335 | l.b.print("DBG", l.tag, args...)
}
} | |
c180336 |
l.b.printf("DBG", l.tag, format, args...)
}
} | |
c180337 | l.b.print("INF", l.tag, args...)
}
} | |
c180338 |
l.b.printf("INF", l.tag, format, args...)
}
} | |
c180339 | l.b.print("WRN", l.tag, args...)
}
} | |
c180340 |
l.b.printf("WRN", l.tag, format, args...)
}
} | |
c180341 | l.b.print("ERR", l.tag, args...)
}
} | |
c180342 |
l.b.printf("ERR", l.tag, format, args...)
}
} | |
c180343 | l.Level()
if lvl <= LevelCritical {
l.b.print("CRT", l.tag, args...)
}
} | |
c180344 | {
l.b.printf("CRT", l.tag, format, args...)
}
} | |
c180345 | Level(atomic.LoadUint32((*uint32)(&l.lvl)))
} | |
c180346 |
atomic.StoreUint32((*uint32)(&l.lvl), uint32(level))
} | |
c180347 | }
for mode, roles := range p.AllowedRoles {
result.AllowedRoles[mode] = append(result.AllowedRoles[mode], roles...)
}
}
}
appendRoles(newPermission)
appendRoles(permission)
return &result
} | |
c180348 | {
return false
}
}
}
// return true if haven't define allowed roles
if len(permission.AllowedRoles) == 0 {
return true
}
if AllowedRoles := permission.AllowedRoles[mode]; AllowedRoles != nil {
if includeRoles(AllowedRoles, roleNames) {
return true
}
}
return false
} | |
c180349 | newPS = append(newPS, p)
}
}
return permissioners(newPS)
} | |
c180350 | {
for _, p := range ps {
if p != nil && !p.HasPermission(mode, roles) {
return false
}
}
return true
} | |
c180351 | }
definition := role.definitions[name]
if definition != nil {
fmt.Printf("Role `%v` already defined, overwrited it!\n", name)
}
role.definitions[name] = fc
} | |
c180352 |
AllowedRoles: map[PermissionMode][]string{},
DeniedRoles: map[PermissionMode][]string{},
}
} | |
c180353 | ok := role.definitions[name]
return fc, ok
} | |
c180354 | p.findHeapInfo(a).IsPtr(a, p.proc.PtrSize())
} | |
c180355 |
i := a.Sub(min)
return p.proc.ReadUint8(gc.Add(i/8))>>uint(i%8) != 0
}
}
// Everywhere else can't be a pointer. At least, not a pointer into the Go heap.
// TODO: stacks?
// TODO: finalizers?
return false
} | |
c180356 | / h.size * h.size)
// Check if object is marked.
h = p.findHeapInfo(x)
if h.mark>>(uint64(x)%heapInfoSize/8)&1 == 0 { // free or garbage
return 0, 0
}
return Object(x), a.Sub(x)
} | |
c180357 | Object(k)*pageTableSize*heapInfoSize + Object(i)*heapInfoSize + Object(j)*8
if !fn(x) {
return
}
}
}
}
} | |
c180358 | := range g.frames {
for _, r := range f.roots {
if !fn(r) {
return
}
}
}
}
} | |
c180359 | core.Address {
return core.Address(x)
} | |
c180360 | {
return p.findHeapInfo(core.Address(x)).size
} | |
c180361 | := p.findObjectIndex(core.Address(x))
return p.types[i].t, p.types[i].r
} | |
c180362 | {
edges1(p, r, 0, r.Type, fn)
} | |
c180363 | p.FindObject(p.proc.ReadPtr(a))
if dst != 0 {
if !fn(off, dst, off2) {
return false
}
}
}
case KindArray:
s := t.Elem.Size
for i := int64(0); i < t.Count; i++ {
if !edges1(p, r, off+i*s, t.Elem, fn) {
return false
}
}
case KindStruct:
for _, f := range t.Fields {
if !edges1(p, r, off+f.Off, f.Type, fn) {
return false
}
}
}
return true
} | |
c180364 | return
}
i := a % heapInfoSize / 4
h.ptr[i/64] |= uint64(1) << (i % 64)
} | |
c180365 | := a / heapInfoSize % pageTableSize
t := p.pageTable[k]
if t == nil {
return nil
}
h := &t[i]
if h.base == 0 {
return nil
}
return h
} | |
c180366 | j := 0; j < pageTableSize; j++ {
t[j].firstIdx = -1
}
p.pageTable[k] = t
p.pages = append(p.pages, k)
}
return &t[i]
} | |
c180367 | triggers.
for len(anon) < len(x.Field) {
anon = append(anon, false)
}
// Build runtime name from the DWARF fields.
s := "struct {"
first := true
for _, f := range x.Field {
if !first {
s += ";"
}
name := f.Name
if i := strings.Index(name, "."); i >= 0 {
name = name[i+1:]
}
if anon[0] {
s += fmt.Sprintf(" %s", runtimeName(f.Type))
} else {
s += fmt.Sprintf(" %s %s", name, runtimeName(f.Type))
}
first = false
anon = anon[1:]
}
s += " }"
return s
default:
return stripPackagePath(dt.String())
}
} | |
c180368 | = 0
m["tflagExtraStar"] = 1 << 1
m["kindGCProg"] = 1 << 6
m["kindDirectIface"] = 1 << 5
m["_PageSize"] = 1 << 13
m["_KindSpecialFinalizer"] = 1
// From 1.10, these constants are recorded in DWARF records.
d, _ := p.proc.DWARF()
r := d.Reader()
for e, err := r.Next(); e != nil && err == nil; e, err = r.Next() {
if e.Tag != dwarf.TagConstant {
continue
}
f := e.AttrField(dwarf.AttrName)
if f == nil {
continue
}
name := f.Val.(string)
if !strings.HasPrefix(name, "runtime.") {
continue
}
name = name[8:]
c := e.AttrField(dwarf.AttrConstValue)
if c == nil {
continue
}
p.rtConstants[name] = c.Val.(int64)
}
} | |
c180369 | append(t.entries, funcTabEntry{min: min, max: max, f: f})
} | |
c180370 | func(i, j int) bool {
return t.entries[i].min < t.entries[j].min
})
} | |
c180371 | return t.entries[i].max > pc
})
if n == len(t.entries) || pc < t.entries[n].min || pc >= t.entries[n].max {
return nil
}
return t.entries[n].f
} | |
c180372 | == 0 && !first {
return
}
data = data.Add(n)
if v&1 != 0 {
val += ^(v >> 1)
} else {
val += v >> 1
}
// Advance pc.
v, n = readVarint(core, data)
data = data.Add(n)
t.entries = append(t.entries, pcTabEntry{bytes: v * pcQuantum, val: val})
first = false
}
} | |
c180373 | int64(b&0x7f) << uint(n*7)
n++
a++
if b&0x80 == 0 {
return
}
}
} | |
c180374 | useline
}
if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") {
useline += " [flags]"
}
return useline
} | |
c180375 | commandPath(c) + " " + c.Name()
}
return c.Use
} | |
c180376 | err := gocore.Core(c)
if os.IsNotExist(err) && cfg.exePath == "" {
return nil, nil, fmt.Errorf("%v; consider specifying the --exe flag", err)
}
if err != nil {
return nil, nil, err
}
for _, w := range c.Warnings() {
fmt.Fprintf(os.Stderr, "WARNING: %s\n", w)
}
cc.cfg = cfg
cc.coreP = c
cc.gocoreP = p
cc.err = nil
return c, p, nil
} | |
c180377 | }
name := typ.String()
n := size / typ.Size
if n > 1 {
if repeat < n {
name = fmt.Sprintf("[%d+%d?]%s", repeat, n-repeat, name)
} else {
name = fmt.Sprintf("[%d]%s", repeat, name)
}
}
return name
} | |
c180378 |
return fmt.Sprintf("f%d", off)
}
q := ""
if i >= repeat {
// Past the known repeat section, add a ? because we're not sure about the type.
q = "?"
}
return fmt.Sprintf("[%d]%s%s", i, typeFieldName(typ, off-i*typ.Size), q)
} | |
c180379 | i := off / s
return fmt.Sprintf("[%d]%s", i, typeFieldName(t.Elem, off-i*s))
case gocore.KindStruct:
for _, f := range t.Fields {
if f.Off <= off && off < f.Off+f.Type.Size {
return "." + f.Name + typeFieldName(f.Type, off-f.Off)
}
}
}
return ".???"
} | |
c180380 | *Func {
return p.funcTab.find(pc)
} | |
c180381 | them.
p.rtGlobals = map[string]region{}
for _, g := range p.globals {
if strings.HasPrefix(g.Name, "runtime.") {
p.rtGlobals[g.Name[8:]] = region{p: p, a: g.Addr, typ: g.Type}
}
}
// Read all the data that depend on runtime globals.
p.buildVersion = p.rtGlobals["buildVersion"].String()
p.readModules()
p.readHeap()
p.readGs()
p.readStackVars() // needs to be after readGs.
p.markObjects() // needs to be after readGlobals, readStackVars.
return p, nil
} | |
c180382 | non-pointer " + r.typ.Name)
}
return r.p.proc.ReadPtr(r.a)
} | |
c180383 | != r.p.proc.PtrSize() {
panic("not an int: " + r.typ.Name)
}
return r.p.proc.ReadInt(r.a)
} | |
c180384 | != r.p.proc.PtrSize() {
panic("not a uintptr: " + r.typ.Name)
}
return r.p.proc.ReadUintptr(r.a)
} | |
c180385 | r.p, a: r.a, typ: r.p.findType(typ)}
} | |
c180386 | panic("can't deref unsafe.Pointer")
}
p := r.p.proc.ReadPtr(r.a)
return region{p: r.p, a: p, typ: r.typ.Elem}
} | |
c180387 | + r.typ.Name)
}
return r.p.proc.ReadUint64(r.a)
} | |
c180388 | + r.typ.Name)
}
return r.p.proc.ReadUint32(r.a)
} | |
c180389 | + r.typ.Name)
}
return r.p.proc.ReadInt32(r.a)
} | |
c180390 | + r.typ.Name)
}
return r.p.proc.ReadUint16(r.a)
} | |
c180391 | + r.typ.Name)
}
return r.p.proc.ReadUint8(r.a)
} | |
c180392 | r.p.proc.ReadUintptr(r.a.Add(r.p.proc.PtrSize()))
b := make([]byte, n)
r.p.proc.ReadAt(b, p)
return string(b)
} | |
c180393 | &Type{Name: "*" + r.typ.Name[2:], Size: r.p.proc.PtrSize(), Kind: KindPtr, Elem: r.typ.Elem}}
} | |
c180394 |
return r.p.proc.ReadInt(r.a.Add(r.p.proc.PtrSize()))
} | |
c180395 |
panic("can't find field " + r.typ.Name + "." + f)
}
return region{p: r.p, a: r.a.Add(finfo.Off), typ: finfo.Type}
} | |
c180396 | in the core file", a))
}
return m.contents[a.Sub(m.min)]
} | |
c180397 | [2]byte
b = buf[:]
p.ReadAt(b, a)
}
if p.littleEndian {
return binary.LittleEndian.Uint16(b)
}
return binary.BigEndian.Uint16(b)
} | |
c180398 | [4]byte
b = buf[:]
p.ReadAt(b, a)
}
if p.littleEndian {
return binary.LittleEndian.Uint32(b)
}
return binary.BigEndian.Uint32(b)
} | |
c180399 | [8]byte
b = buf[:]
p.ReadAt(b, a)
}
if p.littleEndian {
return binary.LittleEndian.Uint64(b)
}
return binary.BigEndian.Uint64(b)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.