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

2018-01-19 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:240
 
+CLANG_MODULE_CACHE_DIR := module-cache
+

aprantl wrote:
> Is it safe that this is a relative path?
I admit it's not great, but it's at least in keeping with the other targets we 
define in this Makefile (like a.out, the dsym, etc). As I'm writing this, I've 
realized I did not upload a diff with context, so this might not have been 
apparent!



Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:242
+
+MANDATORY_MODULE_BUILD_CFLAGS := -fmodules 
-fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
+

aprantl wrote:
> Should we also specify `-fcxxmodules` here? Or will that break some bots with 
> older clangs?
I've tried to avoid changing the flags used by each Makefile when possible. The 
only exception is my removal of "$(subst -fmodules,, $(CFLAGS))" in CXXFLAGS, 
which I needed to do because the substitution would make us pass 
"-cache-path=foo".

We might consider adding in -fcxxmodules as a followup (maybe just in 
CXXFLAGS?).


https://reviews.llvm.org/D42277



___
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-19 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 130566.
vsk added a comment.

- Upload a diff with context.


https://reviews.llvm.org/D42277

Files:
  packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
  packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
  packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
  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 
-fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
+
 ifeq "$(MAKE_GMODULES)" "YES"
-   CFLAGS += -fmodules -gmodules
+   CFLAGS += -gmodules $(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/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/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/Makefile
===
--- packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 OBJC_SOURCES := main.m
 
-CFLAGS += -fmodules -gmodules -g
+CFLAGS += -gmodules $(MANDATORY_MODULE_BUILD_CFLAGS)
 
 include $(LEVEL)/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 -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
+
 ifeq "$(MAKE_GMODULES)" "YES"
-	CFLAGS += -fmodules -gmodules
+	CFLAGS += -gmodules $(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/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/Makefile
===
--- packages/Python/lldbsuite/test/lang/objc/modu

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

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

Well.. whether this plugin is tested depends on what machine you're running on. 
If you're running on a ppc machine, plenty of tests will exercise this code 
(TestReturnValue, and pretty much any test doing expression evaluation). 
Correct me if I am wrong, but I am assuming you guys are running the lldb 
testsuite as a part of ppc64le bringup.

Given that our entire test suite is based on compiling things and running them 
on the host, I don't think it's fair to ask a random contributor to come up 
with a new test strategy.

(Of course, I would still very much like to have tests which are not 
host-dependent).


https://reviews.llvm.org/D41702



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


[Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

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

I like the direction this is going in. When looking at this, it occurred to me 
some of our tests do recursive make invocations, generally to build shared 
libraries (TestConflictingSymbol is a good example). The $(MAKE) line in those 
may need to be fixed somehow.




Comment at: packages/Python/lldbsuite/test/dotest.py:1195
+if configuration.test_build_dir:
+try: os.makedirs(configuration.test_build_dir, 448)
+except: pass

Can we just not specify the mode and let user's umask do the selection. That's 
the standard behaviour of all unix tools.



Comment at: packages/Python/lldbsuite/test/plugins/builder_base.py:69
+"-I", test_dir,
+"-f", os.path.join(test_dir, "Makefile")]
 

I like this trick. :)
Originally, I was afraid we'd have to copy the Makefile to the build folder or 
something...


https://reviews.llvm.org/D42281



___
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-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thank you for making the changes. The parsing code looks much cleaner now. I 
just have one more round of tiny remarks.




Comment at: 
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py:241
+self.port = self._socket.getsockname()[1]
+self._socket.listen(0)
+self._thread = threading.Thread(target=self._run)

You've deleted closing of the listening socket altogether (I just wanted you to 
delete the comment). The socket itself needs to be closed, of course, I just 
don't think calling shutdown on it is needed.



Comment at: 
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py:400
+temp_files = None
+process = None
+

There's already a `TestBase.process()` that should do what you need.


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] [PATCH] D42195: [lldb] Generic base for testing gdb-remote behavior

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

