[Lldb-commits] [PATCH] D56537: ObjectFilePECOFF: Create a "container" section spanning the entire module image

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added a comment.

In D56537#1393202 , @amccarth wrote:

> My knowledge of PECOFF is even more limited, but it's my understanding that 
> the ImageBase is the _preferred_ address for the module.  That doesn't 
> guarantee that's the actual address it would be loaded at.  Not just because 
> of ASLR but also because there may be conflicts with modules that have 
> already been loaded.  Is GetBaseAddress supposed to return the actual base 
> address or the preferred one?


Well, it kind of returns both. The returned Address object stores the address 
in a section-relative form. So, if you ask it for the "file address", it will 
return the "address, as known to the object file", or the "preferred load 
address", or however you like to call it. OTOH, you can also ask it for the 
"load address" for a specific target, which will consult the target for the 
load address of the section, and return the actual load address in a specific 
target. This is the main reason why I needed to create the extra container 
section sitting on top of everything (though that has other benefits too).




Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:1370
 
-auto section = section_list->GetSectionAtIndex(section_idx);
+auto section = section_list->FindSectionByID(section_id);
 if (!section)

clayborg wrote:
> How fast is this? Do we need a local cache so we aren't looking up a section 
> for each symbol? Maybe a locally cached vector since sections are represented 
> by indexes? 
It's not particularly fast (linear search), but the number of sections is 
generally small. FindSectionByID is also used in other places for Symtab 
construction (e.g. ObjectFileELF; ObjectFileMachO does some complicated thing, 
which I believe involves caching), so it doesn't seem to be too bad. If it 
turns out we need to speed up the lookup here, then I think it should be done a 
bit more generically, so that all users can benefit from this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56537



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


[Lldb-commits] [lldb] r353806 - [NativePDB] Process virtual bases in the correct order

2019-02-12 Thread Aleksandr Urakov via lldb-commits
Author: aleksandr.urakov
Date: Tue Feb 12 00:17:11 2019
New Revision: 353806

URL: http://llvm.org/viewvc/llvm-project?rev=353806&view=rev
Log:
[NativePDB] Process virtual bases in the correct order

Summary:
This patch makes virtual bases to be added in the correct order to the bases
list. It is important because `VTableContext` (`MicrosoftVTableContext` in our
case) uses then the order of virtual bases in the list to restore the virtual
table indexes. These indexes are used then to resolve the layout of the virtual
bases.

We haven't enough information about offsets of virtual bases regarding to the
object (moreover, in a common case we can't rely on such information, see the
example here: https://reviews.llvm.org/D53506#1272306 ), but there should be
enough information to restore the layout of the virtual bases from the indexes
in runtime. After D53506 this information is used whenever possible, so there
should be no problems with virtual bases' fields reading.

Reviewers: zturner, rnk, stella.stamenova

Subscribers: abidh, teemperor, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h

Modified: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit?rev=353806&r1=353805&r2=353806&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit Tue Feb 12 
00:17:11 2019
@@ -3,6 +3,8 @@ type lookup -- Class
 type lookup -- Union
 type lookup -- Derived
 type lookup -- Derived2
+type lookup -- DerivedVirtual1
+type lookup -- DerivedVirtual2
 type lookup -- EnumInt
 type lookup -- EnumShort
 type lookup -- InvalidType

Modified: lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp?rev=353806&r1=353805&r2=353806&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp Tue Feb 12 00:17:11 2019
@@ -2,7 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s
 
@@ -115,6 +115,12 @@ public:
 
 unsigned Derived2::StaticDataMember = 0;
 
+// Test virtual inheritance.
+class DerivedVirtual1 : public virtual Class {};
+
+// Test the correctness of the virtual bases order.
+class DerivedVirtual2 : public DerivedVirtual1, public virtual OneMember {};
+
 // Test scoped enums and unscoped enums.
 enum class EnumInt {
   A = 1,
@@ -133,6 +139,8 @@ int main(int argc, char **argv) {
   Union U;
   Derived D;
   Derived2 D2;
+  DerivedVirtual1 DV1;
+  DerivedVirtual2 DV2;
   EnumInt EI;
   EnumShort ES;
   
@@ -221,6 +229,12 @@ int main(int argc, char **argv) {
 // CHECK-NEXT: class Derived2 : protected Class, private Struct {
 // CHECK-NEXT: static unsigned int StaticDataMember;
 // CHECK-NEXT: }
+// CHECK-NEXT: (lldb) type lookup -- DerivedVirtual1
+// CHECK-NEXT: class DerivedVirtual1 : virtual public Class {
+// CHECK-NEXT: }
+// CHECK-NEXT: (lldb) type lookup -- DerivedVirtual2
+// CHECK-NEXT: class DerivedVirtual2 : public DerivedVirtual1, virtual public 
Class, virtual public OneMember {
+// CHECK-NEXT: }
 // CHECK-NEXT: (lldb) type lookup -- EnumInt
 // CHECK-NEXT: enum EnumInt {
 // CHECK-NEXT: A,

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp?rev=353806&r1=353805&r2=353806&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp Tue 
Feb 12 00:17:11 2019
@@ -50,7 +50,8 @@ UdtRecordCompleter::UdtRecordCompleter(P
 }
 
 clang::QualType UdtRecordCompleter::AddBaseClassForTypeIndex(
-llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access) {
+llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
+llvm::Optional vtable_idx) {
   PdbTypeSymId type_id(ti);
   clang::QualType qt = m_ast_builder.GetOrCreateType(type_id);
 
@@ -58,10 +59,13 @@ clang::QualType UdtRecordCompleter::

[Lldb-commits] [PATCH] D56904: [NativePDB] Process virtual bases in the correct order

2019-02-12 Thread Aleksandr Urakov 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 rLLDB353806: [NativePDB] Process virtual bases in the correct 
order (authored by aleksandr.urakov, committed by ).
Herald added a subscriber: jdoerfert.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56904

Files:
  lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
  lit/SymbolFile/NativePDB/tag-types.cpp
  source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h

Index: source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
===
--- source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
+++ source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
@@ -35,6 +35,9 @@
 class PdbAstBuilder;
 
 class UdtRecordCompleter : public llvm::codeview::TypeVisitorCallbacks {
+  using IndexedBase =
+  std::pair>;
+
   union UdtTagRecord {
 UdtTagRecord() {}
 llvm::codeview::UnionRecord ur;
@@ -47,7 +50,7 @@
   clang::TagDecl &m_tag_decl;
   PdbAstBuilder &m_ast_builder;
   llvm::pdb::TpiStream &m_tpi;
-  std::vector> m_bases;
+  std::vector m_bases;
   ClangASTImporter::LayoutInfo m_layout;
 
 public:
@@ -64,8 +67,9 @@
   void complete();
 
 private:
-  clang::QualType AddBaseClassForTypeIndex(llvm::codeview::TypeIndex ti,
-   llvm::codeview::MemberAccess access);
+  clang::QualType AddBaseClassForTypeIndex(
+  llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
+  llvm::Optional vtable_idx = llvm::Optional());
   void AddMethod(llvm::StringRef name, llvm::codeview::TypeIndex type_idx,
  llvm::codeview::MemberAccess access,
  llvm::codeview::MethodOptions options,
Index: source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
===
--- source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -50,7 +50,8 @@
 }
 
 clang::QualType UdtRecordCompleter::AddBaseClassForTypeIndex(
-llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access) {
+llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
+llvm::Optional vtable_idx) {
   PdbTypeSymId type_id(ti);
   clang::QualType qt = m_ast_builder.GetOrCreateType(type_id);
 
@@ -58,10 +59,13 @@
 
   std::unique_ptr base_spec =
   m_ast_builder.clang().CreateBaseClassSpecifier(
-  qt.getAsOpaquePtr(), TranslateMemberAccess(access), false,
-  udt_cvt.kind() == LF_CLASS);
+  qt.getAsOpaquePtr(), TranslateMemberAccess(access),
+  vtable_idx.hasValue(), udt_cvt.kind() == LF_CLASS);
   lldbassert(base_spec);
-  m_bases.push_back(std::move(base_spec));
+
+  m_bases.push_back(
+  std::make_pair(vtable_idx.getValueOr(0), std::move(base_spec)));
+
   return qt;
 }
 
@@ -98,9 +102,8 @@
 
 Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
VirtualBaseClassRecord &base) {
-  AddBaseClassForTypeIndex(base.BaseType, base.getAccess());
+  AddBaseClassForTypeIndex(base.BaseType, base.getAccess(), base.VTableIndex);
 
-  // FIXME: Handle virtual base offsets.
   return Error::success();
 }
 
@@ -209,9 +212,19 @@
 }
 
 void UdtRecordCompleter::complete() {
+  // Ensure the correct order for virtual bases.
+  std::stable_sort(m_bases.begin(), m_bases.end(),
+   [](const IndexedBase &lhs, const IndexedBase &rhs) {
+ return lhs.first < rhs.first;
+   });
+
+  std::vector> bases;
+  bases.reserve(m_bases.size());
+  for (auto &ib : m_bases)
+bases.push_back(std::move(ib.second));
+
   ClangASTContext &clang = m_ast_builder.clang();
-  clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(),
-std::move(m_bases));
+  clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(), std::move(bases));
 
   clang.AddMethodOverridesForCXXRecordType(m_derived_ct.GetOpaqueQualType());
   ClangASTContext::BuildIndirectFields(m_derived_ct);
Index: lit/SymbolFile/NativePDB/tag-types.cpp
===
--- lit/SymbolFile/NativePDB/tag-types.cpp
+++ lit/SymbolFile/NativePDB/tag-types.cpp
@@ -2,7 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s
 
@@ -115,6 +115,12 @@
 
 unsigned Derived2::StaticDataMember = 0;
 
+// Test virtual inheritance.
+class DerivedVirtual1 : public virtual Class {}

[Lldb-commits] [PATCH] D57995: [lldb] [cmake] Use install directories for LLVM_* variables

2019-02-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Indeed it is a problem. However, it seems to be a bug that `LLVM_INCLUDE_DIR` 
contains two directories. Apparently in regular builds it contains the 
directory with built includes only, with `LLVM_MAIN_INCLUDE_DIR` being the 
other directory. In other words, it's a mess ;-/.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57995



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


[Lldb-commits] [lldb] r353812 - Extract common PlatformPOSIX/Windows code into a separate class

2019-02-12 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Feb 12 01:27:24 2019
New Revision: 353812

URL: http://llvm.org/viewvc/llvm-project?rev=353812&view=rev
Log:
Extract common PlatformPOSIX/Windows code into a separate class

Summary:
The two classes contained a lot of duplicated code, but there wasn't a
good place to factor it to. It couldn't be the base Platform class,
since we also have platforms which are only remote (such as
PlatformGDBRemoteServer), and so it did not make sense for those to have
an m_remote_platform member.

This patch creates a new class, RemoteAwarePlatform, which can serve as
a base class for platforms which can both serve as a host, and forward
actions to a remote system. It is motivated partly by D56232 (which was
about to add a bunch of additional duplicated methods), and partly by my
own need to modify a function which happens to be implemented in both
places identically.

The patch moves the methods which are trivially identical in the two
classes into the common base class, there were one or two more methods
which could probably be merged into one, but this wasn't completely
trivial, so I did not attempt to do that now.

Reviewers: jingham, zturner, clayborg, asmith

Subscribers: emaste, mgorny, Hui, lldb-commits

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

Added:
lldb/trunk/include/lldb/Target/RemoteAwarePlatform.h
lldb/trunk/source/Target/RemoteAwarePlatform.cpp
Modified:
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
lldb/trunk/source/Target/CMakeLists.txt

Added: lldb/trunk/include/lldb/Target/RemoteAwarePlatform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RemoteAwarePlatform.h?rev=353812&view=auto
==
--- lldb/trunk/include/lldb/Target/RemoteAwarePlatform.h (added)
+++ lldb/trunk/include/lldb/Target/RemoteAwarePlatform.h Tue Feb 12 01:27:24 
2019
@@ -0,0 +1,50 @@
+//===-- RemoteAwarePlatform.h ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_TARGET_REMOTEAWAREPLATFORM_H
+#define LLDB_TARGET_REMOTEAWAREPLATFORM_H
+
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+/// A base class for platforms which automatically want to be able to forward
+/// operations to a remote platform instance (such as PlatformRemoteGDBServer).
+class RemoteAwarePlatform : public Platform {
+public:
+  using Platform::Platform;
+
+  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
+ ModuleSpec &module_spec) override;
+  Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
+ FileSpec &local_file) override;
+
+  bool GetRemoteOSVersion() override;
+  bool GetRemoteOSBuildString(std::string &s) override;
+  bool GetRemoteOSKernelDescription(std::string &s) override;
+  ArchSpec GetRemoteSystemArchitecture() override;
+
+  const char *GetHostname() override;
+  const char *GetUserName(uint32_t uid) override;
+  const char *GetGroupName(uint32_t gid) override;
+  lldb_private::Environment GetEnvironment() override;
+
+  bool IsConnected() const override;
+
+  bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) 
override;
+  uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &process_infos) override;
+  Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
+
+protected:
+  lldb::PlatformSP m_remote_platform_sp;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=353812&r1=353811&r2=353812&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Tue Feb 12 
01:27:24 2019
@@ -40,11 +40,10 @@ using namespace lldb_private;
 /// Default Constructor
 //--
 PlatformPOSIX::PlatformPOSIX(bool is_host)
-: Platform(is_host), // This is the local host platform
+: RemoteAwarePlatform(is_host), // This is the local host platform
   m_option_group_platform_rsync(new OptionGroupPlatformRSync()),
   m_option_group_platform_ssh(new OptionGroupPlatformSSH()),
-  m

[Lldb-commits] [PATCH] D58052: Extract common PlatformPOSIX/Windows code into a separate class

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB353812: Extract common PlatformPOSIX/Windows code into a 
separate class (authored by labath, committed by ).
Herald added a subscriber: jdoerfert.
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D58052?vs=186258&id=186414#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58052

Files:
  include/lldb/Target/RemoteAwarePlatform.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/Windows/PlatformWindows.cpp
  source/Plugins/Platform/Windows/PlatformWindows.h
  source/Target/CMakeLists.txt
  source/Target/RemoteAwarePlatform.cpp

Index: include/lldb/Target/RemoteAwarePlatform.h
===
--- include/lldb/Target/RemoteAwarePlatform.h
+++ include/lldb/Target/RemoteAwarePlatform.h
@@ -0,0 +1,50 @@
+//===-- RemoteAwarePlatform.h ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_TARGET_REMOTEAWAREPLATFORM_H
+#define LLDB_TARGET_REMOTEAWAREPLATFORM_H
+
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+/// A base class for platforms which automatically want to be able to forward
+/// operations to a remote platform instance (such as PlatformRemoteGDBServer).
+class RemoteAwarePlatform : public Platform {
+public:
+  using Platform::Platform;
+
+  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
+ ModuleSpec &module_spec) override;
+  Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
+ FileSpec &local_file) override;
+
+  bool GetRemoteOSVersion() override;
+  bool GetRemoteOSBuildString(std::string &s) override;
+  bool GetRemoteOSKernelDescription(std::string &s) override;
+  ArchSpec GetRemoteSystemArchitecture() override;
+
+  const char *GetHostname() override;
+  const char *GetUserName(uint32_t uid) override;
+  const char *GetGroupName(uint32_t gid) override;
+  lldb_private::Environment GetEnvironment() override;
+
+  bool IsConnected() const override;
+
+  bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
+  uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &process_infos) override;
+  Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
+
+protected:
+  lldb::PlatformSP m_remote_platform_sp;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -40,11 +40,10 @@
 /// Default Constructor
 //--
 PlatformPOSIX::PlatformPOSIX(bool is_host)
