diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-01-29 22:51:39 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-01-29 13:51:39 -0800 |
commit | b1d24f5c552ccb0c3076e252b893990340d6016e (patch) | |
tree | ffe29a3b77c1c717be279f21d6970cbfa83ed129 /src/binaryen-c.h | |
parent | f9087893cde7e653a66dd125386a97d228a749a2 (diff) | |
download | binaryen-b1d24f5c552ccb0c3076e252b893990340d6016e.tar.gz binaryen-b1d24f5c552ccb0c3076e252b893990340d6016e.tar.bz2 binaryen-b1d24f5c552ccb0c3076e252b893990340d6016e.zip |
Sourcemap support for Binaryen C/JS (#1392)
* Initial source map support for C/JS
* Also test getDebugInfoFileName
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r-- | src/binaryen-c.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/binaryen-c.h b/src/binaryen-c.h index b91689c3f..9033a6950 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -697,6 +697,16 @@ void BinaryenModuleAutoDrop(BinaryenModuleRef module); // @return how many bytes were written. This will be less than or equal to outputSize size_t BinaryenModuleWrite(BinaryenModuleRef module, char* output, size_t outputSize); +typedef struct BinaryenBufferSizes { + size_t outputBytes; + size_t sourceMapBytes; +} BinaryenBufferSizes; + +// Serialize a module into binary form including its source map. Uses the currently set +// global debugInfo option. +// @returns how many bytes were written. This will be less than or equal to outputSize +BinaryenBufferSizes BinaryenModuleWriteWithSourceMap(BinaryenModuleRef module, const char* url, char* output, size_t outputSize, char* sourceMap, size_t sourceMapSize); + // Deserialize a module from binary form. BinaryenModuleRef BinaryenModuleRead(char* input, size_t inputSize); @@ -705,6 +715,13 @@ BinaryenModuleRef BinaryenModuleRead(char* input, size_t inputSize); // and then destroying the instance. void BinaryenModuleInterpret(BinaryenModuleRef module); +// Adds a debug info file name to the module and returns its index. +BinaryenIndex BinaryenModuleAddDebugInfoFileName(BinaryenModuleRef module, const char* filename); + +// Gets the name of the debug info file at the specified index. Returns `NULL` if it +// does not exist. +const char* BinaryenModuleGetDebugInfoFileName(BinaryenModuleRef module, BinaryenIndex index); + // // ======== FunctionType Operations ======== // @@ -747,6 +764,9 @@ void BinaryenFunctionOptimize(BinaryenFunctionRef func, BinaryenModuleRef module // optimize and shrink level. void BinaryenFunctionRunPasses(BinaryenFunctionRef func, BinaryenModuleRef module, const char **passes, BinaryenIndex numPasses); +// Sets the debug location of the specified `Expression` within the specified `Function`. +void BinaryenFunctionSetDebugLocation(BinaryenFunctionRef func, BinaryenExpressionRef expr, BinaryenIndex fileIndex, BinaryenIndex lineNumber, BinaryenIndex columnNumber); + // // ========== Import Operations ========== // |