Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 81 for pcs (0.02 sec)

  1. test/fixedbugs/issue19799.go

    import (
    	"os"
    	"runtime"
    )
    
    func foo(x int) int {
    	return x + 1
    }
    
    func test() {
    	defer func() {
    		if r := recover(); r != nil {
    			pcs := make([]uintptr, 10)
    			n := runtime.Callers(0, pcs)
    			pcs = pcs[:n]
    			frames := runtime.CallersFrames(pcs)
    			for {
    				f, more := frames.Next()
    				if f.Function == "main.foo" {
    					println("did not expect to see call to foo in stack trace")
    					os.Exit(1)
    				}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 02 13:41:01 UTC 2017
    - 1.1K bytes
    - Viewed (0)
  2. src/runtime/runtime-seh_windows_test.go

    	return sehf4(pan)
    }
    
    //go:noinline
    func sehf4(pan bool) []uintptr {
    	var pcs []uintptr
    	if pan {
    		panic("sehf4")
    	}
    	pcs = sehCallers()
    	return pcs
    }
    
    func testSehCallersEqual(t *testing.T, pcs []uintptr, want []string) {
    	t.Helper()
    	got := make([]string, 0, len(want))
    	for _, pc := range pcs {
    		fn := runtime.FuncForPC(pc)
    		if fn == nil || len(got) >= len(want) {
    			break
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jul 31 16:52:06 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  3. src/runtime/callers_test.go

    		"runtime_test.TestCallersPanic"}
    
    	defer func() {
    		if r := recover(); r == nil {
    			t.Fatal("did not panic")
    		}
    		pcs := make([]uintptr, 20)
    		pcs = pcs[:runtime.Callers(0, pcs)]
    		testCallers(t, pcs, true)
    		testCallersEqual(t, pcs, want)
    	}()
    	f1(true)
    }
    
    func TestCallersDoublePanic(t *testing.T) {
    	// Make sure we don't have any extra frames on the stack (due to
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 21:36:31 UTC 2023
    - 12.1K bytes
    - Viewed (0)
  4. test/fixedbugs/issue34123.go

    var x byte
    var p *byte
    
    //go:noinline
    func f() {
    	q := p
    	x = 11  // line 23
    	*q = 12 // line 24
    }
    func main() {
    	defer func() {
    		recover()
    		var pcs [10]uintptr
    		n := runtime.Callers(1, pcs[:])
    		frames := runtime.CallersFrames(pcs[:n])
    		for {
    			f, more := frames.Next()
    			if f.Function == "main.f" && f.Line != 24 {
    				panic(fmt.Errorf("expected line 24, got line %d", f.Line))
    			}
    			if !more {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 08 21:05:17 UTC 2019
    - 735 bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/telemetry/internal/counter/stackcounter.go

    // creating it if necessary.
    func (c *StackCounter) Inc() {
    	pcs := make([]uintptr, c.depth)
    	n := runtime.Callers(2, pcs) // caller of Inc
    	pcs = pcs[:n]
    
    	c.mu.Lock()
    	defer c.mu.Unlock()
    
    	// Existing counter?
    	var ctr *Counter
    	for _, s := range c.stacks {
    		if eq(s.pcs, pcs) {
    			if s.counter != nil {
    				ctr = s.counter
    				break
    			}
    		}
    	}
    
    	if ctr == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:10:54 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  6. src/cmd/trace/pprof.go

    		return rec
    	}
    	// Slow path: the stack may still be in the map.
    
    	// Grab the stack's PCs as the source-of-truth.
    	var pcs [pprofMaxStack]uint64
    	pcsForStack(stack, &pcs)
    
    	// Check the source-of-truth.
    	var rec *traceviewer.ProfileRecord
    	if existing, ok := m.pcs[pcs]; ok {
    		// In the map.
    		rec = m.stacks[existing]
    		delete(m.stacks, existing)
    	} else {
    		// Not in the map.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 10.1K bytes
    - Viewed (0)
  7. src/runtime/pprof/proto.go

    }
    
    type locInfo struct {
    	// location id assigned by the profileBuilder
    	id uint64
    
    	// sequence of PCs, including the fake PCs returned by the traceback
    	// to represent inlined functions
    	// https://github.com/golang/go/blob/d6f2f833c93a41ec1c68e49804b8387a06b131c5/src/runtime/traceback.go#L347-L368
    	pcs []uintptr
    
    	// firstPCFrames and firstPCSymbolizeResult hold the results of the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 13 20:40:52 UTC 2023
    - 25.7K bytes
    - Viewed (0)
  8. src/internal/pkgbits/sync.go

    // walkFrames calls visit for each call frame represented by pcs.
    //
    // pcs should be a slice of PCs, as returned by runtime.Callers.
    func walkFrames(pcs []uintptr, visit frameVisitor) {
    	if len(pcs) == 0 {
    		return
    	}
    
    	frames := runtime.CallersFrames(pcs)
    	for {
    		frame, more := frames.Next()
    		visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 04 17:12:28 UTC 2022
    - 2.4K bytes
    - Viewed (0)
  9. src/runtime/tracestack.go

    type traceStackTable struct {
    	tab traceMap
    }
    
    // put returns a unique id for the stack trace pcs and caches it in the table,
    // if it sees the trace for the first time.
    func (t *traceStackTable) put(pcs []uintptr) uint64 {
    	if len(pcs) == 0 {
    		return 0
    	}
    	id, _ := t.tab.put(noescape(unsafe.Pointer(&pcs[0])), uintptr(len(pcs))*unsafe.Sizeof(uintptr(0)))
    	return id
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 14:38:56 UTC 2024
    - 11K bytes
    - Viewed (0)
  10. src/runtime/example_test.go

    package runtime_test
    
    import (
    	"fmt"
    	"runtime"
    	"strings"
    )
    
    func ExampleFrames() {
    	c := func() {
    		// Ask runtime.Callers for up to 10 PCs, including runtime.Callers itself.
    		pc := make([]uintptr, 10)
    		n := runtime.Callers(0, pc)
    		if n == 0 {
    			// No PCs available. This can happen if the first argument to
    			// runtime.Callers is large.
    			//
    			// Return now to avoid processing the zero Frame that would
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 18 22:05:09 UTC 2021
    - 1.5K bytes
    - Viewed (0)
Back to top