@@ -21,12 +21,14 @@ class LinuxCoreTestCase(TestBase):
2121 _x86_64_pid = 32259
2222 _s390x_pid = 1045
2323 _ppc64le_pid = 28147
24+ _riscv64_pid = 89328
2425
2526 _aarch64_regions = 4
2627 _i386_regions = 4
2728 _x86_64_regions = 5
2829 _s390x_regions = 2
2930 _ppc64le_regions = 2
31+ _riscv64_regions = 4
3032
3133 @skipIfLLVMTargetMissing ("AArch64" )
3234 def test_aarch64 (self ):
@@ -58,6 +60,11 @@ def test_s390x(self):
5860 """Test that lldb can read the process information from an s390x linux core file."""
5961 self .do_test ("linux-s390x" , self ._s390x_pid , self ._s390x_regions , "a.out" )
6062
63+ @skipIfLLVMTargetMissing ("RISCV" )
64+ def test_riscv64 (self ):
65+ """Test that lldb can read the process information from an riscv64 linux core file."""
66+ self .do_test ("linux-riscv64" , self ._riscv64_pid , self ._riscv64_regions , "a.out" )
67+
6168 @skipIfLLVMTargetMissing ("X86" )
6269 def test_same_pid_running (self ):
6370 """Test that we read the information from the core correctly even if we have a running
@@ -629,6 +636,56 @@ def test_arm_core(self):
629636
630637 self .expect ("register read --all" )
631638
639+ @skipIfLLVMTargetMissing ("RISCV" )
640+ def test_riscv64_regs (self ):
641+ # check basic registers using 64 bit RISC-V core file
642+ target = self .dbg .CreateTarget (None )
643+ self .assertTrue (target , VALID_TARGET )
644+ process = target .LoadCore ("linux-riscv64.core" )
645+
646+ values = {}
647+ values ["pc" ] = "0x000000000001015e"
648+ values ["ra" ] = "0x000000000001018c"
649+ values ["sp" ] = "0x0000003fffd132a0"
650+ values ["gp" ] = "0x0000002ae919af50"
651+ values ["tp" ] = "0x0000003fdceae3e0"
652+ values ["t0" ] = "0x0"
653+ values ["t1" ] = "0x0000002ae9187b1c"
654+ values ["t2" ] = "0x0000000000000021"
655+ values ["fp" ] = "0x0000003fffd132d0"
656+ values ["s1" ] = "0x0000002ae919cd98"
657+ values ["a0" ] = "0x0"
658+ values ["a1" ] = "0x0000000000010144"
659+ values ["a2" ] = "0x0000002ae919cdb0"
660+ values ["a3" ] = "0x000000000000002f"
661+ values ["a4" ] = "0x000000000000002f"
662+ values ["a5" ] = "0x0"
663+ values ["a6" ] = "0x7efefefefefefeff"
664+ values ["a7" ] = "0x00000000000000dd"
665+ values ["s2" ] = "0x0000002ae9196860"
666+ values ["s3" ] = "0x0000002ae919cdb0"
667+ values ["s4" ] = "0x0000003fffc63be8"
668+ values ["s5" ] = "0x0000002ae919cb78"
669+ values ["s6" ] = "0x0000002ae9196860"
670+ values ["s7" ] = "0x0000002ae9196860"
671+ values ["s8" ] = "0x0"
672+ values ["s9" ] = "0x000000000000000f"
673+ values ["s10" ] = "0x0000002ae919a8d0"
674+ values ["s11" ] = "0x0000000000000008"
675+ values ["t3" ] = "0x0000003fdce07df4"
676+ values ["t4" ] = "0x0"
677+ values ["t5" ] = "0x0000000000000020"
678+ values ["t6" ] = "0x0000002ae919f1b0"
679+ values ["zero" ] = "0x0"
680+
681+ for regname , value in values .items ():
682+ self .expect (
683+ "register read {}" .format (regname ),
684+ substrs = ["{} = {}" .format (regname , value )],
685+ )
686+
687+ self .expect ("register read --all" )
688+
632689 def test_get_core_file_api (self ):
633690 """
634691 Test SBProcess::GetCoreFile() API can successfully get the core file.
0 commit comments