[Lldb-commits] [lldb] r282683 - Add a unit test for an x86_64 assembly inspection of

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 28 21:30:03 PDT 2016


Good suggestions, thanks.  I'll fix those when I commit the 32-bit version of the same test.

J

> On Sep 28, 2016, at 9:28 PM, Zachary Turner <zturner at google.com> wrote:
> 
> 
> 
> On Wed, Sep 28, 2016 at 9:10 PM Jason Molenda via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> +  EXPECT_TRUE(regloc.GetOffset() == -8);
> This should be 
> 
> EXPECT_EQ(-8, regloc.GetOffset());
> 
> That way if it fails, you'll get a handy error message that says:
> 
> Expected: -8
> Actual: -7
> 
> If you use EXPECT_TRUE, it's not going to tell you the actual value.  The same goes for many other places in the file.  Note that you're supposed to put the expected value *first*.  The test is the same either way obviously, but it affects the printing of the above message.
>  
> +
> +  // these could be set to IsSame and be valid -- meaning that the
> +  // register value is the same as the caller's -- but I'd rather
> +  // they not be mentioned at all.
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_rbp, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r15, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r14, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r13, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_r12, regloc) == false);
> +  EXPECT_TRUE(row_sp->GetRegisterInfo(k_rbx, regloc) == false);
> If you're using EXPECT_TRUE and EXPECT_FALSE, I think it's more intuitive to not use the comparison operator.  The above is just
> 
> EXPECT_FALSE(row_sp->GetRegisterInfo(k_rbx, regloc));



More information about the lldb-commits mailing list