From a13de95b66262ea268a97124b9ef99fb378ecb78 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Sun, 4 Jan 2026 10:22:16 -0500 Subject: [PATCH] feat: expose internal debug API handler (#255) ## Why this should be merged This allows exposing a number of APIs exposed by Geth's [`debug` namespace](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug). Specifically: - [debug_blockProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugblockprofile) - [debug_cpuProfile ](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugcpuprofile) - [debug_freeOSMemory ](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugfreeosmemory) - [debug_gcStats](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debuggcstats) - [debug_goTrace ](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debuggotrace) - [debug_memStats](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugmemstats) - [debug_mutexProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugmutexprofile) - [debug_setBlockProfileRate](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugsetblockprofilerate) - [debug_setGCPercent](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugsetgcpercent) - [debug_setMutexProfileFraction](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugsetmutexprofilefraction) - [debug_stacks](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugstacks) - [debug_startCPUProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugstartcpuprofile) - [debug_startGoTrace](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugstartgotrace) - [debug_stopCPUProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugstopcpuprofile) - [debug_stopGoTrace](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugstopgotrace) - [debug_verbosity](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugverbosity) - [debug_vmodule](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugvmodule) - [debug_writeBlockProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugwriteblockprofile) - [debug_writeMemProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugwritememprofile) - [debug_writeMutexProfile](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugwritemutexprofile) Note: This is _not_ the full debug namespace. ## How this works Simply re-exports the API, similarly to how the `ethapi`s are re-exported. ## How this was tested N/A --- libevm/debug/api.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 libevm/debug/api.go diff --git a/libevm/debug/api.go b/libevm/debug/api.go new file mode 100644 index 0000000000..72de550b9d --- /dev/null +++ b/libevm/debug/api.go @@ -0,0 +1,23 @@ +// Copyright 2026 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// Package debug exposes the internal debug package. +package debug + +import "github.com/ava-labs/libevm/internal/debug" + +// Handler is the debug API handler for tracking process level statistics. +var Handler = debug.Handler