[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2019-01-31 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy updated this revision to Diff 184471.
leonid.mashinskiy marked an inline comment as done.
leonid.mashinskiy added a comment.

- made changes related to review


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55122/new/

https://reviews.llvm.org/D55122

Files:
  lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
  lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
  lit/SymbolFile/PDB/variables-locations.test
  source/Expression/DWARFExpression.cpp
  source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
  source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
  source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.h
  source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
  source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.h
  source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
  source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.h
  source/Plugins/SymbolFile/NativePDB/PdbIndex.h
  source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  source/Plugins/SymbolFile/NativePDB/PdbUtil.h
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  source/Plugins/SymbolFile/PDB/CMakeLists.txt
  source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
  source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  unittests/SymbolFile/CMakeLists.txt
  unittests/SymbolFile/NativePDB/CMakeLists.txt
  unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp

Index: unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
===
--- /dev/null
+++ unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
@@ -0,0 +1,166 @@
+//===-- PDBFPOProgramToDWARFExpressionTests.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.h"
+
+#include "lldb/Core/StreamBuffer.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/StreamString.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::npdb;
+
+/// Valid programs tests
+
+static void
+CheckValidProgramTranslation(llvm::StringRef fpo_program,
+ llvm::StringRef target_register_name,
+ llvm::StringRef expected_dwarf_expression) {
+  // initial setup
+  ArchSpec arch_spec("i686-pc-windows");
+  llvm::Triple::ArchType arch_type = arch_spec.GetMachine();
+  ByteOrder byte_order = arch_spec.GetByteOrder();
+  uint32_t address_size = arch_spec.GetAddressByteSize();
+  uint32_t byte_size = arch_spec.GetDataByteSize();
+
+  // program translation
+  StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
+  ASSERT_TRUE(TranslateFPOProgramToDWARFExpression(
+  fpo_program, target_register_name, arch_type, stream));
+
+  // print dwarf expression to comparable textual representation
+  DataBufferSP buffer =
+  std::make_shared(stream.GetData(), stream.GetSize());
+  DataExtractor extractor(buffer, byte_order, address_size, byte_size);
+
+  StreamString result_dwarf_expression;
+  ASSERT_TRUE(DWARFExpression::PrintDWARFExpression(
+  result_dwarf_expression, extractor, address_size, 4, false));
+
+  // actual check
+  ASSERT_STREQ(expected_dwarf_expression.data(),
+   result_dwarf_expression.GetString().data());
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentConst) {
+  CheckValidProgramTranslation("$T0 0 = ", "$T0", "DW_OP_constu 0x0");
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentRegisterRef) {
+  CheckValidProgramTranslation("$T0 $ebp = ", "$T0", "DW_OP_breg6 +0");
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentExpressionPlus) {
+  CheckValidProgramTranslation("$T0 $ebp 4 + = ", "$T0",
+   "DW_OP_breg6 +0, DW_OP_constu 0x4, DW_OP_plus ");
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentExpressionDeref) {
+  CheckValidProgramTranslation("$T0 $ebp ^ = ", "$T0",
+   "DW_OP_breg6 +0, DW_OP_deref ");
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentExpressionMinus) {
+  CheckValidProgramTranslation(
+  "$T0 $ebp 4 - = ", "$T0",
+  "DW_OP_breg6 +0, DW_OP_constu 0x4, DW_OP_minus ");
+}
+
+TEST(PDBFPOProgramToDWARFExpressionTests, SingleAssignmentExpressionAlign) {
+  CheckValidProgramTranslation("$T0 $ebp 128 @ = ", "$T0",
+   "DW_OP_breg6 +0, 

[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2019-01-31 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy added inline comments.



Comment at: source/Expression/DWARFExpression.cpp:3253
 
-  return false;
+  return true;
 }

zturner wrote:
> Why do we change the return value here?
This function had mixed return value semantics and I changed it to always 
returning true on success and false on failure.
Nobody checked return value before and I use it in unit tests.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55122/new/

https://reviews.llvm.org/D55122



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57506: [LLDB] FreeBSD suppress compilation warning

2019-01-31 Thread David CARLIER via Phabricator via lldb-commits
devnexen created this revision.
devnexen added a reviewer: labath.
devnexen created this object with visibility "All Users".
Herald added subscribers: lldb-commits, emaste.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57506

Files:
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp


Index: source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -167,7 +167,7 @@
 
   pi_desc.piod_op = PIOD_WRITE_D;
   pi_desc.piod_offs = (void *)vm_addr;
-  pi_desc.piod_addr = (void *)buf;
+  pi_desc.piod_addr = const_cast(buf);
   pi_desc.piod_len = size;
 
   if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {


Index: source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -167,7 +167,7 @@
 
   pi_desc.piod_op = PIOD_WRITE_D;
   pi_desc.piod_offs = (void *)vm_addr;
-  pi_desc.piod_addr = (void *)buf;
+  pi_desc.piod_addr = const_cast(buf);
   pi_desc.piod_len = size;
 
   if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57506: [LLDB] FreeBSD suppress compilation warning

2019-01-31 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57506/new/

https://reviews.llvm.org/D57506



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r352744 - [LLDB] FreeBSD suppress compilation warning

2019-01-31 Thread David Carlier via lldb-commits
Author: devnexen
Date: Thu Jan 31 03:54:58 2019
New Revision: 352744

URL: http://llvm.org/viewvc/llvm-project?rev=352744&view=rev
Log:
[LLDB] FreeBSD suppress compilation warning

Reviewers: labath, teemperor

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D57506

Msource/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=352744&r1=352743&r2=352744&view=diff
==
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Jan 31 
03:54:58 2019
@@ -167,7 +167,7 @@ static size_t DoWriteMemory(lldb::pid_t
 
   pi_desc.piod_op = PIOD_WRITE_D;
   pi_desc.piod_offs = (void *)vm_addr;
-  pi_desc.piod_addr = (void *)buf;
+  pi_desc.piod_addr = const_cast(buf);
   pi_desc.piod_len = size;
 
   if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57506: [LLDB] FreeBSD suppress compilation warning

2019-01-31 Thread David CARLIER via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352744: [LLDB] FreeBSD suppress compilation warning 
(authored by devnexen, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57506?vs=184480&id=184482#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57506/new/

https://reviews.llvm.org/D57506

Files:
  lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp


Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -167,7 +167,7 @@
 
   pi_desc.piod_op = PIOD_WRITE_D;
   pi_desc.piod_offs = (void *)vm_addr;
-  pi_desc.piod_addr = (void *)buf;
+  pi_desc.piod_addr = const_cast(buf);
   pi_desc.piod_len = size;
 
   if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {


Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -167,7 +167,7 @@
 
   pi_desc.piod_op = PIOD_WRITE_D;
   pi_desc.piod_offs = (void *)vm_addr;
-  pi_desc.piod_addr = (void *)buf;
+  pi_desc.piod_addr = const_cast(buf);
   pi_desc.piod_len = size;
 
   if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2019-01-31 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy added a comment.

Thanks for review!
Please, commit this for me, because I have no commit access.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55122/new/

https://reviews.llvm.org/D55122



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r352772 - Fix use of non-existing variable in crashlog.py

2019-01-31 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Jan 31 09:33:17 2019
New Revision: 352772

URL: http://llvm.org/viewvc/llvm-project?rev=352772&view=rev
Log:
Fix use of non-existing variable in crashlog.py

Summary:
The method find_matching_slice(self) uses uuid_str on one of the paths but the 
variable does not exist and so this results in a NameError exception if we take 
that path.

Differential Revision: https://reviews.llvm.org/D57467

Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=352772&r1=352771&r2=352772&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Thu Jan 31 09:33:17 2019
@@ -260,7 +260,7 @@ class CrashLog(symbolication.Symbolicato
 if not self.resolved_path:
 self.unavailable = True
 print("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, uuid_str))
+  % (self.path, self.get_normalized_uuid_string()))
 return False
 
 def locate_module_and_debug_symbols(self):


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57467: Fix use of non-existing variable in crashlog.py

2019-01-31 Thread Shafik Yaghmour via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB352772: Fix use of non-existing variable in crashlog.py 
(authored by shafik, committed by ).

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57467/new/

https://reviews.llvm.org/D57467

Files:
  examples/python/crashlog.py


Index: examples/python/crashlog.py
===
--- examples/python/crashlog.py
+++ examples/python/crashlog.py
@@ -260,7 +260,7 @@
 if not self.resolved_path:
 self.unavailable = True
 print("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, uuid_str))
+  % (self.path, self.get_normalized_uuid_string()))
 return False
 
 def locate_module_and_debug_symbols(self):


Index: examples/python/crashlog.py
===
--- examples/python/crashlog.py
+++ examples/python/crashlog.py
@@ -260,7 +260,7 @@
 if not self.resolved_path:
 self.unavailable = True
 print("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, uuid_str))
+  % (self.path, self.get_normalized_uuid_string()))
 return False
 
 def locate_module_and_debug_symbols(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57475: [Reproducers] Add SBReproducer macros

2019-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

BTW, it would be nice to mention somewhere how to use this tool. Do you just 
run it, or does it needs some special arguments, or something?




Comment at: source/API/SBBlock.cpp:52-58
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsValid);
+  return m_opaque_ptr != NULL;
+}
 
 bool SBBlock::IsInlined() const {
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsInlined);
+

It looks like some functions have a newline after the macro, and some don't. 
What's the reason for that?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57475/new/

https://reviews.llvm.org/D57475



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57475: [Reproducers] Add SBReproducer macros

2019-01-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: source/API/SBBlock.cpp:52-58
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsValid);
+  return m_opaque_ptr != NULL;
+}
 
 bool SBBlock::IsInlined() const {
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsInlined);
+

labath wrote:
> It looks like some functions have a newline after the macro, and some don't. 
> What's the reason for that?
It depends on whether there was a newline before or not. So

```
foo { bar }
```

will not have the newline, while

```
foo {
bar;
}
```

This happens because we insert the macro at the first loc, before the 
potentially existing `\n`. Getting this right for all cases and coding styles 
is tricky, so the tool doesn't try to get it right. It just inserts it there 
and relies on clang-format to fix the formatting. 


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57475/new/

https://reviews.llvm.org/D57475



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r352780 - [unittest] Fix scalar unit test.

2019-01-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jan 31 10:48:17 2019
New Revision: 352780

URL: http://llvm.org/viewvc/llvm-project?rev=352780&view=rev
Log:
[unittest] Fix scalar unit test.

The test was using ASSERT_EQ instead of ASSERT_STREQ which meant we were
comparing string addresses instead of the actual string. This caused the
test to fail with with the sanitizers enabled.

Modified:
lldb/trunk/unittests/Utility/ScalarTest.cpp

Modified: lldb/trunk/unittests/Utility/ScalarTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ScalarTest.cpp?rev=352780&r1=352779&r2=352780&view=diff
==
--- lldb/trunk/unittests/Utility/ScalarTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ScalarTest.cpp Thu Jan 31 10:48:17 2019
@@ -288,13 +288,13 @@ TEST(ScalarTest, Scalar_512) {
   ASSERT_TRUE(Z.IsZero());
 
   Scalar S(APInt(512, 2000));
-  EXPECT_EQ(S.GetTypeAsCString(), "int512_t");
-  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
+  ASSERT_STREQ(S.GetTypeAsCString(), "int512_t");
+  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
 
   ASSERT_TRUE(S.MakeUnsigned());
   EXPECT_EQ(S.GetType(), Scalar::e_uint512);
-  EXPECT_EQ(S.GetTypeAsCString(), "unsigned int512_t");
-  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
+  ASSERT_STREQ(S.GetTypeAsCString(), "unsigned int512_t");
+  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
   EXPECT_EQ(S.GetByteSize(), 64U);
 
   ASSERT_TRUE(S.MakeSigned());


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57466: [lldb] Relax libc++ ABI version checking

2019-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I was going to say that this has the potential of breaking libstdc++ 
formatters, but it looks like you found that out already. Since the libc++ 
inline namespace can really be anything, it makes sense to have the regex match 
that. Since libstdc++ (AFAIK) doesn't have that functionality, we can get away 
with it by moving it's formatters to the front. If we end up having two c++ 
standard libraries with configurable inline namespaces, we may have to do 
something smarter, like having a single regex, but then dispatching the 
implementation based on the presence of some member variable or something...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57466/new/

https://reviews.llvm.org/D57466



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r352780 - [unittest] Fix scalar unit test.

2019-01-31 Thread Davide Italiano via lldb-commits
On Thu, Jan 31, 2019 at 10:48 AM Jonas Devlieghere via lldb-commits
 wrote:
>
> Author: jdevlieghere
> Date: Thu Jan 31 10:48:17 2019
> New Revision: 352780
>
> URL: http://llvm.org/viewvc/llvm-project?rev=352780&view=rev
> Log:
> [unittest] Fix scalar unit test.
>
> The test was using ASSERT_EQ instead of ASSERT_STREQ which meant we were
> comparing string addresses instead of the actual string. This caused the
> test to fail with with the sanitizers enabled.
>

Thank you for fixing my mistake!

--
Davide

> Modified:
> lldb/trunk/unittests/Utility/ScalarTest.cpp
>
> Modified: lldb/trunk/unittests/Utility/ScalarTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ScalarTest.cpp?rev=352780&r1=352779&r2=352780&view=diff
> ==
> --- lldb/trunk/unittests/Utility/ScalarTest.cpp (original)
> +++ lldb/trunk/unittests/Utility/ScalarTest.cpp Thu Jan 31 10:48:17 2019
> @@ -288,13 +288,13 @@ TEST(ScalarTest, Scalar_512) {
>ASSERT_TRUE(Z.IsZero());
>
>Scalar S(APInt(512, 2000));
> -  EXPECT_EQ(S.GetTypeAsCString(), "int512_t");
> -  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
> +  ASSERT_STREQ(S.GetTypeAsCString(), "int512_t");
> +  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
>
>ASSERT_TRUE(S.MakeUnsigned());
>EXPECT_EQ(S.GetType(), Scalar::e_uint512);
> -  EXPECT_EQ(S.GetTypeAsCString(), "unsigned int512_t");
> -  EXPECT_EQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
> +  ASSERT_STREQ(S.GetTypeAsCString(), "unsigned int512_t");
> +  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
>EXPECT_EQ(S.GetByteSize(), 64U);
>
>ASSERT_TRUE(S.MakeSigned());
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57475: [Reproducers] Add SBReproducer macros

2019-01-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/API/SBBlock.cpp:52-58
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsValid);
+  return m_opaque_ptr != NULL;
+}
 
 bool SBBlock::IsInlined() const {
+  SB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsInlined);
+

JDevlieghere wrote:
> labath wrote:
> > It looks like some functions have a newline after the macro, and some 
> > don't. What's the reason for that?
> It depends on whether there was a newline before or not. So
> 
> ```
> foo { bar }
> ```
> 
> will not have the newline, while
> 
> ```
> foo {
> bar;
> }
> ```
> 
> This happens because we insert the macro at the first loc, before the 
> potentially existing `\n`. Getting this right for all cases and coding styles 
> is tricky, so the tool doesn't try to get it right. It just inserts it there 
> and relies on clang-format to fix the formatting. 
Aha. That's funny.

How about changing to tool to always add *two* newlines after the macro 
invocation? clang-format removes multiple empty lines, so if this results in 
creates them, clang-format should always coalesce into one.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57475/new/

https://reviews.llvm.org/D57475



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-31 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 184586.
tatyana-krasnukha removed a subscriber: llvm-commits.
tatyana-krasnukha added a comment.

Changed configuration register handling logic: if an RSP-server doesn't provide 
a register, don't count this as a failure - just use default values for flags.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55718/new/

https://reviews.llvm.org/D55718

Files:
  include/lldb/Core/Architecture.h
  include/lldb/Utility/ArchSpec.h
  source/API/SystemInitializerFull.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.h
  source/Plugins/Architecture/Arc/CMakeLists.txt
  source/Plugins/Architecture/CMakeLists.txt
  source/Plugins/Architecture/Mips/ArchitectureMips.h
  source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -220,7 +220,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -457,7 +458,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2060,6 +2060,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1868,6 +1868,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -70,6 +70,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "GDBRemoteRegisterContext.h"
+#include "Plugins/Architecture/Arc/ArchitectureArc.h"
 #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/Utility/InferiorCallPOSIX.h"
@@ -81,6 +82,8 @@
 #include "lldb/Utility/StringExtractorGDBRemote.h"
 
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -1090,6 +1093,79 @@
   return error;
 }
 
+namespace arc {
+bool CheckArchitectureCompatibility(const ArchSpec &arch_spec,
+Flags arch_features) {
+  return ((arch_spec.GetByteOrder() == eByteOrderBig) ==
+  arch_features.Test(ArchitectureArc::eBigEndian)) &&
+  ((arch_spec.GetAddressByteSize() == 4) ==
+  arch_features.Test(ArchitectureArc::eAddressSize32));
+}
+
+Status SetArchitectureFlags(ProcessGDBRemote &process,
+const DynamicRegisterInfo ®isters,
+Architecture &arch) {
+  auto read_register_value = [®isters, &process] (
+  const RegisterInfo ®_info) -> llvm::Expected {
+
+// Configuration registers are not context-dependent.
+const auto tid = LLDB_INVALID_THREAD_ID;
+
+// Cannot use GDBR

[Lldb-commits] [PATCH] D57466: [lldb] Relax libc++ ABI version checking

2019-01-31 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

labath, was that an lg? :-)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57466/new/

https://reviews.llvm.org/D57466



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55724: [ARC] Add SystemV ABI

2019-01-31 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 184642.
tatyana-krasnukha added a comment.

Updated file headers to reflect the new license;
Updated according to the last revision of D55718 
.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55724/new/

https://reviews.llvm.org/D55724

Files:
  source/API/SystemInitializerFull.cpp
  source/Plugins/ABI/CMakeLists.txt
  source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
  source/Plugins/ABI/SysV-arc/ABISysV_arc.h
  source/Plugins/ABI/SysV-arc/CMakeLists.txt

Index: source/Plugins/ABI/SysV-arc/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-arc/CMakeLists.txt
+++ source/Plugins/ABI/SysV-arc/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_lldb_library(lldbPluginABISysV_arc PLUGIN
+  ABISysV_arc.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+  )
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.h
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.h
+++ source/Plugins/ABI/SysV-arc/ABISysV_arc.h
@@ -0,0 +1,101 @@
+//===-- ArchitectureArc.h ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_arc_h_
+#define liblldb_ABISysV_arc_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_arc : public lldb_private::ABI {
+public:
+  ~ABISysV_arc() override = default;
+
+  size_t GetRedZoneSize() const override;
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   llvm::Type &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// Stack call frame address must be 4 byte aligned.
+return (cfa & 0x3ull) == 0;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Code addresse must be 2 byte aligned.
+return (pc & 1ull) == 0;
+  }
+
+  const lldb_private::RegisterInfo *
+  GetRegisterInfoArray(uint32_t &count) override;
+
+  //--
+  // Static Functions
+  //--
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp,
+const lldb_private::ArchSpec &arch);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //--
+  // PluginInterface protocol
+  //--
+
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+private:
+  lldb::ValueObjectSP
+  GetReturnValueObjectSimple(lldb_private::Thread &thread,
+ lldb_private::CompilerType &ast_type) const;
+
+  using lldb_private::ABI::ABI; // Call CreateInstance instead.
+};
+
+#endif // liblldb_ABISysV_arc_h_
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
+++ sourc

[Lldb-commits] [PATCH] D56322: [Reproducers] SBReproducer framework

2019-01-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 184644.
JDevlieghere added a comment.

Add unit testing for supporting classes


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56322/new/

https://reviews.llvm.org/D56322

Files:
  include/lldb/API/SBReproducer.h
  source/API/CMakeLists.txt
  source/API/SBReproducer.cpp
  source/API/SBReproducerPrivate.h
  tools/driver/Driver.cpp
  unittests/API/CMakeLists.txt
  unittests/API/SBReproducerTest.cpp
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -58,6 +58,7 @@
 endfunction()
 
 add_subdirectory(TestingSupport)
+add_subdirectory(API)
 add_subdirectory(Breakpoint)
 add_subdirectory(Core)
 add_subdirectory(Disassembler)
Index: unittests/API/SBReproducerTest.cpp
===
--- /dev/null
+++ unittests/API/SBReproducerTest.cpp
@@ -0,0 +1,240 @@
+//===-- SBReproducerTest.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "SBReproducerPrivate.h"
+
+using namespace lldb_private;
+using namespace lldb_private::repro;
+
+namespace {
+struct Foo {};
+struct Bar {};
+
+struct Pod {
+  bool a = true;
+  bool b = false;
+  char c = 'a';
+  float d = 1.1;
+  int e = 2;
+  long long f = 3;
+  long g = 4;
+  short h = 5;
+  unsigned char i = 'b';
+  unsigned int j = 6;
+  unsigned long long k = 7;
+  unsigned long l = 8;
+  unsigned short m = 9;
+
+  unsigned char data[52] = {
+  0x01, 0x00, 0x61, 0xcd, 0xcc, 0x8c, 0x3f, 0x02, 0x00, 0x00, 0x00,
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x62, 0x06, 0x00, 0x00,
+  0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00};
+};
+
+class TestingSBDeserializer : public SBDeserializer {
+public:
+  using SBDeserializer::GetSBIndexToObject;
+  using SBDeserializer::SBDeserializer;
+};
+} // namespace
+
+static const Pod p;
+
+TEST(SBIndexToObjectTest, ObjectForIndex) {
+  SBIndexToObject index_to_object;
+  Foo foo;
+  Bar bar;
+
+  EXPECT_EQ(nullptr, index_to_object.GetObjectForIndex(1));
+  EXPECT_EQ(nullptr, index_to_object.GetObjectForIndex(2));
+
+  index_to_object.AddObjectForIndex(1, foo);
+  index_to_object.AddObjectForIndex(2, &bar);
+
+  EXPECT_EQ(&foo, index_to_object.GetObjectForIndex(1));
+  EXPECT_EQ(&bar, index_to_object.GetObjectForIndex(2));
+}
+
+TEST(SBDeserializerTest, HasData) {
+  {
+SBDeserializer deserializer;
+EXPECT_FALSE(deserializer.HasData());
+deserializer.LoadBuffer("a");
+EXPECT_TRUE(deserializer.HasData());
+EXPECT_FALSE(deserializer.HasData(1));
+  }
+
+  {
+SBDeserializer deserializer("");
+EXPECT_FALSE(deserializer.HasData());
+  }
+
+  {
+SBDeserializer deserializer("a");
+EXPECT_TRUE(deserializer.HasData());
+EXPECT_FALSE(deserializer.HasData(1));
+  }
+}
+
+TEST(SBDeserializerTest, DeserializePod) {
+  llvm::StringRef buffer(reinterpret_cast(p.data), 52);
+  SBDeserializer deserializer(buffer);
+
+  EXPECT_EQ(p.a, deserializer.Deserialize());
+  EXPECT_EQ(p.b, deserializer.Deserialize());
+  EXPECT_EQ(p.c, deserializer.Deserialize());
+  EXPECT_EQ(p.d, deserializer.Deserialize());
+  EXPECT_EQ(p.e, deserializer.Deserialize());
+  EXPECT_EQ(p.f, deserializer.Deserialize());
+  EXPECT_EQ(p.g, deserializer.Deserialize());
+  EXPECT_EQ(p.h, deserializer.Deserialize());
+  EXPECT_EQ(p.i, deserializer.Deserialize());
+  EXPECT_EQ(p.j, deserializer.Deserialize());
+  EXPECT_EQ(p.k, deserializer.Deserialize());
+  EXPECT_EQ(p.l, deserializer.Deserialize());
+  EXPECT_EQ(p.m, deserializer.Deserialize());
+}
+
+TEST(SBDeserializerTest, DeserializePodPointer) {
+  llvm::StringRef buffer(reinterpret_cast(p.data), 52);
+  SBDeserializer deserializer(buffer);
+
+  EXPECT_EQ(p.a, *deserializer.Deserialize());
+  EXPECT_EQ(p.b, *deserializer.Deserialize());
+  EXPECT_EQ(p.c, *deserializer.Deserialize());
+  EXPECT_EQ(p.d, *deserializer.Deserialize());
+  EXPECT_EQ(p.e, *deserializer.Deserialize());
+  EXPECT_EQ(p.f, *deserializer.Deserialize());
+  EXPECT_EQ(p.g, *deserializer.Deserialize());
+  EXPECT_EQ(p.h, *deserializer.Deserialize());
+  EXPECT_EQ(p.i, *deserializer.Deserialize());
+  EXPECT_EQ(p.j, *deserializer.Deserialize());
+  EXPECT_EQ(p.k, *deserializer.Deserialize());
+  EXPECT_EQ(p.l, *deserializer.Deserialize());
+  EXPECT_EQ(p.m, *deserializer.Deserialize());
+}
+
+TEST(SBDeserializerTest, DeserializePodReference) {
+  llvm::StringRef buffer(reinterpret_ca