[Lldb-commits] [lldb] r323081 - Fix unrepresentable float value in ScalarTest

2018-01-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jan 22 00:11:29 2018
New Revision: 323081

URL: http://llvm.org/viewvc/llvm-project?rev=323081&view=rev
Log:
Fix unrepresentable float value in ScalarTest

Summary: float can't represent the given value in the literal, so we get this 
UB error: `runtime error: 1.23457e+48 is outside the range of representable 
values of type 'float'`. The test seems to not rely on this specific value, so 
let's just choose a smaller one that can be represented.

Reviewers: uweigand

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/unittests/Core/ScalarTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/ScalarTest.cpp?rev=323081&r1=323080&r2=323081&view=diff
==
--- lldb/trunk/unittests/Core/ScalarTest.cpp (original)
+++ lldb/trunk/unittests/Core/ScalarTest.cpp Mon Jan 22 00:11:29 2018
@@ -31,7 +31,7 @@ TEST(ScalarTest, RightShiftOperator) {
 TEST(ScalarTest, GetBytes) {
   int a = 0x01020304;
   long long b = 0x0102030405060708LL;
-  float c = 1234567.89e42;
+  float c = 1234567.89e32;
   double d = 1234567.89e42;
   char e[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
   char f[32] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16,


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


[Lldb-commits] [PATCH] D42338: Fix unrepresentable float value in ScalarTest

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323081: Fix unrepresentable float value in ScalarTest 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42338?vs=130778&id=130838#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42338

Files:
  lldb/trunk/unittests/Core/ScalarTest.cpp


Index: lldb/trunk/unittests/Core/ScalarTest.cpp
===
--- lldb/trunk/unittests/Core/ScalarTest.cpp
+++ lldb/trunk/unittests/Core/ScalarTest.cpp
@@ -31,7 +31,7 @@
 TEST(ScalarTest, GetBytes) {
   int a = 0x01020304;
   long long b = 0x0102030405060708LL;
-  float c = 1234567.89e42;
+  float c = 1234567.89e32;
   double d = 1234567.89e42;
   char e[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
   char f[32] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16,


Index: lldb/trunk/unittests/Core/ScalarTest.cpp
===
--- lldb/trunk/unittests/Core/ScalarTest.cpp
+++ lldb/trunk/unittests/Core/ScalarTest.cpp
@@ -31,7 +31,7 @@
 TEST(ScalarTest, GetBytes) {
   int a = 0x01020304;
   long long b = 0x0102030405060708LL;
-  float c = 1234567.89e42;
+  float c = 1234567.89e32;
   double d = 1234567.89e42;
   char e[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
   char f[32] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D42348: Prevent unaligned memory read in parseMinidumpString

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a reviewer: davide.
teemperor added a comment.

Thanks, I think only this and the first GoParser patch ( 
https://reviews.llvm.org/D42339 ) needs some double checking, the others ( 
https://reviews.llvm.org/D42346, https://reviews.llvm.org/D42338 ) are trivial 
and I'll merge in the next few hours as zturner suggested.


https://reviews.llvm.org/D42348



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


[Lldb-commits] [PATCH] D42346: Fix use after free in DiskFilesOrDirectories

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323082: Fix use after free in DiskFilesOrDirectories 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42346?vs=130796&id=130841#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42346

Files:
  lldb/trunk/source/Commands/CommandCompletions.cpp


Index: lldb/trunk/source/Commands/CommandCompletions.cpp
===
--- lldb/trunk/source/Commands/CommandCompletions.cpp
+++ lldb/trunk/source/Commands/CommandCompletions.cpp
@@ -165,7 +165,7 @@
 // search in the fully resolved directory, but CompletionBuffer keeps the
 // unmodified form that the user typed.
 Storage = Resolved;
-SearchDir = Resolved;
+SearchDir = Storage;
   } else {
 SearchDir = path::parent_path(CompletionBuffer);
   }


Index: lldb/trunk/source/Commands/CommandCompletions.cpp
===
--- lldb/trunk/source/Commands/CommandCompletions.cpp
+++ lldb/trunk/source/Commands/CommandCompletions.cpp
@@ -165,7 +165,7 @@
 // search in the fully resolved directory, but CompletionBuffer keeps the
 // unmodified form that the user typed.
 Storage = Resolved;
-SearchDir = Resolved;
+SearchDir = Storage;
   } else {
 SearchDir = path::parent_path(CompletionBuffer);
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r323082 - Fix use after free in DiskFilesOrDirectories

2018-01-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jan 22 01:17:16 2018
New Revision: 323082

URL: http://llvm.org/viewvc/llvm-project?rev=323082&view=rev
Log:
Fix use after free in DiskFilesOrDirectories

Summary:
We copy the local variable `Resolved` into `Storage` to keep it around. 
However, we then still let the `SearchDir` ref point to `Resolved` which then 
is used to access the already freed memory later on. With this patch we point 
to `Storage` which doesn't get deleted after the current scope exits.

Discovered by memory sanitizer in the CompletionTest.DirCompletionUsername test.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Commands/CommandCompletions.cpp

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=323082&r1=323081&r2=323082&view=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Mon Jan 22 01:17:16 2018
@@ -165,7 +165,7 @@ static int DiskFilesOrDirectories(const
 // search in the fully resolved directory, but CompletionBuffer keeps the
 // unmodified form that the user typed.
 Storage = Resolved;
-SearchDir = Resolved;
+SearchDir = Storage;
   } else {
 SearchDir = path::parent_path(CompletionBuffer);
   }


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


[Lldb-commits] [PATCH] D42347: Fix memory leaks in MinidumpParserTest

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 130846.
teemperor added a comment.

- Using make_unique now.


https://reviews.llvm.org/D42347

Files:
  unittests/Process/minidump/MinidumpParserTest.cpp


Index: unittests/Process/minidump/MinidumpParserTest.cpp
===
--- unittests/Process/minidump/MinidumpParserTest.cpp
+++ unittests/Process/minidump/MinidumpParserTest.cpp
@@ -315,9 +315,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_64(registers, reg_interface);
+  ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@
   llvm::ArrayRef registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();


Index: unittests/Process/minidump/MinidumpParserTest.cpp
===
--- unittests/Process/minidump/MinidumpParserTest.cpp
+++ unittests/Process/minidump/MinidumpParserTest.cpp
@@ -315,9 +315,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_64(registers, reg_interface);
+  ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@
   llvm::ArrayRef registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r323085 - Fix memory leaks in MinidumpParserTest

2018-01-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jan 22 01:48:40 2018
New Revision: 323085

URL: http://llvm.org/viewvc/llvm-project?rev=323085&view=rev
Log:
Fix memory leaks in MinidumpParserTest

Summary: We never delete the allocated RegisterContext objects, causing those 
tests to fail with enabled memory sanitizer.

Reviewers: dvlahovski, zturner

Reviewed By: zturner

Subscribers: zturner, lldb-commits

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

Modified:
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp

Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=323085&r1=323084&r2=323085&view=diff
==
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Mon Jan 22 
01:48:40 2018
@@ -315,9 +315,9 @@ TEST_F(MinidumpParserTest, ConvertMinidu
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@ TEST_F(MinidumpParserTest, ConvertMinidu
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_64(registers, reg_interface);
+  ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@ TEST_F(MinidumpParserTest, ConvertMinidu
   llvm::ArrayRef registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();


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


[Lldb-commits] [PATCH] D42347: Fix memory leaks in MinidumpParserTest

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323085: Fix memory leaks in MinidumpParserTest (authored by 
teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42347?vs=130846&id=130847#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42347

Files:
  lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp


Index: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -315,9 +315,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_64(registers, reg_interface);
+  ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@
   llvm::ArrayRef registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();


Index: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -315,9 +315,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@
   llvm::ArrayRef registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_64(registers, reg_interface);
+  ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@
   llvm::ArrayRef registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique(arch);
   lldb::DataBufferSP buf =
-  ConvertMinidumpContext_x86_32(registers, reg_interface);
+  ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r323086 - Fix TestTargetSymbolsAddCommand [getBuildArtifact refactor]

2018-01-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Jan 22 01:55:30 2018
New Revision: 323086

URL: http://llvm.org/viewvc/llvm-project?rev=323086&view=rev
Log:
Fix TestTargetSymbolsAddCommand [getBuildArtifact refactor]

Modified:

lldb/trunk/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py?rev=323086&r1=323085&r2=323086&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
 Mon Jan 22 01:55:30 2018
@@ -47,7 +47,7 @@ class TargetSymbolsAddCommand(TestBase):
 
 # Tell LLDB that a.out has symbols for stripped.out
 self.runCmd("target symbols add -s %s %s" %
-exe, self.getBuildArtifact("a.out"))
+(exe, self.getBuildArtifact("a.out")))
 
 # Check that symbols are now loaded and main.c is in the output.
 self.expect("frame select", substrs=['main.c'])


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


[Lldb-commits] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

2018-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added subscribers: krytarowski, jingham, davide.
labath added a comment.

In https://reviews.llvm.org/D42195#982035, @owenpshaw wrote:

> - Added yaml2obj dependency.  It it okay to be an unconditional dependency?


Yeah, it probably needs to be conditional (if(TARGET yaml2obj)), because 
standalone builds will not have that target. OTOH, standalone builds will 
probably also have an issue with finding yaml2obj. However, I don't think it 
should be up to you to make standalone builds work. cc'ing Kamil and Michal, as 
they are the ones who use those builds.

What I am not sure about is whether we need to make any changes to accomodate 
the XCode build. Jim, Davide: What would it take to make a test like this work 
from xcode?

> - I can put the socket close() back in, but had removed it because python 
> should close it automatically on garbage collection, so it didn't seem to 
> matter either way

Yes, please put it back. There's no telling when GC will happen, so we 
shouldn't be holding onto relatively scarce os resources waiting for that...


https://reviews.llvm.org/D42195



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


[Lldb-commits] [lldb] r323100 - Add SysV Abi for PPC64le

2018-01-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Jan 22 03:27:43 2018
New Revision: 323100

URL: http://llvm.org/viewvc/llvm-project?rev=323100&view=rev
Log:
Add SysV Abi for PPC64le

Summary:
This patch implements the ABI Plugin for PPC64le. It was based on the
ABI for PPC64. It also enables LLDB to evaluate expressions using JIT.

Reviewers: labath, clayborg, jhibbits, davide

Reviewed By: labath, clayborg, jhibbits, davide

Subscribers: davide, JDevlieghere, chmeee, emaste, jhibbits, hfinkel, 
lldb-commits, nemanjai, luporl, lbianc, mgorny, anajuliapc, kbarton

Differential Revision: https://reviews.llvm.org/D41702
Patch by Alexandre Yukio Yamashita 

Added:
lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_ppc64.h
lldb/trunk/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h
lldb/trunk/source/Utility/PPC64_DWARF_Registers.h
Modified:
lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=323100&r1=323099&r2=323100&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Mon Jan 22 
03:27:43 2018
@@ -33,191 +33,38 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
+#include "Utility/PPC64_DWARF_Registers.h"
+#include "Utility/PPC64LE_DWARF_Registers.h"
+
+#define DECLARE_REGISTER_INFOS_PPC64_STRUCT
+#include "Plugins/Process/Utility/RegisterInfos_ppc64.h"
+#undef DECLARE_REGISTER_INFOS_PPC64_STRUCT
+
+#define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+#include "Plugins/Process/Utility/RegisterInfos_ppc64le.h"
+#undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
 
 using namespace lldb;
 using namespace lldb_private;
 
-enum dwarf_regnums {
-  dwarf_r0 = 0,
-  dwarf_r1,
-  dwarf_r2,
-  dwarf_r3,
-  dwarf_r4,
-  dwarf_r5,
-  dwarf_r6,
-  dwarf_r7,
-  dwarf_r8,
-  dwarf_r9,
-  dwarf_r10,
-  dwarf_r11,
-  dwarf_r12,
-  dwarf_r13,
-  dwarf_r14,
-  dwarf_r15,
-  dwarf_r16,
-  dwarf_r17,
-  dwarf_r18,
-  dwarf_r19,
-  dwarf_r20,
-  dwarf_r21,
-  dwarf_r22,
-  dwarf_r23,
-  dwarf_r24,
-  dwarf_r25,
-  dwarf_r26,
-  dwarf_r27,
-  dwarf_r28,
-  dwarf_r29,
-  dwarf_r30,
-  dwarf_r31,
-  dwarf_f0,
-  dwarf_f1,
-  dwarf_f2,
-  dwarf_f3,
-  dwarf_f4,
-  dwarf_f5,
-  dwarf_f6,
-  dwarf_f7,
-  dwarf_f8,
-  dwarf_f9,
-  dwarf_f10,
-  dwarf_f11,
-  dwarf_f12,
-  dwarf_f13,
-  dwarf_f14,
-  dwarf_f15,
-  dwarf_f16,
-  dwarf_f17,
-  dwarf_f18,
-  dwarf_f19,
-  dwarf_f20,
-  dwarf_f21,
-  dwarf_f22,
-  dwarf_f23,
-  dwarf_f24,
-  dwarf_f25,
-  dwarf_f26,
-  dwarf_f27,
-  dwarf_f28,
-  dwarf_f29,
-  dwarf_f30,
-  dwarf_f31,
-  dwarf_cr,
-  dwarf_fpscr,
-  dwarf_xer = 101,
-  dwarf_lr = 108,
-  dwarf_ctr,
-  dwarf_pc,
-  dwarf_cfa,
-};
-
-// Note that the size and offset will be updated by platform-specific classes.
-#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)   
\
-  {
\
-#reg, alt, 8, 0, eEncodingUint, eFormatHex, {kind1, kind2, kind3, kind4 }, 
\
- nullptr, nullptr, nullptr, 0  
\
-  }
-
-static const RegisterInfo g_register_infos[] = {
-// General purpose registers.eh_frame,  DWARF,
-// Generic, Process Plugin
-DEFINE_GPR(r0, nullptr, dwarf_r0, dwarf_r0, LLDB_INVALID_REGNUM,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r1, "sp", dwarf_r1, dwarf_r1, LLDB_REGNUM_GENERIC_SP,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r2, nullptr, dwarf_r2, dwarf_r2, LLDB_INVALID_REGNUM,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r3, "arg1", dwarf_r3, dwarf_r3, LLDB_REGNUM_GENERIC_ARG1,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r4, "arg2", dwarf_r4, dwarf_r4, LLDB_REGNUM_GENERIC_ARG2,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r5, "arg3", dwarf_r5, dwarf_r5, LLDB_REGNUM_GENERIC_ARG3,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r6, "arg4", dwarf_r6, dwarf_r6, LLDB_REGNUM_GENERIC_ARG4,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r7, "arg5", dwarf_r7, dwarf_r7, LLDB_REGNUM_GENERIC_ARG5,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r8, "arg6", dwarf_r8, dwarf_r8, LLDB_REGNUM_GENERIC_ARG6,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r9, "arg7", dwarf_r9, dwarf_r9, LLDB_REGNUM_GENERIC_ARG7,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r10, "arg8", dwarf_r10, dwarf_r10, LLDB_REGNUM_GENERIC_ARG8,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r11, nullptr, dwarf_r11, dwarf_r11, LLDB_INVALID_REGNUM,
-   LLDB_INVALID_REGNUM),
-DEFINE_GPR(r12, nullptr, dwarf_r12, dwarf_r12, LL

[Lldb-commits] [PATCH] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D42280#982229, @jingham wrote:

> I didn't intend to block this patch, just to point out that this was really 
> work you shouldn't have had to do, and that as we touch these files we should 
> clean them up so next time we don't have to.  It will also make the test 
> files easier to read.


While we're on that topic, I would actually propose going one step further than 
`lldbutil.run_to_source_breakpoint`. I would propose creating a new test class 
(StandardLaunchTestCase ?) . This class would assume a certain executable name 
(a.out),  a certain source file name (main.cpp, but this can be taken from a 
class property, so it can be overriden to main.mm for objc tests) and a certain 
breakpoint string.

That way, it can do the "build, set breakpoint, launch, validate stop reason" 
dance without any user input in the setUp() method, and the test can start with 
the process primed and ready and just focus on the thing it's testing


Repository:
  rL LLVM

https://reviews.llvm.org/D42280



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


[Lldb-commits] [PATCH] D41702: Add SysV Abi for PPC64le

2018-01-22 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323100: Add SysV Abi for PPC64le (authored by labath, 
committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D41702?vs=130236&id=130860#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41702

Files:
  lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_ppc64.h
  lldb/trunk/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h
  lldb/trunk/source/Utility/PPC64_DWARF_Registers.h

Index: lldb/trunk/source/Utility/PPC64_DWARF_Registers.h
===
--- lldb/trunk/source/Utility/PPC64_DWARF_Registers.h
+++ lldb/trunk/source/Utility/PPC64_DWARF_Registers.h
@@ -0,0 +1,127 @@
+//===-- PPC64_DWARF_Registers.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef utility_PPC64_DWARF_Registers_h_
+#define utility_PPC64_DWARF_Registers_h_
+
+#include "lldb/lldb-private.h"
+
+namespace ppc64_dwarf {
+
+enum {
+  dwarf_r0_ppc64 = 0,
+  dwarf_r1_ppc64,
+  dwarf_r2_ppc64,
+  dwarf_r3_ppc64,
+  dwarf_r4_ppc64,
+  dwarf_r5_ppc64,
+  dwarf_r6_ppc64,
+  dwarf_r7_ppc64,
+  dwarf_r8_ppc64,
+  dwarf_r9_ppc64,
+  dwarf_r10_ppc64,
+  dwarf_r11_ppc64,
+  dwarf_r12_ppc64,
+  dwarf_r13_ppc64,
+  dwarf_r14_ppc64,
+  dwarf_r15_ppc64,
+  dwarf_r16_ppc64,
+  dwarf_r17_ppc64,
+  dwarf_r18_ppc64,
+  dwarf_r19_ppc64,
+  dwarf_r20_ppc64,
+  dwarf_r21_ppc64,
+  dwarf_r22_ppc64,
+  dwarf_r23_ppc64,
+  dwarf_r24_ppc64,
+  dwarf_r25_ppc64,
+  dwarf_r26_ppc64,
+  dwarf_r27_ppc64,
+  dwarf_r28_ppc64,
+  dwarf_r29_ppc64,
+  dwarf_r30_ppc64,
+  dwarf_r31_ppc64,
+  dwarf_f0_ppc64,
+  dwarf_f1_ppc64,
+  dwarf_f2_ppc64,
+  dwarf_f3_ppc64,
+  dwarf_f4_ppc64,
+  dwarf_f5_ppc64,
+  dwarf_f6_ppc64,
+  dwarf_f7_ppc64,
+  dwarf_f8_ppc64,
+  dwarf_f9_ppc64,
+  dwarf_f10_ppc64,
+  dwarf_f11_ppc64,
+  dwarf_f12_ppc64,
+  dwarf_f13_ppc64,
+  dwarf_f14_ppc64,
+  dwarf_f15_ppc64,
+  dwarf_f16_ppc64,
+  dwarf_f17_ppc64,
+  dwarf_f18_ppc64,
+  dwarf_f19_ppc64,
+  dwarf_f20_ppc64,
+  dwarf_f21_ppc64,
+  dwarf_f22_ppc64,
+  dwarf_f23_ppc64,
+  dwarf_f24_ppc64,
+  dwarf_f25_ppc64,
+  dwarf_f26_ppc64,
+  dwarf_f27_ppc64,
+  dwarf_f28_ppc64,
+  dwarf_f29_ppc64,
+  dwarf_f30_ppc64,
+  dwarf_f31_ppc64,
+  dwarf_cr_ppc64 = 64,
+  dwarf_fpscr_ppc64,
+  dwarf_msr_ppc64,
+  dwarf_xer_ppc64 = 100,
+  dwarf_lr_ppc64 = 108,
+  dwarf_ctr_ppc64,
+  dwarf_vscr_ppc64,
+  dwarf_vrsave_ppc64 = 356,
+  dwarf_pc_ppc64,
+  dwarf_vr0_ppc64 = 1124,
+  dwarf_vr1_ppc64,
+  dwarf_vr2_ppc64,
+  dwarf_vr3_ppc64,
+  dwarf_vr4_ppc64,
+  dwarf_vr5_ppc64,
+  dwarf_vr6_ppc64,
+  dwarf_vr7_ppc64,
+  dwarf_vr8_ppc64,
+  dwarf_vr9_ppc64,
+  dwarf_vr10_ppc64,
+  dwarf_vr11_ppc64,
+  dwarf_vr12_ppc64,
+  dwarf_vr13_ppc64,
+  dwarf_vr14_ppc64,
+  dwarf_vr15_ppc64,
+  dwarf_vr16_ppc64,
+  dwarf_vr17_ppc64,
+  dwarf_vr18_ppc64,
+  dwarf_vr19_ppc64,
+  dwarf_vr20_ppc64,
+  dwarf_vr21_ppc64,
+  dwarf_vr22_ppc64,
+  dwarf_vr23_ppc64,
+  dwarf_vr24_ppc64,
+  dwarf_vr25_ppc64,
+  dwarf_vr26_ppc64,
+  dwarf_vr27_ppc64,
+  dwarf_vr28_ppc64,
+  dwarf_vr29_ppc64,
+  dwarf_vr30_ppc64,
+  dwarf_vr31_ppc64,
+};
+
+} // namespace ppc64_dwarf
+
+#endif // utility_PPC64_DWARF_Registers_h_
Index: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
===
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
@@ -108,6 +108,8 @@
   ABISysV_ppc64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
 // Call CreateInstance instead.
   }
+
+  lldb::ByteOrder GetByteOrder() const;
 };
 
 #endif // liblldb_ABISysV_ppc64_h_
Index: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
===
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -33,199 +33,47 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
+#include "Utility/PPC64_DWARF_Registers.h"
+#include "Utility/PPC64LE_DWARF_Registers.h"
+
+#define DECLARE_REGISTER_INFOS_PPC64_STRUCT
+#include "Plugins/Process/Utility/RegisterInfos_ppc64.h"
+#undef DECLARE_REGISTER_INFOS_PPC64_STRUCT
+
+#define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+#include "Plugins/Process/Utility/RegisterInfos_ppc64le.h"
+#undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
 
 using namespace lldb;
 using namespace lldb_private;
 
-enum dwarf_regnums {
-  dwarf_r0 = 0,
-

[Lldb-commits] [PATCH] D42339: Fix uninitialized variable in GoParser

2018-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

lgtm (the go plugin is kinda unmaintained now...)


https://reviews.llvm.org/D42339



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


[Lldb-commits] [lldb] r323102 - Revert "[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it"

2018-01-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Jan 22 03:51:56 2018
New Revision: 323102

URL: http://llvm.org/viewvc/llvm-project?rev=323102&view=rev
Log:
Revert "[SymbolFilePDB] Fix null array access when parsing the type of a 
function without any arguments, i.e. 'int main()' and add support to test it"

This reverts commit r322995, as it breaks
lldb-Unit::SymbolFilePDBTests.TestTypedefs
.

Removed:
lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
lldb/trunk/lit/SymbolFile/PDB/typedefs.test
Modified:
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Removed: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp?rev=323101&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp (removed)
@@ -1,40 +0,0 @@
-// typedef
-typedef unsigned long ULongArrayTypedef[10];
-ULongArrayTypedef ULongArrayVar;
-
-typedef long double*& RefTypedef;
-long double* LongDoublePtrVar = 0;
-RefTypedef RefVar = LongDoublePtrVar;
-
-typedef long long (*FuncPtrTypedef)(int&, unsigned char**, short[], const 
double, volatile bool);
-FuncPtrTypedef FuncVar;
-
-typedef char (*VarArgsFuncTypedef)(void*, long, unsigned short, unsigned int, 
...);
-VarArgsFuncTypedef VarArgsFuncVar;
-
-typedef float (*VarArgsFuncTypedefA)(...);
-VarArgsFuncTypedefA VarArgsFuncVarA;
-
-// unscoped enum
-enum Enum { RED, GREEN, BLUE };
-Enum EnumVar;
-
-enum EnumConst { LOW, NORMAL = 10, HIGH };
-EnumConst EnumConstVar;
-
-enum EnumEmpty {};
-EnumEmpty EnumEmptyVar;
-
-enum EnumUChar : unsigned char { ON, OFF, AUTO };
-EnumUChar EnumCharVar;
-
-// scoped enum
-enum class EnumClass { YES, NO, DEFAULT };
-EnumClass EnumClassVar;
-
-enum struct EnumStruct { red, blue, black };
-EnumStruct EnumStructVar;
-  
-int main() {
-  return 0;
-}

Removed: lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/enums-layout.test?rev=323101&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/enums-layout.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/enums-layout.test (removed)
@@ -1,45 +0,0 @@
-REQUIRES: windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o 
%T/SimpleTypesTest.cpp.enums.obj
-RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main 
/OUT:%T/SimpleTypesTest.cpp.enums.exe
-RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
-
-; FIXME: PDB does not have information about scoped enumeration (Enum class) 
so the  
-; compiler type used is the same as the one for unscoped enumeration.
-
-CHECK: Module [[CU:.*]]
-CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
-CHECK:  Type{{.*}} , name = "Enum", size = 4, compiler_type = {{.*}} enum 
Enum {
-CHECK-NEXT:RED,
-CHECK-NEXT:GREEN,
-CHECK-NEXT:BLUE
-CHECK-NEXT:}
-
-CHECK:  Type{{.*}} , name = "EnumConst", size = 4, compiler_type = {{.*}} 
enum EnumConst {
-CHECK-NEXT:LOW,
-CHECK-NEXT:NORMAL,
-CHECK-NEXT:HIGH
-CHECK-NEXT:}
-
-CHECK:  Type{{.*}} , name = "EnumEmpty", size = 4, compiler_type = {{.*}} 
enum EnumEmpty {
-CHECK-NEXT:}
-
-CHECK:  Type{{.*}} , name = "EnumUChar", size = 1, compiler_type = {{.*}} 
enum EnumUChar {
-CHECK-NEXT:ON,
-CHECK-NEXT:OFF,
-CHECK-NEXT:AUTO
-CHECK-NEXT:}
-
-; Note that `enum EnumClass` is tested instead of `enum class EnumClass`
-CHECK:  Type{{.*}} , name = "EnumClass", size = 4, compiler_type = {{.*}} 
enum EnumClass {
-CHECK-NEXT:YES,
-CHECK-NEXT:NO,
-CHECK-NEXT:DEFAULT
-CHECK-NEXT:}
-
-CHECK:  Type{{.*}} , name = "EnumStruct", size = 4, compiler_type = {{.*}} 
enum EnumStruct {
-CHECK-NEXT:red,
-CHECK-NEXT:blue,
-CHECK-NEXT:black
-CHECK-NEXT:}
-
-CHECK-DAG: {{^[0-9A-F]+}}:   CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = 
"c++", file = '{{.*}}\SimpleTypesTest.cpp'

Removed: lldb/trunk/lit/SymbolFile/PDB/typedefs.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/typedefs.test?rev=323101&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/typedefs.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/typedefs.test (removed)
@@ -1,55 +0,0 @@
-REQUIRES: windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o 
%T/SimpleTypesTest.cpp.typedefs.obj
-RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main 
/

[Lldb-commits] [PATCH] D41427: [SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it

2018-01-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I have reverted this because this breaks the   
lldb-Unit::SymbolFilePDBTests.TestTypedefs test 
http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/7715. My guess 
is that this is because you did not update the checked-in exe to account for 
the changes in it's source. I'll leave up to you and Zachary to figure out 
whether you  actually want to update the exe or test everything using the 
lldb-test approach, but in the mean time, we cannot have failing tests in the 
repository.


Repository:
  rL LLVM

https://reviews.llvm.org/D41427



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


[Lldb-commits] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

2018-01-22 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

yaml2obj looks like a program from LLVM and we build and install it in pkgsrc.


https://reviews.llvm.org/D42195



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


[Lldb-commits] [lldb] r323119 - Fix uninitialized variable in GoParser

2018-01-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jan 22 06:32:43 2018
New Revision: 323119

URL: http://llvm.org/viewvc/llvm-project?rev=323119&view=rev
Log:
Fix uninitialized variable in GoParser

Summary:
`m_last_tok` isn't initialized anywhere before it's used the first time (most 
likely in the `GoParser::Rule::error` method), which causes most of the 
GoParser tests to fail with sanitizers enabled with errors like this:

```
GoParser.cpp:52:21: runtime error: load of value , which is not a 
valid value for type 'GoLexer::TokenType'
UndefinedBehaviorSanitizer: undefined-behavior GoParser.cpp:52:21
```

Reviewers: ribrdb, davide, labath

Reviewed By: labath

Subscribers: labath, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp?rev=323119&r1=323118&r2=323119&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp Mon Jan 22 
06:32:43 2018
@@ -67,7 +67,9 @@ private:
   size_t m_pos;
 };
 
-GoParser::GoParser(const char *src) : m_lexer(src), m_pos(0), m_failed(false) 
{}
+GoParser::GoParser(const char *src)
+: m_lexer(src), m_pos(0), m_last_tok(GoLexer::TOK_INVALID),
+  m_failed(false) {}
 
 GoASTStmt *GoParser::Statement() {
   Rule r("Statement", this);


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


[Lldb-commits] [PATCH] D42339: Fix uninitialized variable in GoParser

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323119: Fix uninitialized variable in GoParser (authored by 
teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42339?vs=130779&id=130877#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42339

Files:
  lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp


Index: lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
@@ -67,7 +67,9 @@
   size_t m_pos;
 };
 
-GoParser::GoParser(const char *src) : m_lexer(src), m_pos(0), m_failed(false) 
{}
+GoParser::GoParser(const char *src)
+: m_lexer(src), m_pos(0), m_last_tok(GoLexer::TOK_INVALID),
+  m_failed(false) {}
 
 GoASTStmt *GoParser::Statement() {
   Rule r("Statement", this);


Index: lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
@@ -67,7 +67,9 @@
   size_t m_pos;
 };
 
-GoParser::GoParser(const char *src) : m_lexer(src), m_pos(0), m_failed(false) {}
+GoParser::GoParser(const char *src)
+: m_lexer(src), m_pos(0), m_last_tok(GoLexer::TOK_INVALID),
+  m_failed(false) {}
 
 GoASTStmt *GoParser::Statement() {
   Rule r("Statement", this);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D42348: Prevent unaligned memory read in parseMinidumpString

2018-01-22 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM. Did you run the testsuite? If it's clean, feel free to merge.


https://reviews.llvm.org/D42348



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


[Lldb-commits] [PATCH] D42339: Fix uninitialized variable in GoParser

2018-01-22 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

LGTM. FWIW, if people are not maintaining the `Go` and the `Java` plugin we 
should consider removing them entirely.
It's a huge amount of code and if there are no users/developers, it's really 
not worth the trouble.


Repository:
  rL LLVM

https://reviews.llvm.org/D42339



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I am fine with checking this. The only issue on my end is the extra memory that 
will be needed to store these often huge mangled names in every AST context for 
the 0.0001% of the time it is actually needed.


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Thanks Greg. I'll wait another day and check this one in. Nelson, does the plan 
make sense to you?


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In https://reviews.llvm.org/D40283#983908, @clayborg wrote:

> I am fine with checking this. The only issue on my end is the extra memory 
> that will be needed to store these often huge mangled names in every AST 
> context for the 0.0001% of the time it is actually needed.


Well since this is for libstdc++ only, should we make this a platform-specific 
behavior and, e.g., disable it on Darwin?


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In https://reviews.llvm.org/D40283#983946, @aprantl wrote:

> In https://reviews.llvm.org/D40283#983908, @clayborg wrote:
>
> > I am fine with checking this. The only issue on my end is the extra memory 
> > that will be needed to store these often huge mangled names in every AST 
> > context for the 0.0001% of the time it is actually needed.
>
>
> Well since this is for libstdc++ only, should we make this a 
> platform-specific behavior and, e.g., disable it on Darwin?


Could be, but is it really worth the complexity? I'd rather defer this if we 
find it being a performance problem.
Either way is fine to me, FWIW.


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Nelson Elhage via Phabricator via lldb-commits
nelhage added a comment.

> Thanks Greg. I'll wait another day and check this one in. Nelson, does the 
> plan make sense to you?

Yep, sounds great. Thanks so much.

I'd prefer to not gate this on !Darwin, since the added complexity seems 
unfortunate, and this isn't, strictly-speaking, only about libstdc++ (although 
in practice that's the ~only place where it's likely to manifest). But I'm 
happy to write the patch if it turns out to be an issue and the maintainers 
think that's the way forward.


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

As Greg pointed out C++ (and Swift) mangled names can be enormous, so it would 
definitely have an impact on the memory footprint (unless we are only passing 
`StringRef`s around. Are we?)


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

2018-01-22 Thread Owen Shaw via Phabricator via lldb-commits
owenpshaw updated this revision to Diff 130920.
owenpshaw added a comment.

Added back socket close()

It looks like the yaml2obj target hasn't been defined yet when the check-lldb 
target is defined, so if(TARGET yaml2obj) always returns false.  Is there 
another way to do the conditional dependency?  I'm assuming we don't want to 
reorder the includes in llvm/tools/CMakeLists.txt.


https://reviews.llvm.org/D42195

Files:
  
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py
  packages/Python/lldbsuite/test/functionalities/gdb_remote_client/a.yaml
  
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  test/CMakeLists.txt

Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -13,7 +13,7 @@
 )
 endfunction()
 
-set(LLDB_TEST_DEPS lldb)
+set(LLDB_TEST_DEPS lldb yaml2obj)
 
 # darwin-debug is an hard dependency for the testsuite.
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
Index: packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
@@ -0,0 +1,467 @@
+import os
+import os.path
+import subprocess
+import threading
+import socket
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbtest_config
+
+
+def yaml2obj_executable():
+"""
+Get the path to the yaml2obj executable, which can be used to create test
+object files from easy to write yaml instructions.
+
+Throws an Exception if the executable cannot be found.
+"""
+# Tries to find yaml2obj at the same folder as the lldb
+path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "yaml2obj")
+if os.path.exists(path):
+return path
+raise Exception("yaml2obj executable not found")
+
+
+def yaml2obj(yaml_path, obj_path):
+"""
+Create an object file at the given path from a yaml file at the given path.
+
+Throws a subprocess.CalledProcessError if the object could not be created.
+"""
+yaml2obj = yaml2obj_executable()
+command = [yaml2obj, "-o=%s" % obj_path, yaml_path]
+system([command])
+
+
+def checksum(message):
+"""
+Calculate the GDB server protocol checksum of the message.
+
+The GDB server protocol uses a simple modulo 256 sum.
+"""
+check = 0
+for c in message:
+check += ord(c)
+return check % 256
+
+
+def frame_packet(message):
+"""
+Create a framed packet that's ready to send over the GDB connection
+channel.
+
+Framing includes surrounding the message between $ and #, and appending
+a two character hex checksum.
+"""
+return "$%s#%02x" % (message, checksum(message))
+
+
+def escape_binary(message):
+"""
+Escape the binary message using the process described in the GDB server
+protocol documentation.
+
+Most bytes are sent through as-is, but $, #, and { are escaped by writing
+a { followed by the original byte mod 0x20.
+"""
+out = ""
+for c in message:
+d = ord(c)
+if d in (0x23, 0x24, 0x7d):
+out += chr(0x7d)
+out += chr(d ^ 0x20)
+else:
+out += c
+return out
+
+
+def hex_encode_bytes(message):
+"""
+Encode the binary message by converting each byte into a two-character
+hex string.
+"""
+out = ""
+for c in message:
+out += "%02x" % ord(c)
+return out
+
+
+def hex_decode_bytes(hex_bytes):
+"""
+Decode the hex string into a binary message by converting each two-character
+hex string into a single output byte.
+"""
+out = ""
+hex_len = len(hex_bytes)
+while i < hex_len - 1:
+out += chr(int(hex_bytes[i:i + 2]), 16)
+i += 2
+return out
+
+
+class MockGDBServerResponder:
+"""
+A base class for handing client packets and issuing server responses for
+GDB tests.
+
+This handles many typical situations, while still allowing subclasses to
+completely customize their responses.
+
+Most subclasses will be interested in overriding the other() method, which
+handles any packet not recognized in the common packet handling code.
+"""
+
+registerCount = 40
+packetLog = None
+
+def __init__(self):
+self.packetLog = []
+
+def respond(self, packet):
+"""
+Return the unframed packet data that the server should issue in response
+to the given packet received from the client.
+"""
+self.packetLog.append(packet)
+if packet == "g":
+return self.readRegisters()
+if packet[0] == "G":
+return self.writeRegisters(packet[1:])
+if packet[0] == "p":
+return self.readRegister(int(packet[1:], 16))
+if packet[0] == "P":
+   

[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In https://reviews.llvm.org/D40283#983997, @aprantl wrote:

> As Greg pointed out C++ (and Swift) mangled names can be enormous, so it 
> would definitely have an impact on the memory footprint (unless we are only 
> passing `StringRef`s around. Are we?)


Most strings seemed to be created using clang identifiers... Not sure what this 
API uses for the asm name...


https://reviews.llvm.org/D40283



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


[Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2018-01-22 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.
Herald added a subscriber: llvm-commits.

What about having 2 versions:

1. WriteMemory(..., bool force = false), that fails if there are breakpoints in 
the area. Let user decide what to do.

If force == true just call DoWriteMemory without checking on breakpoints. It is 
needed while writing on stack, for example (and to all sections beside .text ?).
All usages should be followed with if (status.Success()).

2. WriteMemorySavingBreakpoints for that cases where it is really needed. It 
will not return bytes_written, only status.


Repository:
  rL LLVM

https://reviews.llvm.org/D39967



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


[Lldb-commits] [lldb] r323138 - Fix memory leak in TestClangASTContext.TestRecordHasFields

2018-01-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jan 22 10:56:33 2018
New Revision: 323138

URL: http://llvm.org/viewvc/llvm-project?rev=323138&view=rev
Log:
Fix memory leak in TestClangASTContext.TestRecordHasFields

Summary: We can't use unique_ptr's here because we use those variables as `out` 
parameters to some functions. Discovered by the memory sanitizer.

Subscribers: lldb-commits

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

Modified:
lldb/trunk/unittests/Symbol/TestClangASTContext.cpp

Modified: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestClangASTContext.cpp?rev=323138&r1=323137&r2=323138&view=diff
==
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp (original)
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Mon Jan 22 10:56:33 2018
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@ TEST_F(TestClangASTContext, TestRecordHa
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {


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


[Lldb-commits] [PATCH] D42386: Fix memory leak in TestClangASTContext.TestRecordHasFields

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.

We can't use unique_ptr's here because we use those variables as `out` 
parameters to some functions. Discovered by the memory sanitizer.


https://reviews.llvm.org/D42386

Files:
  unittests/Symbol/TestClangASTContext.cpp


Index: unittests/Symbol/TestClangASTContext.cpp
===
--- unittests/Symbol/TestClangASTContext.cpp
+++ unittests/Symbol/TestClangASTContext.cpp
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {


Index: unittests/Symbol/TestClangASTContext.cpp
===
--- unittests/Symbol/TestClangASTContext.cpp
+++ unittests/Symbol/TestClangASTContext.cpp
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

This will need a test, preferable covering all of the cases:

- breakpoint right at start with extra data after
- breakpoint right at start with no extra data after
- breakpoint in middle of ranges with data before and after
- breakpoint at end of range with no data after
- multiple breakpoints tests with two breakpoints in a row with no data between 
with no data before first or after last
- multiple breakpoints tests with two breakpoints in a row with no data between 
with data before first and after last
- multiple breakpoints tests with two discontiguous breakpoints data between 
them with data before first and after last

Also, when submitted a diff, please add more context using the -U option:

  % svn diff -x -U9 ...
  % git diff -U9 ...

This allows us to see the entire context (I tried to see the context for 
Process.h, but was unable to see more).


Repository:
  rL LLVM

https://reviews.llvm.org/D39967



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


[Lldb-commits] [PATCH] D42386: Fix memory leak in TestClangASTContext.TestRecordHasFields

2018-01-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323138: Fix memory leak in 
TestClangASTContext.TestRecordHasFields (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42386?vs=130926&id=130928#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42386

Files:
  lldb/trunk/unittests/Symbol/TestClangASTContext.cpp


Index: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
===
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {


Index: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
===
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I am not sure we can say for sure that a breakpoint intersected with the write 
here? I would rather just have an error saying something like "only %u of %u 
bytes in section %s were written". Extra credit for checking if there are 
overlapping breakpoints and appending "(try disabling all breakpoints and 
loading again)" to the error message.


https://reviews.llvm.org/D39969



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


[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

2018-01-22 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

Yes, I see... There is some inconsistency between status and returned value. 
That is why I wandered about this https://reviews.llvm.org/D39967#984065


https://reviews.llvm.org/D39969



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


[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

And yes, if the write memory can only write fewer byte than requested, it won't 
be an error if at least some bytes were written


https://reviews.llvm.org/D39969



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


Re: [Lldb-commits] [PATCH] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-22 Thread Jim Ingham via lldb-commits
That sounds like a great idea.  It should make a nice half-way between the 
regular SB tests and the inline tests.  The latter are super easy to write, 
which is nice, but hard to debug - particularly when you have to insert some 
more error output because the test only fails on a bot or some system you can't 
get your hands on - which happens more often that you might naively think. 

Also, the less we do by hand test by test the cleverer we can be about 
optimizing test running.

Jim

> On Jan 22, 2018, at 3:28 AM, Pavel Labath via Phabricator 
>  wrote:
> 
> labath added a comment.
> 
> In https://reviews.llvm.org/D42280#982229, @jingham wrote:
> 
>> I didn't intend to block this patch, just to point out that this was really 
>> work you shouldn't have had to do, and that as we touch these files we 
>> should clean them up so next time we don't have to.  It will also make the 
>> test files easier to read.
> 
> 
> While we're on that topic, I would actually propose going one step further 
> than `lldbutil.run_to_source_breakpoint`. I would propose creating a new test 
> class (StandardLaunchTestCase ?) . This class would assume a certain 
> executable name (a.out),  a certain source file name (main.cpp, but this can 
> be taken from a class property, so it can be overriden to main.mm for objc 
> tests) and a certain breakpoint string.
> 
> That way, it can do the "build, set breakpoint, launch, validate stop reason" 
> dance without any user input in the setUp() method, and the test can start 
> with the process primed and ready and just focus on the thing it's testing
> 
> 
> Repository:
>  rL LLVM
> 
> https://reviews.llvm.org/D42280
> 
> 
> 

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


Re: [Lldb-commits] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

2018-01-22 Thread Jim Ingham via lldb-commits


> On Jan 22, 2018, at 3:10 AM, Pavel Labath via Phabricator 
>  wrote:
> 
> labath added subscribers: krytarowski, jingham, davide.
> labath added a comment.
> 
> In https://reviews.llvm.org/D42195#982035, @owenpshaw wrote:
> 
>> - Added yaml2obj dependency.  It it okay to be an unconditional dependency?
> 
> 
> Yeah, it probably needs to be conditional (if(TARGET yaml2obj)), because 
> standalone builds will not have that target. OTOH, standalone builds will 
> probably also have an issue with finding yaml2obj. However, I don't think it 
> should be up to you to make standalone builds work. cc'ing Kamil and Michal, 
> as they are the ones who use those builds.
> 
> What I am not sure about is whether we need to make any changes to accomodate 
> the XCode build. Jim, Davide: What would it take to make a test like this 
> work from xcode?

Sorry, I haven't been following.  These seem like standard lldb-unittest2 type 
tests.  What is the difficultly of getting such a test to run from Xcode?

Jim


> 
>> - I can put the socket close() back in, but had removed it because python 
>> should close it automatically on garbage collection, so it didn't seem to 
>> matter either way
> 
> Yes, please put it back. There's no telling when GC will happen, so we 
> shouldn't be holding onto relatively scarce os resources waiting for that...
> 
> 
> https://reviews.llvm.org/D42195
> 
> 
> 

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


[Lldb-commits] [lldb] r323163 - [lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by

2018-01-22 Thread Lang Hames via lldb-commits
Author: lhames
Date: Mon Jan 22 15:53:56 2018
New Revision: 323163

URL: http://llvm.org/viewvc/llvm-project?rev=323163&view=rev
Log:
[lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
building method override tables for CXXMethodDecls in 
DWARFASTParserClang::CompleteTypeFromDWARF.

C++ virtual method calls in LLDB expressions may fail if the override table for
the method being called is not correct as IRGen will produce references to the
wrong (or a missing) vtable entry.

This patch does not fix calls to virtual methods with covariant return types as
it mistakenly treats these as overloads, rather than overrides. This will be
addressed in a future patch.

Review: https://reviews.llvm.org/D41997

Partially fixes 

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile?rev=323163&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile
 Mon Jan 22 15:53:56 2018
@@ -0,0 +1,8 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
+
+clean::
+   rm -rf $(wildcard *.o *.d *.dSYM)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py?rev=323163&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
 Mon Jan 22 15:53:56 2018
@@ -0,0 +1,47 @@
+"""
+Test calling an overriden method.
+
+Note:
+  This verifies that LLDB is correctly building the method overrides table.
+  If this table is not built correctly then calls to overridden methods in
+  derived classes may generate references to non-existant vtable entries,
+  as the compiler treats the overridden method as a totally new virtual
+  method definition.
+  
+
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class ExprCommandCallOverriddenMethod(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break for main.c.
+self.line = line_number('main.cpp', '// Set breakpoint here')
+
+def test(self):
+"""Test calls to overridden methods in derived classes."""
+self.build()
+
+# Set breakpoint in main and run exe
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+lldbutil.run_break_set_by_file_and_line(
+self, "main.cpp", self.line, num_expected_locations=-1, 
loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# Test call to method in base class (this should always work as the 
base
+# class method is never an override).
+self.expect("expr b->foo()")
+
+# Test call to overridden method in derived class (this will fail if 
the
+# overrides table is not correctly set up, as Derived::foo will be 
assigned
+# a vtable entry that does not exist in the compiled program).
+self.expect("expr d.foo()")

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp?rev=323163&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp
 Mon Jan 22 15:53:56 2018
@@ -0,0 +1,16 @@
+class Base {
+public:
+  virtual ~Base() {}
+  virtual void foo() {}
+};
+
+class Derived : public Base {
+publi

[Lldb-commits] [PATCH] D41997: Build virtual override tables in DWARFASTParserClang::CompleteTypeFromDWARF

2018-01-22 Thread Lang Hames via Phabricator via lldb-commits
lhames accepted this revision.
lhames added a comment.

Committed in r323163.




Comment at: Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2106
+// a vtable entry) from overloads (which require distinct entries).
+static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) {
+  // FIXME: This should detect covariant return types, but currently doesn't.

clayborg wrote:
> I don't like things that can crash when asserts are off. I don't see why we 
> wouldn't just check this, If someone does pass in a method from on AST and 
> another from another AST, what will happen? Crash somewhere else? Why would 
> we risk crashing or misbehaving here when it is so easy to check and avoid. 
> I'll leave it at your discretion to do what you think is right though since I 
> know clang does this all over.
This can not crash unless someone has called it out-of-contract (like passing a 
nullptr into a routine that requires not-null). If user-input can cause a value 
that would have been used as a non-null argument to be null it should be 
guarded outside the method, not inside. I.e.:

  static void foo(Foo *f) {
assert(f && "f must not be null");
//...
  }

  auto *f = lookup(readline());
  if (!f)
return; // Can't call foo without a valid f so bail out
  foo(f);

If you're passing something that can't be null, there's no need for the check:

  Foo* bar(); // Never returns null
  foo(bar()); // this is fine.

The case in this patch is like the latter: isOverload is called with two 
CXXMethodDecls, where the second was found via a lookup on a CXXRecordDecl that 
is on the same context as the first CXXMethodDecl. There's no intervening user 
input that could mess with that, so we're safe.


Repository:
  rL LLVM

https://reviews.llvm.org/D41997



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


[Lldb-commits] [PATCH] D41997: Build virtual override tables in DWARFASTParserClang::CompleteTypeFromDWARF

2018-01-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Sounds good then.


Repository:
  rL LLVM

https://reviews.llvm.org/D41997



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


[Lldb-commits] [PATCH] D42277: Use test-specific module caches to avoid stale header conflicts

2018-01-22 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 131000.
vsk added a comment.

- Skip tests which fail when -fmodules is passed 
(https://bugs.llvm.org/show_bug.cgi?id=36048).


https://reviews.llvm.org/D42277

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
  packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
  
packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
  packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
  
packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
  packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
  
packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
  packages/Python/lldbsuite/test/make/Makefile.rules

Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -237,13 +237,15 @@
 	CFLAGS += -gsplit-dwarf
 endif
 
+CLANG_MODULE_CACHE_DIR := module-cache
+
+MANDATORY_MODULE_BUILD_CFLAGS := -fmodules -gmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
+
 ifeq "$(MAKE_GMODULES)" "YES"
-	CFLAGS += -fmodules -gmodules
+	CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
 endif
 
-CXXFLAGS += -std=c++11
-# FIXME: C++ modules aren't supported on all platforms.
-CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
+CXXFLAGS += -std=c++11 $(CFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
@@ -636,7 +638,7 @@
 dsym:	$(DSYM)
 all:	$(EXE) $(DSYM)
 clean::
-	$(RM) $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
+	$(RM) -rf $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(CLANG_MODULE_CACHE_DIR)
 ifneq "$(DYLIB_NAME)" ""
 	$(RM) -r $(DYLIB_FILENAME).dSYM
 	$(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug
Index: packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
===
--- packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
+++ packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
@@ -27,7 +27,7 @@
 self.line = line_number('main.m', '// Set breakpoint here.')
 
 @skipUnlessDarwin
-@skipIf(macos_version=["<", "10.12"])
+@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
 def test_expr(self):
 self.build()
 exe = self.getBuildArtifact("a.out")
Index: packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
===
--- packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
@@ -6,4 +6,4 @@
 
 include $(LEVEL)/Makefile.rules
 
-CFLAGS += -fmodules -I$(PWD)
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
Index: packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
===
--- packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
+++ packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
@@ -24,7 +24,7 @@
 
 @skipUnlessDarwin
 @unittest2.expectedFailure("rdar://20416388")
-@skipIf(macos_version=["<", "10.12"])
+@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
 def test_expr(self):
 self.build()
 exe = self.getBuildArtifact("a.out")
Index: packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
===
--- packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
@@ -4,5 +4,5 @@
 
 include $(LEVEL)/Makefile.rules
 
-CFLAGS += -fmodules -I$(PWD)
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
 LDFLAGS += -framework Foundation
Index: packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
===
--- packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
+++ pa