Oh, and please add yaml2obj as a dependency of the check-lldb target in cmake.


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] [PATCH] D42277: Use test-specific module caches to avoid stale header conflicts

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

I don't know much about clang modules, but the change seems reasonable to me.


https://reviews.llvm.org/D42277



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


Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module

2018-01-19 Thread Pavel Labath via lldb-commits
On 11 January 2018 at 22:42, Davide Italiano  wrote:
> The test Jim committed broke the public bots, so I went ahead and reverted it.
>
>
> Committing to https://llvm.org/svn/llvm-project/lldb/trunk ...
> commit 87eb2de0885d646e71d5848c1fa699b784bf5d2b
> Author: Davide Italiano 
> Date:   Thu Jan 11 14:37:49 2018 -0800
>
> [testsuite] Remove a broken test which tried to find App in bundles.
>
> That never really worked, and the change associated isn't yet
> committed, so, let's try to make the bots green for now.
>
>
> Let's make sure we add a test before we commit your change :)
>
> Thank you!


I see the test is back now, and it seems to be passing on the jenkins
bot, so I'm going to go ahead and commit this.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r322935 - Remove Platform references from the Host module

2018-01-19 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jan 19 03:10:54 2018
New Revision: 322935

URL: http://llvm.org/viewvc/llvm-project?rev=322935&view=rev
Log:
Remove Platform references from the Host module

Summary:
These were used by Host::LaunchProcess to "resolve" the executable it
was about to launch. The only parts of Platform::ResolveExecutable, which
seem to be relevant here are the FileSpec::ResolvePath and
ResolveExecutableLocation calls.

The rest (most) of that function deals with selecting an architecture
out of a fat binary and making sure we are able to create a Module with that
slice. These are reasonable actions when selecting a binary to debug,
but not for a generic process launching framework (it's technically even
wrong because we should be able to launch a binary with execute
permissions only, but trying to parse such file will obviously fail).

I remove the platform call by inlining the relevant FileSpec calls and
ignoring the rest of the Platform::ResolveExecutable code.  The
architecture found by the slice-searching code is being ignored already
anyway, as we use the one specified in the LaunchInfo, so the only
effect of this should be a different error message in case the
executable does not contain the requested architecture -- before we
would get an error message from the Platform class, but now we will get
an error from the actual posix_spawn syscall (this is only relevant on
mac, as it's the only target supporting fat binaries).

Launching targets for debugging should not be affected as here the
executable is pre-resolved at the point when the Target is created.

Reviewers: jingham, clayborg

Subscribers: lldb-commits, emaste

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

Modified:
lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
lldb/trunk/source/Host/freebsd/Host.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/netbsd/Host.cpp
lldb/trunk/source/Host/openbsd/Host.cpp

Modified: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp?rev=322935&r1=322934&r2=322935&view=diff
==
--- lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp (original)
+++ lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp Fri Jan 19 
03:10:54 2018
@@ -8,10 +8,7 @@
 
//===--===//
 
 #include "lldb/Host/MonitoringProcessLauncher.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Host/HostProcess.h"
-#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 #include "lldb/Utility/Log.h"
@@ -32,36 +29,23 @@ MonitoringProcessLauncher::LaunchProcess
   ProcessLaunchInfo resolved_info(launch_info);
 
   error.Clear();
-  char exe_path[PATH_MAX];
-
-  PlatformSP host_platform_sp(Platform::GetHostPlatform());
-
-  const ArchSpec &arch_spec = resolved_info.GetArchitecture();
 
   FileSpec exe_spec(resolved_info.GetExecutableFile());
 
   llvm::sys::fs::file_status stats;
   status(exe_spec.GetPath(), stats);
-  if (!is_regular_file(stats)) {
-ModuleSpec module_spec(exe_spec, arch_spec);
-lldb::ModuleSP exe_module_sp;
-error =
-host_platform_sp->ResolveExecutable(module_spec, exe_module_sp, NULL);
-
-if (error.Fail())
-  return HostProcess();
-
-if (exe_module_sp) {
-  exe_spec = exe_module_sp->GetFileSpec();
-  status(exe_spec.GetPath(), stats);
-}
+  if (!exists(stats)) {
+exe_spec.ResolvePath();
+status(exe_spec.GetPath(), stats);
+  }
+  if (!exists(stats)) {
+exe_spec.ResolveExecutableLocation();
+status(exe_spec.GetPath(), stats);
   }
 
-  if (exists(stats)) {
-exe_spec.GetPath(exe_path, sizeof(exe_path));
-  } else {
-resolved_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path));
-error.SetErrorStringWithFormat("executable doesn't exist: '%s'", exe_path);
+  if (!exists(stats)) {
+error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'",
+exe_spec);
 return HostProcess();
   }
 

