[Lldb-commits] [PATCH] D62021: Fix LLDB warnings when compiling with Clang 8.0

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Host/windows/ProcessLauncherWindows.cpp:35-37
+  reinterpret_cast(const_cast(warg.c_str())),
+  reinterpret_cast(
+  const_cast(warg.c_str() + warg.size() + 1)));

I don't believe the const_cast here is needed. You should be able to just 
reinterpret_cast to `const char *`..


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62021



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


[Lldb-commits] [PATCH] D61994: [CommandInterpreter] Refactor SourceInitFile

2019-05-17 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.

I think this looks better than the original. Given that the only callers of 
`SourceInitFile` pass a constant value for the `InitFileLocation` argument, 
what I'd consider also doing is getting rid of the function and the enum, and 
making SourceInitFileHome/SourceInitFileCwd the main entry points.

One day I'm going to start a thread about reducing the use of FileSpecs in the 
FileSystem api...


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

https://reviews.llvm.org/D61994



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


[Lldb-commits] [PATCH] D61952: [CMake] Stabilize install process for LLDB.framework

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Yeah, neither of the options look really appealing... Still, I can't escape the 
feeling that we are doing something wrong, as the installation process should 
not be that complicated. Or is the framework support in cmake just not good 
enough?

Given that Alex (I believe) is the only other major user of the framework 
build, I'll let you two figure out what's the best way forward here...

In D61952#1505027 , @sgraenitz wrote:

> The problem here is, that there may be more things in the build-tree 
> framework than we overwrite, and thus remain in the install-tree (thinking 
> about Swift resources in swift-lldb for example).


Why are the swift resources (whatever they are) in the build-tree framework if 
they should not end up being installed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61952



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


[Lldb-commits] [lldb] r361000 - Make DWARFContext dwo-aware and port debug_info sections over

2019-05-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri May 17 01:26:58 2019
New Revision: 361000

URL: http://llvm.org/viewvc/llvm-project?rev=361000&view=rev
Log:
Make DWARFContext dwo-aware and port debug_info sections over

Summary:
The previous attempt and moving section handling over to DWARFContext
(D59611) failed because it did not take into account the dwo sections
correctly. All DWARFContexts (even those in SymbolFileDWARFDwo) used the
main module for loading the sections, but in the dwo scenario some
sections should come from the dwo file.

This patch fixes that by making the DWARFContext aware of whether it a
dwo context or a regular one. A dwo context gets two sections lists, and
it knows where to look for a particular type of a section. This isn't
fully consistent with how the llvm DWARFContext behaves, because that
one leaves it up to the user to know whether it should ask for a dwo
section or not. However, for the time being, it seems useful to have a
single entity which knows how to peice together the debug info in dwo
and non-dwo scenarios. The rough roadmap for the future is:
- port over the rest of the sections to DWARFContext
- find a way to get rid of SymbolFileDWARFDwo/Dwp/DwpDwo. This will
  likely involve adding the ability for the DWARFContext to spawn
  dwo sub-contexts, similarly to how it's done in llvm.