-: Platform(is_host), // This is the local host platform
+: RemoteAwarePlatform(is_host), // This is the local host platform
   m_option_group_platform_rsync(new OptionGroupPlatformRSync()),
   m_option_group_platform_ssh(new OptionGroupPlatformSSH()),
-  m_option_group_platform_caching(new OptionGroupPlatformCaching()),
-  m_remote_platform_sp() {}
+  m_option_group_platform_caching(new OptionGroupPlatformCaching()) {}
 
 //--
 /// Destructor.
@@ -54,16 +53,6 @@
 //--
 PlatformPOSIX::~PlatformPOSIX() {}
 
-bool PlatformPOSIX::GetModuleSpec(const FileSpec &module_file_spec,
-  const ArchSpec &arch,
-  ModuleSpec &module_spec) {
-  if (m_remote_platform_sp)
-return m_remote_platform_sp->GetModuleSpec(module_file_spec, arch,
-   module_spec);
-
-  return Platform::GetModuleSpec(module_file_spec, arch, module_spec);
-}
-
 lldb_private::OptionGroupOptions *PlatformPOSIX::GetConnectionOptions(
 lldb_private::CommandInterpreter &interpreter) {
   auto iter = m_options.find(&interpreter), end = m_options.end();
@@ -79,14 +68,6 @@
   return m_options.at(&interpreter).get();
 }
 