Modified: lldb/trunk/source/Host/freebsd/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=322935&r1=322934&r2=322935&view=diff
==
--- lldb/trunk/source/Host/freebsd/Host.cpp (original)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Fri Jan 19 03:10:54 2018
@@ -29,7 +29,6 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
-#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataBufferHeap.h"

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/

[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module

2018-01-19 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322935: Remove Platform references from the Host module 
(authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D41902?vs=129435&id=130579#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41902

Files:
  lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/trunk/source/Host/freebsd/Host.cpp
  lldb/trunk/source/Host/macosx/Host.mm
  lldb/trunk/source/Host/netbsd/Host.cpp
  lldb/trunk/source/Host/openbsd/Host.cpp

Index: lldb/trunk/source/Host/openbsd/Host.cpp
===
--- lldb/trunk/source/Host/openbsd/Host.cpp
+++ lldb/trunk/source/Host/openbsd/Host.cpp
@@ -25,7 +25,6 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
-#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataBufferHeap.h"
Index: lldb/trunk/source/Host/macosx/Host.mm
===
--- lldb/trunk/source/Host/macosx/Host.mm
+++ lldb/trunk/source/Host/macosx/Host.mm
@@ -55,12 +55,9 @@
 #include 
 
 #include "lldb/Core/Communication.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/ThreadLauncher.h"
-#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/CleanUp.h"
@@ -1463,36 +1460,28 @@
 
 Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) {
   Status error;
-  char exe_path[PATH_MAX];
-  PlatformSP host_platform_sp(Platform::GetHostPlatform());
+  FileSpec exe_spec(launch_info.GetExecutableFile());
 
-  ModuleSpec exe_module_spec(launch_info.GetExecutableFile(),
- launch_info.GetArchitecture());
-
-  if (!llvm::sys::fs::is_regular_file(
-  exe_module_spec.GetFileSpec().GetPath())) {
-lldb::ModuleSP exe_module_sp;
-error = host_platform_sp->ResolveExecutable(exe_module_spec, exe_module_sp,
-NULL);
-
-if (error.Fail())
-  return error;
-
-if (exe_module_sp)
-  exe_module_spec.GetFileSpec() = exe_module_sp->GetFileSpec();
-  }
-
-  if (exe_module_spec.GetFileSpec().Exists()) {
-exe_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
-  } else {
-launch_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path));
-error.SetErrorStringWithFormat("executable doesn't exist: '%s'", exe_path);
+  llvm::sys::fs::file_status stats;
+  status(exe_spec.GetPath(), stats);
+  if (!exists(stats)) {
+exe_spec.ResolvePath();
+status(exe_spec.GetPath(), stats);
+  }
+  if (!exists(stats)) {
+exe_spec.ResolveExecutableLocation();
+status(exe_spec.GetPath(), stats);
+  }
+  if (!exists(stats)) {
+error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'",
+launch_info.GetExecutableFile());
 return error;
   }
 
   if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) {
 #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__)
-return LaunchInNewTerminalWithAppleScript(exe_path, launch_info);
+return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(),
+  launch_info);
 #else
 error.SetErrorString("launching a process in a new terminal is not "
  "supported on iOS devices");
