mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Degbug build support (for delve debugger and for getting C code profiling, traces) (#1843)
This commit is contained in:
parent
bb56f12388
commit
e7849498d5
19
Makefile
19
Makefile
@ -3,7 +3,8 @@ GOTEST = go test ./... -p 1 --tags 'mdbx'
|
||||
|
||||
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
|
||||
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
GOBUILD = env GO111MODULE=on go build -trimpath -tags "mdbx" -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}"
|
||||
GOBUILD = env GO111MODULE=on CGO_CFLAGS='-DMDBX_BUILD_FLAGS_CONFIG="config.h"' go build -trimpath -tags=mdbx -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}"
|
||||
GO_DBG_BUILD = env CGO_CFLAGS='-O0 -g -DMDBX_BUILD_FLAGS_CONFIG="config.h"' go build -trimpath -tags=mdbx,debug -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}" -gcflags=all="-N -l" # see delve docs
|
||||
|
||||
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
|
||||
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
|
||||
@ -32,6 +33,10 @@ docker:
|
||||
docker-compose:
|
||||
docker-compose up
|
||||
|
||||
# debug build allows see C stack traces, run it with GOTRACEBACK=crash. You don't need debug build for C pit for profiling. To profile C code use SETCGOTRCKEBACK=1
|
||||
dbg: mdbx-dbg
|
||||
$(GO_DBG_BUILD) -o $(GOBIN)/ ./cmd/...
|
||||
|
||||
geth:
|
||||
$(GOBUILD) -o $(GOBIN)/tg ./cmd/tg
|
||||
@echo "Done building."
|
||||
@ -98,12 +103,16 @@ mdbx:
|
||||
&& make clean && make config.h \
|
||||
&& echo '#define MDBX_DEBUG 0' >> config.h \
|
||||
&& echo '#define MDBX_FORCE_ASSERTIONS 0' >> config.h \
|
||||
&& echo '#define MDBX_ENABLE_MADVISE 1' >> config.h \
|
||||
&& echo '#define MDBX_TXN_CHECKOWNER 1' >> config.h \
|
||||
&& echo '#define MDBX_ENV_CHECKPID 1' >> config.h \
|
||||
&& echo '#define MDBX_DISABLE_PAGECHECKS 0' >> config.h \
|
||||
&& CFLAGS_EXTRA="-Wno-deprecated-declarations" make mdbx-static.o
|
||||
|
||||
mdbx-dbg:
|
||||
@echo "Building mdbx"
|
||||
@cd ethdb/mdbx/dist/ \
|
||||
&& make clean && make config.h \
|
||||
&& echo '#define MDBX_DEBUG 1' >> config.h \
|
||||
&& echo '#define MDBX_FORCE_ASSERTIONS 1' >> config.h \
|
||||
&& CFLAGS_EXTRA="-Wno-deprecated-declarations" CFLAGS='-O0 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes' make mdbx-static.o
|
||||
|
||||
test: mdbx
|
||||
TEST_DB=mdbx $(GOTEST) --timeout 15m
|
||||
|
||||
|
@ -133,7 +133,14 @@ details about dealing with such situations.
|
||||
package mdbx
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -Wno-deprecated-declarations -pthread -W -Wall -Werror -Wextra -Wpedantic -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-parameter -Wno-format-extra-args -Wbad-function-cast -Wno-missing-field-initializers -O2 -g
|
||||
//#define MDBX_BUILD_FLAGS_CONFIG "config.h"
|
||||
//#cgo CFLAGS: -Wno-deprecated-declarations -pthread -W -Wall -Wextra -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-parameter -Wno-format-extra-args -Wbad-function-cast -Wno-missing-field-initializers -O0 -g
|
||||
//
|
||||
//#include "config.h"
|
||||
//#include "mdbx.h"
|
||||
//#include "mdbxgo.h"
|
||||
|
||||
#cgo CFLAGS: -O2 -g -Wno-deprecated-declarations -pthread -W -Wall -Werror -Wextra -Wpedantic -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-parameter -Wno-format-extra-args -Wbad-function-cast -Wno-missing-field-initializers
|
||||
#cgo LDFLAGS: ${SRCDIR}/dist/mdbx-static.o
|
||||
*/
|
||||
import "C"
|
||||
|
Loading…
Reference in New Issue
Block a user