-bool PlatformPOSIX::IsConnected() const {
-  if (IsHost())
-return true;
-  else if (m_remote_platform_sp)
-return m_remote_platform_sp->IsConnected();
-  return false;
-}
-
 lldb_private::Status PlatformPOSIX::RunShellCommand(
 const char *command, // Shouldn't be NULL

[Lldb-commits] [PATCH] D57995: [lldb] [cmake] Use install directories for LLVM_* variables

2019-02-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 186427.
mgorny added a comment.

Updated to use exported LLVM_MAIN_INCLUDE_DIR, as introduced by D58109 
. This works both for build-tree and 
install-tree, and avoids having to introduce any conditionals.


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

https://reviews.llvm.org/D57995

Files:
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -20,9 +20,9 @@
   set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake 
modules")
 
   set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM 
source tree")
-  set(LLVM_MAIN_INCLUDE_DIR ${LLVM_BUILD_MAIN_INCLUDE_DIR} CACHE PATH "Path to 
llvm/include")
-  set(LLVM_LIBRARY_DIR ${LLVM_BUILD_LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
-  set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build 
tree")
+  set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to 
llvm/include")
+  set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR} CACHE PATH "Path to LLVM build tree")
   set(LLVM_DEFAULT_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH 
"Path to llvm-lit")
 
   if(CMAKE_CROSSCOMPILING)


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -20,9 +20,9 @@
   set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
 
   set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-  set(LLVM_MAIN_INCLUDE_DIR ${LLVM_BUILD_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-  set(LLVM_LIBRARY_DIR ${LLVM_BUILD_LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
-  set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree")
+  set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
+  set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR} CACHE PATH "Path to LLVM build tree")
   set(LLVM_DEFAULT_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit")
 
   if(CMAKE_CROSSCOMPILING)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56232: [lldb-server] Add remote platform capabilities for Windows

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.
Herald added a project: LLDB.

`RemoteAwarePlatform` is a thing now, so you should be able to take the methods 
from PlatformPOSIX which make sense for you, and sink them into the new class.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56232



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


[Lldb-commits] [PATCH] D57995: [lldb] [cmake] Use install directories for LLVM_* variables

2019-02-12 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

In D57995#1394412 , @mgorny wrote:

> Indeed it is a problem. However, it seems to be a bug that `LLVM_INCLUDE_DIR` 
> contains two directories.


Yes, especially since we also have `LLVM_INCLUDE_DIRS`. But that's not the 
end.. in `llvm/cmake/modules/CMakeLists.txt` we set:

  set(LLVM_CONFIG_INCLUDE_DIRS
"${LLVM_MAIN_INCLUDE_DIR}"
"${LLVM_INCLUDE_DIR}"
)

The `LLVMConfig.cmake.in` template stores it as:

  set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
  set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
  
  # These variables are duplicated, but they must match the LLVM variables of 
the
  # same name. The variables ending in "S" could some day become lists, and are
  # preserved for convention and compatibility.
  set(LLVM_INCLUDE_DIR "@LLVM_CONFIG_INCLUDE_DIRS@")
  set(LLVM_LIBRARY_DIR "@LLVM_CONFIG_LIBRARY_DIRS@")

The install step fixes that and generates:

  set(LLVM_INCLUDE_DIR "${LLVM_INSTALL_PREFIX}/include")
  set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")

Result:

- LLVM itself and clients of the install-tree see 
`LLVM_INCLUDE_DIR=/path/to/llvm-build/include`
- Clients of the build-tree see 
`LLVM_INCLUDE_DIR=/path/to/llvm/include;/path/to/llvm-build/include`

This should really be fixed. Looks like the confusion started with 
https://reviews.llvm.org/rL280013 and manifested with 
https://reviews.llvm.org/rL280380.

> In other words, it's a mess ;-/.

Yes, definitely


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

https://reviews.llvm.org/D57995



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


[Lldb-commits] [PATCH] D57402: build: remove custom variables

2019-02-12 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz requested changes to this revision.
sgraenitz added a comment.
This revision now requires changes to proceed.

Actually, both use cases already work without this change: passing `LLVM_DIR && 
Clang_DIR` or passing `LLDB_PATH_TO_LLVM_BUILD`. IMHO this patch needs good 
reason to land.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57402



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


[Lldb-commits] [lldb] r353841 - Have Stream::PutCStringAsRawHex8 take llvm::StringRef

2019-02-12 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Feb 12 06:28:55 2019
New Revision: 353841

URL: http://llvm.org/viewvc/llvm-project?rev=353841&view=rev
Log:
Have Stream::PutCStringAsRawHex8 take llvm::StringRef

This enables the function to be called with a StringRef without jumping
through any hoops. I rename the function to "PutStringAsRawHex8" to
honor the extended interface. I also remove ".c_str()" from any calls to
this function I could find.

Modified:
lldb/trunk/include/lldb/Utility/Stream.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Utility/Stream.cpp
lldb/trunk/unittests/Utility/StreamTest.cpp

Modified: lldb/trunk/include/lldb/Utility/Stream.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Stream.h?rev=353841&r1=353840&r2=353841&view=diff
==
--- lldb/trunk/include/lldb/Utility/Stream.h (original)
+++ lldb/trunk/include/lldb/Utility/Stream.h Tue Feb 12 06:28:55 2019
@@ -203,7 +203,7 @@ public:
  lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid,
  lldb::ByteOrder dst_byte_order = lldb::eByteOrderInvalid);
 
-  size_t PutCStringAsRawHex8(const char *s);
+  size_t PutStringAsRawHex8(llvm::StringRef s);
 
   //--
   /// Output a NULL terminated C string \a cstr to the stream \a s.

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=353841&r1=353840&r2=353841&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Feb 12 06:28:55 2019
@@ -1746,7 +1746,7 @@ int GDBRemoteCommunicationClient::SetSTD
 std::string path{file_spec.GetPath(false)};
 StreamString packet;
 packet.PutCString("QSetSTDIN:");
-packet.PutCStringAsRawHex8(path.c_str());
+packet.PutStringAsRawHex8(path);
 
 StringExtractorGDBRemote response;
 if (SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
@@ -1766,7 +1766,7 @@ int GDBRemoteCommunicationClient::SetSTD
 std::string path{file_spec.GetPath(false)};
 StreamString packet;
 packet.PutCString("QSetSTDOUT:");
-packet.PutCStringAsRawHex8(path.c_str());
+packet.PutStringAsRawHex8(path);
 
 StringExtractorGDBRemote response;
 if (SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
@@ -1786,7 +1786,7 @@ int GDBRemoteCommunicationClient::SetSTD
 std::string path{file_spec.GetPath(false)};
 StreamString packet;
 packet.PutCString("QSetSTDERR:");
-packet.PutCStringAsRawHex8(path.c_str());
+packet.PutStringAsRawHex8(path);
 
 StringExtractorGDBRemote response;
 if (SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
@@ -1822,7 +1822,7 @@ int GDBRemoteCommunicationClient::SetWor
 std::string path{working_dir.GetPath(false)};
 StreamString packet;
 packet.PutCString("QSetWorkingDir:");
-packet.PutCStringAsRawHex8(path.c_str());
+packet.PutStringAsRawHex8(path);
 
 StringExtractorGDBRemote response;
 if (SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
@@ -2792,7 +2792,7 @@ lldb_private::Status GDBRemoteCommunicat
   if (working_dir) {
 std::string path{working_dir.GetPath(false)};
 stream.PutChar(',');
-stream.PutCStringAsRawHex8(path.c_str());
+stream.PutStringAsRawHex8(path);
   }
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(stream.GetString(), response, false) ==
@@ -2829,7 +2829,7 @@ Status GDBRemoteCommunicationClient::Mak
   stream.PutCString("qPlatform_mkdir:");
   stream.PutHex32(file_permissions);
   stream.PutChar(',');
-  stream.PutCStringAsRawHex8(path.c_str());
+  stream.PutStringAsRawHex8(path);
   llvm::StringRef packet = stream.GetString();
   StringExtractorGDBRemote response;
 
@@ -2851,7 +2851,7 @@ GDBRemoteCommunicationClient::SetFilePer
   stream.PutCString("qPlatform_chmod:");
   stream.PutHex32(file_permissions);
   stream.PutChar(',');
-  stream.PutCStringAsRawHex8(path.c_str());
+  stream.PutStringAsRawHex8(path);
   llvm::StringRef packet = stream.GetString();
   StringExtractorGDBRemote response;
 
@@ -28

[Lldb-commits] [PATCH] D56537: ObjectFilePECOFF: Create a "container" section spanning the entire module image

2019-02-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added inline comments.
This revision is now accepted and ready to land.



Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:1370
 
-auto section = section_list->GetSectionAtIndex(section_idx);
+auto section = section_list->FindSectionByID(section_id);
 if (!section)

labath wrote:
> clayborg wrote:
> > How fast is this? Do we need a local cache so we aren't looking up a 
> > section for each symbol? Maybe a locally cached vector since sections are 
> > represented by indexes? 
> It's not particularly fast (linear search), but the number of sections is 
> generally small. FindSectionByID is also used in other places for Symtab 
> construction (e.g. ObjectFileELF; ObjectFileMachO does some complicated 
> thing, which I believe involves caching), so it doesn't seem to be too bad. 
> If it turns out we need to speed up the lookup here, then I think it should 
> be done a bit more generically, so that all users can benefit from this.
I think this is actually ok because PECOFF files generally don't have many (if 
any) symbols in them. Unless we did the symbol table out of another location in 
the file that isn't the standard PECOFF symbol table.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56537



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


[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: aprantl, jingham, shafik, friss, davide.
teemperor added a project: C++ modules in LLDB.
Herald added subscribers: lldb-commits, jdoerfert, abidh, mgorny.
Herald added a reviewer: serge-sans-paille.
Herald added a project: LLDB.

This patch is the MVP version of importing the std module into the expression 
parser to improve C++ debugging.

What happens in this patch is that we inject a `@import std` into our 
expression source code. We also
modify our internal Clang instance for parsing this expression to work with 
modules and debug info
at the same time (which is the main change in terms of LOC). We implicitly 
build the `std` module on the first use. The
C++ include paths for building are extracted from the debug info, which means 
that this currently only
works if the program is compiled with `-glldb -fmodules` and uses the std 
module. The C include paths
are currently specified by LLDB.

I enabled the tests currently only for libc++ and Linux because I could test 
this locally. I'll enable the tests
for other platforms once this has landed and doesn't break any bots (and I 
implemented the platform-specific
C include paths for them).

With this patch we can now:

- Build a libc++ as a module and import it into the expression parser.
- Read from the module while also referencing declarations from the debug info. 
E.g. `std::abs(local_variable)`.

What doesn't work (yet):

- Merging debug info and C++ module declarations. E.g. 
`std::vector` doesn't work.
- Pretty much anything that involves the ASTImporter and templated code. As the 
ASTImporter is used for saving the result declaration, this means that we can't

call yet any function that returns a non-trivial type.

- Use libstdc++ for this, as it requires multiple include paths and Clang only 
emits one include path per module. Also libstdc++ doesn't support Clang modules 
without patches.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58125

Files:
  lldb/include/lldb/Expression/ExpressionSourceCode.h
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolVendor.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Target.h
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/main.cpp
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/main.cpp
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/main.cpp
  lldb/source/Expression/ExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTConsumerUtils.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTConsumerUtils.h
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
  lldb/source/Plugins/Platform/Linux/PlatformLinux.h
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/SymbolVendor.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3313,6 +3313,9 @@
 {"auto-import-clang-modules", OptionValue::eTypeBoolean, false, true,
  nullptr, {},
  "Automatically load Clang modules referred to by the program."},
+{"

[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor planned changes to this revision.
teemperor added a comment.

All the changes regarding extracting module include paths are probably 
superseded by Adrian's patch (which does the same thing nicer). So all the code 
related to `GetModuleIncludes` will be removed from this patch most likely.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58125



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


[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 186478.
teemperor added a comment.

- Cleaned up setup method.


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

https://reviews.llvm.org/D58125

Files:
  lldb/include/lldb/Expression/ExpressionSourceCode.h
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolVendor.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Target.h
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/main.cpp
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/main.cpp
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/TestImportStdModule.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/no-std-module/main.cpp
  lldb/source/Expression/ExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTConsumerUtils.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTConsumerUtils.h
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
  lldb/source/Plugins/Platform/Linux/PlatformLinux.h
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/SymbolVendor.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3313,6 +3313,9 @@
 {"auto-import-clang-modules", OptionValue::eTypeBoolean, false, true,
  nullptr, {},
  "Automatically load Clang modules referred to by the program."},
+{"import-std-module", OptionValue::eTypeBoolean, false, false,
+ nullptr, {},
+ "Import the C++ std module to improve debugging STL containers."},
 {"auto-apply-fixits", OptionValue::eTypeBoolean, false, true, nullptr,
  {}, "Automatically apply fix-it hints to expressions."},
 {"notify-about-fixits", OptionValue::eTypeBoolean, false, true, nullptr,
@@ -3451,6 +3454,7 @@
   ePropertyDebugFileSearchPaths,
   ePropertyClangModuleSearchPaths,
   ePropertyAutoImportClangModules,
+  ePropertyImportStdModule,
   ePropertyAutoApplyFixIts,
   ePropertyNotifyAboutFixIts,
   ePropertySaveObjects,
@@ -3873,6 +3877,12 @@
   nullptr, idx, g_properties[idx].default_uint_value != 0);
 }
 
+bool TargetProperties::GetEnableImportStdModule() const {
+  const uint32_t idx = ePropertyImportStdModule;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
 bool TargetProperties::GetEnableAutoApplyFixIts() const {
   const uint32_t idx = ePropertyAutoApplyFixIts;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
Index: lldb/source/Symbol/SymbolVendor.cpp
===
--- lldb/source/Symbol/SymbolVendor.cpp
+++ lldb/source/Symbol/SymbolVendor.cpp
@@ -185,12 +185,15 @@
 }
 
 bool SymbolVendor::ParseImportedModules(
-const SymbolContext &sc, std::vector &imported_modules) {
+const SymbolContext &sc,
+std::vector &imported_modules,
+std::vector &module_includes) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
 std::lock_guard guard(module_sp->GetMutex());
 if (m_sym_file_ap.get())
-  return m_sym_file_ap->ParseImportedModules(sc, imported_modules);
+  return m_sym_file_ap->ParseImportedModules(sc, imp

[Lldb-commits] [PATCH] D58090: [WIP] Deserialize Clang module search path from DWARF

2019-02-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: jdoerfert.

+1. That's a cleaner version of what I had to do in D58125 
, so feel free to commit when done. The code 
is similar enough that rebasing my patch on top shouldn't take too much time.




Comment at: include/lldb/Symbol/SourceModule.h:13
+#include 
+
+namespace lldb_private {

Should also include `lldb/Utility/ConstString.h` otherwise this breaks the 
module build.



Comment at: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:320
+for (auto &imported_module : imported_modules) {
   std::vector path;
+  if (!AddModule(imported_module, &exported_modules, error_stream))

path is unused.


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

https://reviews.llvm.org/D58090



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


[Lldb-commits] [PATCH] D58129: Move UnwindTable from ObjectFile to Module

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: jasonmolenda, clayborg.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

This is a preparatory step to enable adding extra unwind strategies by
symbol file plugins. This has been discussed on the lldb-dev mailing
list: http://lists.llvm.org/pipermail/lldb-dev/2019-February/014703.html.


https://reviews.llvm.org/D58129

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/ObjectFile.h
  source/Commands/CommandObjectTarget.cpp
  source/Core/Module.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  source/Symbol/ObjectFile.cpp

Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -263,8 +263,7 @@
 : ModuleChild(module_sp),
   m_file(), // This file could be different from the original module's file
   m_type(eTypeInvalid), m_strata(eStrataInvalid),
-  m_file_offset(file_offset), m_length(length), m_data(),
-  m_unwind_table(*this), m_process_wp(),
+  m_file_offset(file_offset), m_length(length), m_data(), m_process_wp(),
   m_memory_addr(LLDB_INVALID_ADDRESS), m_sections_ap(), m_symtab_ap(),
   m_synthetic_symbol_idx(0) {
   if (file_spec_ptr)
@@ -286,9 +285,8 @@
DataBufferSP &header_data_sp)
 : ModuleChild(module_sp), m_file(), m_type(eTypeInvalid),
   m_strata(eStrataInvalid), m_file_offset(0), m_length(0), m_data(),
-  m_unwind_table(*this), m_process_wp(process_sp),
-  m_memory_addr(header_addr), m_sections_ap(), m_symtab_ap(),
-  m_synthetic_symbol_idx(0) {
+  m_process_wp(process_sp), m_memory_addr(header_addr), m_sections_ap(),
+  m_symtab_ap(), m_synthetic_symbol_idx(0) {
   if (header_data_sp)
 m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize());
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Index: source/Plugins/Process/Utility/RegisterContextLLDB.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -239,9 +239,8 @@
 
 if (m_sym_ctx_valid) {
   func_unwinders_sp =
-  pc_module_sp->GetObjectFile()
-  ->GetUnwindTable()
-  .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+  pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+  m_current_pc, m_sym_ctx);
 }
 
 if (func_unwinders_sp.get() != nullptr)
@@ -672,9 +671,8 @@
 return unwind_plan_sp;
 
   FuncUnwindersSP func_unwinders_sp(
-  pc_module_sp->GetObjectFile()
-  ->GetUnwindTable()
-  .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx));
+  pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+  m_current_pc, m_sym_ctx));
   if (!func_unwinders_sp)
 return unwind_plan_sp;
 
@@ -775,9 +773,8 @@
   FuncUnwindersSP func_unwinders_sp;
   if (m_sym_ctx_valid) {
 func_unwinders_sp =
-pc_module_sp->GetObjectFile()
-->GetUnwindTable()
-.GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+m_current_pc, m_sym_ctx);
   }
 
   // No FuncUnwinders available for this pc (stripped function symbols, lldb
@@ -795,7 +792,7 @@
 // Even with -fomit-frame-pointer, we can try eh_frame to get back on
 // track.
 DWARFCallFrameInfo *eh_frame =
-pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo();
+pc_module_sp->GetUnwindTable()->GetEHFrameInfo();
 if (eh_frame) {
   unwind_plan_sp = std::make_shared(lldb::eRegisterKindGeneric);
   if (eh_frame->GetUnwindPlan(m_current_pc, *unwind_plan_sp))
@@ -805,7 +802,7 @@
 }
 
 ArmUnwindInfo *arm_exidx =
-pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo();
+pc_module_sp->GetUnwindTable()->GetArmUnwindInfo();
 if (arm_exidx) {
   unwind_plan_sp = std::make_shared(lldb::eRegisterKindGeneric);
   if (arm_exidx->GetUnwindPlan(exe_ctx.GetTargetRef(), m_current_pc,
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2862,8 +2862,8 @@
   }
 }
 
-DWARFCallFrameInfo *eh_frame = GetUnwindTable().GetEHFrameInfo();
-if (eh_frame) {
+if (DWARFCallFrameInfo *eh_frame =
+GetModule()->GetUnwindTable()->GetEHFrameInfo()) {
   if (m_symtab_ap == nullptr)
 m_symtab_ap.reset(new Symtab(this));
   ParseUnwindSymbols(m_symtab_ap.get(), eh_frame);
Index: source/Core/Module.cpp

[Lldb-commits] [PATCH] D58131: [lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

2019-02-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: k8stone, labath, krytarowski.
mgorny added a project: LLDB.

Fix the tests not to use '127.0.0.1' and 'localhost' interchangeably.
More specifically, since tests bind specifically to 127.0.0.1, connect
to that address as well; using 'localhost' can resolve to IPv6 address
which can cause issues -- for example, if the matching port happens to
be used by some other process, the tests hang forever waiting for
the client to connect.

While technically the case of randomly selected IPv4 port being taken
on IPv6 loopback is not very likely, NetBSD happens to be suffering from
some weird kernel issue where connection to that port succeeds
nevertheless.  Until we can really figure out what goes wrong there,
this saves us from the tests hanging randomly.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58131

Files:
  lldb/unittests/Host/SocketTest.cpp
  lldb/unittests/tools/lldb-server/tests/TestClient.cpp


Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -80,7 +80,7 @@
 return status.ToError();
 
   args.AppendArgument(
-  ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+  ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str());
 
   for (StringRef arg : ServerArgs)
 args.AppendArgument(arg);
Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -179,7 +179,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
@@ -193,7 +193,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);


Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -80,7 +80,7 @@
 return status.ToError();
 
   args.AppendArgument(
-  ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+  ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str());
 
   for (StringRef arg : ServerArgs)
 args.AppendArgument(arg);
Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -179,7 +179,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
@@ -193,7 +193,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58129: Move UnwindTable from ObjectFile to Module

2019-02-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

You changed the API to return a pointer which can be NULL so we either need to 
check all returns for this or change the API to return a reference to a default 
constructed UnwindTable. I like the latter option, but I will leave that up to 
you. Since we are moving functionality into symbol files, we might want to opt 
for the latter to allow us to populate the UnwindTable as needed from any 
source when ever that source becomes available (like adding a symbol file to a 
module after the fact).




Comment at: include/lldb/Core/Module.h:709
+  //--
+  UnwindTable *GetUnwindTable();
+

I would vote to return a "UnwindTable&" and make a const and non const version 
of this. Otherwise we have to NULL check any call to this API.



Comment at: include/lldb/Core/Module.h:1108-1110
+  llvm::Optional m_unwind_table; /// < Table of FuncUnwinders
+  /// objects created for this
+  /// Module's functions

Why not just make this an instance to avoid having to null check all accessor 
calls?:

```
UnwindTable m_unwind_table;
```



Comment at: source/Commands/CommandObjectTarget.cpp:3536-3537
   FuncUnwindersSP func_unwinders_sp(
-  sc.module_sp->GetObjectFile()
-  ->GetUnwindTable()
-  .GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
+  sc.module_sp->GetUnwindTable()
+  ->GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
   if (!func_unwinders_sp)

Either NULL check or change the API?



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2865-2866
 
-DWARFCallFrameInfo *eh_frame = GetUnwindTable().GetEHFrameInfo();
-if (eh_frame) {
+if (DWARFCallFrameInfo *eh_frame =
+GetModule()->GetUnwindTable()->GetEHFrameInfo()) {
   if (m_symtab_ap == nullptr)

Either NULL check or change the API?



Comment at: source/Plugins/Process/Utility/RegisterContextLLDB.cpp:242-243
   func_unwinders_sp =
-  pc_module_sp->GetObjectFile()
-  ->GetUnwindTable()
-  .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+  pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+  m_current_pc, m_sym_ctx);
 }

Either NULL check or change the API?



Comment at: source/Plugins/Process/Utility/RegisterContextLLDB.cpp:674-675
   FuncUnwindersSP func_unwinders_sp(
-  pc_module_sp->GetObjectFile()
-  ->GetUnwindTable()
-  .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx));
+  pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+  m_current_pc, m_sym_ctx));
   if (!func_unwinders_sp)

Either NULL check or change the API?



Comment at: source/Plugins/Process/Utility/RegisterContextLLDB.cpp:776-777
 func_unwinders_sp =
-pc_module_sp->GetObjectFile()
-->GetUnwindTable()
-.GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+pc_module_sp->GetUnwindTable()->GetFuncUnwindersContainingAddress(
+m_current_pc, m_sym_ctx);
   }

Either NULL check or change the API?



Comment at: source/Plugins/Process/Utility/RegisterContextLLDB.cpp:795
 DWARFCallFrameInfo *eh_frame =
-pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo();
+pc_module_sp->GetUnwindTable()->GetEHFrameInfo();
 if (eh_frame) {

Either NULL check or change the API?



Comment at: source/Plugins/Process/Utility/RegisterContextLLDB.cpp:805
 ArmUnwindInfo *arm_exidx =
-pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo();
+pc_module_sp->GetUnwindTable()->GetArmUnwindInfo();
 if (arm_exidx) {

Either NULL check or change the API?


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

https://reviews.llvm.org/D58129



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


[Lldb-commits] [PATCH] D58131: [lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

2019-02-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Yeah localhost can cause problems if someone has a custom mapping in their 
network config file.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58131



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


[Lldb-commits] [lldb] r353856 - Fix Xcode project for RemoteAwarePlatform files.

2019-02-12 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Feb 12 08:54:28 2019
New Revision: 353856

URL: http://llvm.org/viewvc/llvm-project?rev=353856&view=rev
Log:
Fix Xcode project for RemoteAwarePlatform files.


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=353856&r1=353855&r2=353856&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Feb 12 08:54:28 2019
@@ -733,6 +733,7 @@
26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp 
*/; };
4C639ED221FA684900A7B957 /* RegisterValueTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 4C639EC421FA684800A7B957 /* 
RegisterValueTest.cpp */; };
26764CA01E48F528008D3573 /* RegularExpression.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 26764C9F1E48F528008D3573 /* 
RegularExpression.cpp */; };
+   26501414221330CE00E16D81 /* RemoteAwarePlatform.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 26501413221330CE00E16D81 /* 
RemoteAwarePlatform.cpp */; };
23D0658F1D4A7BEE0008EDE6 /* RenderScriptExpressionOpts.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 23D065821D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.cpp */; };
23D065901D4A7BEE0008EDE6 /* RenderScriptRuntime.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 23D065841D4A7BDA0008EDE6 /* 
RenderScriptRuntime.cpp */; };
9485545A1DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 948554591DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp */; };
@@ -1894,8 +1895,7 @@
4984BA171B979C08008658D4 /* ExpressionVariable.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ExpressionVariable.h; path = include/lldb/Expression/ExpressionVariable.h; 
sourceTree = ""; };
260C6EA213011581005E16B0 /* File.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = File.cpp; sourceTree = ""; };
260C6EA013011578005E16B0 /* File.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
File.h; path = include/lldb/Host/File.h; sourceTree = ""; };
-   3FDFDDBC199C3A06009756A7 /* FileAction.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = FileAction.cpp; path = FileAction.cpp; sourceTree = ""; };
-   3FDFD6C3199C396E009756A7 /* FileAction.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
FileAction.h; path = include/lldb/Host/FileAction.h; sourceTree = ""; };
+   3FDFDDBC199C3A06009756A7 /* FileAction.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = FileAction.cpp; sourceTree = ""; };
3FDFDDBE199D345E009756A7 /* FileCache.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = FileCache.cpp; path = source/Host/common/FileCache.cpp; sourceTree = 
""; };
3FDFDDC0199D34E2009756A7 /* FileCache.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FileCache.h; path 
= include/lldb/Host/FileCache.h; sourceTree = ""; };
DD8F277D22011CC9004ED75B /* FileCollector.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = FileCollector.cpp; path = source/Utility/FileCollector.cpp; sourceTree = 
""; };
@@ -2531,14 +2531,12 @@
2618EE601315B29C001D6D71 /* ProcessGDBRemote.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ProcessGDBRemote.h; sourceTree = ""; };
2618EE611315B29C001D6D71 /* ProcessGDBRemoteLog.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ProcessGDBRemoteLog.cpp; sourceTree = ""; };
2618EE621315B29C001D6D71 /* ProcessGDBRemoteLog.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ProcessGDBRemoteLog.h; sourceTree = ""; };
-   233B007B1960C9E60090E598 /* ProcessInfo.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = ProcessInfo.cpp; path = ProcessInfo.cpp; sourceTree = ""; };
-   233B007A1960A0440090E598 /* ProcessInfo.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ProcessInfo.h; 
path = include/lldb/Host/ProcessInfo.h; sourceTree = ""; };
+   233B007B1960C9E60090E598 /* ProcessInfo.cpp */ = {isa = 
PBXFileReference; fil

[Lldb-commits] [PATCH] D58131: [lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

2019-02-12 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski accepted this revision.
krytarowski added a comment.

Short term this looks fine.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58131



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


[Lldb-commits] [lldb] r353868 - [lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

2019-02-12 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Feb 12 10:09:00 2019
New Revision: 353868

URL: http://llvm.org/viewvc/llvm-project?rev=353868&view=rev
Log:
[lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

Fix the tests not to use '127.0.0.1' and 'localhost' interchangeably.
More specifically, since tests bind specifically to 127.0.0.1, connect
to that address as well; using 'localhost' can resolve to IPv6 address
which can cause issues -- for example, if the matching port happens to
be used by some other process, the tests hang forever waiting for
the client to connect.

While technically the case of randomly selected IPv4 port being taken
on IPv6 loopback is not very likely, NetBSD happens to be suffering from
some weird kernel issue where connection to that port succeeds
nevertheless.  Until we can really figure out what goes wrong there,
this saves us from the tests hanging randomly.

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

Modified:
lldb/trunk/unittests/Host/SocketTest.cpp
lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp

Modified: lldb/trunk/unittests/Host/SocketTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTest.cpp?rev=353868&r1=353867&r2=353868&view=diff
==
--- lldb/trunk/unittests/Host/SocketTest.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTest.cpp Tue Feb 12 10:09:00 2019
@@ -179,7 +179,7 @@ TEST_F(SocketTest, TCPListen0ConnectAcce
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
@@ -193,7 +193,7 @@ TEST_F(SocketTest, TCPGetAddress) {
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);

Modified: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp?rev=353868&r1=353867&r2=353868&view=diff
==
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp Tue Feb 12 
10:09:00 2019
@@ -80,7 +80,7 @@ Expected> Te
 return status.ToError();
 
   args.AppendArgument(
-  ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+  ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str());
 
   for (StringRef arg : ServerArgs)
 args.AppendArgument(arg);


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


[Lldb-commits] [PATCH] D58131: [lldb] [unittest] Avoid mixing '127.0.0.1' and 'localhost'

2019-02-12 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353868: [lldb] [unittest] Avoid mixing '127.0.0.1' 
and 'localhost' (authored by mgorny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D58131?vs=186484&id=186502#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D58131

Files:
  lldb/trunk/unittests/Host/SocketTest.cpp
  lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp


Index: lldb/trunk/unittests/Host/SocketTest.cpp
===
--- lldb/trunk/unittests/Host/SocketTest.cpp
+++ lldb/trunk/unittests/Host/SocketTest.cpp
@@ -179,7 +179,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
@@ -193,7 +193,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
Index: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -80,7 +80,7 @@
 return status.ToError();
 
   args.AppendArgument(
-  ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+  ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str());
 
   for (StringRef arg : ServerArgs)
 args.AppendArgument(arg);


Index: lldb/trunk/unittests/Host/SocketTest.cpp
===
--- lldb/trunk/unittests/Host/SocketTest.cpp
+++ lldb/trunk/unittests/Host/SocketTest.cpp
@@ -179,7 +179,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
@@ -193,7 +193,7 @@
   [=](const TCPSocket &s) {
 char connect_remote_address[64];
 snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", s.GetLocalPortNumber());
+ "127.0.0.1:%u", s.GetLocalPortNumber());
 return std::string(connect_remote_address);
   },
   &socket_a_up, &socket_b_up);
Index: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -80,7 +80,7 @@
 return status.ToError();
 
   args.AppendArgument(
-  ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+  ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str());
 
   for (StringRef arg : ServerArgs)
 args.AppendArgument(arg);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r353869 - [lldb-instr] Pass PCHContainerOperations to ClangTool

2019-02-12 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Feb 12 10:19:34 2019
New Revision: 353869

URL: http://llvm.org/viewvc/llvm-project?rev=353869&view=rev
Log:
[lldb-instr] Pass PCHContainerOperations to ClangTool

On a local modules build this would cause an error.

> fatal error: no handler registered for module format 'obj'
> LLVM ERROR: unknown module format

Interestingly enough, this didn't trigger on the GreenDragon CMake bot,
which is configured with modules.

Modified:
lldb/trunk/tools/lldb-instr/CMakeLists.txt
lldb/trunk/tools/lldb-instr/Instrument.cpp

Modified: lldb/trunk/tools/lldb-instr/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/CMakeLists.txt?rev=353869&r1=353868&r2=353869&view=diff
==
--- lldb/trunk/tools/lldb-instr/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-instr/CMakeLists.txt Tue Feb 12 10:19:34 2019
@@ -4,6 +4,7 @@ add_lldb_tool(lldb-instr
   LINK_LIBS
 clangAST
 clangBasic
+clangCodeGen
 clangFrontend
 clangLex
 clangRewrite

Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=353869&r1=353868&r2=353869&view=diff
==
--- lldb/trunk/tools/lldb-instr/Instrument.cpp (original)
+++ lldb/trunk/tools/lldb-instr/Instrument.cpp Tue Feb 12 10:19:34 2019
@@ -1,6 +1,7 @@
 #include "clang/AST/AST.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -280,6 +281,11 @@ int main(int argc, const char **argv) {
   CommonOptionsParser OP(argc, argv, InstrCategory,
  "Utility for generating the macros for LLDB's "
  "instrumentation framework.");
-  ClangTool T(OP.getCompilations(), OP.getSourcePathList());
+
+  auto PCHOpts = std::make_shared();
+  PCHOpts->registerWriter(llvm::make_unique());
+  PCHOpts->registerReader(llvm::make_unique());
+
+  ClangTool T(OP.getCompilations(), OP.getSourcePathList(), PCHOpts);
   return T.run(newFrontendActionFactory().get());
 }


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


[Lldb-commits] [PATCH] D58090: [WIP] Deserialize Clang module search path from DWARF

2019-02-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

The change itself looks fine, just a few nits inline.




Comment at: include/lldb/Symbol/SourceModule.h:24
+
+};
+

Can you run clang-format on this? (It will add `// namespace lldb_private` 
here.)



Comment at: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:266
 
-  for (size_t ci = 1; ci < path.size(); ++ci) {
-llvm::StringRef component = path[ci].GetStringRef();
+  for (size_t ci = 1; ci < module.path.size(); ++ci) {
+llvm::StringRef component = module.path[ci].GetStringRef();

Can we make this `i`?



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:941
+
+if (const char *name =
+module_die.GetAttributeValueAsString(DW_AT_name, nullptr)) {

Can we use a StringRef here?


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

https://reviews.llvm.org/D58090



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


[Lldb-commits] [PATCH] D57995: [lldb] [cmake] Use install directories for LLVM_* variables

2019-02-12 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

I just caught up to this thread and wow, yeah things are far more broken than I 
realized. Apologies for opening this can of worms.

That being said, thanks for taking the time to look at it and clean it up.


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

https://reviews.llvm.org/D57995



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


[Lldb-commits] [PATCH] D57402: build: remove custom variables

2019-02-12 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd added a comment.

Yes, both paths currently work since the `LLDB_PATH_TO_*` variables are just 
hints to where to look.  It just seems unnecessary to have the custom variables 
when CMake has a mechanism for directing the build to look for packages in a 
certain location.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57402



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


[Lldb-commits] [PATCH] D58090: [WIP] Deserialize Clang module search path from DWARF

2019-02-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:266
 
-  for (size_t ci = 1; ci < path.size(); ++ci) {
-llvm::StringRef component = path[ci].GetStringRef();
+  for (size_t ci = 1; ci < module.path.size(); ++ci) {
+llvm::StringRef component = module.path[ci].GetStringRef();

JDevlieghere wrote:
> Can we make this `i`?
Or perhaps `path_index` 


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

https://reviews.llvm.org/D58090



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


[Lldb-commits] [lldb] r353894 - [testsuite] Convert TestSingleQuote to lit.

2019-02-12 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Feb 12 14:57:57 2019
New Revision: 353894

URL: http://llvm.org/viewvc/llvm-project?rev=353894&view=rev
Log:
[testsuite] Convert TestSingleQuote to lit.

Nothing crazy, this is pretty mechanical.

Added:
lldb/trunk/lit/Driver/Inputs/hello.c
lldb/trunk/lit/Driver/TestSingleQuote.test
Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/

Added: lldb/trunk/lit/Driver/Inputs/hello.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/hello.c?rev=353894&view=auto
==
--- lldb/trunk/lit/Driver/Inputs/hello.c (added)
+++ lldb/trunk/lit/Driver/Inputs/hello.c Tue Feb 12 14:57:57 2019
@@ -0,0 +1,3 @@
+int main(void) {
+  return 0;
+}

Added: lldb/trunk/lit/Driver/TestSingleQuote.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestSingleQuote.test?rev=353894&view=auto
==
--- lldb/trunk/lit/Driver/TestSingleQuote.test (added)
+++ lldb/trunk/lit/Driver/TestSingleQuote.test Tue Feb 12 14:57:57 2019
@@ -0,0 +1,5 @@
+# RUN: %clang %p/Inputs/hello.c -g -o "%t-'pat"
+# RUN: %lldb -s %s "%t-'pat" | FileCheck %s
+
+br set -p return
+# CHECK: Breakpoint 1: where = TestSingleQuote.test.tmp-'pat`main


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


[Lldb-commits] [lldb] r353896 - [testsuite] Add a comment explaining what this test does.

2019-02-12 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Feb 12 15:02:53 2019
New Revision: 353896

URL: http://llvm.org/viewvc/llvm-project?rev=353896&view=rev
Log:
[testsuite] Add a comment explaining what this test does.

Modified:
lldb/trunk/lit/Driver/TestSingleQuote.test

Modified: lldb/trunk/lit/Driver/TestSingleQuote.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestSingleQuote.test?rev=353896&r1=353895&r2=353896&view=diff
==
--- lldb/trunk/lit/Driver/TestSingleQuote.test (original)
+++ lldb/trunk/lit/Driver/TestSingleQuote.test Tue Feb 12 15:02:53 2019
@@ -1,3 +1,4 @@
+# Make sure lldb can handle filenames with single quotes in them.
 # RUN: %clang %p/Inputs/hello.c -g -o "%t-'pat"
 # RUN: %lldb -s %s "%t-'pat" | FileCheck %s
 


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


[Lldb-commits] [PATCH] D57995: [lldb] [cmake] Use install directories for LLVM_* variables

2019-02-12 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

After looking at the dependent patch, this looks good to me.


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

https://reviews.llvm.org/D57995



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


[Lldb-commits] [PATCH] D58076: [Reproducers] Integrate FileProvider with clang

2019-02-12 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 with one comment.




Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:252-262
+
+  if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator()) {
+repro::FileProvider &fp = g->GetOrCreate();
+m_compiler->setModuleDepCollector(
+std::make_shared(
+fp.GetFileCollector()));
+DependencyOutputOptions &opts = m_compiler->getDependencyOutputOpts();

can you add a comment like: "when recording, set up the state to collect the 
modules, etc..".


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58076



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


[Lldb-commits] [PATCH] D58090: Deserialize Clang module search path from DWARF

2019-02-12 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 186571.
aprantl added a comment.
Herald added a reviewer: serge-sans-paille.

Almost final version. There's a silly bug that prevents the C Darwin module to 
be loaded now that I haven't been able to track down yet.


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

https://reviews.llvm.org/D58090

Files:
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/SourceModule.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h
  packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h
  packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile
  packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py
  packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp
  packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/CompileUnit.cpp
  source/Symbol/SymbolVendor.cpp

Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -185,7 +185,7 @@
 }
 
 bool SymbolVendor::ParseImportedModules(
-const SymbolContext &sc, std::vector &imported_modules) {
+const SymbolContext &sc, std::vector &imported_modules) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
 std::lock_guard guard(module_sp->GetMutex());
Index: source/Symbol/CompileUnit.cpp
===
--- source/Symbol/CompileUnit.cpp
+++ source/Symbol/CompileUnit.cpp
@@ -390,7 +390,7 @@
   m_variables = variables;
 }
 
-const std::vector &CompileUnit::GetImportedModules() {
+const std::vector &CompileUnit::GetImportedModules() {
   if (m_imported_modules.empty() &&
   m_flags.IsClear(flagsParsedImportedModules)) {
 m_flags.Set(flagsParsedImportedModules);
Index: source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
===
--- source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -63,7 +63,7 @@
 
   bool ParseImportedModules(
   const lldb_private::SymbolContext &sc,
-  std::vector &imported_modules) override;
+  std::vector &imported_modules) override;
 
   size_t ParseBlocksRecursive(lldb_private::Function &func) override;
 
Index: source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
===
--- source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -218,7 +218,7 @@
 }
 
 bool SymbolFileSymtab::ParseImportedModules(
-const SymbolContext &sc, std::vector &imported_modules) {
+const SymbolContext &sc, std::vector &imported_modules) {
   return false;
 }
 
Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -74,7 +74,7 @@
 
   bool ParseImportedModules(
   const lldb_private::SymbolContext &sc,
-  std::vector &imported_modules) override;
+  std::vector &imported_modules) override;
 
   size_t ParseBlocksRecursive(lldb_private::Function &func) override;
 
Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -377,7 +377,7 @@
 
 bool SymbolFilePDB::ParseImportedModules(
 const lldb_private::SymbolContext &sc,
-std::vector &imported_modules) {
+std::vector &imported_modules) {
   // PDB does not yet support module debug info
   return false;
 }
Index: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -94,9 +94,9 @@
  FileSpec

[Lldb-commits] [lldb] r353906 - [Reproducers] Integrate FileProvider with clang

2019-02-12 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Feb 12 17:30:41 2019
New Revision: 353906

URL: http://llvm.org/viewvc/llvm-project?rev=353906&view=rev
Log:
[Reproducers] Integrate FileProvider with clang

This patch hooks up clang and lldb's reproducers functionality. It
ensures that when capturing a reproducer, headers and modules imported
through the expression parser are collected.

Differential revision: https://reviews.llvm.org/D58076

Added:
lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in
lldb/trunk/lit/Reproducer/TestClangFileRepro.test
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Added: lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in?rev=353906&view=auto
==
--- lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in (added)
+++ lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in Tue Feb 12 17:30:41 2019
@@ -0,0 +1,2 @@
+expr -- @import Cocoa
+reproducer generate

Added: lldb/trunk/lit/Reproducer/TestClangFileRepro.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestClangFileRepro.test?rev=353906&view=auto
==
--- lldb/trunk/lit/Reproducer/TestClangFileRepro.test (added)
+++ lldb/trunk/lit/Reproducer/TestClangFileRepro.test Tue Feb 12 17:30:41 2019
@@ -0,0 +1,8 @@
+# REQUIRES: system-darwin
+#
+# This tests that modules files from clang end up in the reproducer.
+#
+# RUN: %lldb -x -b -s %S/Inputs/ModuleCapture.in --capture %t.repro
+# cat %t.repro/files.yaml | FileCheck %s
+#
+# CHECK: Cocoa.h

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=353906&r1=353905&r2=353906&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Tue Feb 12 17:30:41 2019
@@ -54,15 +54,15 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Signals.h"
 
-#include "ClangDiagnostic.h"
-#include "ClangExpressionParser.h"
-
 #include "ClangASTSource.h"
+#include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
+#include "ClangExpressionParser.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
 #include "IRForTarget.h"
+#include "ModuleDependencyCollector.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Disassembler.h"
@@ -84,6 +84,7 @@
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StringList.h"
@@ -250,6 +251,19 @@ ClangExpressionParser::ClangExpressionPa
 
   // 1. Create a new compiler instance.
   m_compiler.reset(new CompilerInstance());
+
+  // When capturing a reproducer, hook up the file collector with clang to
+  // collector modules and headers.
+  if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator()) {
+repro::FileProvider &fp = g->GetOrCreate();
+m_compiler->setModuleDepCollector(
+std::make_shared(
+fp.GetFileCollector()));
+DependencyOutputOptions &opts = m_compiler->getDependencyOutputOpts();
+opts.IncludeSystemHeaders = true;
+opts.IncludeModuleFiles = true;
+  }
+
   lldb::LanguageType frame_lang =
   expr.Language(); // defaults to lldb::eLanguageTypeUnknown
   bool overridden_target_opts = false;

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=353906&r1=353905&r2=353906&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
Tue Feb 12 17:30:41 2019
@@ -22,6 +22,7 @@
 
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
+#include "ModuleDependencyCollector.h"
 
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Host/Host.h"
@@ -31,6 +32,7 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
@@ -631,6 +633,18 @@ Clan

[Lldb-commits] [PATCH] D58076: [Reproducers] Integrate FileProvider with clang

2019-02-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB353906: [Reproducers] Integrate FileProvider with clang 
(authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58076?vs=186336&id=186573#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58076

Files:
  lit/Reproducer/Inputs/ModuleCapture.in
  lit/Reproducer/TestClangFileRepro.test
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -54,15 +54,15 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Signals.h"
 
-#include "ClangDiagnostic.h"
-#include "ClangExpressionParser.h"
-
 #include "ClangASTSource.h"
+#include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
+#include "ClangExpressionParser.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
 #include "IRForTarget.h"
+#include "ModuleDependencyCollector.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Disassembler.h"
@@ -84,6 +84,7 @@
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StringList.h"
@@ -250,6 +251,19 @@
 
   // 1. Create a new compiler instance.
   m_compiler.reset(new CompilerInstance());
+
+  // When capturing a reproducer, hook up the file collector with clang to
+  // collector modules and headers.
+  if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator()) {
+repro::FileProvider &fp = g->GetOrCreate();
+m_compiler->setModuleDepCollector(
+std::make_shared(
+fp.GetFileCollector()));
+DependencyOutputOptions &opts = m_compiler->getDependencyOutputOpts();
+opts.IncludeSystemHeaders = true;
+opts.IncludeModuleFiles = true;
+  }
+
   lldb::LanguageType frame_lang =
   expr.Language(); // defaults to lldb::eLanguageTypeUnknown
   bool overridden_target_opts = false;
Index: source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h
===
--- source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h
+++ source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h
@@ -0,0 +1,38 @@
+//===-- ModuleDependencyCollector.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ModuleDependencyCollector_h_
+#define liblldb_ModuleDependencyCollector_h_
+
+#include "lldb/Utility/FileCollector.h"
+#include "clang/Frontend/Utils.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+class ModuleDependencyCollectorAdaptor
+: public clang::ModuleDependencyCollector {
+public:
+  ModuleDependencyCollectorAdaptor(FileCollector &file_collector)
+  : clang::ModuleDependencyCollector(""), m_file_collector(file_collector) {
+  }
+
+  void addFile(llvm::StringRef Filename,
+   llvm::StringRef FileDst = {}) override {
+m_file_collector.AddFile(Filename);
+  }
+
+  bool insertSeen(llvm::StringRef Filename) override { return false; }
+  void addFileMapping(llvm::StringRef VPath, llvm::StringRef RPath) override {}
+  void writeFileMap() override {}
+
+private:
+  FileCollector &m_file_collector;
+};
+} // namespace lldb_private
+
+#endif
Index: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -22,6 +22,7 @@
 
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
+#include "ModuleDependencyCollector.h"
 
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Host/Host.h"
@@ -31,6 +32,7 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
@@ -631,6 +633,18 @@
   std::unique_ptr instance(
   new clang::CompilerInstance);
 
+  // When capturing a reproducer, hook up the file collector with clan

[Lldb-commits] [PATCH] D56232: [lldb-server] Add remote platform capabilities for Windows

2019-02-12 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 186580.
Herald added subscribers: jdoerfert, emaste.

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

https://reviews.llvm.org/D56232

Files:
  include/lldb/Target/RemoteAwarePlatform.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/Windows/PlatformWindows.cpp
  source/Plugins/Platform/Windows/PlatformWindows.h
  source/Target/RemoteAwarePlatform.cpp

Index: source/Target/RemoteAwarePlatform.cpp
===
--- source/Target/RemoteAwarePlatform.cpp
+++ source/Target/RemoteAwarePlatform.cpp
@@ -7,6 +7,8 @@
 //===--===//
 
 #include "lldb/Target/RemoteAwarePlatform.h"
+#include "lldb/Host/FileCache.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 
 using namespace lldb_private;
@@ -21,6 +23,139 @@
   return Platform::GetModuleSpec(module_file_spec, arch, module_spec);
 }
 
+Status RemoteAwarePlatform::RunShellCommand(
+const char *command, const FileSpec &working_dir, int *status_ptr,
+int *signo_ptr, std::string *command_output,
+const Timeout &timeout) {
+  if (IsHost())
+return Host::RunShellCommand(command, working_dir, status_ptr, signo_ptr,
+ command_output, timeout);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->RunShellCommand(
+command, working_dir, status_ptr, signo_ptr, command_output, timeout);
+  return Status("unable to run a remote command without a platform");
+}
+
+Status RemoteAwarePlatform::MakeDirectory(const FileSpec &file_spec,
+  uint32_t file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->MakeDirectory(file_spec, file_permissions);
+  return Platform::MakeDirectory(file_spec, file_permissions);
+}
+
+Status RemoteAwarePlatform::GetFilePermissions(const FileSpec &file_spec,
+   uint32_t &file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->GetFilePermissions(file_spec,
+file_permissions);
+  return Platform::GetFilePermissions(file_spec, file_permissions);
+}
+
+Status RemoteAwarePlatform::SetFilePermissions(const FileSpec &file_spec,
+   uint32_t file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->SetFilePermissions(file_spec,
+file_permissions);
+  return Platform::SetFilePermissions(file_spec, file_permissions);
+}
+
+lldb::user_id_t RemoteAwarePlatform::OpenFile(const FileSpec &file_spec,
+  uint32_t flags, uint32_t mode,
+  Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error);
+  return Platform::OpenFile(file_spec, flags, mode, error);
+}
+
+bool RemoteAwarePlatform::CloseFile(lldb::user_id_t fd, Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().CloseFile(fd, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->CloseFile(fd, error);
+  return Platform::CloseFile(fd, error);
+}
+
+uint64_t RemoteAwarePlatform::ReadFile(lldb::user_id_t fd, uint64_t offset,
+   void *dst, uint64_t dst_len,
+   Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error);
+  return Platform::ReadFile(fd, offset, dst, dst_len, error);
+}
+
+uint64_t RemoteAwarePlatform::WriteFile(lldb::user_id_t fd, uint64_t offset,
+const void *src, uint64_t src_len,
+Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error);
+  return Platform::WriteFile(fd, offset, src, src_len, error);
+}
+
+lldb::user_id_t RemoteAwarePlatform::GetFileSize(const FileSpec &file_spec) {
+  if (IsHost()) {
+uint64_t Size;
+if (llvm::sys::fs::file_size(file_spec.GetPath(), Size))
+  return 0;
+return Size;
+  }
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->GetFileSize(file_spec);
+  return Platform::GetFileSize(file_spec);
+}
+
+Status RemoteAwarePlatform::CreateSymlink(const FileSpec &src,
+  const FileSpec &dst) {
+  if (IsHost())
+return FileSystem::

[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/basic/main.cpp:1
+#include 
+

Looks like you are relying on `iostream` to bring in `cstdlib` which is not 
guaranteed. 



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:444
+  switch (language) {
+  case lldb::eLanguageTypeC_plus_plus:
+  case lldb::eLanguageTypeC_plus_plus_11:

`eLanguageTypeC_plus_plus_03`?


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

https://reviews.llvm.org/D58125



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


[Lldb-commits] [PATCH] D57402: build: remove custom variables

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

IIUC, Stefan would like to have LLVM path be a hint for where to search for 
clang. That doesn't seem like an unreasonable thing to me. Couldn't that just 
be solved by passing `${LLVM_DIR}` as a `HINTS` argument to the 
`find_package(Clang` command?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57402



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


[Lldb-commits] [PATCH] D56232: [lldb-server] Add remote platform capabilities for Windows

2019-02-12 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.

Looks good. Just for future patches, please make sure to only clang-format the 
lines you actually touch. This patch includes a lot of formatting changes to 
lines that haven't been substantially changed. If you're using git, there's a 
plugin command for it, which will allow you to do just that via something like 
`git clang-format HEAD^`. I don't know if there's such an easy equivalent for 
svn, but it should at least be achievable by piping the diff through 
clang-format.


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

https://reviews.llvm.org/D56232



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


[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I don't know much about modules so these are just two comments I noticed from a 
quick glance:

- using both `virtual` and `override` on a method (like 
`ExternalASTSourceWrapper` does) is overkill. Drop `virtual`.
- Returning `/usr/include` from `GetSystemIncludeDirectoriesForLanguage` is 
going to be wrong for remote sessions. The platform instance should have a 
"sysroot" path stored somewhere (from `platform select foo --sysroot=/bar`), so 
it would be good to at least honor that. It might even be good to pass the 
sysroot as the `--sysroot` parameter to clang.




Comment at: lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp:267
+void PlatformLinux::GetSystemIncludeDirectoriesForLanguage(
+lldb::LanguageType lang, std::vector &directories) {
+  switch (lang) {

return directories by value?


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

https://reviews.llvm.org/D58125



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


[Lldb-commits] [PATCH] D56237: Implement GetLoadAddress for the Windows process plugin

2019-02-12 Thread Hui Huang via Phabricator via lldb-commits
Hui added a comment.

In D56237#1394320 , @labath wrote:

> I like the direction this is going. I have one small comment about the code 
> organization inline, but the bigger question I have in mind is: After these 
> changes, is there any use for `Host::GetProcessBaseAddress` left? If so, what 
> is it? I'd like to understand it and remove it.


From my understanding, lldb-server.exe is to debug a process instantiated by 
NativeProcessProtocol which might or might not relate to ProcessWindows plugin.

To remove the host codes mentioned above, it requires the implementation of 
NativeProcessProtocol also notify the DYLD the load address of the main 
executable otherwise
DYLD has to do the job with the OS help. For now I think just remove them.


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

https://reviews.llvm.org/D56237



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


[Lldb-commits] [lldb] r353916 - ObjectFilePECOFF: Create a "container" section spanning the entire module image

2019-02-12 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Feb 12 23:17:24 2019
New Revision: 353916

URL: http://llvm.org/viewvc/llvm-project?rev=353916&view=rev
Log:
ObjectFilePECOFF: Create a "container" section spanning the entire module image

Summary:
This is coming from the discussion in D55356 (the most interesting part
happened on the mailing list, so it isn't reflected on the review page).

In short the issue is that lldb assumes that all bytes of a module image
in memory will be backed by a "section". This isn't the case for PECOFF
files because the initial bytes of the module image will contain the
file header, which does not correspond to any normal section in the
file. In particular, this means it is not possible to implement
GetBaseAddress function for PECOFF files, because that's supposed point
to the first byte of that header.

If my (limited) understanding of how PECOFF files work is correct, then
the OS is expecded to load the entire module into one continuous chunk
of memory. The address of that chunk (+/- ASLR) is given by the "image
base" field in the COFF header, and it's size by "image size". All of
the COFF sections are then loaded into this range.

If that's true, then we can model this behavior in lldb by creating a
"container" section to represent the entire module image, and then place
other sections inside that. This would make be consistent with how MachO
and ELF files are modelled (except that those can have multiple
top-level containers as they can be loaded into multiple discontinuous
chunks of memory).

This change required a small number of fixups in the PDB plugins, which
assumed a certain order of sections within the object file (which
obivously changes now). I fix this by changing the lookup code to use
section IDs (which are unchanged) instead of indexes. This has the nice
benefit of removing spurious -1s in the plugins as the section IDs in
the pdbs match the 1-based section IDs in the COFF plugin.

Besides making the implementation of GetBaseAddress possible, this also
improves the lookup of addresses in the gaps between the object file
sections, which will now be correctly resolved as belonging to the
object file.

Reviewers: zturner, amccarth, stella.stamenova, clayborg, lemo

Reviewed By: clayborg, lemo

Subscribers: JDevlieghere, abidh, lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/lit/Modules/PECOFF/subsections.yaml
Modified:
lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Modified: lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml?rev=353916&r1=353915&r2=353916&view=diff
==
--- lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml (original)
+++ lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml Tue Feb 12 23:17:24 2019
@@ -7,7 +7,7 @@
 # RUN: lldb-test object-file -dep-modules %t.dll | FileCheck 
-check-prefix=DEPS %s
 
 
-# BASIC-CHECK: Showing 3 sections
+# BASIC-CHECK: Showing 3 subsections
 # BASIC-CHECK:  Index: 0
 # BASIC-CHECK:  Name: .text
 # BASIC-CHECK:  Type: code

Added: lldb/trunk/lit/Modules/PECOFF/subsections.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/subsections.yaml?rev=353916&view=auto
==
--- lldb/trunk/lit/Modules/PECOFF/subsections.yaml (added)
+++ lldb/trunk/lit/Modules/PECOFF/subsections.yaml Tue Feb 12 23:17:24 2019
@@ -0,0 +1,70 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+
+# CHECK:  Showing 1 sections
+# CHECK-NEXT:   Index: 0
+# CHECK-NEXT:   ID: 0x
+# CHECK-NEXT:   Name:
+# CHECK-NEXT:   Type: container
+# CHECK-NEXT:   Permissions: ---
+# CHECK-NEXT:   Thread specific: no
+# CHECK-NEXT:   VM address: 0x4000
+# CHECK-NEXT:   VM size: 12288
+# CHECK-NEXT:   File size: 0
+# CHECK-NEXT:   Showing 2 subsections
+# CHECK-NEXT: Index: 0
+# CHECK-NEXT: ID: 0x1
+# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Type: code
+# CHECK-NEXT: Permissions: ---
+# CHECK-NEXT: Thread specific: no
+# CHECK-NEXT: VM address: 0x40001000
+# CHECK-NEXT: VM size: 64
+# CHECK-NEXT: File size: 512
+# CHECK-EMPTY: 
+# CHECK-NEXT: Index: 1
+# CHECK-NEXT: ID: 0x2
+# CHECK-NEXT: Name: .data
+# CHECK-NEXT: Type: data
+# CHECK-NEXT: Permissions: ---
+# CHECK-NEXT: Thread specific: no
+# CHECK-NEXT: VM address: 0x40002000
+# CHECK-NEXT: VM size: 64
+# CHECK-NEXT: File size: 512
+
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4616
+  ImageBase:   107

[Lldb-commits] [PATCH] D56537: ObjectFilePECOFF: Create a "container" section spanning the entire module image

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353916: ObjectFilePECOFF: Create a "container" 
section spanning the entire module image (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56537?vs=181022&id=186587#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56537

Files:
  lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml
  lldb/trunk/lit/Modules/PECOFF/subsections.yaml
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Index: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -706,6 +706,15 @@
   ModuleSP module_sp(GetModule());
   if (module_sp) {
 std::lock_guard guard(module_sp->GetMutex());
+
+SectionSP image_sp = std::make_shared(
+module_sp, this, ~user_id_t(0), ConstString(), eSectionTypeContainer,
+m_coff_header_opt.image_base, m_coff_header_opt.image_size,
+/*file_offset*/ 0, /*file_size*/ 0, m_coff_header_opt.sect_alignment,
+/*flags*/ 0);
+m_sections_up->AddSection(image_sp);
+unified_section_list.AddSection(image_sp);
+
 const uint32_t nsects = m_sect_headers.size();
 ModuleSP module_sp(GetModule());
 for (uint32_t idx = 0; idx < nsects; ++idx) {
@@ -808,20 +817,16 @@
   section_type = eSectionTypeData;
   }
 
-  // Use a segment ID of the segment index shifted left by 8 so they
-  // never conflict with any of the sections.
   SectionSP section_sp(new Section(
-  module_sp, // Module to which this section belongs
-  this,  // Object file to which this section belongs
-  idx + 1, // Section ID is the 1 based segment index shifted right by
-   // 8 bits as not to collide with any of the 256 section IDs
-   // that are possible
+  image_sp,// Parent section
+  module_sp,   // Module to which this section belongs
+  this,// Object file to which this section belongs
+  idx + 1, // Section ID is the 1 based section index.
   const_sect_name, // Name of this section
-  section_type,// This section is a container of other sections.
-  m_coff_header_opt.image_base +
-  m_sect_headers[idx].vmaddr, // File VM address == addresses as
-  // they are found in the object file
-  m_sect_headers[idx].vmsize, // VM size in bytes of this section
+  section_type,
+  m_sect_headers[idx].vmaddr, // File VM address == addresses as
+  // they are found in the object file
+  m_sect_headers[idx].vmsize, // VM size in bytes of this section
   m_sect_headers[idx]
   .offset, // Offset to the data for this section in the file
   m_sect_headers[idx]
@@ -829,10 +834,7 @@
   m_coff_header_opt.sect_alignment, // Section alignment
   m_sect_headers[idx].flags));  // Flags for this section
 
-  // section_sp->SetIsEncrypted (segment_is_encrypted);
-
-  unified_section_list.AddSection(section_sp);
-  m_sections_up->AddSection(section_sp);
+  image_sp->GetChildren().AddSection(std::move(section_sp));
 }
   }
 }
Index: lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
@@ -207,13 +207,7 @@
 SectionList *section_list = module->GetSectionList();
 assert(section_list);
 
-// Section indices in PDB are 1-based, but in DWARF they are 0-based, so
-// we need to subtract 1.
-uint32_t section_idx = section - 1;
-if (section_idx >= section_list->GetSize())
-  return false;
-
-auto section_ptr = section_list->GetSectionAtIndex(section_idx);
+auto section_ptr = section_list->FindSectionByID(section);
 if (!section_ptr)
   return 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
@@ -1349,11 +1349,9 @@
 

[Lldb-commits] [PATCH] D56237: Implement GetLoadAddress for the Windows process plugin

2019-02-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: sas.
labath added a comment.

In D56237#1395791 , @Hui wrote:

> In D56237#1394320 , @labath wrote:
>
> > I like the direction this is going. I have one small comment about the code 
> > organization inline, but the bigger question I have in mind is: After these 
> > changes, is there any use for `Host::GetProcessBaseAddress` left? If so, 
> > what is it? I'd like to understand it and remove it.
>
>
> From my understanding, lldb-server.exe is to debug a process instantiated by 
> NativeProcessProtocol which might or might not relate to ProcessWindows 
> plugin.
>
> To remove the host codes mentioned above, it requires the implementation of 
> NativeProcessProtocol also notify the DYLD the load address of the main 
> executable otherwise
>  DYLD has to do the job with the OS help. For now I think just remove them.


Yes, the NativeProcessWindows will need to notify the DYLD about the load 
address somehow. If DYLD went and did that on it's own, it would kill the 
"remote" aspect of lldb-server, as the DYLD plugin lives in the client. I think 
@sas is already passing that information somehow with ds2, so it might be good 
to sync up with him, so we don't reinvent something new. (My guess would be 
that they just have ds2 implement the packet underlying the 
`GetFileLoadAddress()` call.)

It short, let's remove the host code for now, and we can discuss that again 
after we get around to implementing NativeProcessWindows or whatever.


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

https://reviews.llvm.org/D56237



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


[Lldb-commits] [PATCH] D56232: [lldb-server] Add remote platform capabilities for Windows

2019-02-12 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 186591.

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

https://reviews.llvm.org/D56232

Files:
  include/lldb/Target/RemoteAwarePlatform.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/Windows/PlatformWindows.cpp
  source/Plugins/Platform/Windows/PlatformWindows.h
  source/Target/RemoteAwarePlatform.cpp

Index: source/Target/RemoteAwarePlatform.cpp
===
--- source/Target/RemoteAwarePlatform.cpp
+++ source/Target/RemoteAwarePlatform.cpp
@@ -7,6 +7,8 @@
 //===--===//
 
 #include "lldb/Target/RemoteAwarePlatform.h"
+#include "lldb/Host/FileCache.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 
 using namespace lldb_private;
@@ -21,6 +23,139 @@
   return Platform::GetModuleSpec(module_file_spec, arch, module_spec);
 }
 
+Status RemoteAwarePlatform::RunShellCommand(
+const char *command, const FileSpec &working_dir, int *status_ptr,
+int *signo_ptr, std::string *command_output,
+const Timeout &timeout) {
+  if (IsHost())
+return Host::RunShellCommand(command, working_dir, status_ptr, signo_ptr,
+ command_output, timeout);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->RunShellCommand(
+command, working_dir, status_ptr, signo_ptr, command_output, timeout);
+  return Status("unable to run a remote command without a platform");
+}
+
+Status RemoteAwarePlatform::MakeDirectory(const FileSpec &file_spec,
+  uint32_t file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->MakeDirectory(file_spec, file_permissions);
+  return Platform::MakeDirectory(file_spec, file_permissions);
+}
+
+Status RemoteAwarePlatform::GetFilePermissions(const FileSpec &file_spec,
+   uint32_t &file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->GetFilePermissions(file_spec,
+file_permissions);
+  return Platform::GetFilePermissions(file_spec, file_permissions);
+}
+
+Status RemoteAwarePlatform::SetFilePermissions(const FileSpec &file_spec,
+   uint32_t file_permissions) {
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->SetFilePermissions(file_spec,
+file_permissions);
+  return Platform::SetFilePermissions(file_spec, file_permissions);
+}
+
+lldb::user_id_t RemoteAwarePlatform::OpenFile(const FileSpec &file_spec,
+  uint32_t flags, uint32_t mode,
+  Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error);
+  return Platform::OpenFile(file_spec, flags, mode, error);
+}
+
+bool RemoteAwarePlatform::CloseFile(lldb::user_id_t fd, Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().CloseFile(fd, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->CloseFile(fd, error);
+  return Platform::CloseFile(fd, error);
+}
+
+uint64_t RemoteAwarePlatform::ReadFile(lldb::user_id_t fd, uint64_t offset,
+   void *dst, uint64_t dst_len,
+   Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error);
+  return Platform::ReadFile(fd, offset, dst, dst_len, error);
+}
+
+uint64_t RemoteAwarePlatform::WriteFile(lldb::user_id_t fd, uint64_t offset,
+const void *src, uint64_t src_len,
+Status &error) {
+  if (IsHost())
+return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error);
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error);
+  return Platform::WriteFile(fd, offset, src, src_len, error);
+}
+
+lldb::user_id_t RemoteAwarePlatform::GetFileSize(const FileSpec &file_spec) {
+  if (IsHost()) {
+uint64_t Size;
+if (llvm::sys::fs::file_size(file_spec.GetPath(), Size))
+  return 0;
+return Size;
+  }
+  if (m_remote_platform_sp)
+return m_remote_platform_sp->GetFileSize(file_spec);
+  return Platform::GetFileSize(file_spec);
+}
+
+Status RemoteAwarePlatform::CreateSymlink(const FileSpec &src,
+  const FileSpec &dst) {
+  if (IsHost())
+return FileSystem::Instance().Symlink(src, dst);
+  if (m_remote