1
+ import json
1
2
import logging
2
3
import sys
3
4
from pathlib import Path
25
26
26
27
27
28
class KEVM (KProve , KRun ):
29
+
30
+ srcmap : Optional [Dict [int , str ]]
31
+
28
32
def __init__ (
29
33
self ,
30
34
definition_dir : Path ,
@@ -33,6 +37,7 @@ def __init__(
33
37
profile : bool = False ,
34
38
kprove_command : str = 'kprove' ,
35
39
krun_command : str = 'krun' ,
40
+ srcmap_file : Optional [Path ] = None ,
36
41
) -> None :
37
42
# I'm going for the simplest version here, we can change later if there is an advantage.
38
43
# https://stackoverflow.com/questions/9575409/calling-parent-class-init-with-multiple-inheritance-whats-the-right-way
@@ -47,6 +52,10 @@ def __init__(
47
52
)
48
53
KRun .__init__ (self , definition_dir , use_directory = use_directory , profile = profile , command = krun_command )
49
54
KEVM ._patch_symbol_table (self .symbol_table )
55
+ self .srcmap = None
56
+ if srcmap_file is not None and srcmap_file .exists ():
57
+ with open (srcmap_file , 'r' ) as sm :
58
+ self .srcmap = {int (k ): v for k , v in json .loads (sm .read ()).items ()}
50
59
51
60
@staticmethod
52
61
def kompile (
@@ -440,9 +449,17 @@ def __init__(
440
449
main_file : Optional [Path ] = None ,
441
450
use_directory : Optional [Path ] = None ,
442
451
profile : bool = False ,
452
+ srcmap_file : Optional [Path ] = None ,
443
453
) -> None :
444
454
# copied from KEVM class and adapted to inherit KPrint instead
445
- KEVM .__init__ (self , definition_dir , main_file = main_file , use_directory = use_directory , profile = profile )
455
+ KEVM .__init__ (
456
+ self ,
457
+ definition_dir ,
458
+ main_file = main_file ,
459
+ use_directory = use_directory ,
460
+ profile = profile ,
461
+ srcmap_file = srcmap_file ,
462
+ )
446
463
Foundry ._patch_symbol_table (self .symbol_table )
447
464
448
465
class Sorts :
0 commit comments