mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Debug: add cgo symbolizer (#5255)
* Add cgo_symbolizer config * Add comment * use import block
This commit is contained in:
parent
6edb3018f9
commit
00ef08b3dc
6
.bazelrc
6
.bazelrc
@ -39,6 +39,12 @@ build:release --compilation_mode=opt
|
||||
build:llvm --crosstool_top=@llvm_toolchain//:toolchain
|
||||
build:llvm --define compiler=llvm
|
||||
|
||||
# Build binary with cgo symbolizer for debugging / profiling.
|
||||
build:cgo_symbolizer --config=llvm
|
||||
build:cgo_symbolizer --copt=-g
|
||||
build:cgo_symbolizer --define=USE_CGO_SYMBOLIZER=true
|
||||
build:cgo_symbolizer -c dbg
|
||||
|
||||
# multi-arch cross-compiling toolchain configs:
|
||||
-----------------------------------------------
|
||||
build:cross --crosstool_top=@prysm_toolchains//:multiarch_toolchain
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,6 +17,7 @@ bazel-*
|
||||
# Coverage outputs
|
||||
coverage.txt
|
||||
profile.out
|
||||
profile.grind
|
||||
|
||||
# Nodejs
|
||||
node_modules
|
||||
|
@ -1649,3 +1649,10 @@ go_repository(
|
||||
load("@com_github_prysmaticlabs_prombbolt//:repositories.bzl", "prombbolt_dependencies")
|
||||
|
||||
prombbolt_dependencies()
|
||||
|
||||
go_repository(
|
||||
name = "com_github_ianlancetaylor_cgosymbolizer",
|
||||
importpath = "github.com/ianlancetaylor/cgosymbolizer",
|
||||
sum = "h1:GWsU1WjSE2rtvyTYGcndqmPPkQkBNV7pEuZdnGtwtu4=",
|
||||
version = "v0.0.0-20200321040036-d43e30eacb43",
|
||||
)
|
||||
|
@ -1,11 +1,20 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
config_setting(
|
||||
name = "use_cgosymbolizer",
|
||||
values = {"define": "USE_CGO_SYMBOLIZER=true"},
|
||||
)
|
||||
|
||||
# gazelle:ignore cgo_symbolizer.go
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"debug.go",
|
||||
"maxprocs_metric.go",
|
||||
],
|
||||
] + select({
|
||||
":use_cgosymbolizer": ["cgo_symbolizer.go"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
importpath = "github.com/prysmaticlabs/prysm/shared/debug",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
@ -14,5 +23,8 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@in_gopkg_urfave_cli_v2//:go_default_library",
|
||||
],
|
||||
] + select({
|
||||
":use_cgosymbolizer": ["@com_github_ianlancetaylor_cgosymbolizer//:go_default_library"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
8
shared/debug/cgo_symbolizer.go
Normal file
8
shared/debug/cgo_symbolizer.go
Normal file
@ -0,0 +1,8 @@
|
||||
package debug
|
||||
|
||||
import (
|
||||
// Using this file with this imported library configures the process to
|
||||
// expose cgo symbols when possible. Use --config=cgo_symbolizer to make use of
|
||||
// this feature.
|
||||
_ "github.com/ianlancetaylor/cgosymbolizer"
|
||||
)
|
Loading…
Reference in New Issue
Block a user