@@ -1503,9 +1492,10 @@
   lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
 
   if (ShouldLaunchUsingXPC(launch_info)) {
-error = LaunchProcessXPC(exe_path, launch_info, pid);
+error = LaunchProcessXPC(exe_spec.GetPath().c_str(), launch_info, pid);
   } else {
-error = LaunchProcessPosixSpawn(exe_path, launch_info, pid);
+error =
+LaunchProcessPosixSpawn(exe_spec.GetPath().c_str(), launch_info, pid);
   }
 
   if (pid != LLDB_INVALID_PROCESS_ID) {
Index: lldb/trunk/source/Host/freebsd/Host.cpp
===
--- lldb/trunk/source/Host/freebsd/Host.cpp
+++ lldb/trunk/source/Host/freebsd/Host.cpp
@@ -29,7 +29,6 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
-#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataBufferHeap.h"
Index: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
===
--- lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
+++ lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
@@ -8,10 +8,7 @@
 //===--===//
 
 #include

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

2018-01-19 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added a comment.

In https://reviews.llvm.org/D41702#981456, @labath wrote:

> Well.. whether this plugin is tested depends on what machine you're running 
> on. If you're running on a ppc machine, plenty of tests will exercise this 
> code (TestReturnValue, and pretty much any test doing expression evaluation). 
> Correct me if I am wrong, but I am assuming you guys are running the lldb 
> testsuite as a part of ppc64le bringup.
>
> Given that our entire test suite is based on compiling things and running 
> them on the host, I don't think it's fair to ask a random contributor to come 
> up with a new test strategy.
>
> (Of course, I would still very much like to have tests which are not 
> host-dependent).


We are running the lldb suite as part of our development process.
And we know that there are still some issues with the PPC64le code.
But we are already working on that.
Later, we will send other patches to fix them.
Thanks!


https://reviews.llvm.org/D41702



___
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-19 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added a comment.

In https://reviews.llvm.org/D41702#980893, @davide wrote:

> Wait a minute. Is there any reason why we can't add tests now?


Thanks.
We are running the default tests of the lldb suite.
Currently, we have 48 failures that we are working on.
Could we proceed with this patch? 
We will send fixes for these issues soon.


https://reviews.llvm.org/D41702



___
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-19 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, feel free to go ahead.


https://reviews.llvm.org/D41702



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


[Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

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

Looks like a good start. It might be nice to validate that after "clean" that 
we have no files that are untracked in the test directory? This could help us 
to verify that we don't leave artifacts around.




Comment at: packages/Python/lldbsuite/test/dotest_args.py:166
+metavar='Test build directory',
+help='The root build directory for the tests')
 

Maybe add a default right here?:

```
default=os.getcwd()
```


https://reviews.llvm.org/D42281



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


[Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

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

In https://reviews.llvm.org/D42281#981969, @clayborg wrote:

> Looks like a good start. It might be nice to validate that after "clean" that 
> we have no files that are untracked in the test directory? This could help us 
> to verify that we don't leave artifacts around.


My idea was actually to remove the requirement that Makefiles have to implement 
a functional `clean:` rule, since we now can clean by merely wiping 
--build-dir. What do you think about that?


https://reviews.llvm.org/D42281



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


[Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

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

In https://reviews.llvm.org/D42281#981973, @aprantl wrote:

> In https://reviews.llvm.org/D42281#981969, @clayborg wrote:
>
> > Looks like a good start. It might be nice to validate that after "clean" 
> > that we have no files that are untracked in the test directory? This could 
> > help us to verify that we don't leave artifacts around.
>
>
> My idea was actually to remove the requirement that Makefiles have to 
> implement a functional `clean:` rule, since we now can clean by merely wiping 
> --build-dir. What do you think about that?


I think that's a much more robust solution. We had a bunch of issues with 
`clean` in the past.


https://reviews.llvm.org/D42281



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


[Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

2018-01-19 Thread Davide Italiano via Phabricator via lldb-commits
davide requested changes to this revision.
davide added a comment.
This revision now requires changes to proceed.

This looks like a decent way of going forward, I'm a little concerned about 
swallowing an error, see comment inline.




Comment at: packages/Python/lldbsuite/test/dotest.py:1196
+try: os.makedirs(configuration.test_build_dir, 448)
+except: pass
+else:

should we actually print some warning here? (e.g. directory `blah/` already 
exists?)


https://reviews.llvm.org/D42281



___
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-19 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added a comment.

In https://reviews.llvm.org/D41702#981651, @alexandreyy wrote:

> In https://reviews.llvm.org/D41702#980893, @davide wrote:
>
> > Wait a minute. Is there any reason why we can't add tests now?
>
>
> Thanks.
>  We are running the default tests of the lldb suite.
>  Currently, we have 48 failures that we are working on.
>  Could we proceed with this patch? 
>  We will send fixes for these issues soon.


@labath , Could you please commit this patch?


https://reviews.llvm.org/D41702



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


Re: [Lldb-commits] [PATCH] D42281: WIP: compile the LLDB tests out-of-tree

2018-01-19 Thread Greg Clayton via lldb-commits

> On Jan 19, 2018, at 9:04 AM, Adrian Prantl via Phabricator 
>  wrote:
> 
> aprantl added a comment.
> 
> In https://reviews.llvm.org/D42281#981969, @clayborg wrote:
> 
>> Looks like a good start. It might be nice to validate that after "clean" 
>> that we have no files that are untracked in the test directory? This could 
>> help us to verify that we don't leave artifacts around.
> 
> 
> My idea was actually to remove the requirement that Makefiles have to 
> implement a functional `clean:` rule, since we now can clean by merely wiping 
> --build-dir. What do you think about that?

That is fine. 

> https://reviews.llvm.org/D42281
> 
> 
> 

___
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-19 Thread Owen Shaw via Phabricator via lldb-commits
owenpshaw updated this revision to Diff 130643.
owenpshaw added a comment.
Herald added a subscriber: mgorny.

- Updated to use TestBase.process() instead of a new member
- Added yaml2obj dependency.  It it okay to be an unconditional dependency?
- 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


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,466 @@
+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))
+

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

2018-01-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

We have a lot of ugly boilerplate in the testsuite.  I added:

  (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
 "Set a breakpoint here", self.main_source_file)

Because that's what a lot of tests did.  I converted a handful of tests and 
then ran out of time.

If we're going to touch how all the tests get started with their executable it 
would be nice to see how many of them can be easily converted to this 
interface.  I can also add a file & line version of this, though in fact most 
tests that use file & line breakpoints actually use a source match to get a 
line number and then feed the line to lldb, so they could easily be converted 
to this.

Then all the business of locating the binary could be centralized.

I guess it's a little late for this comment, however...


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

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

> We have a lot of ugly boilerplate in the testsuite.  I added:
>
>   (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
>  "Set a breakpoint here", self.main_source_file)
>   
>
> Because that's what a lot of tests did.  I converted a handful of tests and 
> then ran out of time.
>
> If we're going to touch how all the tests get started with their executable 
> it would be nice to see how many of them can be easily converted to this 
> interface.  I can also add a file & line version of this, though in fact most 
> tests that use file & line breakpoints actually use a source match to get a 
> line number and then feed the line to lldb, so they could easily be converted 
> to this.
>
> Then all the business of locating the binary could be centralized.
>
> I guess it's a little late for this comment, however...


I think lldbutil.run_to_source_breakpoint is definitely worth standardizing on, 
but as it stands, this patch lgtm as an initial step.


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 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.

Awesome. This will make flipping the out-of-tree switch much easier.

Making more tests use lldbutil.run_to_source_breakpoint would be nice, but I 
suspect that cannot be done with a shellscript, so I wouldn't tie that to this.


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Nice!


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.

lgtm


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.

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.


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] D42280: Wrap all references to build artifacts in the LLDB testsuite in TestBase::getBuildArtifact()

2018-01-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl 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.


I skimmed through every test*.py file while preparing this patch and noticed 
that there seem to be 3-4 templates that many tests are derived from. 
Refactoring all the common code would be very good thing to do. I will try to 
get some of that done in subsequent patches.


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] 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-19 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added a comment.

