@@ -403,44 +403,48 @@ def handle_p(subcmd):
403403 def handle_P (subcmd ):
404404 reg_index , reg_data = subcmd .split ('=' )
405405 reg_index = int (reg_index , 16 )
406+ reg_name = self .tables [self .ql .archtype ][reg_index ]
406407
407408 if self .ql .archtype == QL_ARCH .A8086 :
408409 reg_data = int (reg_data , 16 )
409410 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'big' )
410- self .ql .reg .write (self . tables [ QL_ARCH . A8086 ][ reg_index ] , reg_data )
411+ self .ql .reg .write (reg_name , reg_data )
411412
412413 elif self .ql .archtype == QL_ARCH .X86 :
413414 reg_data = int (reg_data , 16 )
414415 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'big' )
415- self .ql .reg .write (self . tables [ QL_ARCH . X86 ][ reg_index ] , reg_data )
416+ self .ql .reg .write (reg_name , reg_data )
416417
417418 elif self .ql .archtype == QL_ARCH .X8664 :
418419 if reg_index <= 17 :
419420 reg_data = int (reg_data , 16 )
420421 reg_data = int .from_bytes (struct .pack ('<Q' , reg_data ), byteorder = 'big' )
421- self .ql .reg .write (self . tables [ QL_ARCH . X8664 ][ reg_index ] , reg_data )
422+ self .ql .reg .write (reg_name , reg_data )
422423 else :
423424 reg_data = int (reg_data [:8 ], 16 )
424425 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'big' )
425- self .ql .reg .write (self . tables [ QL_ARCH . X8664 ][ reg_index ] , reg_data )
426+ self .ql .reg .write (reg_name , reg_data )
426427
427428 elif self .ql .archtype == QL_ARCH .ARM :
428429 reg_data = int (reg_data , 16 )
429430 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'big' )
430- self .ql .reg .write (self . tables [ QL_ARCH . ARM ][ reg_index ] , reg_data )
431+ self .ql .reg .write (reg_name , reg_data )
431432
432433 elif self .ql .archtype == QL_ARCH .ARM64 :
433434 reg_data = int (reg_data , 16 )
434435 reg_data = int .from_bytes (struct .pack ('<Q' , reg_data ), byteorder = 'big' )
435- self .ql .reg .write (self . tables [ QL_ARCH . ARM64 ][ reg_index ] , reg_data )
436+ self .ql .reg .write (reg_name , reg_data )
436437
437438 elif self .ql .archtype == QL_ARCH .MIPS :
438439 reg_data = int (reg_data , 16 )
439440 if self .ql .archendian == QL_ENDIAN .EL :
440441 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'little' )
441442 else :
442443 reg_data = int .from_bytes (struct .pack ('<I' , reg_data ), byteorder = 'big' )
443- self .ql .reg .write (self .tables [QL_ARCH .MIPS ][reg_index ], reg_data )
444+ self .ql .reg .write (reg_name , reg_data )
445+
446+ if reg_name == self .ql .reg .arch_pc_name :
447+ self .gdb .current_address = reg_data
444448
445449 logging .info ("gdb> Write to register %s with %x\n " % (self .tables [self .ql .archtype ][reg_index ], reg_data ))
446450 self .send ('OK' )
@@ -462,6 +466,9 @@ def handle_Q(subcmd):
462466 elif subcmd .startswith ('PassSignals' ):
463467 self .send ('OK' )
464468
469+ elif subcmd .startswith ('qemu' ):
470+ self .send ('' )
471+
465472 def handle_D (subcmd ):
466473 self .send ('OK' )
467474
@@ -479,9 +486,9 @@ def handle_q(subcmd):
479486 xfercmd_file = os .path .join (xfercmd_abspath ,"xml" ,xml_folder , xfercmd_file )
480487
481488 if os .path .exists (xfercmd_file ) and self .ql .ostype is not QL_OS .WINDOWS :
482- f = open (xfercmd_file , 'r' )
483- file_contents = f .read ()
484- self .send ("l%s" % file_contents )
489+ with open (xfercmd_file , 'r' ) as f :
490+ file_contents = f .read ()
491+ self .send ("l%s" % file_contents )
485492 else :
486493 logging .info ("gdb> Platform is not supported by xml or xml file not found: %s\n " % (xfercmd_file ))
487494 self .send ("l" )
@@ -522,7 +529,7 @@ def handle_q(subcmd):
522529 AT_HWCAP2 = "0000000000000000"
523530 ID_AT_EXECFN = "1f00000000000000"
524531 AT_EXECFN = "0000000000000000" # File name of executable
525- ID_AT_PLATFORM = "f000000000000000 "
532+ ID_AT_PLATFORM = "0f00000000000000 "
526533 ID_AT_NULL = "0000000000000000"
527534 AT_NULL = "0000000000000000"
528535
@@ -550,7 +557,7 @@ def handle_q(subcmd):
550557 AT_HWCAP2 = "00000000"
551558 ID_AT_EXECFN = "1f000000"
552559 AT_EXECFN = "00000000" # File name of executable
553- ID_AT_PLATFORM = "f0000000 "
560+ ID_AT_PLATFORM = "0f000000 "
554561 ID_AT_NULL = "00000000"
555562 AT_NULL = "00000000"
556563
@@ -758,6 +765,10 @@ def handle_s(subcmd):
758765 self .send ('S%.2x' % GDB_SIGNAL_TRAP )
759766
760767
768+ def handle_X (subcmd ):
769+ self .send ('' )
770+
771+
761772 def handle_Z (subcmd ):
762773 data = subcmd
763774 ztype = data [data .find ('Z' ) + 1 :data .find (',' )]
@@ -807,6 +818,7 @@ def handle_exclaim(subcmd):
807818 'Q' : handle_Q ,
808819 's' : handle_s ,
809820 'v' : handle_v ,
821+ 'X' : handle_X ,
810822 'Z' : handle_Z ,
811823 'z' : handle_z
812824 }
0 commit comments