MCPcopy Create free account
hub / github.com/google/pprof / TestLLVMSymbolizer

Function TestLLVMSymbolizer

internal/binutils/binutils_test.go:451–490  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

449}
450
451func TestLLVMSymbolizer(t *testing.T) {
452 if runtime.GOOS != "linux" {
453 t.Skip("testtdata/llvm-symbolizer has only been tested on linux")
454 }
455
456 cmd := filepath.Join("testdata", "fake-llvm-symbolizer")
457 for _, c := range []struct {
458 addr uint64
459 isData bool
460 frames []plugin.Frame
461 }{
462 {0x10, false, []plugin.Frame{
463 {Func: "Inlined_0x10", File: "foo.h", Line: 0, Column: 0, StartLine: 0},
464 {Func: "Func_0x10", File: "foo.c", Line: 2, Column: 1, StartLine: 2},
465 }},
466 {0x20, true, []plugin.Frame{
467 {Func: "foo_0x20", File: "0x20 8"},
468 }},
469 } {
470 desc := fmt.Sprintf("Code %x", c.addr)
471 if c.isData {
472 desc = fmt.Sprintf("Data %x", c.addr)
473 }
474 t.Run(desc, func(t *testing.T) {
475 symbolizer, err := newLLVMSymbolizer(cmd, "foo", 0, c.isData)
476 if err != nil {
477 t.Fatalf("newLLVMSymbolizer: unexpected error %v", err)
478 }
479 defer symbolizer.rw.close()
480
481 frames, err := symbolizer.addrInfo(c.addr)
482 if err != nil {
483 t.Fatalf("LLVM: unexpected error %v", err)
484 }
485 if !reflect.DeepEqual(frames, c.frames) {
486 t.Errorf("LLVM: expect %v; got %v\n", c.frames, frames)
487 }
488 })
489 }
490}
491
492func TestPEFile(t *testing.T) {
493 // If this test fails, check the address for main function in testdata/exe_windows_64.exe

Callers

nothing calls this directly

Calls 3

newLLVMSymbolizerFunction · 0.85
closeMethod · 0.65
addrInfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…