File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Sources/WasmKit/Execution/Instructions Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,11 @@ extension InstructionSequence {
226226 }
227227 target. write ( " 0x \( hexOffset) : " )
228228 let instruction = Instruction . load ( from: & cursor)
229- context. print ( instruction: instruction, to: & target)
229+ context. print (
230+ instruction: instruction,
231+ instructionOffset: cursor - cursorStart,
232+ to: & target
233+ )
230234 target. write ( " \n " )
231235 }
232236 }
@@ -271,6 +275,7 @@ struct InstructionPrintingContext {
271275
272276 mutating func print< Target> (
273277 instruction: Instruction ,
278+ instructionOffset: Int ,
274279 to target: inout Target
275280 ) where Target : TextOutputStream {
276281 switch instruction {
@@ -317,7 +322,8 @@ struct InstructionPrintingContext {
317322 case . brIf( let op) :
318323 target. write ( " br_if \( reg ( op. condition) ) , + \( op. offset) " )
319324 case . br( let offset) :
320- target. write ( " br \( offset > 0 ? " + " : " " ) \( offset) " )
325+ let iseqOffset = instructionOffset + Int( offset)
326+ target. write ( " br \( offset > 0 ? " + " : " " ) \( offset) ; 0x \( String ( iseqOffset, radix: 16 ) ) " )
321327 case . brTable( let table) :
322328 target. write ( " br_table \( reg ( table. index) ) , \( table. count) cases " )
323329 for i in 0 ..< table. count {
You can’t perform that action at this time.
0 commit comments