Sorry for forgetting about this!  lgtm


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] D42277: Use test-specific module caches to avoid stale header conflicts

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

Per an offline comment by Adrian, include -gmodules in the mandatory set of 
module flags.


https://reviews.llvm.org/D42277

Files:
  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 = os.path.join(os.getcwd(), "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 = os.path.join(os.getcwd(), "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
+++ packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
@@ -26,7 +26,7 @@
 self.line = line_number('main.m', '// Set breakpoint 0 here.')
 
 @skipUnlessDarwin
-@skipIf(macos_version=["<", "10.12"])
+@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
 def test_expr(self):
 self.build()
 exe = os.path.join(os.getcwd(), "a.out")
Index: packages/Python/lldbsuite/test/lang/objc/modules-auto-i

[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-19 Thread Aaron Smith 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 rL322995: [SymbolFilePDB] Fix null array access when parsing 
the type of a function… (authored by asmith, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41427?vs=130089&id=130688#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41427

Files:
  lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
  lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
  lldb/trunk/lit/SymbolFile/PDB/typedefs.test
  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

Index: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
===
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
@@ -48,6 +48,10 @@
 
 typedef Class ClassTypedef;
 typedef NS::NSClass NSClassTypedef;
+typedef int(*FuncPointerTypedef)();
+typedef int(*VariadicFuncPointerTypedef)(char,...);
+FuncPointerTypedef GlobalFunc;
+VariadicFuncPointerTypedef GlobalVariadicFunc;
 int GlobalArray[10];
 
 static const int sizeof_NSClass = sizeof(NS::NSClass);
@@ -57,6 +61,8 @@
 static const int sizeof_ShortEnum = sizeof(ShortEnum);
 static const int sizeof_ClassTypedef = sizeof(ClassTypedef);
 static const int sizeof_NSClassTypedef = sizeof(NSClassTypedef);
+static const int sizeof_FuncPointerTypedef = sizeof(FuncPointerTypedef);
+static const int sizeof_VariadicFuncPointerTypedef = sizeof(VariadicFuncPointerTypedef);
 static const int sizeof_GlobalArray = sizeof(GlobalArray);
 
 int main(int argc, char **argv) {
Index: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
===
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -483,7 +483,10 @@
   llvm::DenseSet searched_files;
   TypeMap results;
 
-  const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef"};
+  const char *TypedefsToCheck[] = {
+  "ClassTypedef", "NSClassTypedef",
+  "FuncPointerTypedef", "VariadicFuncPointerTypedef"
+  };
   for (auto Typedef : TypedefsToCheck) {
 TypeMap results;
 EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false,
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -20,6 +20,7 @@
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/TypeMap.h"
+#include "lldb/Symbol/TypeList.h"
 #include "lldb/Utility/RegularExpression.h"
 
 #include "llvm/DebugInfo/PDB/GenericError.h"
@@ -318,8 +319,33 @@
 }
 
 size_t SymbolFilePDB::ParseTypes(const lldb_private::SymbolContext &sc) {
-  // TODO: Implement this
-  return size_t();
+  lldbassert(sc.module_sp.get());
+  size_t num_added = 0;
+  auto results_up = m_session_up->getGlobalScope()->findAllChildren();
+  if (!results_up)
+return 0;
+  while (auto symbol_up = results_up->getNext()) {
+switch (symbol_up->getSymTag()) {
+case PDB_SymType::Enum:
+case PDB_SymType::UDT:
+case PDB_SymType::Typedef:
+  break;
+default:
+  continue;
+}
+
+auto type_uid = symbol_up->getSymIndexId();
+if (m_types.find(type_uid) != m_types.end())
+  continue;
+
+// This should cause the type to get cached and stored in the `m_types`
+// lookup.
+if (!ResolveTypeUID(symbol_up->getSymIndexId()))
+  continue;
+
+++num_added;
+  }
+  return num_added;
 }
 
 size_t
@@ -349,8 +375,11 @@
 return nullptr;
 
   lldb::TypeSP result = pdb->CreateLLDBTypeFromPDBType(*pdb_type);
-  if (result.get())
+  if (result.get()) {
 m_types.insert(std::make_pair(type_uid, result));
+auto type_list = GetTypeList();
+type_list->Insert(result);
+  }
   return result.get();
 }
 
@@ -649,7 +678,9 @@
   return 0;
 }
 
-lldb_private::TypeList *SymbolFilePDB::GetTypeList() { return nullptr; }
+lldb_private::TypeList *SymbolFilePDB::GetTypeList() {
+  return m_obj_file->GetModule()->GetTypeList();
+}
 
 size_t SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
uint32_t type_mask,
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -26,12 +26,12 @@
 #include "llvm/DebugInfo/PDB/PDBSymbo

[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-19 Thread Aaron Smith via Phabricator via lldb-commits
asmith accepted this revision.
asmith added a comment.

Revision was approved by zturner in the comments


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] D42317: [Host] Respect LLVM_LIBDIR_SUFFIX when looking for LLDB plugins on Linux

2018-01-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: k8stone, zturner, beanz.

Fix the Linux plugin lookup path to include appropriate libdir suffix
for the system. To accomplish this, store the value of
LLVM_LIBDIR_SUFFIX in lldb/Host/Config.h as LLDB_LIBDIR_SUFFIX,
and use this variable when defining the plugin path.


https://reviews.llvm.org/D42317

Files:
  include/lldb/Host/Config.h.cmake
  source/Host/linux/HostInfoLinux.cpp


Index: source/Host/linux/HostInfoLinux.cpp
===
--- source/Host/linux/HostInfoLinux.cpp
+++ source/Host/linux/HostInfoLinux.cpp
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+#include "lldb/Host/Config.h"
 #include "lldb/Host/linux/HostInfoLinux.h"
 #include "lldb/Utility/Log.h"
 
@@ -204,7 +205,7 @@
 }
 
 bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) {
-  FileSpec temp_file("/usr/lib/lldb/plugins", true);
+  FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins", true);
   file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
   return true;
 }
