@@ -189,7 +189,8 @@ def read(self, addr: int, size: int) -> bytearray:
189
189
pages = []
190
190
for page_addr , index , length in self .iter_chunks (addr , size ):
191
191
page = self .pages .get (page_addr , None )
192
- assert page is not None
192
+ if page is None :
193
+ raise IndexError (f"Could not find page { hex (page_addr )} while reading { hex (addr )} [{ hex (size )} ]" )
193
194
pages .append ((page , index , length ))
194
195
195
196
if all ([page .committed for page , _ , _ in pages ]):
@@ -212,7 +213,8 @@ def write(self, addr: int, data: bytes) -> None:
212
213
pages = []
213
214
for page_addr , index , length in self .iter_chunks (addr , len (data )):
214
215
page = self .pages .get (page_addr , None )
215
- assert page is not None
216
+ if page is None :
217
+ raise IndexError (f"Could not find page { hex (page_addr )} while writing { hex (addr )} [{ hex (len (data ))} ]" )
216
218
pages .append ((page , index , length ))
217
219
218
220
if all ([page .committed for page , _ , _ in pages ]):
@@ -1385,6 +1387,20 @@ def syscall_arg(index):
1385
1387
for i in range (0 , argcount ):
1386
1388
argname = argspec .args [1 + i ]
1387
1389
argtype = argspec .annotations [argname ]
1390
+ # Extract the type information from the annotation
1391
+ # Reference: https://github.com/python/cpython/issues/89543
1392
+ # It looks like the python designers did an oopsie, so we're going
1393
+ # the fully-undocumented route.
1394
+ sal = None
1395
+ if argtype .__name__ == "Annotated" :
1396
+ sal , = argtype .__metadata__
1397
+ argtype = argtype .__origin__
1398
+
1399
+ if sal is None :
1400
+ sal_pretty = ""
1401
+ else :
1402
+ sal_pretty = str (sal ) + " "
1403
+
1388
1404
argvalue = syscall_arg (i )
1389
1405
if issubclass (argtype , PVOID ):
1390
1406
argvalue = argtype (argvalue , dp )
@@ -1401,7 +1417,7 @@ def syscall_arg(index):
1401
1417
if i + 1 == argcount :
1402
1418
comma = ""
1403
1419
1404
- dp .info (f" { _arg_type_string (argvalue )} { argname } = { _arg_to_string (dp , argvalue )} { comma } " )
1420
+ dp .info (f" { sal_pretty } { _arg_type_string (argvalue )} { argname } = { _arg_to_string (dp , argvalue )} { comma } " )
1405
1421
dp .info (")" )
1406
1422
try :
1407
1423
status = syscall_impl (dp , * args )
0 commit comments