[Lldb-commits] [lldb] r328488 - Add and fix some tests for PPC64

Alexandre Yukio Yamashita via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 26 08:55:54 PDT 2018


If the issue was not solved yet, I can take a look at it if you send me 
the disassemble outputs with/without the breakpoints.
Thanks.

Em 26/03/2018 12:32, Davide Italiano escreveu:
> Thanks, I'll take a look at the bots myself.
>
> On Mon, Mar 26, 2018 at 8:24 AM, Pavel Labath <labath at google.com> wrote:
>> I was also looking at this because it broke on our android bots. I have just
>> committed r328504 to fix those, and I believe it will fix the issues you are
>> seeing on osx (but I'll probably need to go home before I can verify that).
>>
>>
>> On Mon, 26 Mar 2018 at 16:14, Davide Italiano <dccitaliano at gmail.com> wrote:
>>> This commit broke the Jenkins macOS x86-64 bots
>>>
>>>
>>> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/5943/testReport/junit/TestDisassembleBreakpoint/DisassemblyTestCase/test_dwarf/
>>>
>>> Can you take a look? (if you can't, let me know).
>>>
>>> Thanks,
>>>
>>> --
>>> Davide
>>>
>>> On Mon, Mar 26, 2018 at 5:42 AM, Pavel Labath via lldb-commits
>>> <lldb-commits at lists.llvm.org> wrote:
>>>> Author: labath
>>>> Date: Mon Mar 26 05:42:07 2018
>>>> New Revision: 328488
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=328488&view=rev
>>>> Log:
>>>> Add and fix some tests for PPC64
>>>>
>>>> Summary:
>>>> TestExprsChar.py
>>>> Char is unsigned char by default in PowerPC.
>>>>
>>>> TestDisassembleBreakpoint.py
>>>> Modify disassemble testcase to consider multiple architectures.
>>>>
>>>> TestThreadJump.py
>>>> Jumping directly to the return line on PowerPC architecture dos not
>>>> means returning the value that is seen on the code. The last test fails,
>>>> because it needs the execution of some assembly in the beginning of the
>>>> function. Avoiding this test for this architecture.
>>>>
>>>> TestEhFrameUnwind.py
>>>> Implement func for ppc64le test case.
>>>>
>>>> TestWatchLocation.py
>>>> TestStepOverWatchpoint.py
>>>> PowerPC currently supports only one H/W watchpoint.
>>>>
>>>> TestDisassembleRawData.py
>>>> Add PowerPC opcode and instruction for disassemble testcase.
>>>>
>>>> Reviewers: labath
>>>>
>>>> Reviewed By: labath
>>>>
>>>> Subscribers: davide, labath, alexandreyy, lldb-commits, luporl, lbianc
>>>>
>>>> Differential Revision: https://reviews.llvm.org/D44472
>>>> Patch by Alexandre Yukio Yamashita
>>>> <alexandre.yamashita at eldorado.org.br>.
>>>>
>>>> Modified:
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
>>>>
>>>> lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -49,6 +49,7 @@ class ExprCharTestCase(TestBase):
>>>>           archs=[
>>>>               "arm",
>>>>               "aarch64",
>>>> +            "powerpc64le",
>>>>               "s390x"],
>>>>           bugnumber="llvm.org/pr23069")
>>>>       @expectedFailureAll(oslist=["windows"],
>>>> bugnumber="llvm.org/pr21765")
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -26,6 +26,9 @@ class DisassemblyTestCase(TestBase):
>>>>           self.expect("file " + exe,
>>>>                       patterns=["Current executable set to .*a.out.*"])
>>>>
>>>> +        self.runCmd("dis -n main")
>>>> +        disassembly_before_break = self.res.GetOutput().splitlines()
>>>> +
>>>>           match_object = lldbutil.run_break_set_command(self, "br s -n
>>>> sum")
>>>>           lldbutil.check_breakpoint_result(
>>>>               self,
>>>> @@ -37,36 +40,16 @@ class DisassemblyTestCase(TestBase):
>>>>           self.expect("run",
>>>>                       patterns=["Process .* launched: "])
>>>>
>>>> -        self.runCmd("dis -f")
>>>> -        disassembly = self.res.GetOutput()
>>>> +        self.runCmd("dis -n main")
>>>> +        disassembly_after_break = self.res.GetOutput().splitlines()
>>>>
>>>> -        # ARCH, if not specified, defaults to x86_64.
>>>> -        arch = self.getArchitecture()
>>>> -        if arch in ["", 'x86_64', 'i386', 'i686']:
>>>> -            breakpoint_opcodes = ["int3"]
>>>> -            instructions = [' mov', ' addl ', 'ret']
>>>> -        elif arch in ["arm", "aarch64", "arm64", "armv7", "armv7k"]:
>>>> -            breakpoint_opcodes = ["brk", "udf"]
>>>> -            instructions = [' add ', ' ldr ', ' str ']
>>>> -        elif re.match("mips", arch):
>>>> -            breakpoint_opcodes = ["break"]
>>>> -            instructions = ['lw', 'sw']
>>>> -        elif arch in ["s390x"]:
>>>> -            breakpoint_opcodes = [".long"]
>>>> -            instructions = [' l ', ' a ', ' st ']
>>>> -        else:
>>>> -            # TODO please add your arch here
>>>> -            self.fail(
>>>> -                'unimplemented for arch = "{arch}"'.format(
>>>> -                    arch=self.getArchitecture()))
>>>> -
>>>> -        # make sure that the software breakpoint has been removed
>>>> -        for op in breakpoint_opcodes:
>>>> -            self.assertFalse(op in disassembly)
>>>> -
>>>> -        # make sure a few reasonable assembly instructions are here
>>>> -        self.expect(
>>>> -            disassembly,
>>>> -            exe=False,
>>>> -            startstr="a.out`sum",
>>>> -            substrs=instructions)
>>>> +        # make sure all assembly instructions are the same as the
>>>> original
>>>> +        # instructions before inserting breakpoints.
>>>> +        self.assertEqual(len(disassembly_before_break),
>>>> +                         len(disassembly_after_break))
>>>> +
>>>> +        for dis_inst_before, dis_inst_after in \
>>>> +                zip(disassembly_before_break, disassembly_after_break):
>>>> +            inst_before = dis_inst_before.split(':')[-1]
>>>> +            inst_after = dis_inst_after.split(':')[-1]
>>>> +            self.assertEqual(inst_before, inst_after)
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -1,6 +1,18 @@
>>>>   void func() {
>>>>
>>>> -#ifndef __mips__
>>>> +#ifdef __powerpc64__
>>>> +  __asm__ (
>>>> +    "mflr 0;"
>>>> +    "std 0,16(1);"
>>>> +    "addi 1,1,-24;"
>>>> +    "mr 31,1;"
>>>> +    ".cfi_def_cfa_offset 24;"
>>>> +    "addi 0,0,0;"
>>>> +    "addi 1,1,24;"
>>>> +    "ld 0,16(1);"
>>>> +    ".cfi_def_cfa_offset 0;"
>>>> +  );
>>>> +#elif !defined __mips__
>>>>          __asm__ (
>>>>                  "pushq $0x10;"
>>>>                  ".cfi_def_cfa_offset 16;"
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -39,8 +39,8 @@ class HelloWatchLocationTestCase(TestBas
>>>>       # Most of the MIPS boards provide only one H/W watchpoints, and S/W
>>>>       # watchpoints are not supported yet
>>>>       @expectedFailureAll(triple=re.compile('^mips'))
>>>> -    # SystemZ also currently supports only one H/W watchpoint
>>>> -    @expectedFailureAll(archs=['s390x'])
>>>> +    # SystemZ and PowerPC also currently supports only one H/W
>>>> watchpoint
>>>> +    @expectedFailureAll(archs=['powerpc64le', 's390x'])
>>>>       @skipIfDarwin
>>>>       def test_hello_watchlocation(self):
>>>>           """Test watching a location with '-s size' option."""
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -81,7 +81,7 @@ class TestStepOverWatchpoint(TestBase):
>>>>           # Most of the MIPS boards provide only one H/W watchpoints, and
>>>> S/W
>>>>           # watchpoints are not supported yet
>>>>           arch = self.getArchitecture()
>>>> -        if re.match("^mips", arch):
>>>> +        if re.match("^mips", arch) or re.match("powerpc64le", arch):
>>>>               self.runCmd("watchpoint delete 1")
>>>>
>>>>           # resolve_location=True, read=False, write=True
>>>>
>>>> Modified:
>>>> lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=328488&r1=328487&r2=328488&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
>>>> (original)
>>>> +++
>>>> lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
>>>> Mon Mar 26 05:42:07 2018
>>>> @@ -31,6 +31,9 @@ class DisassembleRawDataTestCase(TestBas
>>>>           elif re.match("mips", arch):
>>>>               target = self.dbg.CreateTargetWithFileAndTargetTriple("",
>>>> "mips")
>>>>               raw_bytes = bytearray([0x03, 0xa0, 0xf0, 0x21])
>>>> +        elif re.match("powerpc64le", arch):
>>>> +            target = self.dbg.CreateTargetWithFileAndTargetTriple("",
>>>> "powerpc64le")
>>>> +            raw_bytes = bytearray([0x00, 0x00, 0x80, 0x38])
>>>>           else:
>>>>               target = self.dbg.CreateTargetWithFileAndTargetTriple("",
>>>> "x86_64")
>>>>               raw_bytes = bytearray([0x48, 0x89, 0xe5])
>>>> @@ -48,6 +51,9 @@ class DisassembleRawDataTestCase(TestBas
>>>>               self.assertTrue(inst.GetMnemonic(target) == "move")
>>>>               self.assertTrue(inst.GetOperands(target) ==
>>>>                               '$' + "fp, " + '$' + "sp")
>>>> +        elif re.match("powerpc64le", arch):
>>>> +            self.assertTrue(inst.GetMnemonic(target) == "li")
>>>> +            self.assertTrue(inst.GetOperands(target) == "4, 0")
>>>>           else:
>>>>               self.assertTrue(inst.GetMnemonic(target) == "movq")
>>>>               self.assertTrue(inst.GetOperands(target) ==
>>>>
>>>>
>>>> _______________________________________________
>>>> lldb-commits mailing list
>>>> lldb-commits at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

-- 
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br
+55 19 3757 3201 / +55 19 9 8336 5553


More information about the lldb-commits mailing list