diff --git a/libs/remix-debug/src/debugger/debugger.ts b/libs/remix-debug/src/debugger/debugger.ts index fe15df4051..43c45d8b38 100644 --- a/libs/remix-debug/src/debugger/debugger.ts +++ b/libs/remix-debug/src/debugger/debugger.ts @@ -95,7 +95,7 @@ export class Debugger { sources[genSource.name] = { content: genSource.contents } } } - const lineColumnPos = await this.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, sources, astSources) + const lineColumnPos = rawLocationAndOpcode.lineColumnPos let lineGasCostObj = null try { diff --git a/libs/remix-debug/src/solidity-decoder/internalCallTree.ts b/libs/remix-debug/src/solidity-decoder/internalCallTree.ts index ef7704b61c..b0f1230be3 100644 --- a/libs/remix-debug/src/solidity-decoder/internalCallTree.ts +++ b/libs/remix-debug/src/solidity-decoder/internalCallTree.ts @@ -250,13 +250,12 @@ async function buildTree (tree, step, scopeId, isExternalCall, isCreation, funct if (stepDetail && nextStepDetail) { stepDetail.gasCost = parseInt(stepDetail.gas as string) - parseInt(nextStepDetail.gas as string) } - tree.locationAndOpcodePerVMTraceIndex[step] = { sourceLocation, stepDetail } - tree.scopes[scopeId].gasCost += stepDetail.gasCost - + // gas per line + let lineColumnPos if (tree.offsetToLineColumnConverter) { try { - const lineColumnPos = await tree.offsetToLineColumnConverter.offsetToLineColumn(validSourceLocation, validSourceLocation.file, tree.solidityProxy.sourcesCode, tree.solidityProxy.sources) + lineColumnPos = await tree.offsetToLineColumnConverter.offsetToLineColumn(validSourceLocation, validSourceLocation.file, tree.solidityProxy.sourcesCode, tree.solidityProxy.sources) if (!tree.gasCostPerLine[validSourceLocation.file]) tree.gasCostPerLine[validSourceLocation.file] = {} if (!tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line]) { tree.gasCostPerLine[validSourceLocation.file][lineColumnPos.start.line] = { @@ -271,6 +270,9 @@ async function buildTree (tree, step, scopeId, isExternalCall, isCreation, funct } } + tree.locationAndOpcodePerVMTraceIndex[step] = { sourceLocation, stepDetail, lineColumnPos } + tree.scopes[scopeId].gasCost += stepDetail.gasCost + const contractObj = await tree.solidityProxy.contractObjectAtAddress(address) const generatedSources = getGeneratedSources(tree, scopeId, contractObj) const functionDefinition = resolveFunctionDefinition(tree, sourceLocation, generatedSources)