Expand description
Finding and loading one contract’s debug artifacts from a directory.
An output directory holds the global resource file (ethdebug.json from older
compilers, ethdebug_resources.json from modern ones), one program artifact per
contract and environment (<Contract>_ethdebug.json for creation code,
<Contract>_ethdebug-runtime.json for runtime code), and, for compilers that predate
ETHDebug, a combined.json with legacy source maps. load_debug_program is the one
path through all of that: ETHDebug first, the legacy map as a fallback, and the
source text read from the compilation record or from disk. The CLI and the DAP server
both load through it, so a directory that works in one works in the other.
Structs§
- Contract
Mapping - One entry of a contract mapping file: a deployed address and the directory holding the artifacts that describe its code.
- Debug
Program - One contract’s debug information as loaded from its artifacts.
Enums§
- Code
Generator - Which of solc’s code generators produced a program.
Functions§
- contract_
name_ from_ program_ path - The contract name a program artifact’s file name carries.
- ethdebug_
resources_ from_ metadata - The resources record of an ETHDebug metadata file: its
resourcesentry when it has one, otherwise one assembled from the compilation, types, and pointers it carries. - find_
ethdebug_ metadata - The global ETHDebug resource file in
root, under either of its names. - find_
program_ ethdebug - The ETHDebug program artifact for one contract and environment.
- load_
contract_ mapping - Reads a contract mapping file,
{"contracts": [{"address", "name", "debug_dir"}]}, where an entry may also name itscode_hash. - load_
debug_ program - Loads a contract’s debug program from
root: the ETHDebug artifacts when present, otherwise the legacy source map incombined.json. - load_
debug_ program_ with_ sources - The same, also looking for sources in
source_roots. - load_
storage_ layout - The
<Contract>_storage.jsonthatsolc --storage-layout -o <root>writes, when it is there. A missing file is not an error: the layout is optional debug information. An unreadable one is, because the user compiled with it and would otherwise get a silent “no storage layout” that looks identical to never having asked for it. - load_
transient_ storage_ layout <Contract>_transient_storage.json, under the same rules asload_storage_layout.- parse_
contract_ mapping - The entries of a parsed mapping file. A relative
debug_diris relative to the file. - read_
debug_ source - Reads a source file named by the compiler, trying it relative to the artifact directory, to that directory’s parent, and as given.
- read_
json_ file - Parses a JSON file, naming the file in the error.
- source_
candidates - Where a source path recorded in an artifact might be on disk.