Index: include/lldb/Host/Config.h.cmake
===
--- include/lldb/Host/Config.h.cmake
+++ include/lldb/Host/Config.h.cmake
@@ -14,6 +14,8 @@
 
 #cmakedefine LLDB_DISABLE_POSIX
 
+#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL


Index: source/Host/linux/HostInfoLinux.cpp
===
--- source/Host/linux/HostInfoLinux.cpp
+++ source/Host/linux/HostInfoLinux.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
 #include "lldb/Host/linux/HostInfoLinux.h"
 #include "lldb/Utility/Log.h"
 
@@ -204,7 +205,7 @@
 }
 
 bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) {
-  FileSpec temp_file("/usr/lib/lldb/plugins", true);
+  FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins", true);
   file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
   return true;
 }
Index: include/lldb/Host/Config.h.cmake
===
--- include/lldb/Host/Config.h.cmake
+++ include/lldb/Host/Config.h.cmake
@@ -14,6 +14,8 @@
 
 #cmakedefine LLDB_DISABLE_POSIX
 
+#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D42317: [Host] Respect LLVM_LIBDIR_SUFFIX when looking for LLDB plugins on Linux

2018-01-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Disclaimer: I have never seen a plugin for LLDB. I've just noticed the wrong 
path in `strace` output and fixed it ;-).


https://reviews.llvm.org/D42317



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


[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-19 Thread David Majnemer via Phabricator via lldb-commits
majnemer added inline comments.



Comment at: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp:162-163
+return ConstString("HRESULT");
+  case PDB_BuiltinType::BCD:
+return ConstString("HRESULT");
+  case PDB_BuiltinType::None:

Copy paste bug?


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