- get rid of the special handling of the "dwo" contexts by making
  sure everything knows whether it should ask for the .dwo version of
  the section or not (similarly to how llvm's DWARFUnits do that)

To demonstrate how the DWARFContext should behave in this new world, I
port the debug_info section (which is debug_info.dwo in the dwo file)
handling to DWARFContext. The rest of the sections will come in
subsequent patches.

Reviewers: aprantl, clayborg, JDevlieghere

Subscribers: zturner, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=361000&r1=360999&r2=361000&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri May 17 
01:26:58 2019
@@ -106,5 +106,5 @@ uint32_t DWARFCompileUnit::GetHeaderByte
 }
 
 const lldb_private::DWARFDataExtractor &DWARFCompileUnit::GetData() const {
-  return m_dwarf->get_debug_info_data();
+  return m_dwarf->GetDWARFContext().getOrLoadDebugInfoData();
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp?rev=361000&r1=360999&r2=361000&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp Fri May 17 
01:26:58 2019
@@ -13,9 +13,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static DWARFDataExtractor LoadSection(Module &module,
+static DWARFDataExtractor LoadSection(SectionList *section_list,
   SectionType section_type) {
-  SectionList *section_list = module.GetSectionList();
   if (!section_list)
 return DWARFDataExtractor();
 
@@ -29,16 +28,22 @@ static DWARFDataExtractor LoadSection(Mo
 }
 
 static const DWARFDataExtractor &
-LoadOrGetSection(Module &module, SectionType section_type,
+LoadOrGetSection(SectionList *section_list, SectionType section_type,
  llvm::Optional &extractor) {
   if (!extractor)
-extractor = LoadSection(module, section_type);
+extractor = LoadSection(section_list, section_type);
   return *extractor;
 }
 
-DWARFContext::DWARFContext(Module &module) : m_module(module) {}
-
 const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() {
-  return LoadOrGetSection(m_module, eSectionTypeDWARFDebugAranges,
+  return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAranges,
   m_data_debug_aranges);
 }
+
+const DWARFDataExtractor &DWARFContext::getOrLoadDebugInfoData() {
+  if (isDwo())
+return LoadOrGetSection(m_dwo_section_list, eSectionTypeDWARFDebugInfoDwo,
+ 

[Lldb-commits] [PATCH] D62012: Make DWARFContext dwo-aware and port debug_info sections over

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Closed by commit rL361000: Make DWARFContext dwo-aware and port debug_info 
sections over (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62012?vs=199833&id=199988#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62012

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -21,8 +21,9 @@
 
 SymbolFileDWARFDwo::SymbolFileDWARFDwo(ObjectFileSP objfile,
DWARFUnit *dwarf_cu)
-: SymbolFileDWARF(objfile.get()), m_obj_file_sp(objfile),
-  m_base_dwarf_cu(dwarf_cu) {
+: SymbolFileDWARF(objfile.get(), objfile->GetSectionList(
+ /*update_module_section_list*/ false)),
+  m_obj_file_sp(objfile), m_base_dwarf_cu(dwarf_cu) {
   SetID(((lldb::user_id_t)dwarf_cu->GetID()) << 32);
 }
 
@@ -129,10 +130,6 @@
   return m_data_debug_addr.m_data;
 }
 
-const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_info_data() {
-  return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo, m_data_debug_info);
-}
-
 const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_data() {
   return GetCachedSectionData(eSectionTypeDWARFDebugStrDwo, m_data_debug_str);
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -80,7 +80,7 @@
 return;
 
   lldb::offset_t offset = 0;
-  const auto &debug_info_data = m_dwarf2Data->get_debug_info_data();
+  const auto &debug_info_data = m_context.getOrLoadDebugInfoData();
 
   while (debug_info_data.ValidOffset(offset)) {
 llvm::Expected cu_sp = DWARFCompileUnit::extract(
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -106,5 +106,5 @@
 }
 
 const lldb_private::DWARFDataExtractor &DWARFCompileUnit::GetData() const {
-  return m_dwarf->get_debug_info_data();
+  return m_dwarf->GetDWARFContext().getOrLoadDebugInfoData();
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -13,9 +13,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static DWARFDataExtractor LoadSection(Module &module,
+static DWARFDataExtractor LoadSection(SectionList *section_list,
   SectionType section_type) {
-  SectionList *section_list = module.GetSectionList();
   if (!section_list)
 return DWARFDataExtractor();
 
@@ -29,16 +28,22 @@
 }
 
 static const DWARFDataExtractor &
-LoadOrGetSection(Module &module, SectionType section_type,
+LoadOrGetSection(SectionList *section_list, SectionType section_type,
  llvm::Optional &extractor) {
   if (!extractor)
-extractor = LoadSection(module, section_type);
+extractor = LoadSection(section_list, section_type);
   return *extractor;
 }
 
-DWARFContext::DWARFContext(Module &module) : m_module(module) {}
-
 const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() {
-  return LoadOrGetSection(m_module, eSectionTypeDWARFDebugAranges,
+  return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAranges,
   m_data_debug_aranges);
 }
+
+const DWARFDataExtractor &DWARFContext::getOrLoadDebugInfoData() {
+  if (isDwo())
+return LoadOrGetSection(m_dwo_section_list, eSectionTypeDWARFDebugInfoDwo,
+m_data_debug_info);
+  return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugInfo,
+  

[Lldb-commits] [PATCH] D62012: Make DWARFContext dwo-aware and port debug_info sections over

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFContext.cpp:47
+m_data_debug_info);
+  else
+return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugInfo,

JDevlieghere wrote:
> After the early return we can remove the else.
done.


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

https://reviews.llvm.org/D62012



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


[Lldb-commits] [PATCH] D62041: [Docs] Remove SVN checkout from LLDB build steps

2019-05-17 Thread J. Ryan Stinnett via Phabricator via lldb-commits
jryans updated this revision to Diff 13.
jryans added a comment.

Updated to remove the whole section


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62041

Files:
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -236,59 +236,8 @@
 
   > pkgin install swig python27 cmake ninja-build
 
-
-**Building LLDB**
-
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM鈥檚 tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
-It is highly recommended that you build the system out of tree. Create a second
-build directory and configure the LLVM project tree to your specifications as
-outlined in LLVM鈥檚 Getting Started Guide. A typical build procedure might be:
-
-::
-
-  > cd $llvm/..
-  > mkdir build
-  > cd build
-
 **To build with CMake**
 
-
 Using CMake is documented on the `Building LLVM with CMake
 `_ page. Building LLDB is possible using one
 of the following generators:


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -236,59 +236,8 @@
 
   > pkgin install swig python27 cmake ninja-build
 
-
-**Building LLDB**
-
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM鈥檚 tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
-It is highly recommended that you build the system out of tree. Create a second
-build directory and configure the LLVM project tree to your specifications as
-outlined in LLVM鈥檚 Getting Started Guide. A typical build procedure might be:
-
-::
-
-  > cd $llvm/..
-  > mkdir build
-  > cd build
-
 **To build with CMake**
 
-
 Using CMake is documented on the `Building LLVM with CMake
 `_ page. Building LLDB is possible using one
 of the following generators:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62041: [Docs] Remove SVN checkout from LLDB build steps

2019-05-17 Thread J. Ryan Stinnett via Phabricator via lldb-commits
jryans marked 2 inline comments as done.
jryans added a comment.

Thanks for the review @JDevlieghere! 馃槃 This should be ready for another look. I 
don't have commit access yet, so assuming it's approved, please commit when you 
have time.




Comment at: lldb/docs/resources/build.rst:242
 
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM鈥檚 tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
 It is highly recommended that you build the system out of tree. Create a second
 build directory and configure the LLVM project tree to your specifications as

JDevlieghere wrote:
> Let's remove the next paragraph as well and remove the whole section.
Makes sense to me! I have updated to do so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62041



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


[Lldb-commits] [PATCH] D61952: [CMake] Stabilize install process for LLDB.framework

2019-05-17 Thread Stefan Gr盲nitz via Phabricator via lldb-commits
sgraenitz added a comment.

Sure, ideally CMake defined a global install order and this order would handle 
overlap. I think that's unlikely to happen. It took quite some time to find and 
fix an overlap case downstream and I think it's worth avoiding it in general in 
the future. OTOH I see that the solution shouldn't be too intrusive. For the 
swift resources: I am not familiar with the details; all I know is that tests 
fail if they are missing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61952



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


[Lldb-commits] [lldb] r361010 - minidump: Use MemoryList parsing code from llvm

2019-05-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri May 17 02:47:34 2019
New Revision: 361010

URL: http://llvm.org/viewvc/llvm-project?rev=361010&view=rev
Log:
minidump: Use MemoryList parsing code from llvm

Modified:
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h

Modified: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp?rev=361010&r1=361009&r2=361010&view=diff
==
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp Fri May 17 
02:47:34 2019
@@ -284,7 +284,7 @@ std::vector Mi
 auto ExpectedName = m_file->getString(module.ModuleNameRVA);
 if (!ExpectedName) {
   LLDB_LOG_ERROR(log, ExpectedName.takeError(),
- "Failed to module name: {0}");
+ "Failed to get module name: {0}");
   continue;
 }
 
@@ -324,19 +324,15 @@ const MinidumpExceptionStream *MinidumpP
 
 llvm::Optional
 MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
-  llvm::ArrayRef data = GetStream(StreamType::MemoryList);
   llvm::ArrayRef data64 = GetStream(StreamType::Memory64List);
+  Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
 
-  if (data.empty() && data64.empty())
-return llvm::None;
-
-  if (!data.empty()) {
-llvm::ArrayRef memory_list = ParseMemoryList(data);
-
-if (memory_list.empty())
-  return llvm::None;
-
-for (const auto &memory_desc : memory_list) {
+  auto ExpectedMemory = GetMinidumpFile().getMemoryList();
+  if (!ExpectedMemory) {
+LLDB_LOG_ERROR(log, ExpectedMemory.takeError(),
+   "Failed to read memory list: {0}");
+  } else {
+for (const auto &memory_desc : *ExpectedMemory) {
   const LocationDescriptor &loc_desc = memory_desc.Memory;
   const lldb::addr_t range_start = memory_desc.StartOfMemoryRange;
   const size_t range_size = loc_desc.DataSize;
@@ -345,8 +341,13 @@ MinidumpParser::FindMemoryRange(lldb::ad
 return llvm::None;
 
   if (range_start <= addr && addr < range_start + range_size) {
-return minidump::Range(range_start,
-   GetData().slice(loc_desc.RVA, range_size));
+auto ExpectedSlice = GetMinidumpFile().getRawData(loc_desc);
+if (!ExpectedSlice) {
+  LLDB_LOG_ERROR(log, ExpectedSlice.takeError(),
+ "Failed to get memory slice: {0}");
+  return llvm::None;
+}
+return minidump::Range(range_start, *ExpectedSlice);
   }
 }
   }
@@ -450,14 +451,15 @@ CreateRegionsCacheFromMemoryInfoList(Min
 static bool
 CreateRegionsCacheFromMemoryList(MinidumpParser &parser,
  std::vector 庐ions) {
-  auto data = parser.GetStream(StreamType::MemoryList);
-  if (data.empty())
+  Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
+  auto ExpectedMemory = parser.GetMinidumpFile().getMemoryList();
+  if (!ExpectedMemory) {
+LLDB_LOG_ERROR(log, ExpectedMemory.takeError(),
+   "Failed to read memory list: {0}");
 return false;
-  auto memory_list = ParseMemoryList(data);
-  if (memory_list.empty())
-return false;
-  regions.reserve(memory_list.size());
-  for (const auto &memory_desc : memory_list) {
+  }
+  regions.reserve(ExpectedMemory->size());
+  for (const MemoryDescriptor &memory_desc : *ExpectedMemory) {
 if (memory_desc.Memory.DataSize == 0)
   continue;
 MemoryRegionInfo region;

Modified: lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp?rev=361010&r1=361009&r2=361010&view=diff
==
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp Fri May 17 
02:47:34 2019
@@ -68,25 +68,6 @@ MinidumpExceptionStream::Parse(llvm::Arr
   return exception_stream;
 }
 
-llvm::ArrayRef
-minidump::ParseMemoryList(llvm::ArrayRef &data) {
-  const auto orig_size = data.size();
-  const llvm::support::ulittle32_t *mem_ranges_count;
-  Status error = consumeObject(data, mem_ranges_count);
-  if (error.Fail() ||
-  *mem_ranges_count * sizeof(MemoryDescriptor) > data.size())
-return {};
-  
-  // Compilers might end up padding an extra 4 bytes depending on how the
-  // structure is padded by the compiler and the #pragma pack settings.
-  if (4 + *mem_ranges_count * sizeof(MemoryDescriptor) < orig_size)
-data = data.drop_front(4);
-
-  return llvm::makeArrayRef(
-  reinterpret_cast(data.data()),
-  *mem_ranges_count);
-}
-
 std::

[Lldb-commits] [PATCH] D61956: [CMake] Add first CMake cache files

2019-05-17 Thread Stefan Gr盲nitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 27.
sgraenitz marked 11 inline comments as done.
sgraenitz added a comment.

Fix default install locations and add comments on how to use DESTDIR


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61956

Files:
  lldb/cmake/caches/Apple-lldb-base.cmake
  lldb/cmake/caches/Apple-lldb-macOS.cmake


Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- /dev/null
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -0,0 +1,22 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+
+# Set the install prefix to the default install location on the enduser 
machine.
+# If the location is not writeable on the build machine, specify another prefix
+# in the DESTDIR environment variable, e.g.: DESTDIR=/tmp ninja install
+set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/usr CACHE 
STRING "")
+
+# Choose the install location for LLDB.framework so that it matches the
+# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
+# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
+set(LLDB_FRAMEWORK_INSTALL_DIR 
/Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")
+
+# Release builds may change these:
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
Index: lldb/cmake/caches/Apple-lldb-base.cmake
===
--- /dev/null
+++ lldb/cmake/caches/Apple-lldb-base.cmake
@@ -0,0 +1,8 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+
+# Release builds set these explicitly:
+#set(LLDB_VERSION_MAJOR  CACHE STRING "")
+#set(LLDB_VERSION_MINOR 9 CACHE STRING "")
+#set(LLDB_VERSION_PATCH 9 CACHE STRING "")
+#set(LLDB_VERSION_SUFFIX git CACHE STRING "")


Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- /dev/null
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -0,0 +1,22 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+
+# Set the install prefix to the default install location on the enduser machine.
+# If the location is not writeable on the build machine, specify another prefix
+# in the DESTDIR environment variable, e.g.: DESTDIR=/tmp ninja install
+set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/usr CACHE STRING "")
+
+# Choose the install location for LLDB.framework so that it matches the
+# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
+# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
+set(LLDB_FRAMEWORK_INSTALL_DIR /Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")
+
+# Release builds may change these:
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
Index: lldb/cmake/caches/Apple-lldb-base.cmake
===
--- /dev/null
+++ lldb/cmake/caches/Apple-lldb-base.cmake
@@ -0,0 +1,8 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+
+# Release builds set these explicitly:
+#set(LLDB_VERSION_MAJOR  CACHE STRING "")
+#set(LLDB_VERSION_MINOR 9 CACHE STRING "")
+#set(LLDB_VERSION_PATCH 9 CACHE STRING "")
+#set(LLDB_VERSION_SUFFIX git CACHE STRING "")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61956: [CMake] Add first CMake cache files

2019-05-17 Thread Stefan Gr盲nitz via Phabricator via lldb-commits
sgraenitz added a comment.

In D61956#1505144 , @xiaobai wrote:

> I noticed you have lots of comments that say "Release has different values 
> for these variables".


Yes, I was arguing: //In a previous sketch I had extra variants for development 
and release builds. I preferred to keep only one variant for now and make notes 
for release builds instead, because actual release configurations are likely 
more complex anyway.//

> I think that you could instead guard the Release configuration behind a check.

This would require setting `CMAKE_BUILD_TYPE` before loading the cache and it's 
not obvious when looking at the cache file.
I think we should avoid this, because the more useful command line order is: 
first load the cache, then override options on top of it. Let's not motivate 
people to mix the two. Thus, I'd keep it as is.

Thanks for all the input and discussions. I think this is something we have to 
iterate on. The current state looks like a good starting point to me. If there 
are no major concerns, I would land this some time soon.




Comment at: lldb/cmake/caches/Apple-lldb-macOS.cmake:18
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")

xiaobai wrote:
> xiaobai wrote:
> > labath wrote:
> > > sgraenitz wrote:
> > > > compnerd wrote:
> > > > > sgraenitz wrote:
> > > > > > Can / Should we add this? Here?
> > > > > This is fine to add assuming that you are building on Darwin since 
> > > > > that implies clang and that will work.  I would say that if you 
> > > > > really want to be pedantically correct, it would be better to do:
> > > > > 
> > > > > ```
> > > > > if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
> > > > >   set(LLVM_ENABLE_MODULES_ON CACHE BOOL "")
> > > > > endif()
> > > > > ```
> > > > > 
> > > > > Note that the `MATCHES` is required here to match both `Clang` and 
> > > > > `AppleClang`.
> > > > That sounds reasonable. I would take your version and put it in the 
> > > > base cache?
> > > > 
> > > > The other question was, whether `RelWithDebInfo` is a good default. 
> > > > Personally, I use it far more often than other configurations. (Running 
> > > > the test suite with a debug Clang is just too slow.) Moving to the base 
> > > > cache too.
> > > Are you sure that `CMAKE_CXX_COMPILER_ID` is available this early in the 
> > > initialization ?
> > I think RelWithDebInfo is an okay default. I personally don't like to set 
> > build types in caches because I think it's reasonable to expect the user to 
> > specify their build type, but if you mostly use that one build type then 
> > it's fine.
> I don't think `CMAKE_CXX_COMPILER_ID` is available at the cache processing 
> stage of initialization, so this is probably not something you can do. Maybe 
> you can guard with the condition that the OS is Darwin? Maybe that's not 
> needed, since the cache is Apple-specific anyway.
Build type can still be set on the command line, it just feels like a better 
default then Debug.
Everything else: agreed. Will keep it as is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61956



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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-05-17 Thread Rui Ueyama via Phabricator via lldb-commits
ruiu added a comment.

Bob, thank you for reverting this.

So, Robert, looks like this idea didn't work well. We need a different 
solution. And perhaps a better approach is to use --start-lib and --end-lib. 
You found that these options didn't work well for your input, but I don't fully 
understand why that's the case. Are you combining all input object files into a 
single object file using `-r` linker option? If you just pass all object files 
to the linker's command line, the linker can choose only the files that are 
actually used. I'd like to understand why that didn't work for Rust.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [PATCH] D62061: Add AST logging

2019-05-17 Thread Gabor Marton via Phabricator via lldb-commits
martong created this revision.
martong added a reviewer: shafik.
Herald added subscribers: lldb-commits, gamesh411, Szelethus, dkrupp, rnkovacs.
Herald added a project: LLDB.

Log the AST of the TU associated with LLDB's `expr` command, once a declaration
is completed


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62061

Files:
  lldb/include/lldb/Utility/Logging.h
  lldb/source/Symbol/ClangASTImporter.cpp
  lldb/source/Utility/Logging.cpp


Index: lldb/source/Utility/Logging.cpp
===
--- lldb/source/Utility/Logging.cpp
+++ lldb/source/Utility/Logging.cpp
@@ -17,6 +17,7 @@
 
 static constexpr Log::Category g_categories[] = {
   {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API},
+  {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST},
   {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS},
   {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS},
   {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION},
Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -951,6 +951,28 @@
   if (clang::TagDecl *to_tag = dyn_cast(to)) {
 if (clang::TagDecl *from_tag = dyn_cast(from)) {
   to_tag->setCompleteDefinition(from_tag->isCompleteDefinition());
+
+  Log *log_ast(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST));
+  if (log_ast) {
+std::string name_string;
+if (NamedDecl *from_named_decl = dyn_cast(from)) {
+  llvm::raw_string_ostream name_stream(name_string);
+  from_named_decl->printName(name_stream);
+  name_stream.flush();
+}
+log_ast->Printf(" [ClangASTImporter][TUDecl: %p] Imported "
+"(%sDecl*)%p, named %s (from "
+"(Decl*)%p)",
+static_cast(to->getTranslationUnitDecl()),
+from->getDeclKindName(), static_cast(to),
+name_string.c_str(), static_cast(from));
+
+// Log the AST of the TU.
+std::string ast_string;
+llvm::raw_string_ostream ast_stream(ast_string);
+to->getTranslationUnitDecl()->dump(ast_stream);
+log_ast->Printf("%s", ast_string.c_str());
+  }
 }
   }
 
Index: lldb/include/lldb/Utility/Logging.h
===
--- lldb/include/lldb/Utility/Logging.h
+++ lldb/include/lldb/Utility/Logging.h
@@ -42,6 +42,7 @@
 #define LIBLLDB_LOG_LANGUAGE (1u << 28)
 #define LIBLLDB_LOG_DATAFORMATTERS (1u << 29)
 #define LIBLLDB_LOG_DEMANGLE (1u << 30)
+#define LIBLLDB_LOG_AST (1u << 31)
 #define LIBLLDB_LOG_ALL (UINT32_MAX)
 #define LIBLLDB_LOG_DEFAULT
\
   (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD | LIBLLDB_LOG_DYNAMIC_LOADER | 
\


Index: lldb/source/Utility/Logging.cpp
===
--- lldb/source/Utility/Logging.cpp
+++ lldb/source/Utility/Logging.cpp
@@ -17,6 +17,7 @@
 
 static constexpr Log::Category g_categories[] = {
   {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API},
+  {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST},
   {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS},
   {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS},
   {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION},
Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -951,6 +951,28 @@
   if (clang::TagDecl *to_tag = dyn_cast(to)) {
 if (clang::TagDecl *from_tag = dyn_cast(from)) {
   to_tag->setCompleteDefinition(from_tag->isCompleteDefinition());
+
+  Log *log_ast(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST));
+  if (log_ast) {
+std::string name_string;
+if (NamedDecl *from_named_decl = dyn_cast(from)) {
+  llvm::raw_string_ostream name_stream(name_string);
+  from_named_decl->printName(name_stream);
+  name_stream.flush();
+}
+log_ast->Printf(" [ClangASTImporter][TUDecl: %p] Imported "
+"(%sDecl*)%p, named %s (from "
+"(Decl*)%p)",
+static_cast(to->getTranslationUnitDecl()),
+from->getDeclKindName(), static_cast(to),
+name_string.c_str(), static_cast(from));
+
+// Log the AST of the TU.
+std::string ast_string;
+llvm::raw_string_ostream ast_stream(ast_string);
+to->getTranslationUnitDecl()->dump(ast_stream);
+log_ast->Printf("%s", ast_string.c_str());
+  }
 }
   }
 
Index: lldb/include/lldb/Utility/Logging.h

[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-05-17 Thread Gabor Marton via Phabricator via lldb-commits
martong updated this revision to Diff 200031.
martong added a comment.

- Rebase to master
- Rebase to D62061 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp
  lldb/packages/Python/lldbsuite/test/lang/c/ast/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
  lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
  lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -637,18 +637,6 @@
 
 m_ast_importer_sp->RequireCompleteType(copied_field_type);
   }
-
-  DeclContext *decl_context_non_const =
-  const_cast(decl_context);
-
-  if (copied_decl->getDeclContext() != decl_context) {
-if (copied_decl->getDeclContext()->containsDecl(copied_decl))
-  copied_decl->getDeclContext()->removeDecl(copied_decl);
-copied_decl->setDeclContext(decl_context_non_const);
-  }
-
-  if (!decl_context_non_const->containsDecl(copied_decl))
-decl_context_non_const->addDeclInternal(copied_decl);
 }
   }
 
Index: lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
===
--- lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
@@ -5,11 +5,11 @@
 typedef struct {
 int a;
 int b;
-} FILE;
+} MYFILE;
 
 int main()
 {
-FILE *myFile = malloc(sizeof(FILE));
+MYFILE *myFile = malloc(sizeof(MYFILE));
 
 myFile->a = 5;
 myFile->b = 9;
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
@@ -0,0 +1,5 @@
+int main()
+{
+int a = 0; // Set breakpoint 0 here.
+return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
@@ -0,0 +1,77 @@
+"""Test that importing modules in C works as expected."""
+
+from __future__ import print_function
+
+
+from distutils.version import StrictVersion
+import os
+import time
+import platform
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class CModulesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfFreeBSD
+@skipIfLinux
+@skipIfWindows
+@skipIfNetBSD
+@skipIf(macos_version=["<", "10.12"])
+def test_expr(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(
+self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+substrs=[' resolved, hit count = 1'])
+
+# Enable logging of the imported AST.
+log_file = os.path.join(self.getBuildDir(), "lldb-ast-log.txt")
+self.runCmd("log enable lldb ast -f '%s'" % log_file)
+
+self.expect(
+"expr -l objc++ -- @import Darwin; 3",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+"int",
+"3"])
+
+# This expr command imports __sFILE with definition
+# (FILE is a typedef to __sFILE.)
+self.expect(
+"expr *fopen(\"/dev/zero\", \"w\")",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+"FILE",
+"_close"]
+)
+
+# Check that the AST log contains exactly one definition of __sFILE.
+f = open(log_file)
+log_lines = f.readlines()
+f.close()
+os.remove(log_file)
+self.assertEqual(" ".join(log_lines).count("struct __sFILE definition"), 1)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.line = line_number('main.c', '// Set breakpoint 0 here.')
Index: lldb/pack

[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-05-17 Thread Gabor Marton via Phabricator via lldb-commits
martong marked an inline comment as done.
martong added inline comments.



Comment at: lldb/source/Symbol/ClangASTImporter.cpp:922
+
+  Log *log_ast(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST));
+  if (log_ast) {

shafik wrote:
> I am going to say that the logging change is an excellent additions and 
> stands alone from this change. Although I realize the test depends on this 
> new feature. It makes sense to add the logging in a separate PR.
> 
> I also say this b/c I found a regression and it would be nice to get the 
> logging in while we resolve the regression.
Ok, I have created a new patch for logging (https://reviews.llvm.org/D62061).
I made this patch to be the child of that and rebased to that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333



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


[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-05-17 Thread Gabor Marton via Phabricator via lldb-commits
martong updated this revision to Diff 200033.
martong added a comment.

- se -> so


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp
  lldb/packages/Python/lldbsuite/test/lang/c/ast/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
  lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
  lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -637,18 +637,6 @@
 
 m_ast_importer_sp->RequireCompleteType(copied_field_type);
   }
-
-  DeclContext *decl_context_non_const =
-  const_cast(decl_context);
-
-  if (copied_decl->getDeclContext() != decl_context) {
-if (copied_decl->getDeclContext()->containsDecl(copied_decl))
-  copied_decl->getDeclContext()->removeDecl(copied_decl);
-copied_decl->setDeclContext(decl_context_non_const);
-  }
-
-  if (!decl_context_non_const->containsDecl(copied_decl))
-decl_context_non_const->addDeclInternal(copied_decl);
 }
   }
 
Index: lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
===
--- lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
@@ -5,11 +5,11 @@
 typedef struct {
 int a;
 int b;
-} FILE;
+} MYFILE;
 
 int main()
 {
-FILE *myFile = malloc(sizeof(FILE));
+MYFILE *myFile = malloc(sizeof(MYFILE));
 
 myFile->a = 5;
 myFile->b = 9;
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
@@ -0,0 +1,5 @@
+int main()
+{
+int a = 0; // Set breakpoint 0 here.
+return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
@@ -0,0 +1,77 @@
+"""Test that importing modules in C works as expected."""
+
+from __future__ import print_function
+
+
+from distutils.version import StrictVersion
+import os
+import time
+import platform
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class CModulesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfFreeBSD
+@skipIfLinux
+@skipIfWindows
+@skipIfNetBSD
+@skipIf(macos_version=["<", "10.12"])
+def test_expr(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(
+self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+substrs=[' resolved, hit count = 1'])
+
+# Enable logging of the imported AST.
+log_file = os.path.join(self.getBuildDir(), "lldb-ast-log.txt")
+self.runCmd("log enable lldb ast -f '%s'" % log_file)
+
+self.expect(
+"expr -l objc++ -- @import Darwin; 3",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+"int",
+"3"])
+
+# This expr command imports __sFILE with definition
+# (FILE is a typedef to __sFILE.)
+self.expect(
+"expr *fopen(\"/dev/zero\", \"w\")",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+"FILE",
+"_close"]
+)
+
+# Check that the AST log contains exactly one definition of __sFILE.
+f = open(log_file)
+log_lines = f.readlines()
+f.close()
+os.remove(log_file)
+self.assertEqual(" ".join(log_lines).count("struct __sFILE definition"), 1)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.line = line_number('main.c', '// Set breakpoint 0 here.')
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/Makefile
==

[Lldb-commits] [PATCH] D61952: [CMake] Stabilize install process for LLDB.framework

2019-05-17 Thread Stefan Gr盲nitz via Phabricator via lldb-commits
sgraenitz added a comment.

>> In D61952#1503551 , @JDevlieghere 
>> wrote:
>> 
>>> How does this cleanup affect dependency tracking? Does the build dir become 
>>> unusable after running ninja install?
>> 
>> 
>> In D61952#1504942 , @sgraenitz 
>> wrote:
>>  Actually, why not make the copy operations `PRE_BUILD` actions of the test 
>> suite instead of `POST_BUILD` actions of their executables?
> 
> In D61952#1505019 , @sgraenitz wrote:
>  The solution to the "install -> test" issue would be having both I guess.

TBH, I don't know how to accomplish this in the current state of the build 
system. I went through various options and didn't find a functioning one that 
works without, basically, turning everything upside down. We have similar 
functionality in `lldb-framework-headers`, but the appraoch only works in the 
directory where `lldb-framework` was defined. Furthermore we cannot rely on the 
existence of `lldb-framework` as `lldb_add_to_framework()` may be called before 
`/lldb/source/API` is processed (e.g. everything else in `/lldb/source`).

On one hand, the main use-case works: if the test suite succeeds then run 
install. And it sounds "kind of" acceptable that it fails the other way around.
On the other hand, seeing the amount of extra effort, "workaround" may be a 
better term to describe this change then "stabilize".

At the moment I agree, that neither of the options look really appealing. Good 
point to rethink the approach and find something more solid. If that fails, I 
might re-evaluate this one.

@xiaobai Out of interest: have you faced overwrite issues when running 
`install` and would this patch help?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61952



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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-05-17 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

For posterity, https://bugs.chromium.org/p/chromium/issues/detail?id=960881#c31 
has the explanation for what exactly was happening in the Chromium/Android 
build. It's a bit different from rnk's example since no cross-TU imports are 
happening. It likely explains why rnk couldn't find an example that doesn't use 
thinlto though: To get the bug, you need to require debug info in a TU but all 
actual code of the TU needs to be stripped. In regular builds this can't 
happen, but in thinlto builds it can happen in several cases:

- rnk's example: A function is inlined into a different TU for inlining, but 
the definition (+ debug info) is in a different, now-empty TU.

- my example: An inline function is in two TUs. The thin link step marks one of 
them as weak_odr and the others as available_externally, which causes the debug 
info to go into only the TU where the function is weak_odr. If this TU happens 
to contain no actual code, it will now be dead-stripped, even though the other 
TUs relied on it to provide debug info. This doesn't require any cross-TU 
function importing.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [PATCH] D61994: [CommandInterpreter] Refactor SourceInitFile

2019-05-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 200056.
JDevlieghere added a comment.

Remove unneeded use of FileSpec. I wanted to do this yesterday but didn't get 
around to it...


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

https://reviews.llvm.org/D61994

Files:
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -81,6 +81,17 @@
 static constexpr uintptr_t DefaultValueTrue = true;
 static constexpr uintptr_t DefaultValueFalse = false;
 static constexpr const char *NoCStrDefault = nullptr;
+static constexpr const char *InitFileWarning =
+"There is a .lldbinit file in the current directory which is not being "
+"read.\n"
+"To silence this warning without sourcing in the local .lldbinit,\n"
+"add the following to the lldbinit file in your home directory:\n"
+"settings set target.load-cwd-lldbinit false\n"
+"To allow lldb to source .lldbinit files in the current working "
+"directory,\n"
+"set the value of this variable to true.  Only do so if you understand "
+"and\n"
+"accept the security risk.";
 
 static constexpr PropertyDefinition g_properties[] = {
 {"expand-regex-aliases", OptionValue::eTypeBoolean, NoGlobalSetting,
@@ -2091,100 +2102,111 @@
   return position;
 }
 
-void CommandInterpreter::SourceInitFile(bool in_cwd,
-CommandReturnObject &result) {
-  FileSpec init_file;
-  if (in_cwd) {
-lldb::TargetPropertiesSP properties = Target::GetGlobalProperties();
-if (properties) {
-  // In the current working directory we don't load any program specific
-  // .lldbinit files, we only look for a ".lldbinit" file.
-  if (m_skip_lldbinit_files)
-return;
+static llvm::SmallString<128> GetHomeInitFile(llvm::StringRef suffix = {}) {
+  std::string init_file_name = ".lldbinit";
+  if (!suffix.empty()) {
+init_file_name.append("-");
+init_file_name.append(suffix.str());
+  }
 
-  LoadCWDlldbinitFile should_load = properties->GetLoadCWDlldbinitFile();
-  if (should_load == eLoadCWDlldbinitWarn) {
-FileSpec dot_lldb(".lldbinit");
-FileSystem::Instance().Resolve(dot_lldb);
-llvm::SmallString<64> home_dir_path;
-llvm::sys::path::home_directory(home_dir_path);
-FileSpec homedir_dot_lldb(home_dir_path.c_str());
-homedir_dot_lldb.AppendPathComponent(".lldbinit");
-FileSystem::Instance().Resolve(homedir_dot_lldb);
-if (FileSystem::Instance().Exists(dot_lldb) &&
-dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) {
-  result.AppendErrorWithFormat(
-  "There is a .lldbinit file in the current directory which is not "
-  "being read.\n"
-  "To silence this warning without sourcing in the local "
-  ".lldbinit,\n"
-  "add the following to the lldbinit file in your home directory:\n"
-  "settings set target.load-cwd-lldbinit false\n"
-  "To allow lldb to source .lldbinit files in the current working "
-  "directory,\n"
-  "set the value of this variable to true.  Only do so if you "
-  "understand and\n"
-  "accept the security risk.");
-  result.SetStatus(eReturnStatusFailed);
-  return;
-}
-  } else if (should_load == eLoadCWDlldbinitTrue) {
-init_file.SetFile("./.lldbinit", FileSpec::Style::native);
-FileSystem::Instance().Resolve(init_file);
-  }
-}
-  } else {
-// If we aren't looking in the current working directory we are looking in
-// the home directory. We will first see if there is an application
-// specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-"
-// and the name of the program. If this file doesn't exist, we fall back to
-// just the "~/.lldbinit" file. We also obey any requests to not load the
-// init files.
-llvm::SmallString<64> home_dir_path;
-llvm::sys::path::home_directory(home_dir_path);
-FileSpec profilePath(home_dir_path.c_str());
-profilePath.AppendPathComponent(".lldbinit");
-std::string init_file_path = profilePath.GetPath();
-
-if (!m_skip_app_init_files) {
-  FileSpec program_file_spec(HostInfo::GetProgramFileSpec());
-  const char *program_name = program_file_spec.GetFilename().AsCString();
-
-  if (program_name) {
-char program_init_file_name[PATH_MAX];
-::snprintf(program_init_file_name, sizeof(program_init_file_name),
-   "%s-%s", init_file_path.c_str(), program_name);
-init_file.SetFile(program_init_file_name, FileSpec::Style::nati

[Lldb-commits] [lldb] r361046 - [Docs] Remove SVN checkout from LLDB build steps

2019-05-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri May 17 09:22:26 2019
New Revision: 361046

URL: http://llvm.org/viewvc/llvm-project?rev=361046&view=rev
Log:
[Docs] Remove SVN checkout from LLDB build steps

This removes several older paragraphs in the LLDB build steps for Unix
systems which suggested checking out various components via SVN. Since
there's a separate page about getting the LLDB source which only
mentions Git, it seems appropriate to remove this older info from the
build docs.

Patch by: J. Ryan Stinnett

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

Modified:
lldb/trunk/docs/resources/build.rst

Modified: lldb/trunk/docs/resources/build.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=361046&r1=361045&r2=361046&view=diff
==
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Fri May 17 09:22:26 2019
@@ -236,59 +236,8 @@ On NetBSD one might run:
 
   > pkgin install swig python27 cmake ninja-build
 
-
-**Building LLDB**
-
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM芒聙聶s tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
-It is highly recommended that you build the system out of tree. Create a second
-build directory and configure the LLVM project tree to your specifications as
-outlined in LLVM芒聙聶s Getting Started Guide. A typical build procedure might be:
-
-::
-
-  > cd $llvm/..
-  > mkdir build
-  > cd build
-
 **To build with CMake**
 
-
 Using CMake is documented on the `Building LLVM with CMake
 `_ page. Building LLDB is possible using one
 of the following generators:


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


[Lldb-commits] [PATCH] D62041: [Docs] Remove SVN checkout from LLDB build steps

2019-05-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

LGTM. Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62041



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


[Lldb-commits] [PATCH] D62041: [Docs] Remove SVN checkout from LLDB build steps

2019-05-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361046: [Docs] Remove SVN checkout from LLDB build steps 
(authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62041?vs=13&id=200057#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62041

Files:
  lldb/trunk/docs/resources/build.rst


Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -236,59 +236,8 @@
 
   > pkgin install swig python27 cmake ninja-build
 
-
-**Building LLDB**
-
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM鈥檚 tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
-It is highly recommended that you build the system out of tree. Create a second
-build directory and configure the LLVM project tree to your specifications as
-outlined in LLVM鈥檚 Getting Started Guide. A typical build procedure might be:
-
-::
-
-  > cd $llvm/..
-  > mkdir build
-  > cd build
-
 **To build with CMake**
 
-
 Using CMake is documented on the `Building LLVM with CMake
 `_ page. Building LLDB is possible using one
 of the following generators:


Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -236,59 +236,8 @@
 
   > pkgin install swig python27 cmake ninja-build
 
-
-**Building LLDB**
-
-We first need to checkout the source trees into the appropriate locations. Both
-Clang and LLDB build as subprojects of LLVM. This means we will be checking out
-the source for both Clang and LLDB into the tools subdirectory of LLVM. We will
-be setting up a directory hierarchy looking something like this:
-
-::
-
-  llvm
-  |
-  `-- tools
-  |
-  +-- clang
-  |
-  `-- lldb
-
-For reference, we will call the root of the LLVM project tree $llvm, and the
-roots of the Clang and LLDB source trees $clang and $lldb respectively.
-
-Change to the directory where you want to do development work and checkout
-LLVM:
-
-::
-
-  > svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
-
-
-Now switch to LLVM鈥檚 tools subdirectory and checkout both Clang and LLDB:
-
-::
-
-  > cd $llvm/tools
-  > svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
-  > svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-In general, building the LLDB trunk revision requires trunk revisions of both
-LLVM and Clang.
-
-It is highly recommended that you build the system out of tree. Create a second
-build directory and configure the LLVM project tree to your specifications as
-outlined in LLVM鈥檚 Getting Started Guide. A typical build procedure might be:
-
-::
-
-  > cd $llvm/..
-  > mkdir build
-  > cd build
-
 **To build with CMake**
 
-
 Using CMake is documented on the `Building LLVM with CMake
 `_ page. Building LLDB is possible using one
 of the following generators:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62021: Fix LLDB warnings when compiling with Clang 8.0

2019-05-17 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea marked 2 inline comments as done.
aganea added inline comments.



Comment at: source/Host/windows/ProcessLauncherWindows.cpp:35-37
+  reinterpret_cast(const_cast(warg.c_str())),
+  reinterpret_cast(
+  const_cast(warg.c_str() + warg.size() + 1)));

labath wrote:
> I don't believe the const_cast here is needed. You should be able to just 
> reinterpret_cast to `const char *`..
You're right - fixed.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62021



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


[Lldb-commits] [lldb] r361049 - Update list of supported architectures.

2019-05-17 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri May 17 10:05:23 2019
New Revision: 361049

URL: http://llvm.org/viewvc/llvm-project?rev=361049&view=rev
Log:
Update list of supported architectures.

Modified:
lldb/trunk/docs/index.rst

Modified: lldb/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/index.rst?rev=361049&r1=361048&r2=361049&view=diff
==
--- lldb/trunk/docs/index.rst (original)
+++ lldb/trunk/docs/index.rst Fri May 17 10:05:23 2019
@@ -67,11 +67,11 @@ Platform Support
 LLDB is known to work on the following platforms, but ports to new platforms
 are welcome:
 
-* macOS desktop user space debugging for i386 and x86-64
-* iOS simulator debugging on i386
-* iOS device debugging on ARM
-* Linux local user-space debugging for i386, x86-64 and PPC64le
-* FreeBSD local user-space debugging for i386 and x86-64
+* macOS desktop user space debugging for i386 and x86_64
+* iOS simulator debugging on i386 and x86_64
+* iOS device debugging on ARM and AArch64
+* Linux local user-space debugging for i386, x86_64 and PPC64le
+* FreeBSD local user-space debugging for i386 and x86_64
 * Windows local user-space debugging for i386 (*)
 
 (*) Support for Windows is under active development. Basic functionality is


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


[Lldb-commits] [PATCH] D61952: [CMake] Stabilize install process for LLDB.framework

2019-05-17 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D61952#1506608 , @sgraenitz wrote:

> @xiaobai Out of interest: have you faced overwrite issues when running 
> `install` and would this patch help?


It's been a while since I've looked at in detail but I don't remember having 
any issues. It's possible that I don't remember or things have changed while I 
didn't notice. I'll play with my build and try it out with your patch applied, 
and then report back.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61952



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


[Lldb-commits] [lldb] r361064 - [CommandInterpreter] Fix trailing blanks after `all` or [0-9]+ for bt

2019-05-17 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Fri May 17 11:52:42 2019
New Revision: 361064

URL: http://llvm.org/viewvc/llvm-project?rev=361064&view=rev
Log:
[CommandInterpreter] Fix trailing blanks after `all` or [0-9]+ for bt

The change that was committed for this used \\s to match spaces which does not 
work correctly on all platforms. Using [:space:] makes the test pass on both 
Linux and Windows

Modified:
lldb/trunk/lit/Commands/command-backtrace.test
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/lit/Commands/command-backtrace.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/command-backtrace.test?rev=361064&r1=361063&r2=361064&view=diff
==
--- lldb/trunk/lit/Commands/command-backtrace.test (original)
+++ lldb/trunk/lit/Commands/command-backtrace.test Fri May 17 11:52:42 2019
@@ -7,6 +7,6 @@ bt 1
 # CHECK: error: invalid target
 
 # Make sure this is not rejected by the parser as invalid syntax.
-# Blank characters after the '1' are important, as we're testing the parser.
+# Blank characters after the 'all' are important, as we're testing the parser.
 bt all   
 # CHECK: error: invalid target

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=361064&r1=361063&r2=361064&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri May 17 11:52:42 
2019
@@ -758,12 +758,12 @@ void CommandInterpreter::LoadCommandDict
 // command if you wanted to backtrace three frames you would do "bt -c 3"
 // but the intention is to have this emulate the gdb "bt" command and so
 // now "bt 3" is the preferred form, in line with gdb.
-if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)\\s*$",
+if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)\\s*$",
+bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
  "thread backtrace -c %1") &&
-bt_regex_cmd_up->AddRegexCommand("^all\\s*$", "thread backtrace all") 
&&
-bt_regex_cmd_up->AddRegexCommand("^\\s*$", "thread backtrace")) {
+bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread 
backtrace all") &&
+bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread 
backtrace")) {
   CommandObjectSP command_sp(bt_regex_cmd_up.release());
   m_command_dict[command_sp->GetCommandName()] = command_sp;
 }


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


[Lldb-commits] [PATCH] D62073: Introduce DWARFUnitHeader and use it to parse type units out of .debug_info

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: aprantl, clayborg, JDevlieghere.

This patch introduces the DWARFUnitHeader class. Its purpose (and its
structure, to the extent it was possible to make it) is the same as its
LLVM counterpart -- to extract the unit header information before we
actually construct the unit, so that we know which kind of units to
construct. This is needed because as of DWARF5, type units live in the
.debug_info section, which means it's not possible to statically
determine the type of units in a given section.

I add a test which parses dwarf5-style type units.


https://reviews.llvm.org/D62073

Files:
  lit/SymbolFile/DWARF/debug-types-basic.test
  lit/SymbolFile/DWARF/debug-types-expressions.test
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -31,11 +31,46 @@
   eProcucerOther
 };
 
+/// Base class describing the header of any kind of "unit."  Some information
+/// is specific to certain unit types.  We separate this class out so we can
+/// parse the header before deciding what specific kind of unit to construct.
+class DWARFUnitHeader {
+  dw_offset_t m_offset = 0;
+  dw_offset_t m_length = 0;
+  uint16_t m_version = 0;
+  dw_offset_t m_abbr_offset = 0;
+  uint8_t m_unit_type = 0;
+  uint8_t m_addr_size = 0;
+  uint64_t m_dwo_id = 0;
+
+  DWARFUnitHeader() = default;
+
+public:
+  dw_offset_t GetOffset() const { return m_offset; }
+  uint16_t GetVersion() const { return m_version; }
+  uint16_t GetAddressByteSize() const { return m_addr_size; }
+  dw_offset_t GetLength() const { return m_length; }
+  dw_offset_t GetAbbrOffset() const { return m_abbr_offset; }
+  uint8_t GetUnitType() const { return m_unit_type; }
+  bool IsTypeUnit() const {
+return m_unit_type == DW_UT_type || m_unit_type == DW_UT_split_type;
+  }
+  uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; }
+
+  static llvm::Expected
+  extract(const lldb_private::DWARFDataExtractor &data, DIERef::Section section,
+  lldb::offset_t *offset_ptr);
+};
+
 class DWARFUnit : public lldb_private::UserID {
   using die_iterator_range =
   llvm::iterator_range;
 
 public:
+  static llvm::Expected
+  extract(SymbolFileDWARF *dwarf2Data, lldb::user_id_t uid,
+  const lldb_private::DWARFDataExtractor &debug_info,
+  DIERef::Section section, lldb::offset_t *offset_ptr);
   virtual ~DWARFUnit();
 
   void ExtractUnitDIEIfNeeded();
@@ -66,14 +101,16 @@
   ///
   /// \return
   ///   The correct data for the DIE information in this unit.
-  virtual const lldb_private::DWARFDataExtractor &GetData() const = 0;
-  /// Get the size in bytes of the compile unit header.
+  const lldb_private::DWARFDataExtractor &GetData() const;
+
+  /// Get the size in bytes of the unit header.
   ///
   /// \return
-  /// Byte size of the compile unit header
-  virtual uint32_t GetHeaderByteSize() const = 0;
+  /// Byte size of the unit header
+  uint32_t GetHeaderByteSize() const;
+
   // Offset of the initial length field.
-  dw_offset_t GetOffset() const { return m_offset; }
+  dw_offset_t GetOffset() const { return m_header.GetOffset(); }
   /// Get the size in bytes of the length field in the header.
   ///
   /// In DWARF32 this is just 4 bytes
@@ -87,17 +124,17 @@
die_offset < GetNextUnitOffset();
   }
   dw_offset_t GetFirstDIEOffset() const {
-return m_offset + GetHeaderByteSize();
+return GetOffset() + GetHeaderByteSize();
   }
-  dw_offset_t GetNextUnitOffset() const;
+  dw_offset_t GetNextUnitOffset() const { return m_header.GetNextUnitOffset(); }
   // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const;
   // Size of the CU data incl. header but without initial length.
-  uint32_t GetLength() const { return m_length; }
-  uint16_t GetVersion() const { return m_version; }
+  uint32_t GetLength() const { return m_header.GetLength(); }
+  uint16_t GetVersion() const { return m_header.GetVersion(); }
   const DWARFAbbreviationDeclarationSet *GetAbbreviations() const;
   dw_offset_t GetAbbrevOffset() const;
-  uint8_t GetAddressByteSize() const { return m_addr_size; }
+  uint8_t GetAddressByteSize() const { return m_header.GetAddressByteSize(); }
   dw_addr_t GetBaseAddress() const { return m_base_addr; }
   dw_addr_t GetAddrBase() const { return m_addr_base; }
   dw_addr_t GetRangesBase() const { return m_ranges_base; }
@@ -167,17 +204,17 @@
 return die_iterator_range(m_die_array.begi

[Lldb-commits] [PATCH] D62073: Introduce DWARFUnitHeader and use it to parse type units out of .debug_info

2019-05-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The TypeUnit and CompileUnit classes are pretty much identical now, but that'll 
change once we start parsing type signatures and cross-referencing them.


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

https://reviews.llvm.org/D62073



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


[Lldb-commits] [PATCH] D61952: [CMake] Stabilize install process for LLDB.framework

2019-05-17 Thread Stefan Gr盲nitz via Phabricator via lldb-commits
sgraenitz added a comment.

Ok thanks. I will be OOO next week, so no hurries.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61952



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


[Lldb-commits] [lldb] r361069 - [CMake] Add first CMake cache files

2019-05-17 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Fri May 17 12:19:41 2019
New Revision: 361069

URL: http://llvm.org/viewvc/llvm-project?rev=361069&view=rev
Log:
[CMake] Add first CMake cache files

Summary:
CMake cache scripts pre-populate the CMakeCache in a build directory with 
commonly used settings.
The CMake invocation from D61952 could look like this:

```
cmake -G Ninja -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-osx.cmake 
-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;lldb" ../llvm-project/llvm
```

Options specified on the command line will override options in the cache files 
(as long as caches don't use `FORCE`).
What do you think? (This is a first proposal and not set in stone.)

Reviewers: xiaobai, compnerd, JDevlieghere, aprantl, labath

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

Added:
lldb/trunk/cmake/caches/
lldb/trunk/cmake/caches/Apple-lldb-base.cmake
lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake

Added: lldb/trunk/cmake/caches/Apple-lldb-base.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/caches/Apple-lldb-base.cmake?rev=361069&view=auto
==
--- lldb/trunk/cmake/caches/Apple-lldb-base.cmake (added)
+++ lldb/trunk/cmake/caches/Apple-lldb-base.cmake Fri May 17 12:19:41 2019
@@ -0,0 +1,8 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+
+# Release builds set these explicitly:
+#set(LLDB_VERSION_MAJOR  CACHE STRING "")
+#set(LLDB_VERSION_MINOR 9 CACHE STRING "")
+#set(LLDB_VERSION_PATCH 9 CACHE STRING "")
+#set(LLDB_VERSION_SUFFIX git CACHE STRING "")

Added: lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake?rev=361069&view=auto
==
--- lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake (added)
+++ lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake Fri May 17 12:19:41 2019
@@ -0,0 +1,22 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+
+# Set the install prefix to the default install location on the enduser 
machine.
+# If the location is not writeable on the build machine, specify another prefix
+# in the DESTDIR environment variable, e.g.: DESTDIR=/tmp ninja install
+set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/usr CACHE 
STRING "")
+
+# Choose the install location for LLDB.framework so that it matches the
+# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
+# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
+set(LLDB_FRAMEWORK_INSTALL_DIR 
/Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")
+
+# Release builds may change these:
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")


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


[Lldb-commits] [lldb] r361068 - [CMake] Inline info plist in lldb driver

2019-05-17 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Fri May 17 12:19:34 2019
New Revision: 361068

URL: http://llvm.org/viewvc/llvm-project?rev=361068&view=rev
Log:
[CMake] Inline info plist in lldb driver

Modified:
lldb/trunk/tools/driver/CMakeLists.txt

Modified: lldb/trunk/tools/driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/CMakeLists.txt?rev=361068&r1=361067&r2=361068&view=diff
==
--- lldb/trunk/tools/driver/CMakeLists.txt (original)
+++ lldb/trunk/tools/driver/CMakeLists.txt Fri May 17 12:19:34 2019
@@ -2,6 +2,11 @@ set(LLVM_TARGET_DEFINITIONS Options.td)
 tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LLDBOptionsTableGen)
 
+if(APPLE)
+  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${LLDB_SOURCE_DIR}/tools/driver/lldb-Info.plist")
+endif()
+
 add_lldb_tool(lldb
   Driver.cpp
   Platform.cpp


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


[Lldb-commits] [PATCH] D61956: [CMake] Add first CMake cache files

2019-05-17 Thread Phabricator 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 rL361069: [CMake] Add first CMake cache files (authored by 
stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61956?vs=27&id=200078#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61956

Files:
  lldb/trunk/cmake/caches/Apple-lldb-base.cmake
  lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake


Index: lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
@@ -0,0 +1,22 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+
+# Set the install prefix to the default install location on the enduser 
machine.
+# If the location is not writeable on the build machine, specify another prefix
+# in the DESTDIR environment variable, e.g.: DESTDIR=/tmp ninja install
+set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/usr CACHE 
STRING "")
+
+# Choose the install location for LLDB.framework so that it matches the
+# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
+# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
+set(LLDB_FRAMEWORK_INSTALL_DIR 
/Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")
+
+# Release builds may change these:
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
Index: lldb/trunk/cmake/caches/Apple-lldb-base.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-base.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-base.cmake
@@ -0,0 +1,8 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+
+# Release builds set these explicitly:
+#set(LLDB_VERSION_MAJOR  CACHE STRING "")
+#set(LLDB_VERSION_MINOR 9 CACHE STRING "")
+#set(LLDB_VERSION_PATCH 9 CACHE STRING "")
+#set(LLDB_VERSION_SUFFIX git CACHE STRING "")


Index: lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-macOS.cmake
@@ -0,0 +1,22 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+
+# Set the install prefix to the default install location on the enduser machine.
+# If the location is not writeable on the build machine, specify another prefix
+# in the DESTDIR environment variable, e.g.: DESTDIR=/tmp ninja install
+set(CMAKE_INSTALL_PREFIX /Applications/Xcode.app/Contents/Developer/usr CACHE STRING "")
+
+# Choose the install location for LLDB.framework so that it matches the
+# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
+# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
+set(LLDB_FRAMEWORK_INSTALL_DIR /Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")
+
+# Release builds may change these:
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
Index: lldb/trunk/cmake/caches/Apple-lldb-base.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-base.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-base.cmake
@@ -0,0 +1,8 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+
+# Release builds set these explicitly:
+#set(LLDB_VERSION_MAJOR  CACHE STRING "")
+#set(LLDB_VERSION_MINOR 9 CACHE STRING "")
+#set(LLDB_VERSION_PATCH 9 CACHE STRING "")
+#set(LLDB_VERSION_SUFFIX git CACHE STRING "")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62073: Introduce DWARFUnitHeader and use it to parse type units out of .debug_info

2019-05-17 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Nice! FYI, we have a bot that runs the LLDB dotests against DWARF5 (the last 
stage http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/) to 
track the progress.


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

https://reviews.llvm.org/D62073



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


[Lldb-commits] [PATCH] D62073: Introduce DWARFUnitHeader and use it to parse type units out of .debug_info

2019-05-17 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:882
+  case llvm::dwarf::DW_UT_partial:
+return GetVersion() < 5 ? 11 :12;
+  case llvm::dwarf::DW_UT_skeleton:

clang-format?


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

https://reviews.llvm.org/D62073



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


[Lldb-commits] [PATCH] D62073: Introduce DWARFUnitHeader and use it to parse type units out of .debug_info

2019-05-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Are type units still disabled with the kill switch we had in? Or is this on top 
of the .debug_types patch? We have an internal .debug_types patch we have been 
using on an older LLVM/Clang/LLDB and we had some major performance issues 
regarding line tables so I am not sure where we would need to put these fixes 
(in this patch or in the .debug_types specific patch. This patch seems to 
enable parsing .debug_types already. The main issue we ran into were:

- only search actual compile unit line tables for breakpoints as many 
.debug_type units will point to existing line tables from real compile units
- don't add address ranges to type unit DWARFUnits from the line tables
- re-work how support files are parsed by sharing the line tables within a 
SymbolFileDWARF. .debug_types has type units that reuse line tables from real 
compile units (thousands of times) and we ended up seeing the same line table 
being parsed over and over and over. Another way to fix this is to no vend a 
lldb_private::CompileUnit for any units that aren't really compile units 
(DW_UT_type and DW_UT_split_type).

So if this patch is enabling all this, we will need to fix this patch to avoid 
all of the above mentioned issues. Let me know your thoughts.


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

https://reviews.llvm.org/D62073



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


[Lldb-commits] [lldb] r361078 - [EditLine] Check string pointers before dereferencing them.

2019-05-17 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri May 17 14:49:17 2019
New Revision: 361078

URL: http://llvm.org/viewvc/llvm-project?rev=361078&view=rev
Log:
[EditLine] Check string pointers before dereferencing them.

Get*AtIndex() can return nullptr. This only happens in the swift
REPL support, so it's hard to test upstream.



Modified:
lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=361078&r1=361077&r2=361078&view=diff
==
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Fri May 17 14:49:17 2019
@@ -870,10 +870,11 @@ static void PrintCompletion(FILE *output
 const char *completion_str = completions.GetStringAtIndex(i);
 const char *description_str = descriptions.GetStringAtIndex(i);
 
-fprintf(output_file, "\n\t%-*s", max_len, completion_str);
+if (completion_str)
+  fprintf(output_file, "\n\t%-*s", max_len, completion_str);
 
 // Print the description if we got one.
-if (strlen(description_str))
+if (description_str && strlen(description_str))
   fprintf(output_file, " -- %s", description_str);
   }
 }


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


[Lldb-commits] [PATCH] D61956: [CMake] Add first CMake cache files

2019-05-17 Thread Don Hinton via Phabricator via lldb-commits
hintonda added a comment.

Btw, options on the command line always override what's in the cache.  Has 
nothing to do with FORCE.  All FORCE does is make sure the set command actually 
changes an existing cache value.  So it's an ordering issue.  If the `-D` comes 
before the `-C` then using FORCE would override, but if the `-C` comes before 
the `-D`, the `-D` always overrides.

I always use FORCE and put my overrides after the cache file.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61956



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


[Lldb-commits] [lldb] r361079 - Fix IPv6 support on lldb-server platform

2019-05-17 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri May 17 15:30:53 2019
New Revision: 361079

URL: http://llvm.org/viewvc/llvm-project?rev=361079&view=rev
Log:
Fix IPv6 support on lldb-server platform

This is a general fix for the ConnectionFileDescriptor class but my main
motivation was to make lldb-server working with IPv6.
The connect URI can use square brackets ([]) to wrap the interface part
of the URI (e.g.: ://[]:). For IPv6 addresses
this is a must since its ip can include colons and it will overlap with
the port colon otherwise. The URIParser class parses the square brackets
correctly but the ConnectionFileDescriptor doesn't generate them for
IPv6 addresses making it impossible to connect to the gdb server when
using this protocol.

How to reproduce the issue:

$ lldb-server p --server --listen [::1]:8080
...
$ lldb
(lldb) platform select remote-macosx
(lldb) platform connect connect://[::1]:8080
(lldb) platform process -p 
error: unable to launch a GDB server on 'computer'

The server was actually launched we were just not able to connect to it.
With this fix lldb will correctly connect. I fixed this by wrapping the
ip portion with [].

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

Patch by Ant贸nio Afonso 

Added:
lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
lldb/trunk/unittests/Host/SocketTestUtilities.cpp
lldb/trunk/unittests/Host/SocketTestUtilities.h
Modified:
lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/trunk/unittests/Host/CMakeLists.txt
lldb/trunk/unittests/Host/SocketTest.cpp

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=361079&r1=361078&r2=361079&view=diff
==
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Fri May 17 
15:30:53 2019
@@ -764,7 +764,7 @@ void ConnectionFileDescriptor::Initializ
   m_write_sp.reset(socket);
   m_read_sp = m_write_sp;
   StreamString strm;
-  strm.Printf("connect://%s:%u", tcp_socket->GetRemoteIPAddress().c_str(),
+  strm.Printf("connect://[%s]:%u", tcp_socket->GetRemoteIPAddress().c_str(),
   tcp_socket->GetRemotePortNumber());
   m_uri = strm.GetString();
 }

Modified: lldb/trunk/unittests/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=361079&r1=361078&r2=361079&view=diff
==
--- lldb/trunk/unittests/Host/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Host/CMakeLists.txt Fri May 17 15:30:53 2019
@@ -9,6 +9,8 @@ set (FILES
   SocketAddressTest.cpp
   SocketTest.cpp
   TaskPoolTest.cpp
+  SocketTestUtilities.cpp
+  ConnectionFileDescriptorTest.cpp
 )
 
 if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")

Added: lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp?rev=361079&view=auto
==
--- lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp (added)
+++ lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp Fri May 17 
15:30:53 2019
@@ -0,0 +1,50 @@
+//===-- ConnectionFileDescriptorTest.cpp *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "SocketTestUtilities.h"
+#include "gtest/gtest.h"
+
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
+#include "lldb/Utility/UriParser.h"
+
+using namespace lldb_private;
+
+class ConnectionFileDescriptorTest : public testing::Test {
+public:
+  void SetUp() override {
+ASSERT_THAT_ERROR(Socket::Initialize(), llvm::Succeeded());
+  }
+
+  void TearDown() override { Socket::Terminate(); }
+
+  void TestGetURI(std::string ip) {
+std::unique_ptr socket_a_up;
+std::unique_ptr socket_b_up;
+if (!IsAddressFamilySupported(ip)) {
+  GTEST_LOG_(WARNING) << "Skipping test due to missing IPv"
+  << (IsIPv4(ip) ? "4" : "6") << " support.";
+  return;
+}
+CreateTCPConnectedSockets(ip, &socket_a_up, &socket_b_up);
+auto socket = socket_a_up.release();
+ConnectionFileDescriptor connection_file_descriptor(socket);
+
+llvm::StringRef scheme;
+llvm::StringRef hostname;
+int port;
+llvm::StringRef path;
+EXPECT_TRUE(UriParser::Parse(connection_file_descriptor.GetURI(), scheme,
+ hostname, port, path));
+EXPECT_EQ(ip, hostname);
+EXPE

[Lldb-commits] [PATCH] D61833: Fix IPv6 support on lldb-server platform

2019-05-17 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

Landed -- r361079


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61833



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


[Lldb-commits] [PATCH] D61833: Fix IPv6 support on lldb-server platform

2019-05-17 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361079: Fix IPv6 support on lldb-server platform 
(authored by xiaobai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61833?vs=199619&id=200108#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61833

Files:
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/ConnectionFileDescriptorTest.cpp
  unittests/Host/SocketTest.cpp
  unittests/Host/SocketTestUtilities.cpp
  unittests/Host/SocketTestUtilities.h

Index: unittests/Host/SocketTestUtilities.cpp
===
--- unittests/Host/SocketTestUtilities.cpp
+++ unittests/Host/SocketTestUtilities.cpp
@@ -0,0 +1,98 @@
+//===- SocketTestUtilities.cpp --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "SocketTestUtilities.h"
+#include "lldb/Utility/StreamString.h"
+#include 
+
+using namespace lldb_private;
+
+const void AcceptThread(Socket *listen_socket, bool child_processes_inherit,
+Socket **accept_socket, Status *error) {
+  *error = listen_socket->Accept(*accept_socket);
+}
+
+template 
+void lldb_private::CreateConnectedSockets(
+llvm::StringRef listen_remote_address,
+const std::function &get_connect_addr,
+std::unique_ptr *a_up, std::unique_ptr *b_up) {
+  bool child_processes_inherit = false;
+  Status error;
+  std::unique_ptr listen_socket_up(
+  new SocketType(true, child_processes_inherit));
+  EXPECT_FALSE(error.Fail());
+  error = listen_socket_up->Listen(listen_remote_address, 5);
+  EXPECT_FALSE(error.Fail());
+  EXPECT_TRUE(listen_socket_up->IsValid());
+
+  Status accept_error;
+  Socket *accept_socket;
+  std::thread accept_thread(AcceptThread, listen_socket_up.get(),
+child_processes_inherit, &accept_socket,
+&accept_error);
+
+  std::string connect_remote_address = get_connect_addr(*listen_socket_up);
+  std::unique_ptr connect_socket_up(
+  new SocketType(true, child_processes_inherit));
+  EXPECT_FALSE(error.Fail());
+  error = connect_socket_up->Connect(connect_remote_address);
+  EXPECT_FALSE(error.Fail());
+  EXPECT_TRUE(connect_socket_up->IsValid());
+
+  a_up->swap(connect_socket_up);
+  EXPECT_TRUE(error.Success());
+  EXPECT_NE(nullptr, a_up->get());
+  EXPECT_TRUE((*a_up)->IsValid());
+
+  accept_thread.join();
+  b_up->reset(static_cast(accept_socket));
+  EXPECT_TRUE(accept_error.Success());
+  EXPECT_NE(nullptr, b_up->get());
+  EXPECT_TRUE((*b_up)->IsValid());
+
+  listen_socket_up.reset();
+}
+
+bool lldb_private::CreateTCPConnectedSockets(
+std::string listen_remote_ip, std::unique_ptr *socket_a_up,
+std::unique_ptr *socket_b_up) {
+  StreamString strm;
+  strm.Printf("[%s]:0", listen_remote_ip.c_str());
+  CreateConnectedSockets(
+  strm.GetString(),
+  [=](const TCPSocket &s) {
+char connect_remote_address[64];
+snprintf(connect_remote_address, sizeof(connect_remote_address),
+ "[%s]:%u", listen_remote_ip.c_str(), s.GetLocalPortNumber());
+return std::string(connect_remote_address);
+  },
+  socket_a_up, socket_b_up);
+  return true;
+}
+
+#ifndef LLDB_DISABLE_POSIX
+void lldb_private::CreateDomainConnectedSockets(
+llvm::StringRef path, std::unique_ptr *socket_a_up,
+std::unique_ptr *socket_b_up) {
+  return CreateConnectedSockets(
+  path, [=](const DomainSocket &) { return path.str(); }, socket_a_up,
+  socket_b_up);
+}
+#endif
+
+bool lldb_private::IsAddressFamilySupported(std::string ip) {
+  auto addresses = lldb_private::SocketAddress::GetAddressInfo(
+  ip.c_str(), NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
+  return addresses.size() > 0;
+}
+
+bool lldb_private::IsIPv4(std::string ip) {
+  struct sockaddr_in sock_addr;
+  return inet_pton(AF_INET, ip.c_str(), &(sock_addr.sin_addr)) != 0;
+}
Index: unittests/Host/ConnectionFileDescriptorTest.cpp
===
--- unittests/Host/ConnectionFileDescriptorTest.cpp
+++ unittests/Host/ConnectionFileDescriptorTest.cpp
@@ -0,0 +1,50 @@
+//===-- ConnectionFileDescriptorTest.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "SocketTestUtilities.h"
+#includ

[Lldb-commits] [lldb] r361080 - [CommandInterpreter] Refactor SourceInitFile

2019-05-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri May 17 15:53:04 2019
New Revision: 361080

URL: http://llvm.org/viewvc/llvm-project?rev=361080&view=rev
Log:
[CommandInterpreter] Refactor SourceInitFile

I was looking at the current implementation of SourceInitFile and there
were a few things that made this function hard to read:

 * The code to find the ~/.lldbinit file is duplicated across the cwd
   and non-cwd branch.
 * The ./.lldbinit is once computed by resolving .lldbinit and once by
   resolving ./.lldbinit.
 * It wasn't clear to me what happened when you're sourcing the
   .lldbinit file in the current working directory. Apparently we do
   nothing when we property to control that is set to warn (makes sense)
   and we don't care when the property is set to true (debatable).
 * There were at least two branches where the status of the
   CommandReturnObject were not set.

This patch attempts to simplify that code.

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

Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=361080&r1=361079&r2=361080&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri May 17 
15:53:04 2019
@@ -212,7 +212,8 @@ public:
 return GetStaticBroadcasterClass();
   }
 
-  void SourceInitFile(bool in_cwd, CommandReturnObject &result);
+  void SourceInitFileCwd(CommandReturnObject &result);
+  void SourceInitFileHome(CommandReturnObject &result);
 
   bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
   bool can_replace);
@@ -533,6 +534,8 @@ protected:
 private:
   Status PreprocessCommand(std::string &command);
 
+  void SourceInitFile(FileSpec file, CommandReturnObject &result);
+
   // Completely resolves aliases and abbreviations, returning a pointer to the
   // final command object and updating command_line to the fully substituted
   // and translated command.

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=361080&r1=361079&r2=361080&view=diff
==
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri May 17 15:53:04 2019
@@ -540,7 +540,7 @@ void SBCommandInterpreter::SourceInitFil
 std::unique_lock lock;
 if (target_sp)
   lock = std::unique_lock(target_sp->GetAPIMutex());
-m_opaque_ptr->SourceInitFile(false, result.ref());
+m_opaque_ptr->SourceInitFileHome(result.ref());
   } else {
 result->AppendError("SBCommandInterpreter is not valid");
 result->SetStatus(eReturnStatusFailed);
@@ -559,7 +559,7 @@ void SBCommandInterpreter::SourceInitFil
 std::unique_lock lock;
 if (target_sp)
   lock = std::unique_lock(target_sp->GetAPIMutex());
-m_opaque_ptr->SourceInitFile(true, result.ref());
+m_opaque_ptr->SourceInitFileCwd(result.ref());
   } else {
 result->AppendError("SBCommandInterpreter is not valid");
 result->SetStatus(eReturnStatusFailed);

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=361080&r1=361079&r2=361080&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri May 17 15:53:04 
2019
@@ -81,6 +81,17 @@ static constexpr bool NoGlobalSetting =
 static constexpr uintptr_t DefaultValueTrue = true;
 static constexpr uintptr_t DefaultValueFalse = false;
 static constexpr const char *NoCStrDefault = nullptr;
+static constexpr const char *InitFileWarning =
+"There is a .lldbinit file in the current directory which is not being "
+"read.\n"
+"To silence this warning without sourcing in the local .lldbinit,\n"
+"add the following to the lldbinit file in your home directory:\n"
+"settings set target.load-cwd-lldbinit false\n"
+"To allow lldb to source .lldbinit files in the current working "
+"directory,\n"
+"set the value of this variable to true.  Only do so if you understand "
+"and\n"
+"accept the security risk.";
 
 static constexpr PropertyDefinition g_properties[] = {
 {"expand-regex-aliases", OptionValue::eTypeBoolean, NoGlobalSetting,
@@ -2091,100 +2102,114 @@ int CommandInterpreter::GetOptionArgumen
   return position;
 }
 
-void CommandInterpreter::SourceInitFile(b

[Lldb-commits] [PATCH] D61994: [CommandInterpreter] Refactor SourceInitFile

2019-05-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361080: [CommandInterpreter] Refactor SourceInitFile 
(authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61994?vs=200056&id=200111#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61994

Files:
  lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
  lldb/trunk/source/API/SBCommandInterpreter.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp
@@ -81,6 +81,17 @@
 static constexpr uintptr_t DefaultValueTrue = true;
 static constexpr uintptr_t DefaultValueFalse = false;
 static constexpr const char *NoCStrDefault = nullptr;
+static constexpr const char *InitFileWarning =
+"There is a .lldbinit file in the current directory which is not being "
+"read.\n"
+"To silence this warning without sourcing in the local .lldbinit,\n"
+"add the following to the lldbinit file in your home directory:\n"
+"settings set target.load-cwd-lldbinit false\n"
+"To allow lldb to source .lldbinit files in the current working "
+"directory,\n"
+"set the value of this variable to true.  Only do so if you understand "
+"and\n"
+"accept the security risk.";
 
 static constexpr PropertyDefinition g_properties[] = {
 {"expand-regex-aliases", OptionValue::eTypeBoolean, NoGlobalSetting,
@@ -2091,100 +2102,114 @@
   return position;
 }
 
-void CommandInterpreter::SourceInitFile(bool in_cwd,
-CommandReturnObject &result) {
-  FileSpec init_file;
-  if (in_cwd) {
-lldb::TargetPropertiesSP properties = Target::GetGlobalProperties();
-if (properties) {
-  // In the current working directory we don't load any program specific
-  // .lldbinit files, we only look for a ".lldbinit" file.
-  if (m_skip_lldbinit_files)
-return;
+static void GetHomeInitFile(llvm::SmallVectorImpl &init_file,
+llvm::StringRef suffix = {}) {
+  std::string init_file_name = ".lldbinit";
+  if (!suffix.empty()) {
+init_file_name.append("-");
+init_file_name.append(suffix.str());
+  }
 
-  LoadCWDlldbinitFile should_load = properties->GetLoadCWDlldbinitFile();
-  if (should_load == eLoadCWDlldbinitWarn) {
-FileSpec dot_lldb(".lldbinit");
-FileSystem::Instance().Resolve(dot_lldb);
-llvm::SmallString<64> home_dir_path;
-llvm::sys::path::home_directory(home_dir_path);
-FileSpec homedir_dot_lldb(home_dir_path.c_str());
-homedir_dot_lldb.AppendPathComponent(".lldbinit");
-FileSystem::Instance().Resolve(homedir_dot_lldb);
-if (FileSystem::Instance().Exists(dot_lldb) &&
-dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) {
-  result.AppendErrorWithFormat(
-  "There is a .lldbinit file in the current directory which is not "
-  "being read.\n"
-  "To silence this warning without sourcing in the local "
-  ".lldbinit,\n"
-  "add the following to the lldbinit file in your home directory:\n"
-  "settings set target.load-cwd-lldbinit false\n"
-  "To allow lldb to source .lldbinit files in the current working "
-  "directory,\n"
-  "set the value of this variable to true.  Only do so if you "
-  "understand and\n"
-  "accept the security risk.");
-  result.SetStatus(eReturnStatusFailed);
-  return;
-}
-  } else if (should_load == eLoadCWDlldbinitTrue) {
-init_file.SetFile("./.lldbinit", FileSpec::Style::native);
-FileSystem::Instance().Resolve(init_file);
-  }
-}
-  } else {
-// If we aren't looking in the current working directory we are looking in
-// the home directory. We will first see if there is an application
-// specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-"
-// and the name of the program. If this file doesn't exist, we fall back to
-// just the "~/.lldbinit" file. We also obey any requests to not load the
-// init files.
-llvm::SmallString<64> home_dir_path;
-llvm::sys::path::home_directory(home_dir_path);
-FileSpec profilePath(home_dir_path.c_str());
-profilePath.AppendPathComponent(".lldbinit");
-std::string init_file_path = profilePath.GetPath();
-
-if (!m_skip_app_init_files) {
-  FileSpec program_file_spec(HostInfo::GetProgramFileSpec());
-  const char *program_name = program_file_spec.GetFilename().AsCString();
-
-  if (program_n

[Lldb-commits] [PATCH] D62089: Make ConnectionFileDescription work with all sockets

2019-05-17 Thread Ant贸nio Afonso via Phabricator via lldb-commits
aadsm created this revision.
aadsm added reviewers: labath, clayborg, xiaobai.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

My main goal here is to make lldb-server work with Android Studio.

This is currently not the case because lldb-server is started in platform mode 
listening on a domain socket. When Android Studio connects to it lldb-server 
crashes because even though it's listening on a domain socket as soon as it 
gets a connection it asserts that it's a TCP connection, which will obviously 
fails for any non-tcp connection.

To do this I came up with a new method called GetConnectURI() in Socket that 
returns the URI needed to connect to the connected portion of the socket.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62089

Files:
  lldb/include/lldb/Host/Socket.h
  lldb/include/lldb/Host/common/TCPSocket.h
  lldb/include/lldb/Host/common/UDPSocket.h
  lldb/include/lldb/Host/posix/DomainSocket.h
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/source/Host/posix/DomainSocket.cpp
  lldb/unittests/Host/SocketTest.cpp

Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -7,7 +7,9 @@
 //===--===//
 
 #include "SocketTestUtilities.h"
+#include "lldb/Utility/UriParser.h"
 #include "gtest/gtest.h"
+#include 
 
 using namespace lldb_private;
 
@@ -147,3 +149,67 @@
   EXPECT_TRUE(socket_up->IsValid());
   EXPECT_NE(socket_up->GetLocalPortNumber(), 0);
 }
+
+TEST_F(SocketTest, TCPGetConnectURI) {
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  if (!IsAddressFamilySupported("127.0.0.1")) {
+GTEST_LOG_(WARNING) << "Skipping test due to missing IPv4 support.";
+return;
+  }
+  CreateTCPConnectedSockets("127.0.0.1", &socket_a_up, &socket_b_up);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(UriParser::Parse(socket_a_up->GetConnectURI(), scheme, hostname,
+   port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "connect");
+  EXPECT_EQ(port, socket_a_up->GetRemotePortNumber());
+}
+
+TEST_F(SocketTest, UDPGetConnectURI) {
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  if (!IsAddressFamilySupported("127.0.0.1")) {
+GTEST_LOG_(WARNING) << "Skipping test due to missing IPv4 support.";
+return;
+  }
+  Socket *socket;
+
+  bool child_processes_inherit = false;
+  auto error =
+  UDPSocket::Connect("127.0.0.1:0", child_processes_inherit, socket);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(
+  UriParser::Parse(socket->GetConnectURI(), scheme, hostname, port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "udp");
+}
+
+#ifndef LLDB_DISABLE_POSIX
+TEST_F(SocketTest, DomainGetConnectURI) {
+  llvm::SmallString<64> Path;
+  std::error_code EC =
+  llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
+  ASSERT_FALSE(EC);
+  llvm::sys::path::append(Path, "test");
+
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  CreateDomainConnectedSockets(Path, &socket_a_up, &socket_b_up);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(UriParser::Parse(socket_a_up->GetConnectURI(), scheme, hostname,
+   port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "unix-connect");
+  EXPECT_STREQ(path.str().c_str(), Path.c_str());
+}
+#endif
\ No newline at end of file
Index: lldb/source/Host/posix/DomainSocket.cpp
===
--- lldb/source/Host/posix/DomainSocket.cpp
+++ lldb/source/Host/posix/DomainSocket.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "lldb/Host/posix/DomainSocket.h"
+#include "lldb/Utility/StreamString.h"
 
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
@@ -125,3 +126,29 @@
 void DomainSocket::DeleteSocketFile(llvm::StringRef name) {
   llvm::sys::fs::remove(name);
 }
+
+std::string DomainSocket::GetSocketName() const {
+  if (m_socket != kInvalidSocketValue) {
+struct sockaddr_un saddr_un;
+saddr_un.sun_family = AF_UNIX;
+socklen_t sock_addr_len = sizeof(struct sockaddr_un);
+if (::getpeername(m_socket, (struct sockaddr *)&saddr_un, &sock_addr_len) ==
+0)
+  return std::string(saddr_un.sun_path + GetNameOffset(),
+ sock_addr_len -
+ offsetof(struct sockaddr_un, sun_path) -
+ GetNameOffset());
+  }
+  return "";
+}
+
+std::string DomainSocket::GetConnectURI() const {
+  if (m_sock

[Lldb-commits] [PATCH] D62089: Make ConnectionFileDescription work with all sockets

2019-05-17 Thread Ant贸nio Afonso via Phabricator via lldb-commits
aadsm added a comment.

I'm not really sure which source version lldb-server is being shipped with 
Android Studio today (since their version works just fine obviously)...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62089



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


[Lldb-commits] [lldb] r361083 - Unbreak windows build bot

2019-05-17 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri May 17 17:09:43 2019
New Revision: 361083

URL: http://llvm.org/viewvc/llvm-project?rev=361083&view=rev
Log:
Unbreak windows build bot

Commit c28f81797084b8416ff5be4f9e79000a9741ca6a (svn r361079)
broke the windows buildbot. This should fix it.

Modified:
lldb/trunk/unittests/Host/SocketTestUtilities.cpp

Modified: lldb/trunk/unittests/Host/SocketTestUtilities.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTestUtilities.cpp?rev=361083&r1=361082&r2=361083&view=diff
==
--- lldb/trunk/unittests/Host/SocketTestUtilities.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTestUtilities.cpp Fri May 17 17:09:43 2019
@@ -8,7 +8,13 @@
 
 #include "SocketTestUtilities.h"
 #include "lldb/Utility/StreamString.h"
+
+#if defined(_WIN32)
+#include 
+#include 
+#else
 #include 
+#endif
 
 using namespace lldb_private;
 


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


[Lldb-commits] [lldb] r361086 - Revert "Fix IPv6 support on lldb-server platform"

2019-05-17 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri May 17 18:09:44 2019
New Revision: 361086

URL: http://llvm.org/viewvc/llvm-project?rev=361086&view=rev
Log:
Revert "Fix IPv6 support on lldb-server platform"

This reverts commit c28f81797084b8416ff5be4f9e79000a9741ca6a.
This reverts commit 7e79b64642486f510f7872174eb831df68d65b84.

Looks like there is more work to be done on this patch. I've spoken to
the author and for the time being we will revert to keep the buildbots
green.

Removed:
lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
lldb/trunk/unittests/Host/SocketTestUtilities.cpp
lldb/trunk/unittests/Host/SocketTestUtilities.h
Modified:
lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/trunk/unittests/Host/CMakeLists.txt
lldb/trunk/unittests/Host/SocketTest.cpp

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=361086&r1=361085&r2=361086&view=diff
==
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Fri May 17 
18:09:44 2019
@@ -764,7 +764,7 @@ void ConnectionFileDescriptor::Initializ
   m_write_sp.reset(socket);
   m_read_sp = m_write_sp;
   StreamString strm;
-  strm.Printf("connect://[%s]:%u", tcp_socket->GetRemoteIPAddress().c_str(),
+  strm.Printf("connect://%s:%u", tcp_socket->GetRemoteIPAddress().c_str(),
   tcp_socket->GetRemotePortNumber());
   m_uri = strm.GetString();
 }

Modified: lldb/trunk/unittests/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=361086&r1=361085&r2=361086&view=diff
==
--- lldb/trunk/unittests/Host/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Host/CMakeLists.txt Fri May 17 18:09:44 2019
@@ -9,8 +9,6 @@ set (FILES
   SocketAddressTest.cpp
   SocketTest.cpp
   TaskPoolTest.cpp
-  SocketTestUtilities.cpp
-  ConnectionFileDescriptorTest.cpp
 )
 
 if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")

Removed: lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp?rev=361085&view=auto
==
--- lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp (original)
+++ lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp (removed)
@@ -1,50 +0,0 @@
-//===-- ConnectionFileDescriptorTest.cpp *- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "SocketTestUtilities.h"
-#include "gtest/gtest.h"
-
-#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
-#include "lldb/Utility/UriParser.h"
-
-using namespace lldb_private;
-
-class ConnectionFileDescriptorTest : public testing::Test {
-public:
-  void SetUp() override {
-ASSERT_THAT_ERROR(Socket::Initialize(), llvm::Succeeded());
-  }
-
-  void TearDown() override { Socket::Terminate(); }
-
-  void TestGetURI(std::string ip) {
-std::unique_ptr socket_a_up;
-std::unique_ptr socket_b_up;
-if (!IsAddressFamilySupported(ip)) {
-  GTEST_LOG_(WARNING) << "Skipping test due to missing IPv"
-  << (IsIPv4(ip) ? "4" : "6") << " support.";
-  return;
-}
-CreateTCPConnectedSockets(ip, &socket_a_up, &socket_b_up);
-auto socket = socket_a_up.release();
-ConnectionFileDescriptor connection_file_descriptor(socket);
-
-llvm::StringRef scheme;
-llvm::StringRef hostname;
-int port;
-llvm::StringRef path;
-EXPECT_TRUE(UriParser::Parse(connection_file_descriptor.GetURI(), scheme,
- hostname, port, path));
-EXPECT_EQ(ip, hostname);
-EXPECT_EQ(socket->GetRemotePortNumber(), port);
-  }
-};
-
-TEST_F(ConnectionFileDescriptorTest, TCPGetURIv4) { TestGetURI("127.0.0.1"); }
-
-TEST_F(ConnectionFileDescriptorTest, TCPGetURIv6) { TestGetURI("::1"); }
\ No newline at end of file

Modified: lldb/trunk/unittests/Host/SocketTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTest.cpp?rev=361086&r1=361085&r2=361086&view=diff
==
--- lldb/trunk/unittests/Host/SocketTest.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTest.cpp Fri May 17 18:09:44 2019
@@ -6,9 +6,24 @@
 //
 
//===--===//
 
-#include "SocketTestUtilities.h"
+#include 

[Lldb-commits] [lldb] r361087 - [crashlog] Use loads() instead of readPlistFromString() for python 3.

2019-05-17 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri May 17 18:57:12 2019
New Revision: 361087

URL: http://llvm.org/viewvc/llvm-project?rev=361087&view=rev
Log:
[crashlog] Use loads() instead of readPlistFromString() for python 3.



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

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=361087&r1=361086&r2=361087&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Fri May 17 18:57:12 2019
@@ -43,6 +43,12 @@ import sys
 import time
 import uuid
 
+def read_plist(s):
+if sys.version_info.major == 3:
+return plistlib.loads(s)
+else:
+return plistlib.readPlistFromString(s)
+
 try:
 # Just try for LLDB in case PYTHONPATH is already correctly setup
 import lldb
@@ -282,7 +288,7 @@ class CrashLog(symbolication.Symbolicato
 s = subprocess.check_output(dsym_for_uuid_command, shell=True)
 if s:
 try:
-plist_root = plistlib.readPlistFromString(s)
+plist_root = read_plist(s)
 except:
 print(("Got exception: ", sys.exc_info()[1], " 
handling dsymForUUID output: \n", s))
 raise


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


[Lldb-commits] [PATCH] D62089: Make ConnectionFileDescription work with all sockets

2019-05-17 Thread Ant贸nio Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 200126.
aadsm added a comment.

Avoid parsing the URL when starting the GDB server if it's not a TCP connection.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62089

Files:
  lldb/include/lldb/Host/Socket.h
  lldb/include/lldb/Host/common/TCPSocket.h
  lldb/include/lldb/Host/common/UDPSocket.h
  lldb/include/lldb/Host/posix/DomainSocket.h
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/source/Host/posix/DomainSocket.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/unittests/Host/SocketTest.cpp

Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "SocketTestUtilities.h"
+#include "lldb/Utility/UriParser.h"
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
@@ -147,3 +148,67 @@
   EXPECT_TRUE(socket_up->IsValid());
   EXPECT_NE(socket_up->GetLocalPortNumber(), 0);
 }
+
+TEST_F(SocketTest, TCPGetConnectURI) {
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  if (!IsAddressFamilySupported("127.0.0.1")) {
+GTEST_LOG_(WARNING) << "Skipping test due to missing IPv4 support.";
+return;
+  }
+  CreateTCPConnectedSockets("127.0.0.1", &socket_a_up, &socket_b_up);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(UriParser::Parse(socket_a_up->GetConnectURI(), scheme, hostname,
+   port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "connect");
+  EXPECT_EQ(port, socket_a_up->GetRemotePortNumber());
+}
+
+TEST_F(SocketTest, UDPGetConnectURI) {
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  if (!IsAddressFamilySupported("127.0.0.1")) {
+GTEST_LOG_(WARNING) << "Skipping test due to missing IPv4 support.";
+return;
+  }
+  Socket *socket;
+
+  bool child_processes_inherit = false;
+  auto error =
+  UDPSocket::Connect("127.0.0.1:0", child_processes_inherit, socket);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(
+  UriParser::Parse(socket->GetConnectURI(), scheme, hostname, port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "udp");
+}
+
+#ifndef LLDB_DISABLE_POSIX
+TEST_F(SocketTest, DomainGetConnectURI) {
+  llvm::SmallString<64> Path;
+  std::error_code EC =
+  llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
+  ASSERT_FALSE(EC);
+  llvm::sys::path::append(Path, "test");
+
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  CreateDomainConnectedSockets(Path, &socket_a_up, &socket_b_up);
+
+  llvm::StringRef scheme;
+  llvm::StringRef hostname;
+  int port;
+  llvm::StringRef path;
+  EXPECT_TRUE(UriParser::Parse(socket_a_up->GetConnectURI(), scheme, hostname,
+   port, path));
+  EXPECT_STREQ(scheme.str().c_str(), "unix-connect");
+  EXPECT_STREQ(path.str().c_str(), Path.c_str());
+}
+#endif
\ No newline at end of file
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -115,25 +115,24 @@
 this, std::placeholders::_1),
   false);
 
-  llvm::StringRef platform_scheme;
-  llvm::StringRef platform_ip;
-  int platform_port;
-  llvm::StringRef platform_path;
-  std::string platform_uri = GetConnection()->GetURI();
-  bool ok = UriParser::Parse(platform_uri, platform_scheme, platform_ip,
- platform_port, platform_path);
-  UNUSED_IF_ASSERT_DISABLED(ok);
-  assert(ok);
-
   std::ostringstream url;
 // debugserver does not accept the URL scheme prefix.
 #if !defined(__APPLE__)
   url << m_socket_scheme << "://";
 #endif
   uint16_t *port_ptr = &port;
-  if (m_socket_protocol == Socket::ProtocolTcp)
+  if (m_socket_protocol == Socket::ProtocolTcp) {
+llvm::StringRef platform_scheme;
+llvm::StringRef platform_ip;
+int platform_port;
+llvm::StringRef platform_path;
+std::string platform_uri = GetConnection()->GetURI();
+bool ok = UriParser::Parse(platform_uri, platform_scheme, platform_ip,
+   platform_port, platform_path);
+UNUSED_IF_ASSERT_DISABLED(ok);
+assert(ok);
 url << platform_ip.str() << ":" << port;
-  else {
+  } else {
 socket_name = GetDomainSocketPath("gdbserver").GetPath();
 url << socket_name;
 port_ptr = nullptr;
Index: lldb/source/

[Lldb-commits] [PATCH] D61833: Fix IPv6 support on lldb-server platform

2019-05-17 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

This broke windows buildbots. I tried to fix with svn r361083 but there were 
other things that got broken. @aadsm: We should revisit this patch next week 
and see what we need to fix up before it goes in.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61833



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


Re: [Lldb-commits] [lldb] r361079 - Fix IPv6 support on lldb-server platform

2019-05-17 Thread Davide Italiano via lldb-commits
Alex, not sure if it's helpful for you as you already reverted this,
but I was able to find this failing on our lldb-sanitize bot (on Green
dragon).
Here's the stack trace.

 TEST 'lldb-Unit ::
Host/./HostTests/ConnectionFileDescriptorTest.TCPGetURIv6' FAILED

Note: Google Test filter = ConnectionFileDescriptorTest.TCPGetURIv6
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from ConnectionFileDescriptorTest
[ RUN  ] ConnectionFileDescriptorTest.TCPGetURIv6
=
==8350==ERROR: AddressSanitizer: stack-use-after-scope on address
0x7ffeea47c1dc at pc 0x000105e088d2 bp 0x7ffeea47bd90 sp
0x7ffeea47b538
READ of size 3 at 0x7ffeea47c1dc thread T0
#0 0x105e088d1 in MemcmpInterceptorCommon(void*, int (*)(void
const*, void const*, unsigned long), void const*, void const*,
unsigned long) (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x188d1)
#1 0x105e08c95 in wrap_memcmp
(libclang_rt.asan_osx_dynamic.dylib:x86_64+0x18c95)
#2 0x10586e475 in testing::AssertionResult
testing::internal::CmpHelperEQ, std::__1::allocator >,
llvm::StringRef>(char const*, char const*,
std::__1::basic_string,
std::__1::allocator > const&, llvm::StringRef const&)
StringRef.h:67
#3 0x10586d259 in
ConnectionFileDescriptorTest::TestGetURI(std::__1::basic_string, std::__1::allocator >) gtest.h:1421
#4 0x10586db81 in
ConnectionFileDescriptorTest_TCPGetURIv6_Test::TestBody()
ConnectionFileDescriptorTest.cpp:50
#5 0x10590f5ea in testing::Test::Run() gtest.cc:2474
#6 0x105911787 in testing::TestInfo::Run() gtest.cc:2656
#7 0x105913b97 in testing::TestCase::Run() gtest.cc:2774
#8 0x1059265d3 in testing::internal::UnitTestImpl::RunAllTests()
gtest.cc:4649
#9 0x105925740 in testing::UnitTest::Run() gtest.cc:4257
#10 0x1058fc61b in main gtest.h:2233
#11 0x7fff622c7084 in start (libdyld.dylib:x86_64+0x17084)

On Fri, May 17, 2019 at 3:28 PM Alex Langford via lldb-commits
 wrote:
>
> Author: xiaobai
> Date: Fri May 17 15:30:53 2019
> New Revision: 361079
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361079&view=rev
> Log:
> Fix IPv6 support on lldb-server platform
>
> This is a general fix for the ConnectionFileDescriptor class but my main
> motivation was to make lldb-server working with IPv6.
> The connect URI can use square brackets ([]) to wrap the interface part
> of the URI (e.g.: ://[]:). For IPv6 addresses
> this is a must since its ip can include colons and it will overlap with
> the port colon otherwise. The URIParser class parses the square brackets
> correctly but the ConnectionFileDescriptor doesn't generate them for
> IPv6 addresses making it impossible to connect to the gdb server when
> using this protocol.
>
> How to reproduce the issue:
>
> $ lldb-server p --server --listen [::1]:8080
> ...
> $ lldb
> (lldb) platform select remote-macosx
> (lldb) platform connect connect://[::1]:8080
> (lldb) platform process -p 
> error: unable to launch a GDB server on 'computer'
>
> The server was actually launched we were just not able to connect to it.
> With this fix lldb will correctly connect. I fixed this by wrapping the
> ip portion with [].
>
> Differential Revision: https://reviews.llvm.org/D61833
>
> Patch by Ant贸nio Afonso 
>
> Added:
> lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
> lldb/trunk/unittests/Host/SocketTestUtilities.cpp
> lldb/trunk/unittests/Host/SocketTestUtilities.h
> Modified:
> lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
> lldb/trunk/unittests/Host/CMakeLists.txt
> lldb/trunk/unittests/Host/SocketTest.cpp
>
> Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=361079&r1=361078&r2=361079&view=diff
> ==
> --- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
> +++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Fri May 17 
> 15:30:53 2019
> @@ -764,7 +764,7 @@ void ConnectionFileDescriptor::Initializ
>m_write_sp.reset(socket);
>m_read_sp = m_write_sp;
>StreamString strm;
> -  strm.Printf("connect://%s:%u", tcp_socket->GetRemoteIPAddress().c_str(),
> +  strm.Printf("connect://[%s]:%u", tcp_socket->GetRemoteIPAddress().c_str(),
>tcp_socket->GetRemotePortNumber());
>m_uri = strm.GetString();
>  }
>
> Modified: lldb/trunk/unittests/Host/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=361079&r1=361078&r2=361079&view=diff
> ==
> --- lldb/trunk/unittests/Host/CMakeLists.txt (original)
> +++ lldb/trunk/unittests/Host/CMakeLists.txt Fri May 17 15:30:53 2019
> @@