Re: [Lldb-commits] [PATCH] D52572: Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef

2018-09-26 Thread Zachary Turner via lldb-commits
It would be nice if You could replace the logic that iterates these arrays.
We no longer need to terminate on a sentinel nullptr entry and can now use
range based for loop
On Wed, Sep 26, 2018 at 2:06 PM Greg Clayton via Phabricator <
revi...@reviews.llvm.org> wrote:

> clayborg accepted this revision.
> clayborg added a comment.
> This revision is now accepted and ready to land.
>
> Good stuff!
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D52572
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D52572: Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef

2018-09-26 Thread Zachary Turner via lldb-commits
You might be right, I’m on mobile so hard for me to review. I saw a bunch
of nullptr so assumed it was still using sentinel values for iterating. If
not, ignore my suggestion
On Wed, Sep 26, 2018 at 4:26 PM Tatyana Krasnukha via Phabricator <
revi...@reviews.llvm.org> wrote:

> tatyana-krasnukha added a comment.
>
> Hmm... There is no such logic left, isn't it?
> If you mean iterating OptionValueProperties::m_properties vector, I can
> replace cycles with range based for loop, but this doesn't seem to be
> related to these changes.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D52572
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D52572: Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef

2018-09-26 Thread Zachary Turner via lldb-commits
No, separate revision is fine. Thanks!
On Wed, Sep 26, 2018 at 4:40 PM Tatyana Krasnukha via Phabricator <
revi...@reviews.llvm.org> wrote:

> tatyana-krasnukha added a comment.
>
> It seems you are speaking about OptionDefinition, not PropertyDefinition.
> I was going to create a separate revision for it. Should I add
> OptionDefinition related changes to here?
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D52572
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-09-28 Thread Zachary Turner via lldb-commits
I think it’s fine. Eventually when you are ready to support remote
debugging hopefully we can convert it over to using lldb-server
On Fri, Sep 28, 2018 at 4:44 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov added a comment.
>
> Thanks for explanations!
>
> Unfortunately I can't promise that I'll begin porting `lldb-server` on
> Windows in the nearest future. I've looked at my working copy, and there
> are only two small changes related to `ProcessWindows` plugin (but they are
> not related to the current review), may be we'll continue with the plugin
> for now? To proceed with other things that need some implementation of a
> such functionality (whether in `ProcessWindows` or `lldb-server`). How
> about this?
>
>
> https://reviews.llvm.org/D52618
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-10-01 Thread Zachary Turner via lldb-commits
One idea would be to define some lit substitutions like %debuginfo. It’s
true you can produce a gcc style command line that will be equivalent to a
clang-cl invocation but it won’t be easy. eg you’ll needing to pass
-fms-compatibility as well as various -I for includes.

It may be easier to have substitutions instead
On Mon, Oct 1, 2018 at 4:54 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added inline comments.
>
>
> 
> Comment at: lit/Expr/TestIRMemoryMapWindows.test:1-12
> +# REQUIRES: windows
> +
> +# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t
> +
> +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic
> +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic
> +
> 
> The only difference in this test is the command line used to compile the
> inferior right? That sounds like something that we will run into for a lot
> of lit test, so I think it's important to work something our right away.
> Making a windows-flavoured copy of each test is not tractable.
>
> Is there a reason you have to use clang-cl here? I was under the
> impression that clang.exe worked fine on windows too (and used a
> gcc-compatible command line)...
>
>
> https://reviews.llvm.org/D52618
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344154 - Create a SymbolFile plugin for cross-platform PDB access.

2018-10-10 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 10 09:39:07 2018
New Revision: 344154

URL: http://llvm.org/viewvc/llvm-project?rev=344154&view=rev
Log:
Create a SymbolFile plugin for cross-platform PDB access.

The existing SymbolFilePDB only works on Windows, as it is written
against a closed-source Microsoft SDK that ships with their debugging
tools.

There are several reasons we want to bypass this and go straight to the
bits of the PDB, but just to list a few:

More room for optimization. We can't see inside the implementation of
the Microsoft SDK, so we don't always know if we're doing things in the
most efficient way possible. For example, setting a breakpoint on main
of a big program currently takes several seconds. With the
implementation here, the time is unnoticeable.
We want to be able to symbolize Windows minidumps even if not on
Windows. Someone should be able to debug Windows minidumps as if they
were on Windows, given that no running process is necessary.
This patch is a very crude first attempt at filling out some of the
basic pieces.

I've implemented FindFunctions, ParseCompileUnitLineTable, and
ResolveSymbolContext for a limited subset of possible parameter values,
which is just enough to get it to display something nice for the
breakpoint location.

I've added several tests exercising this functionality which are limited
enough to work on all platforms but still exercise this functionality.
I'll try to add as many tests of this nature as I can, but at some
point we'll need a live process.

For now, this plugin is enabled always on non-Windows, and by setting
the environment variable LLDB_USE_NATIVE_PDB_READER=1 on Windows.
Eventually, once it's at parity with the Windows implementation, we'll
delete the Windows DIA-based implementation.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
lldb/trunk/lit/SymbolFile/NativePDB/lit.local.cfg
lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
Modified:
lldb/trunk/include/lldb/Utility/LLDBAssert.h
lldb/trunk/lit/lit.cfg
lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Modified: lldb/trunk/include/lldb/Utility/LLDBAssert.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/LLDBAssert.h?rev=344154&r1=344153&r2=344154&view=diff
==
--- lldb/trunk/include/lldb/Utility/LLDBAssert.h (original)
+++ lldb/trunk/include/lldb/Utility/LLDBAssert.h Wed Oct 10 09:39:07 2018
@@ -14,7 +14,8 @@
 #define lldbassert(x) assert(x)
 #else
 #define lldbassert(x)  
\
-  lldb_private::lldb_assert(x, #x, __FUNCTION__, __FILE__, __LINE__)
+  lldb_private::lldb_assert(static_cast(x), #x, __FUNCTION__, __FILE__,  
\
+__LINE__)
 #endif
 
 namespace lldb_private {

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit?rev=344154&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit Wed Oct 10 
09:39:07 2018
@@ -0,0 +1,6 @@
+break set -n main
+break set -n OvlGlobalFn
+break set -n StaticFn
+break set -n DoesntExist
+break list
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit?rev=344154&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inp

[Lldb-commits] [lldb] r344173 - [SymbolFileNativePDB] Fix compilation errors with gcc.

2018-10-10 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 10 11:52:37 2018
New Revision: 344173

URL: http://llvm.org/viewvc/llvm-project?rev=344173&view=rev
Log:
[SymbolFileNativePDB] Fix compilation errors with gcc.

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp?rev=344173&r1=344172&r2=344173&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp Wed Oct 10 
11:52:37 2018
@@ -134,14 +134,15 @@ void PdbIndex::BuildAddrToSymbolMap(Comp
 // If the debug info is incorrect, we could have multiple symbols with the
 // same address.  So use try_emplace instead of insert, and the first one
 // will win.
-auto emplace_result = cci.m_symbols_by_va.try_emplace(va, cu_sym_uid);
-(void)emplace_result;
+auto insert_result =
+cci.m_symbols_by_va.insert(std::make_pair(va, cu_sym_uid));
+(void)insert_result;
 
 // The odds of an error in some function such as GetSegmentAndOffset or
 // MakeVirtualAddress are much higher than the odds of encountering bad
 // debug info, so assert that this item was inserted in the map as opposed
 // to having already been there.
-lldbassert(emplace_result.second);
+lldbassert(insert_result.second);
   }
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp?rev=344173&r1=344172&r2=344173&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp Wed Oct 10 
11:52:37 2018
@@ -219,14 +219,14 @@ GetSegmentOffsetAndLength
 template <>
 SegmentOffsetLength GetSegmentOffsetAndLength(const CVSymbol &sym) 
{
   Thunk32Sym record = createRecord(sym);
-  return {record.Segment, record.Offset, record.Length};
+  return SegmentOffsetLength{record.Segment, record.Offset, record.Length};
 }
 
 template <>
 SegmentOffsetLength
 GetSegmentOffsetAndLength(const CVSymbol &sym) {
   CoffGroupSym record = createRecord(sym);
-  return {record.Segment, record.Offset, record.Size};
+  return SegmentOffsetLength{record.Segment, record.Offset, record.Size};
 }
 
 SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength(

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h?rev=344173&r1=344172&r2=344173&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h Wed Oct 10 
11:52:37 2018
@@ -20,11 +20,16 @@ namespace lldb_private {
 namespace npdb {
 
 struct SegmentOffset {
+  SegmentOffset() = default;
+  SegmentOffset(uint16_t s, uint32_t o) : segment(s), offset(o) {}
   uint16_t segment = 0;
   uint32_t offset = 0;
 };
 
 struct SegmentOffsetLength {
+  SegmentOffsetLength() = default;
+  SegmentOffsetLength(uint16_t s, uint32_t o, uint32_t l)
+  : so(s, o), length(l) {}
   SegmentOffset so;
   uint32_t length = 0;
 };

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344173&r1=344172&r2=344173&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Wed 
Oct 10 11:52:37 2018
@@ -487,7 +487,6 @@ bool SymbolFileNativePDB::ParseCompileUn
   }
 
   // LLDB wants the index of the file in the list of support files.
-  llvm::StringRef file_name = *efn;
   auto fn_iter = llvm::find(cci->m_file_list, *efn);
   lldbassert(fn_iter != cci->m_file_list.end());
   uint32_t file_index = std::distance(cci->m_file_list.begin(), fn_iter);


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


Re: [Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-10-10 Thread Zachary Turner via lldb-commits
On Wed, Oct 10, 2018 at 6:38 PM Hui Huang via Phabricator <
revi...@reviews.llvm.org> wrote:

> Hui added inline comments.
>
>
> 
> Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:810
> +
> +  std::lock_guard guard(module_sp->GetMutex());
> +
> 
> zturner wrote:
> > Does this actually need to be a `recursive_mutex`?
> I think there is access to the member 'm_filespec_

ap'.


I mean instead of a non recursive mutex.

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


Re: [Lldb-commits] [lldb] r344154 - Create a SymbolFile plugin for cross-platform PDB access.

2018-10-11 Thread Zachary Turner via lldb-commits
I'm working on a fix for this and several other issues right now.  For this
one I think we just need to add -- on the command line.

On Thu, Oct 11, 2018 at 9:36 AM Davide Italiano 
wrote:

> On Wed, Oct 10, 2018 at 9:40 AM Zachary Turner via lldb-commits
>  wrote:
> >
> > Author: zturner
> > Date: Wed Oct 10 09:39:07 2018
> > New Revision: 344154
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=344154&view=rev
> > Log:
> > Create a SymbolFile plugin for cross-platform PDB access.
> >
>
> Hey Zach, I'm afraid this broke the MacOS Cmake bots (see, e.g.
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/11020/)
>
> May I ask you to take a look?
>
> The failure pattern looks like:
>
> 
> FAIL: lldb :: SymbolFile/NativePDB/disassembly.cpp (48 of 1357)
>
> clang-8: warning:
>
> '/Users/davide/work/llvm-project-20170507/lldb/lit/SymbolFile/NativePDB/disassembly.cpp'
> treated as the '/U' option [-Wslash-u-filename]
>
> clang-8: note: Use '--' to treat subsequent arguments as filenames
>
> clang-8: error: no input files
> 
>
> So it's hopefully something relatively straightforward to fix. Please
> let me know if you need other informations.
>
> Thanks,
>
> --
> Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344269 - Better support for POSIX paths in PDBs.

2018-10-11 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Oct 11 11:01:55 2018
New Revision: 344269

URL: http://llvm.org/viewvc/llvm-project?rev=344269&view=rev
Log:
Better support for POSIX paths in PDBs.

While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.

The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).

There's changes in clang, LLD, and lldb in this patch.  After
this the cross-platform disassembly and source-list tests pass
on Linux.

Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.

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

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp?rev=344269&r1=344268&r2=344269&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp Thu Oct 11 11:01:55 2018
@@ -25,7 +25,7 @@ int main(int argc, char **argv) {
 // changing this file.
 
 // CHECK: (lldb) source list -n main
-// CHECK: File: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\source-list.cpp
+// CHECK: File: {{.*}}source-list.cpp
 // CHECK:10
 // CHECK:11// Some context lines before
 // CHECK:12   // the function.

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp?rev=344269&r1=344268&r2=344269&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp Thu Oct 
11 11:01:55 2018
@@ -42,11 +42,8 @@ static bool IsMainFile(llvm::StringRef m
   if (llvm::sys::fs::equivalent(main, other))
 return true;
 
-  // FIXME: If we ever want to support PDB debug info for non-Windows systems
-  // the following check will be wrong, but we need a way to store the host
-  // information in the PDB.
   llvm::SmallString<64> normalized(other);
-  llvm::sys::path::native(normalized, llvm::sys::path::Style::windows);
+  llvm::sys::path::native(normalized);
   return main.equals_lower(normalized);
 }
 
@@ -156,7 +153,8 @@ CompileUnitIndex::GetOrCreateCompiland(P
   // name until we find it, and we can cache that one since the memory is 
backed
   // by a contiguous chunk inside the mapped PDB.
   llvm::SmallString<64> main_file = GetMainSourceFile(*cci);
-  llvm::sys::path::native(main_file, llvm::sys::path::Style::windows);
+  std::string s = main_file.str();
+  llvm::sys::path::native(main_file);
 
   uint32_t file_count = modules.getSourceFileCount(modi);
   cci->m_file_list.reserve(file_count);

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344269&r1=344268&r2=344269&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Thu 
Oct 11 11:01:55 2018
@@ -530,7 +530,9 @@ bool SymbolFileNativePDB::ParseCompileUn
   lldbassert(cci);
 
   for (llvm::StringRef f : cci->m_file_list) {
-FileSpec spec(f, false, FileSpec::Style::windows);
+FileSpec::Style style =
+f.startswith("/") ? FileSpec::Style::posix : FileSpec::Style::windows;
+FileSpec spec(f, false, style);
 support_files.Append(spec);
   }
 


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


[Lldb-commits] [lldb] r344279 - Revert SymbolFileNativePDB plugin.

2018-10-11 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Oct 11 11:45:44 2018
New Revision: 344279

URL: http://llvm.org/viewvc/llvm-project?rev=344279&view=rev
Log:
Revert SymbolFileNativePDB plugin.

This was originally causing some test failures on non-Windows
platforms, which required fixes in the compiler and linker.  After
those fixes, however, other tests started failing.  Reverting
temporarily until I can address everything.

Removed:
lldb/trunk/lit/SymbolFile/NativePDB/
lldb/trunk/source/Plugins/SymbolFile/NativePDB/
Modified:
lldb/trunk/include/lldb/Utility/LLDBAssert.h
lldb/trunk/lit/lit.cfg
lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Modified: lldb/trunk/include/lldb/Utility/LLDBAssert.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/LLDBAssert.h?rev=344279&r1=344278&r2=344279&view=diff
==
--- lldb/trunk/include/lldb/Utility/LLDBAssert.h (original)
+++ lldb/trunk/include/lldb/Utility/LLDBAssert.h Thu Oct 11 11:45:44 2018
@@ -14,8 +14,7 @@
 #define lldbassert(x) assert(x)
 #else
 #define lldbassert(x)  
\
-  lldb_private::lldb_assert(static_cast(x), #x, __FUNCTION__, __FILE__,  
\
-__LINE__)
+  lldb_private::lldb_assert(x, #x, __FUNCTION__, __FILE__, __LINE__)
 #endif
 
 namespace lldb_private {

Modified: lldb/trunk/lit/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=344279&r1=344278&r2=344279&view=diff
==
--- lldb/trunk/lit/lit.cfg (original)
+++ lldb/trunk/lit/lit.cfg Thu Oct 11 11:45:44 2018
@@ -64,8 +64,6 @@ lldb = "%s -S %s/lit-lldb-init" % (lit.u
config.test_source_root)
 
 lldbmi = lit.util.which('lldb-mi', lldb_tools_dir)
-if lldbmi:
-config.available_features.add('lldb-mi')
 
 if not os.path.exists(config.cc):
 config.cc = lit.util.which(config.cc, config.environment['PATH'])
@@ -92,8 +90,7 @@ if platform.system() in ['OpenBSD']:
 config.substitutions.append(('%cc', config.cc))
 config.substitutions.append(('%cxx', config.cxx))
 
-if lldbmi:
-  config.substitutions.append(('%lldbmi', lldbmi + " --synchronous"))
+config.substitutions.append(('%lldbmi', lldbmi + " --synchronous"))
 config.substitutions.append(('%lldb', lldb))
 
 if debugserver is not None:

Modified: lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt?rev=344279&r1=344278&r2=344279&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt Thu Oct 11 11:45:44 2018
@@ -1,4 +1,3 @@
 add_subdirectory(DWARF)
 add_subdirectory(Symtab)
-add_subdirectory(NativePDB)
 add_subdirectory(PDB)

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt?rev=344279&r1=344278&r2=344279&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt Thu Oct 11 11:45:44 
2018
@@ -9,7 +9,6 @@ add_lldb_library(lldbPluginSymbolFilePDB
 lldbCore
 lldbSymbol
lldbUtility
-  lldbPluginSymbolFileNativePDB
   LINK_COMPONENTS
 DebugInfoPDB
 Support

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=344279&r1=344278&r2=344279&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Thu Oct 11 
11:45:44 2018
@@ -46,7 +46,6 @@
 #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" // For 
IsCPPMangledName
-#include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h"
 #include "Plugins/SymbolFile/PDB/PDBASTParser.h"
 #include "Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h"
 
@@ -75,31 +74,14 @@ bool ShouldAddLine(uint32_t requested_li
 }
 } // namespace
 
-static bool ShouldUseNativeReader() {
-#if !defined(_WIN32)
-  return true;
-#endif
-  llvm::StringRef use_native = ::getenv("LLDB_USE_NATIVE_PDB_READER");
-  return use_native.equals_lower("on") || use_native.equals_lower("yes") ||
- use_native.equals_lower("1") || use_native.equals_lower("true");
-}
-
 void SymbolFilePDB::Initialize() {
-  if (ShouldUseNativeReader()) {
-  

Re: [Lldb-commits] [PATCH] D50478: Add support for artificial tail call frames

2018-10-11 Thread Zachary Turner via lldb-commits
See the other email thread.  The bots have been broken since September, all
of them complain about missing FileCheck executable

On Thu, Oct 11, 2018 at 2:58 PM Vedant Kumar via Phabricator <
revi...@reviews.llvm.org> wrote:

> vsk added a comment.
>
> In https://reviews.llvm.org/D50478#1262710, @stella.stamenova wrote:
>
> > Unfortunately, the bots are broken because of the FileCheck issue, so I
> can't confirm with them, but I see a number of these tests fail in our
> local testing. Some fail on both Windows and Linux and some just fail on
> Linux. Here are the failing tests:
> >
> >   Linux:
> >   lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
> >
> >   Windows:
> >   lldb-Suite ::
> functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
> >   lldb-Suite ::
> functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py
> >
> >
> > Let me know what you need to investigate.
>
>
> Strange, I didn't get any bot failure notifications in the days after this
> landed. Could you share the output from the failing tests?
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D50478
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D50478: Add support for artificial tail call frames

2018-10-11 Thread Zachary Turner via lldb-commits
https://reviews.llvm.org/D53002

Is the thread I'm referring to.

On Thu, Oct 11, 2018 at 2:59 PM Zachary Turner via Phabricator <
revi...@reviews.llvm.org> wrote:

> zturner added a subscriber: vsk.
> zturner added a comment.
>
> See the other email thread.  The bots have been broken since September, all
> of them complain about missing FileCheck executable
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D50478
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53175: [dotest] Make a missing FileCheck binary a warning, not an error

2018-10-11 Thread Zachary Turner via lldb-commits
Why is FileCheck missing in the first place?
On Thu, Oct 11, 2018 at 3:13 PM Vedant Kumar via Phabricator <
revi...@reviews.llvm.org> wrote:

> vsk created this revision.
> vsk added reviewers: stella.stamenova, zturner.
>
> This allows bots which haven't updated to pass in --filecheck to dotest.py
> to run more tests. FileCheck-dependent tests will continue to fail.
>
>
> https://reviews.llvm.org/D53175
>
> Files:
>   lldb/packages/Python/lldbsuite/test/dotest.py
>
>
> Index: lldb/packages/Python/lldbsuite/test/dotest.py
> ===
> --- lldb/packages/Python/lldbsuite/test/dotest.py
> +++ lldb/packages/Python/lldbsuite/test/dotest.py
> @@ -311,8 +311,8 @@
>  # The CMake build passes in a path to a working FileCheck binary.
>  configuration.filecheck = os.path.abspath(args.filecheck)
>  else:
> -logging.error('No valid FileCheck executable; aborting...')
> -sys.exit(-1)
> +logging.warning('No valid FileCheck executable; some tests may
> fail...')
> +logging.warning('(Pass in a --filecheck argument to dotest.py)')
>
>  if args.channels:
>  lldbtest_config.channels = args.channels
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53175: [dotest] Make a missing FileCheck binary a warning, not an error

2018-10-12 Thread Zachary Turner via lldb-commits
They have to restart the master, Galina just did it yesterday so it might
happen again in a couple days
On Fri, Oct 12, 2018 at 12:36 PM Stella Stamenova 
wrote:

> + Galina,
>
>
>
> Galina, is there anything we need to do for the buildbots to pick up the
> change that Vedant made?
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* v...@apple.com 
> *Sent:* Friday, October 12, 2018 12:34 PM
>
>
> *To:* Stella Stamenova 
> *Cc:* Zachary Turner ; lldb-commits@lists.llvm.org;
> reviews+d53175+public+09519a8f992e0...@reviews.llvm.org
> *Subject:* Re: [PATCH] D53175: [dotest] Make a missing FileCheck binary a
> warning, not an error
>
>
>
> Ah gotcha. For the public Darwin bots, we needed to specifically trigger a
> Jenkins job to distribute Zorg updates to all our builders. This can be a
> bit of a manual process, because you need to kill the jobs on the builders’
> queues to make sure they run the Zorg_Distribute job asap.
>
>
>
> I’m not sure whether the Linux CI has a similar mechanism.
>
>
>
> vedant
>
>
>
> On Oct 12, 2018, at 12:31 PM, Stella Stamenova 
> wrote:
>
>
>
> Thanks, I’ve been monitoring the bots also and it looks like they haven’t
> picked up the zorg change yet. I don’t know if that’s supposed to just
> happen or if there’s something that needs to be done or if there’s a
> schedule for when they update.
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* v...@apple.com 
> *Sent:* Friday, October 12, 2018 11:33 AM
> *To:* Stella Stamenova 
> *Cc:* Zachary Turner ; lldb-commits@lists.llvm.org;
> reviews+d53175+public+09519a8f992e0...@reviews.llvm.org
> *Subject:* Re: [PATCH] D53175: [dotest] Make a missing FileCheck binary a
> warning, not an error
>
>
>
> All right, Committed r344396, I’ll keep an eye out for failures.
>
>
>
> vedant
>
>
>
>
> On Oct 12, 2018, at 9:58 AM, Stella Stamenova 
> wrote:
>
>
>
> Those changes look reasonable, but I don't know how to test it either. I
> would be in favor of checking it in because the buildbots are currently
> broken and this can't make it worse, right?
>
> -Original Message-
> From: v...@apple.com 
> Sent: Thursday, October 11, 2018 3:56 PM
> To: Stella Stamenova 
> Cc: Zachary Turner ; lldb-commits@lists.llvm.org;
> reviews+d53175+public+09519a8f992e0...@reviews.llvm.org
> Subject: Re: [PATCH] D53175: [dotest] Make a missing FileCheck binary a
> warning, not an error
>
> Does this look reasonable to you? I'm not sure how to test this.
>
> diff --git a/zorg/buildbot/builders/LLDBBuilder.py
> b/zorg/buildbot/builders/LLDBBuilder.py
> index 5a1b2e87..62152924 100644
> --- a/zorg/buildbot/builders/LLDBBuilder.py
> +++ b/zorg/buildbot/builders/LLDBBuilder.py
> @@ -270,6 +270,7 @@ def getLLDBTestSteps(f,
> compilerPath = compiler
> for arch in test_archs:
> DOTEST_OPTS=''.join(['--executable ' + bindir + '/lldb ',
> + '--filecheck ' + bindir + '/FileCheck
> + ',
>  '-A %s ' % arch,
>  '-C %s ' % compilerPath,
>  '-s lldb-test-traces-%s-%s ' % (compiler,
> arch), @@ -819,6 +820,7 @@ def getLLDBxcodebuildFactory(use_cc=None,
>   workdir=lldb_srcdir))
> DOTEST_OPTS = ' '.join(['--executable',
> '%(lldb_bindir)s/lldb',
> +'%(lldb_bindir)s/FileCheck',
> '--framework',
> '%(lldb_bindir)s/LLDB.framework',
> '-A', 'x86_64',
> '-C', 'clang',
>
> vedant
>
>
>
> On Oct 11, 2018, at 3:46 PM, Stella Stamenova via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> stella.stamenova added a comment.
>
> The failing bots are not windows bots but Linux bots. It looks like you
> only updated the configurations for xcode.
>
> I think the file that needs to be updated is:
>
> zorg\buildbot\builders\LLDBBuilder.py
>
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Frevie
> ws.llvm.org
> 
> %2FD53175&data=02%7C01%7CSTILIS%40microsoft.com
> 
> %7Cb8693
> c9edfa5449d97db08d62fccaacd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0
> %7C636748953431151967&sdata=rdn7nntFECouzbw%2FPoQISVCGGrjLCqAygk8q
> l0St%2B5o%3D&reserved=0
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344409 - Resubmit "Add SymbolFileNativePDB plugin."

2018-10-12 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 12 12:47:13 2018
New Revision: 344409

URL: http://llvm.org/viewvc/llvm-project?rev=344409&view=rev
Log:
Resubmit "Add SymbolFileNativePDB plugin."

This was originally reverted due to some test failures on
Linux.  Those problems turned out to require several additional
patches to lld and clang in order to fix, which have since been
submitted.  This patch is resubmitted unchanged.  All tests now
pass on both Linux and Windows.

Added:
lldb/trunk/lit/SymbolFile/NativePDB/
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
lldb/trunk/lit/SymbolFile/NativePDB/lit.local.cfg
lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
Modified:
lldb/trunk/include/lldb/Utility/LLDBAssert.h
lldb/trunk/lit/lit.cfg
lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Modified: lldb/trunk/include/lldb/Utility/LLDBAssert.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/LLDBAssert.h?rev=344409&r1=344408&r2=344409&view=diff
==
--- lldb/trunk/include/lldb/Utility/LLDBAssert.h (original)
+++ lldb/trunk/include/lldb/Utility/LLDBAssert.h Fri Oct 12 12:47:13 2018
@@ -14,7 +14,8 @@
 #define lldbassert(x) assert(x)
 #else
 #define lldbassert(x)  
\
-  lldb_private::lldb_assert(x, #x, __FUNCTION__, __FILE__, __LINE__)
+  lldb_private::lldb_assert(static_cast(x), #x, __FUNCTION__, __FILE__,  
\
+__LINE__)
 #endif
 
 namespace lldb_private {

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit?rev=344409&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit Fri Oct 12 
12:47:13 2018
@@ -0,0 +1,6 @@
+break set -n main
+break set -n OvlGlobalFn
+break set -n StaticFn
+break set -n DoesntExist
+break list
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit?rev=344409&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit Fri Oct 12 
12:47:13 2018
@@ -0,0 +1,2 @@
+disassemble --flavor=intel -m -n main
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit?rev=344409&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit Fri Oct 12 
12:47:13 2018
@@ -0,0 +1,3 @@
+source list -n main
+source list -n OvlGlobalFn
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=344409&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Oct 12 12:47:13 2018
@@ -0,0 +1,38 @@
+// clang-format off
+
+// Test that we can show disassembly and source.
+// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READE

Re: [Lldb-commits] [lldb] r344414 - Add NativePDB subdir again.

2018-10-12 Thread Zachary Turner via lldb-commits
Sorry for the trouble, hopefully it sticks this time.

On Fri, Oct 12, 2018 at 1:55 PM Jason Molenda via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: jmolenda
> Date: Fri Oct 12 13:53:21 2018
> New Revision: 344414
>
> URL: http://llvm.org/viewvc/llvm-project?rev=344414&view=rev
> Log:
> Add NativePDB subdir again.
>
> Modified:
> lldb/trunk/lldb.xcodeproj/project.pbxproj
>
> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=344414&r1=344413&r2=344414&view=diff
>
> ==
> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct 12 13:53:21 2018
> @@ -210,6 +210,7 @@
> 2642FBAE13D003B400ED6808 /* CommunicationKDP.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 2642FBA813D003B400ED6808 /*
> CommunicationKDP.cpp */; };
> 964463EC1A330C0500154ED8 /* CompactUnwindInfo.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 964463EB1A330C0500154ED8 /*
> CompactUnwindInfo.cpp */; };
> 268900D513353E6F00698AC0 /* CompileUnit.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = 26BC7F1510F1B8EC00F91463 /*
> CompileUnit.cpp */; };
> +   AFD966B8217140B6006714AC /* CompileUnitIndex.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = AFD966B4217140B5006714AC /*
> CompileUnitIndex.cpp */; };
> 265192C61BA8E905002F08F6 /* CompilerDecl.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = 265192C51BA8E905002F08F6 /*
> CompilerDecl.cpp */; };
> 2657AFB71B86910100958979 /* CompilerDeclContext.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 2657AFB61B86910100958979 /*
> CompilerDeclContext.cpp */; };
> 268900D213353E6F00698AC0 /* CompilerType.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /*
> CompilerType.cpp */; };
> @@ -586,6 +587,8 @@
> 4CA0C6CC20F929C700CFE6BB /*
> PDBLocationToDWARFExpression.cpp in Sources */ = {isa = PBXBuildFile;
> fileRef = 4CA0C6CA20F929C600CFE6BB /* PDBLocationToDWARFExpression.cpp */;
> };
> 268900EE13353E6F00698AC0 /* PathMappingList.cpp in Sources
> */ = {isa = PBXBuildFile; fileRef = 495BBACB119A0DBE00418BEA /*
> PathMappingList.cpp */; };
> 2668A2EE20AF417D00D94111 /* PathMappingListTest.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 2668A2ED20AF417D00D94111 /*
> PathMappingListTest.cpp */; };
> +   AFD966BA217140B6006714AC /* PdbIndex.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = AFD966B6217140B6006714AC /* PdbIndex.cpp */;
> };
> +   AFD966B9217140B6006714AC /* PdbUtil.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = AFD966B5217140B6006714AC /* PdbUtil.cpp */;
> };
> 25420ED21A649D88009ADBCB /* PipeBase.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = 25420ED11A649D88009ADBCB /* PipeBase.cpp */;
> };
> 2377C2F819E613C100737875 /* PipePosix.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = 2377C2F719E613C100737875 /* PipePosix.cpp
> */; };
> 268900EF13353E6F00698AC0 /* Platform.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = 264A43BD1320BCEB005B4096 /* Platform.cpp */;
> };
> @@ -912,6 +915,7 @@
> 4C7D48251F5099B2005314B4 /* SymbolFileDWARFDwoDwp.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481F1F509964005314B4 /*
> SymbolFileDWARFDwoDwp.cpp */; };
> 4C7D48241F5099A1005314B4 /* SymbolFileDWARFDwp.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481C1F509963005314B4 /*
> SymbolFileDWARFDwp.cpp */; };
> 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 9A20570A1F3B81F300F6C293 /*
> SymbolFileDWARFTests.cpp */; };
> +   AFD966BB217140B6006714AC /* SymbolFileNativePDB.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = AFD966B7217140B6006714AC /*
> SymbolFileNativePDB.cpp */; };
> AF6335E21C87B21E00F7D554 /* SymbolFilePDB.cpp in Sources
> */ = {isa = PBXBuildFile; fileRef = AF6335E01C87B21E00F7D554 /*
> SymbolFilePDB.cpp */; };
> 268900CE13353E5F00698AC0 /* SymbolFileSymtab.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 260C89DE10F57C5600BB2B04 /*
> SymbolFileSymtab.cpp */; };
> 268900E013353E6F00698AC0 /* SymbolVendor.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /*
> SymbolVendor.cpp */; };
> @@ -1663,6 +1667,8 @@
> 964463ED1A330C1B00154ED8 /* CompactUnwindInfo.h */ = {isa
> = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
> name = CompactUnwindInfo.h; path = include/lldb/Symbol/CompactUnwindInfo.h;
> sourceTree = ""; };
> 26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */ = {isa =
> PBXFileRefer

Re: [Lldb-commits] [lldb] r344409 - Resubmit "Add SymbolFileNativePDB plugin."

2018-10-12 Thread Zachary Turner via lldb-commits
I think we just need to add an llvm::consumeError(EC); on both of those
lines before they return failure.  Sorry for missing this.

On Fri, Oct 12, 2018 at 3:27 PM Jason Molenda  wrote:

> Ah, mystery solved.  The lit test specifies REQUIRES Darwin.
>
> > On Oct 12, 2018, at 3:22 PM, Jason Molenda  wrote:
> >
> >
> >
> >> On Oct 12, 2018, at 12:47 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >>
> >> Resubmit "Add SymbolFileNativePDB plugin."
> >>
> >> This was originally reverted due to some test failures on
> >> Linux.  Those problems turned out to require several additional
> >> patches to lld and clang in order to fix, which have since been
> >> submitted.  This patch is resubmitted unchanged.  All tests now
> >> pass on both Linux and Windows.
> >
> >
> > The lit test in lit/Modules/lc_build_version.yaml fails on Darwin
> systems, crashing here -
> >
> > 4   lldb-test 0x0001008ebdab
> llvm::Error::fatalUncheckedError() const + 139
> > 5   lldb-test 0x00010084b307
> llvm::Error::assertIsChecked() + 87 (Error.h:270)
> > 6   lldb-test 0x00010084b279
> llvm::Error::~Error() + 25 (Error.h:230)
> > 7   lldb-test 0x000100844725
> llvm::Error::~Error() + 21 (Error.h:231)
> > 8   lldb-test 0x000101b91e49
> loadPDBFile(std::__1::basic_string,
> std::__1::allocator >,
> llvm::BumpPtrAllocatorImpl&) + 1193
> (SymbolFileNativePDB.cpp:73)
> > 9   lldb-test 0x000101b9024e
> lldb_private::npdb::SymbolFileNativePDB::CalculateAbilities() + 542
> (SymbolFileNativePDB.cpp:187)
> > 10  lldb-test 0x000101060ceb
> lldb_private::SymbolFile::GetAbilities() + 43 (SymbolFile.h:87)
> > 11  lldb-test 0x0001010607fc
> lldb_private::SymbolFile::FindPlugin(lldb_private::ObjectFile*) + 764
> (SymbolFile.cpp:58)
> >
> >
> > Where the loadPDBFile line 73 is
> >
> >
> >59  static std::unique_ptr loadPDBFile(std::string PdbPath,
> >60
> llvm::BumpPtrAllocator &Allocator) {
> >61llvm::ErrorOr>
> ErrorOrBuffer =
> >62llvm::MemoryBuffer::getFile(PdbPath, /*FileSize=*/-1,
> >63
> /*RequiresNullTerminator=*/false);
> >64if (!ErrorOrBuffer)
> >65  return nullptr;
> >66std::unique_ptr Buffer =
> std::move(*ErrorOrBuffer);
> >67
> >68llvm::StringRef Path = Buffer->getBufferIdentifier();
> >69auto Stream = llvm::make_unique(
> >70std::move(Buffer), llvm::support::little);
> >71
> >72auto File = llvm::make_unique(Path, std::move(Stream),
> Allocator);
> >73if (auto EC = File->parseFileHeaders())
> >74  return nullptr;
> >75if (auto EC = File->parseStreamData())
> >
> >
> > I'm not sure why this wouldn't fail on a linux/windows system.  The
> point of the .yaml lit tests was that it is host independent?
> >
> >
> > J
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r344409 - Resubmit "Add SymbolFileNativePDB plugin."

2018-10-12 Thread Zachary Turner via lldb-commits
It's strange though, I wonder how it's even getting to this code path.  If
it makes it this far we've already confirmed that whatever the input is,
it's an actual PDB file.  So I don't know why it would fail to parse.

On Fri, Oct 12, 2018 at 3:29 PM Zachary Turner  wrote:

> I think we just need to add an llvm::consumeError(EC); on both of those
> lines before they return failure.  Sorry for missing this.
>
> On Fri, Oct 12, 2018 at 3:27 PM Jason Molenda  wrote:
>
>> Ah, mystery solved.  The lit test specifies REQUIRES Darwin.
>>
>> > On Oct 12, 2018, at 3:22 PM, Jason Molenda  wrote:
>> >
>> >
>> >
>> >> On Oct 12, 2018, at 12:47 PM, Zachary Turner via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>> >>
>> >> Resubmit "Add SymbolFileNativePDB plugin."
>> >>
>> >> This was originally reverted due to some test failures on
>> >> Linux.  Those problems turned out to require several additional
>> >> patches to lld and clang in order to fix, which have since been
>> >> submitted.  This patch is resubmitted unchanged.  All tests now
>> >> pass on both Linux and Windows.
>> >
>> >
>> > The lit test in lit/Modules/lc_build_version.yaml fails on Darwin
>> systems, crashing here -
>> >
>> > 4   lldb-test 0x0001008ebdab
>> llvm::Error::fatalUncheckedError() const + 139
>> > 5   lldb-test 0x00010084b307
>> llvm::Error::assertIsChecked() + 87 (Error.h:270)
>> > 6   lldb-test 0x00010084b279
>> llvm::Error::~Error() + 25 (Error.h:230)
>> > 7   lldb-test 0x000100844725
>> llvm::Error::~Error() + 21 (Error.h:231)
>> > 8   lldb-test 0x000101b91e49
>> loadPDBFile(std::__1::basic_string,
>> std::__1::allocator >,
>> llvm::BumpPtrAllocatorImpl&) + 1193
>> (SymbolFileNativePDB.cpp:73)
>> > 9   lldb-test 0x000101b9024e
>> lldb_private::npdb::SymbolFileNativePDB::CalculateAbilities() + 542
>> (SymbolFileNativePDB.cpp:187)
>> > 10  lldb-test 0x000101060ceb
>> lldb_private::SymbolFile::GetAbilities() + 43 (SymbolFile.h:87)
>> > 11  lldb-test 0x0001010607fc
>> lldb_private::SymbolFile::FindPlugin(lldb_private::ObjectFile*) + 764
>> (SymbolFile.cpp:58)
>> >
>> >
>> > Where the loadPDBFile line 73 is
>> >
>> >
>> >59  static std::unique_ptr loadPDBFile(std::string PdbPath,
>> >60
>> llvm::BumpPtrAllocator &Allocator) {
>> >61llvm::ErrorOr>
>> ErrorOrBuffer =
>> >62llvm::MemoryBuffer::getFile(PdbPath, /*FileSize=*/-1,
>> >63
>> /*RequiresNullTerminator=*/false);
>> >64if (!ErrorOrBuffer)
>> >65  return nullptr;
>> >66std::unique_ptr Buffer =
>> std::move(*ErrorOrBuffer);
>> >67
>> >68llvm::StringRef Path = Buffer->getBufferIdentifier();
>> >69auto Stream = llvm::make_unique(
>> >70std::move(Buffer), llvm::support::little);
>> >71
>> >72auto File = llvm::make_unique(Path,
>> std::move(Stream), Allocator);
>> >73if (auto EC = File->parseFileHeaders())
>> >74  return nullptr;
>> >75if (auto EC = File->parseStreamData())
>> >
>> >
>> > I'm not sure why this wouldn't fail on a linux/windows system.  The
>> point of the .yaml lit tests was that it is host independent?
>> >
>> >
>> > J
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r344409 - Resubmit "Add SymbolFileNativePDB plugin."

2018-10-12 Thread Zachary Turner via lldb-commits
Yea that part is clear, I just wonder what it's trying to parse.  It sounds
like an actual PDB file, because otherwise it shouldn't have made it that
far in the code.  But if it's an actual PDB file, it shouldn't be failing.

Anyway, the code definitely has a bug in that it doesn't correctly handle
failure, it's just strange that it's failing at all.  I'm about to check in
a fix to better handle failure.

On Fri, Oct 12, 2018 at 3:51 PM Jason Molenda  wrote:

> Adrian suggests that parseFileHeaders is returning an error and that needs
> to be cleared?
>
>
> > On Oct 12, 2018, at 3:27 PM, Jason Molenda  wrote:
> >
> > Ah, mystery solved.  The lit test specifies REQUIRES Darwin.
> >
> >> On Oct 12, 2018, at 3:22 PM, Jason Molenda  wrote:
> >>
> >>
> >>
> >>> On Oct 12, 2018, at 12:47 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >>>
> >>> Resubmit "Add SymbolFileNativePDB plugin."
> >>>
> >>> This was originally reverted due to some test failures on
> >>> Linux.  Those problems turned out to require several additional
> >>> patches to lld and clang in order to fix, which have since been
> >>> submitted.  This patch is resubmitted unchanged.  All tests now
> >>> pass on both Linux and Windows.
> >>
> >>
> >> The lit test in lit/Modules/lc_build_version.yaml fails on Darwin
> systems, crashing here -
> >>
> >> 4   lldb-test0x0001008ebdab
> llvm::Error::fatalUncheckedError() const + 139
> >> 5   lldb-test0x00010084b307
> llvm::Error::assertIsChecked() + 87 (Error.h:270)
> >> 6   lldb-test0x00010084b279
> llvm::Error::~Error() + 25 (Error.h:230)
> >> 7   lldb-test0x000100844725
> llvm::Error::~Error() + 21 (Error.h:231)
> >> 8   lldb-test0x000101b91e49
> loadPDBFile(std::__1::basic_string,
> std::__1::allocator >,
> llvm::BumpPtrAllocatorImpl&) + 1193
> (SymbolFileNativePDB.cpp:73)
> >> 9   lldb-test0x000101b9024e
> lldb_private::npdb::SymbolFileNativePDB::CalculateAbilities() + 542
> (SymbolFileNativePDB.cpp:187)
> >> 10  lldb-test0x000101060ceb
> lldb_private::SymbolFile::GetAbilities() + 43 (SymbolFile.h:87)
> >> 11  lldb-test0x0001010607fc
> lldb_private::SymbolFile::FindPlugin(lldb_private::ObjectFile*) + 764
> (SymbolFile.cpp:58)
> >>
> >>
> >> Where the loadPDBFile line 73 is
> >>
> >>
> >>   59  static std::unique_ptr loadPDBFile(std::string PdbPath,
> >>   60
> llvm::BumpPtrAllocator &Allocator) {
> >>   61llvm::ErrorOr>
> ErrorOrBuffer =
> >>   62llvm::MemoryBuffer::getFile(PdbPath, /*FileSize=*/-1,
> >>   63
> /*RequiresNullTerminator=*/false);
> >>   64if (!ErrorOrBuffer)
> >>   65  return nullptr;
> >>   66std::unique_ptr Buffer =
> std::move(*ErrorOrBuffer);
> >>   67
> >>   68llvm::StringRef Path = Buffer->getBufferIdentifier();
> >>   69auto Stream = llvm::make_unique(
> >>   70std::move(Buffer), llvm::support::little);
> >>   71
> >>   72auto File = llvm::make_unique(Path, std::move(Stream),
> Allocator);
> >>   73if (auto EC = File->parseFileHeaders())
> >>   74  return nullptr;
> >>   75if (auto EC = File->parseStreamData())
> >>
> >>
> >> I'm not sure why this wouldn't fail on a linux/windows system.  The
> point of the .yaml lit tests was that it is host independent?
> >>
> >>
> >> J
> >
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344429 - Try to fix some failures on MacOSX with the NativePDB patch.

2018-10-12 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 12 15:57:40 2018
New Revision: 344429

URL: http://llvm.org/viewvc/llvm-project?rev=344429&view=rev
Log:
Try to fix some failures on MacOSX with the NativePDB patch.

This adds -- before any filenames, so that /U doesn't get interpreted
as a command line.

It also adds better error checking, so that we don't get assertions
on the failure path when a file fails to parse as a PDB.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=344429&r1=344428&r2=344429&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Oct 12 15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can show disassembly and source.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb 
%t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp?rev=344429&r1=344428&r2=344429&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp Fri Oct 12 
15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can set simple breakpoints using PDB on any platform.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb 
%t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN: %p/Inputs/breakpoints.lldbinit | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp?rev=344429&r1=344428&r2=344429&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp Fri Oct 12 15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can set display source of functions.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb 
%t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN: %p/Inputs/source-list.lldbinit | FileCheck %s
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344429&r1=344428&r2=344429&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Fri 
Oct 12 15:57:40 2018
@@ -70,10 +70,14 @@ static std::unique_ptr loadPDBF
   std::move(Buffer), llvm::support::little);
 
   auto File = llvm::make_unique(Path, std::move(Stream), Allocator);
-  if (auto EC = File->parseFileHeaders())
+  if (auto EC = File->parseFileHeaders()) {
+llvm::consumeError(std::move(EC));
 return nullptr;
-  if (auto EC = File->parseStreamData())
+  }
+  if (auto EC = File->parseStreamData()) {
+llvm::consumeError(std::move(EC));
 return nullptr;
+  }
 
   return File;
 }
@@ -109,6 +113,9 @@ loadMatchingPDBFile(std::string exe_path
   if (ec || magic != llvm::file_magic::pdb)
 return nullptr;
   std::unique_ptr pdb = loadPDBFile(pdb_file, allocator);
+  if (!pdb)
+return nullptr;
+
   auto expected_info = pdb->getPDBInfoStream();
   if (!expected_info) {
 llvm::consumeError(expected_info.takeError());


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


Re: [Lldb-commits] [lldb] r344409 - Resubmit "Add SymbolFileNativePDB plugin."

2018-10-12 Thread Zachary Turner via lldb-commits
Candidate fix submitted in r344429.  Thanks for reporting.

On Fri, Oct 12, 2018 at 3:54 PM Zachary Turner  wrote:

> Yea that part is clear, I just wonder what it's trying to parse.  It
> sounds like an actual PDB file, because otherwise it shouldn't have made it
> that far in the code.  But if it's an actual PDB file, it shouldn't be
> failing.
>
> Anyway, the code definitely has a bug in that it doesn't correctly handle
> failure, it's just strange that it's failing at all.  I'm about to check in
> a fix to better handle failure.
>
> On Fri, Oct 12, 2018 at 3:51 PM Jason Molenda  wrote:
>
>> Adrian suggests that parseFileHeaders is returning an error and that
>> needs to be cleared?
>>
>>
>> > On Oct 12, 2018, at 3:27 PM, Jason Molenda  wrote:
>> >
>> > Ah, mystery solved.  The lit test specifies REQUIRES Darwin.
>> >
>> >> On Oct 12, 2018, at 3:22 PM, Jason Molenda  wrote:
>> >>
>> >>
>> >>
>> >>> On Oct 12, 2018, at 12:47 PM, Zachary Turner via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>> >>>
>> >>> Resubmit "Add SymbolFileNativePDB plugin."
>> >>>
>> >>> This was originally reverted due to some test failures on
>> >>> Linux.  Those problems turned out to require several additional
>> >>> patches to lld and clang in order to fix, which have since been
>> >>> submitted.  This patch is resubmitted unchanged.  All tests now
>> >>> pass on both Linux and Windows.
>> >>
>> >>
>> >> The lit test in lit/Modules/lc_build_version.yaml fails on Darwin
>> systems, crashing here -
>> >>
>> >> 4   lldb-test0x0001008ebdab
>> llvm::Error::fatalUncheckedError() const + 139
>> >> 5   lldb-test0x00010084b307
>> llvm::Error::assertIsChecked() + 87 (Error.h:270)
>> >> 6   lldb-test0x00010084b279
>> llvm::Error::~Error() + 25 (Error.h:230)
>> >> 7   lldb-test0x000100844725
>> llvm::Error::~Error() + 21 (Error.h:231)
>> >> 8   lldb-test0x000101b91e49
>> loadPDBFile(std::__1::basic_string,
>> std::__1::allocator >,
>> llvm::BumpPtrAllocatorImpl&) + 1193
>> (SymbolFileNativePDB.cpp:73)
>> >> 9   lldb-test0x000101b9024e
>> lldb_private::npdb::SymbolFileNativePDB::CalculateAbilities() + 542
>> (SymbolFileNativePDB.cpp:187)
>> >> 10  lldb-test0x000101060ceb
>> lldb_private::SymbolFile::GetAbilities() + 43 (SymbolFile.h:87)
>> >> 11  lldb-test0x0001010607fc
>> lldb_private::SymbolFile::FindPlugin(lldb_private::ObjectFile*) + 764
>> (SymbolFile.cpp:58)
>> >>
>> >>
>> >> Where the loadPDBFile line 73 is
>> >>
>> >>
>> >>   59  static std::unique_ptr loadPDBFile(std::string PdbPath,
>> >>   60
>> llvm::BumpPtrAllocator &Allocator) {
>> >>   61llvm::ErrorOr>
>> ErrorOrBuffer =
>> >>   62llvm::MemoryBuffer::getFile(PdbPath, /*FileSize=*/-1,
>> >>   63
>> /*RequiresNullTerminator=*/false);
>> >>   64if (!ErrorOrBuffer)
>> >>   65  return nullptr;
>> >>   66std::unique_ptr Buffer =
>> std::move(*ErrorOrBuffer);
>> >>   67
>> >>   68llvm::StringRef Path = Buffer->getBufferIdentifier();
>> >>   69auto Stream = llvm::make_unique(
>> >>   70std::move(Buffer), llvm::support::little);
>> >>   71
>> >>   72auto File = llvm::make_unique(Path,
>> std::move(Stream), Allocator);
>> >>   73if (auto EC = File->parseFileHeaders())
>> >>   74  return nullptr;
>> >>   75if (auto EC = File->parseStreamData())
>> >>
>> >>
>> >> I'm not sure why this wouldn't fail on a linux/windows system.  The
>> point of the .yaml lit tests was that it is host independent?
>> >>
>> >>
>> >> J
>> >
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344431 - Add REQUIRES: lld to SymbolFileNativePDB tests.

2018-10-12 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 12 16:07:32 2018
New Revision: 344431

URL: http://llvm.org/viewvc/llvm-project?rev=344431&view=rev
Log:
Add REQUIRES: lld to SymbolFileNativePDB tests.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=344431&r1=344430&r2=344431&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Oct 12 16:07:32 2018
@@ -1,4 +1,5 @@
 // clang-format off
+// REQUIRES: lld
 
 // Test that we can show disassembly and source.
 // RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
@@ -18,21 +19,21 @@ int main(int argc, char **argv) {
 
 
 // CHECK:  (lldb) disassemble --flavor=intel -m -n main
-// CHECK: 12   int foo() { return 42; }
-// CHECK-NEXT:13
-// CHECK-NEXT: ** 14   int main(int argc, char **argv) {
+// CHECK: 13   int foo() { return 42; }
+// CHECK-NEXT:14
+// CHECK-NEXT: ** 15   int main(int argc, char **argv) {
 // CHECK:  disassembly.cpp.tmp.exe`main:
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>:  subrsp, 0x38
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>:  movdword ptr [rsp + 
0x34], 0x0
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+12>: movqword ptr [rsp + 
0x28], rdx
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+17>: movdword ptr [rsp + 
0x24], ecx
-// CHECK:  ** 15 foo();
-// CHECK:  disassembly.cpp.tmp.exe[{{.*}}] <+21>: call   {{.*}}
   ; foo at disassembly.cpp:12
+// CHECK:  ** 16 foo();
+// CHECK:  disassembly.cpp.tmp.exe[{{.*}}] <+21>: call   {{.*}}
   ; foo at disassembly.cpp:13
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+26>: xorecx, ecx
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+28>: movdword ptr [rsp + 
0x20], eax
-// CHECK:  ** 16 return 0;
-// CHECK-NEXT:17   }
-// CHECK-NEXT:18
+// CHECK:  ** 17 return 0;
+// CHECK-NEXT:18   }
+// CHECK-NEXT:19
 // CHECK:  disassembly.cpp.tmp.exe[{{.*}}] <+32>: moveax, ecx
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+34>: addrsp, 0x38
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+38>: ret

Modified: lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp?rev=344431&r1=344430&r2=344431&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp Fri Oct 12 
16:07:32 2018
@@ -1,4 +1,5 @@
 // clang-format off
+// REQUIRES: lld
 
 // Test that we can set simple breakpoints using PDB on any platform.
 // RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
@@ -37,27 +38,27 @@ int main(int argc, char **argv) {
 // CHECK:  Current executable set to 
'{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64).
 // CHECK:  (lldb) break set -n main
 // CHECK:  Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + 21
-// CHECK-SAME:   at simple-breakpoints.cpp:30
+// CHECK-SAME:   at simple-breakpoints.cpp:31
 // CHECK:  (lldb) break set -n OvlGlobalFn
 // CHECK:  Breakpoint 2: 3 locations.
 // CHECK:  (lldb) break set -n StaticFn
 // CHECK:  Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 
5
-// CHECK-SAME:   at simple-breakpoints.cpp:23
+// CHECK-SAME:   at simple-breakpoints.cpp:24
 // CHECK:  (lldb) break set -n DoesntExist
 // CHECK:  Breakpoint 4: no locations (pending).
 // CHECK:  (lldb) break list
 // CHECK:  Current breakpoints:
 // CHECK:  1: name = 'main', locations = 1
 // CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21
-// CHECK-SAME:at simple-breakpoints.cpp:30
+// CHECK-SAME:at simple-breakpoints.cpp:31
 // CHECK:  2: name = 'OvlGlobalFn', locations = 3
 // CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 5
-// CHECK-SAME:at simple-breakpoints.cpp:12
+// CHECK-SAME:at simple-breakpoints.cpp:13
 // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
-// CHECK-SAME:at simple-breakpoints.cpp:15
+// CHECK-SAME:at simple-breakpoints.cpp:16
 // CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 17
-// CHECK-SAME:at simple-breakpoints.cpp:19
+// CHECK-SAME:at simple-breakpoints.cpp:20
 // CHECK:  3: name = 'StaticFn', locat

Re: [Lldb-commits] [PATCH] D50478: Add support for artificial tail call frames

2018-10-16 Thread Zachary Turner via lldb-commits
Once we’re no longer using DIA this should be a lot easier to control on
our side
On Tue, Oct 16, 2018 at 11:17 AM Vedant Kumar  wrote:

>
>
> On Oct 16, 2018, at 10:59 AM, Stella Stamenova 
> wrote:
>
> The windows error is because the names are different, as you expected:
>
> AssertionError: 'void sink(void)' != 'sink()'
>
> You can probably update the test to look for a different name on Windows
> (though if I recall correctly, different versions of the DIA sdk provide
> different detail on the names, so that might not be robust either) or look
> for a substring in the full name.
>
>
> I used a substring check in r344634.
>
>
> I’ll look into the Linux error as well and let you know what I find.
>
>
> Thank you very much! I really appreciate your help and patience with this.
>
> The "step" logging channel should provide detailed information about what
> goes wrong when parsing the DWARF for call site information and creating
> artificial frames.
>
> vedant
>
>
>
> *From:* v...@apple.com 
> *Sent:* Monday, October 15, 2018 8:34 PM
> *To:* Frédéric Riss 
> *Cc:* reviews+d50478+public+7e86b794a0909...@reviews.llvm.org; Adrian
> Prantl ; paul.robin...@sony.com; jdevliegh...@apple.com;
> Jim Ingham ; ztur...@google.com; Stella Stamenova <
> sti...@microsoft.com>; abidh@gmail.com; teempe...@gmail.com;
> sgraen...@apple.com; mgr...@codeaurora.org; dblai...@gmail.com;
> lldb-commits@lists.llvm.org
> *Subject:* Re: [PATCH] D50478: Add support for artificial tail call frames
>
>
>
>
> On Oct 15, 2018, at 4:46 PM, Frédéric Riss  wrote:
>
>
>
>
> On Oct 15, 2018, at 4:40 PM, Vedant Kumar  wrote:
>
>
>
>
> On Oct 15, 2018, at 3:47 PM, Stella Stamenova via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> stella.stamenova added a comment.
>
> In https://reviews.llvm.org/D50478#1262717
> ,
> @vsk wrote:
>
>
> In https://reviews.llvm.org/D50478#1262710
> ,
> @stella.stamenova wrote:
>
>
> Unfortunately, the bots are broken because of the FileCheck issue, so I
> can't confirm with them, but I see a number of these tests fail in our
> local testing. Some fail on both Windows and Linux and some just fail on
> Linux. Here are the failing tests:
>
> Linux:
> lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
> lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
> lldb-Suite ::
> functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
> lldb-Suite ::
> functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
> lldb-Suite ::
> functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
> lldb-Suite ::
> functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
> lldb-Suite ::
> functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
>
> Windows:
> lldb-Suite ::
> functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
> lldb-Suite ::
> functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py
>
>
> Let me know what you need to investigate.
>
>
>
> Strange, I didn't get any bot failure notifications in the days after this
> landed. Could you share the output from the failing tests?
>
>
>
> All the failures on Windows are happening when validating the function
> name. For example:
>
> ==
>
> FAIL: test_tail_call_frame_sbapi
> (TestTailCallFrameSBAPI.TestTailCallFrameSBAPI)
>
> --
>
> Traceback (most recent call last):
>
>   File
> "E:\_work\55\s\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\tail_call_frames\sbapi_support\TestTailCallFrameSBAPI.py",
> line 19, in test_tail_call_frame_sbapi
>
> self.do_test()
>
>   File
> "E:\_work\55\s\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\tail_call_frames\sbapi_support\TestTailCallFrameSBAPI.py",
> line 64, in do_test
>
> self.assertTrue(frame.GetDisplayFunctionName() == name)
>
>
> It could be that the display name of a function is formatted differently
> on Windows. Do you have an easy way of determining what
> frame.GetDisplayFunctionName() is?
>
>
> If you use assertEqual(a,b) instead of asser

Re: [Lldb-commits] [PATCH] D53402: [SymbolFileNativePDB] Fix missing linkage to DebugInfoCodeView

2018-10-18 Thread Zachary Turner via lldb-commits
Lgtm
On Thu, Oct 18, 2018 at 8:03 AM Michał Górny via Phabricator <
revi...@reviews.llvm.org> wrote:

> mgorny created this revision.
> mgorny added a reviewer: zturner.
> Herald added a subscriber: JDevlieghere.
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D53402
>
> Files:
>   source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
>
>
> Index: source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
> ===
> --- source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
> +++ source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
> @@ -11,6 +11,7 @@
>  lldbSymbol
>   lldbUtility
>LINK_COMPONENTS
> +DebugInfoCodeView
>  DebugInfoPDB
>  Support
>)
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344913 - Some cleanups to the native pdb plugin [NFC].

2018-10-22 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 22 09:19:07 2018
New Revision: 344913

URL: http://llvm.org/viewvc/llvm-project?rev=344913&view=rev
Log:
Some cleanups to the native pdb plugin [NFC].

This is mostly some cleanup done in the process of implementing
some basic support for types.  I tried to split up the patch a
bit to get some of the NFC portion of the patch out into a separate
commit, and this is the result of that.  It moves some code around,
deletes some spurious namespace qualifications, removes some
unnecessary header includes, forward declarations, etc.

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h?rev=344913&r1=344912&r2=344913&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h Mon Oct 22 
09:19:07 2018
@@ -18,6 +18,7 @@
 #ifndef LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBSYMUID_H
 #define LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBSYMUID_H
 
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 #include "llvm/Support/Compiler.h"
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp?rev=344913&r1=344912&r2=344913&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp Mon Oct 22 
09:19:07 2018
@@ -10,16 +10,18 @@
 #include "PdbUtil.h"
 
 #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
 
 #include "lldb/Utility/LLDBAssert.h"
 
+#include "lldb/lldb-enumerations.h"
+
 using namespace lldb_private;
 using namespace lldb_private::npdb;
 using namespace llvm::codeview;
 using namespace llvm::pdb;
 
-llvm::pdb::PDB_SymType
-lldb_private::npdb::CVSymToPDBSym(llvm::codeview::SymbolKind kind) {
+PDB_SymType lldb_private::npdb::CVSymToPDBSym(SymbolKind kind) {
   switch (kind) {
   case S_COMPILE3:
   case S_OBJNAME:
@@ -71,7 +73,32 @@ lldb_private::npdb::CVSymToPDBSym(llvm::
   return PDB_SymType::None;
 }
 
-bool lldb_private::npdb::SymbolHasAddress(const llvm::codeview::CVSymbol &sym) 
{
+PDB_SymType lldb_private::npdb::CVTypeToPDBType(TypeLeafKind kind) {
+  switch (kind) {
+  case LF_ARRAY:
+return PDB_SymType::ArrayType;
+  case LF_ARGLIST:
+return PDB_SymType::FunctionSig;
+  case LF_BCLASS:
+return PDB_SymType::BaseClass;
+  case LF_BINTERFACE:
+return PDB_SymType::BaseInterface;
+  case LF_CLASS:
+  case LF_STRUCTURE:
+  case LF_INTERFACE:
+  case LF_UNION:
+return PDB_SymType::UDT;
+  case LF_POINTER:
+return PDB_SymType::PointerType;
+  case LF_ENUM:
+return PDB_SymType::Enum;
+  default:
+lldbassert(false && "Invalid type record kind!");
+  }
+  return PDB_SymType::None;
+}
+
+bool lldb_private::npdb::SymbolHasAddress(const CVSymbol &sym) {
   switch (sym.kind()) {
   case S_GPROC32:
   case S_LPROC32:
@@ -98,7 +125,7 @@ bool lldb_private::npdb::SymbolHasAddres
   }
 }
 
-bool lldb_private::npdb::SymbolIsCode(const llvm::codeview::CVSymbol &sym) {
+bool lldb_private::npdb::SymbolIsCode(const CVSymbol &sym) {
   switch (sym.kind()) {
   case S_GPROC32:
   case S_LPROC32:
@@ -156,8 +183,7 @@ SegmentOffset GetSegmentAndOffset(
   return SegmentOffsetLength{record.Segment, record.Offset, record.Size};
 }
 
-SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength(
-const llvm::codeview::CVSymbol &sym) {
+SegmentOffsetLength
+lldb_private::npdb::GetSegmentOffsetAndLength(const CVSymbol &sym) {
   switch (sym.kind()) {
   case S_GPROC32:
   case S_LPROC32:
@@ -256,3 +282,76 @@ SegmentOffsetLength lldb_private::npdb::
   }
   return {0, 0, 0};
 }
+
+bool lldb_private::npdb::IsForwardRefUdt(CVType cvt) {
+  ClassRecord cr;
+  UnionRecord ur;
+  EnumRecord er;
+  switch (cvt.kind()) {
+  case LF_CLASS:
+  case LF_STRUCTURE:
+  case LF_INTERFACE:
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, cr));
+return cr.isForwardRef();
+  case LF_UNION:
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, ur));
+return ur.isForwardRef();
+  case LF_ENUM:
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, er));
+return er.isForwardRef();
+  default:
+return false;
+  }
+}
+
+lldb::AccessType
+lldb_private::npdb::TranslateMemberAccess(Member

Re: [Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file

2018-10-22 Thread Zachary Turner via lldb-commits
To answer your question, PE/COFF executable symbol tables are basically
empty
On Mon, Oct 22, 2018 at 10:44 AM Greg Clayton via Phabricator <
revi...@reviews.llvm.org> wrote:

> clayborg requested changes to this revision.
> clayborg added a comment.
> This revision now requires changes to proceed.
>
> All symbol tables are currently extracted from the object files via
> ObjectFile::GetSymtab(). Are symbols only in the PDB file? If so I would
> vote to add a "virtual void SymbolVendor::AddSymbols(Symtab *symtab)" and a
> "virtual void SymbolFile::AddSymbols(Symtab *symtab)" where we take the
> symbol table that comes from the object file and we can add symbols to it
> if the symbol file has symbols it wants to add to the object file's symbol
> table. All symbol queries go through the lldb_private::Symtab class anyway.
> Care must be taken to watch out for symbols that might already exist from
> an ObjectFile's symbol table to ensure don't have duplicates.
>
> So I would:
>
> - Add "virtual void SymbolVendor::AddSymbols(Symtab *symtab);" to
> SymbolVendor that just calls through to its SymbolFile to do the work
> - Add "virtual void SymbolFile::AddSymbols(Symtab *symtab)" to SymbolFile
> with default implementation that does nothing
> - Override SymbolFile::AddSymbols() for SymbolFilePDB and add symbols to
> the provided symbol table
> - Modify *SymbolVendor::GetSymtab()" to get the object file symbol table,
> then pass that along to any symbol file instances it owns to allow each
> symbol file to augment the symbol table
> - Remove all "FindPublicSymbols()" code from patch
> - Revert all symbol searching code to just use the Symtab class now that
> it contains all needed symbols
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D53368
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r345047 - [NativePDB] Add basic support for tag types to the native pdb plugin.

2018-10-23 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Oct 23 09:37:53 2018
New Revision: 345047

URL: http://llvm.org/viewvc/llvm-project?rev=345047&view=rev
Log:
[NativePDB] Add basic support for tag types to the native pdb plugin.

This adds support to LLDB for named types (class, struct, union, and
enum).  This is true cross platform support, and hits the PDB file
directly without a dependency on Windows.  Tests are added which
compile a program with certain interesting types and then use
load the target in LLDB and use "type lookup -- " to
dump the layout of the type in LLDB without a running process.

Currently only fields are parsed -- we do not parse methods.  Also
we don't deal with bitfields or virtual bases correctly.  Those
will make good followups.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit?rev=345047&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit Tue Oct 23 
09:37:53 2018
@@ -0,0 +1,8 @@
+type lookup -- Struct
+type lookup -- Class
+type lookup -- Union
+type lookup -- Derived
+type lookup -- Derived2
+type lookup -- EnumInt
+type lookup -- EnumShort
+type lookup -- InvalidType

Added: lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp?rev=345047&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp Tue Oct 23 09:37:53 2018
@@ -0,0 +1,236 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test that we can display tag types.
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s
+
+// Test struct
+struct Struct {
+  // Test builtin types, which are represented by special CodeView type 
indices.
+  boolB;
+  charC;
+  signed char SC;
+  unsigned char   UC;
+  char16_tC16;
+  char32_tC32;
+  wchar_t WC;
+  short   S;
+  unsigned short  US;
+  int I;
+  unsigned intUI;
+  longL;
+  unsigned long   UL;
+  long long   LL;
+  unsigned long long  ULL;
+  float   F;
+  double  D;
+  long double LD;
+};
+
+// Test class
+class Class {
+public:
+  // Test pointers to builtin types, which are represented by different special
+  // CodeView type indices.
+  bool*PB;
+  char*PC;
+  signed char *PSC;
+  unsigned char   *PUC;
+  char16_t*PC16;
+  char32_t*PC32;
+  wchar_t *PWC;
+  short   *PS;
+  unsigned short  *PUS;
+  int *PI;
+  unsigned int*PUI;
+  long*PL;
+  unsigned long   *PUL;
+  long long   *PLL;
+  unsigned long long  *PULL;
+  float   *PF;
+  double  *PD;
+  long double *PLD;
+};
+
+// Test union
+union Union {
+  // Test modified types.
+  const bool*PB;
+  const char*PC;
+  const signed char *PSC;
+  const unsigned char   *PUC;
+  const char16_t*PC16;
+  const char32_t*PC32;
+  const wchar_t *PWC;
+  const short   *PS;
+  const unsigned short  *PUS;
+  const int *PI;
+  const unsigned int*PUI;
+  const long*PL;
+  const unsigned long   *PUL;
+  const long long   *PLL;
+  const unsigned long long  *PULL;
+  const float   *PF;
+  const double  *PD;
+  const long double *PLD;
+};
+
+struct OneMember {
+  int N = 0;
+};
+
+
+// Test single inheritance.
+class Derived : public Class {
+public:
+  explicit Derived()
+: Reference(*this), RefMember(Member), 
RValueRefMember((OneMember&&)Member) {}
+
+  // Test reference to self, to make sure we don't 

[Lldb-commits] [lldb] r345055 - Change two methods from const char* to StringRef [NFC].

2018-10-23 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Oct 23 10:22:02 2018
New Revision: 345055

URL: http://llvm.org/viewvc/llvm-project?rev=345055&view=rev
Log:
Change two methods from const char* to StringRef [NFC].

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=345055&r1=345054&r2=345055&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Oct 23 10:22:02 2018
@@ -833,7 +833,7 @@ public:
   // Modifying RecordType
   //--
   static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
-const char *name,
+llvm::StringRef name,
 const CompilerType &field_type,
 lldb::AccessType access,
 uint32_t bitfield_bit_size);
@@ -843,7 +843,7 @@ public:
   static void SetIsPacked(const CompilerType &type);
 
   static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
- const char *name,
+ llvm::StringRef name,
  const CompilerType &var_type,
  lldb::AccessType access);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=345055&r1=345054&r2=345055&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Oct 
23 10:22:02 2018
@@ -3029,7 +3029,7 @@ bool DWARFASTParserClang::ParseChildMemb
   if (anon_field_info.IsValid()) {
 clang::FieldDecl *unnamed_bitfield_decl =
 ClangASTContext::AddFieldToRecordType(
-class_clang_type, NULL,
+class_clang_type, llvm::StringRef(),
 m_ast.GetBuiltinTypeForEncodingAndBitSize(
 eEncodingSint, word_width),
 accessibility, anon_field_info.bit_size);

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp?rev=345055&r1=345054&r2=345055&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp Tue 
Oct 23 10:22:02 2018
@@ -108,8 +108,7 @@ Error UdtRecordCompleter::visitKnownMemb
   lldb::AccessType access =
   TranslateMemberAccess(static_data_member.getAccess());
   ClangASTContext::AddVariableToRecordType(
-  m_derived_ct, static_data_member.Name.str().c_str(), 
complete_member_type,
-  access);
+  m_derived_ct, static_data_member.Name, complete_member_type, access);
 
   // FIXME: Add a PdbSymUid namespace for field list members and update
   // the m_uid_to_decl map with this decl.
@@ -130,8 +129,7 @@ Error UdtRecordCompleter::visitKnownMemb
   lldb::AccessType access = TranslateMemberAccess(data_member.getAccess());
 
   clang::FieldDecl *decl = ClangASTContext::AddFieldToRecordType(
-  m_derived_ct, data_member.Name.str().c_str(), complete_member_type,
-  access, 0);
+  m_derived_ct, data_member.Name, complete_member_type, access, 0);
   // FIXME: Add a PdbSymUid namespace for field list members and update
   // the m_uid_to_decl map with this decl.
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=345055&r1=345054&r2=345055&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct 23 10:22:02 2018
@@ -7778,7 +7778,7 @@ ClangASTContext::GetAsObjCInterfaceDecl(
 }
 
 clang::FieldDecl *ClangASTContext::AddFieldToRecordType(
-const CompilerType &type, const char *

[Lldb-commits] [lldb] r345092 - Remove unused private methods.

2018-10-23 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Oct 23 15:15:27 2018
New Revision: 345092

URL: http://llvm.org/viewvc/llvm-project?rev=345092&view=rev
Log:
Remove unused private methods.

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h?rev=345092&r1=345091&r2=345092&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Tue 
Oct 23 15:15:27 2018
@@ -149,14 +149,6 @@ public:
   ClangASTImporter &GetASTImporter() { return *m_importer; }
 
 private:
-  void AddBaseClassesToLayout(CompilerType &derived_ct,
-  ClangASTImporter::LayoutInfo &layout,
-  const llvm::codeview::ClassRecord &record);
-  void AddMembersToLayout(ClangASTImporter::LayoutInfo &layout,
-  const llvm::codeview::TagRecord &record);
-  void AddMethodsToLayout(ClangASTImporter::LayoutInfo &layout,
-  const llvm::codeview::TagRecord &record);
-
   size_t FindTypesByName(llvm::StringRef name, uint32_t max_matches,
  TypeMap &types);
 


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


[Lldb-commits] [lldb] r345091 - Fix some comments pointed out by Leonard Mosescu.

2018-10-23 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Oct 23 15:15:05 2018
New Revision: 345091

URL: http://llvm.org/viewvc/llvm-project?rev=345091&view=rev
Log:
Fix some comments pointed out by Leonard Mosescu.

These were originally pointed out in D53511 but I forgot
to incorporate them in my patch.

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=345091&r1=345090&r2=345091&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Tue 
Oct 23 15:15:05 2018
@@ -310,7 +310,7 @@ static llvm::StringRef GetSimpleTypeName
 return "char";
   case SimpleTypeKind::SignedCharacter:
   case SimpleTypeKind::SByte:
-return "signed chr";
+return "signed char";
   case SimpleTypeKind::Character16:
 return "char16_t";
   case SimpleTypeKind::Character32:
@@ -332,7 +332,7 @@ static llvm::StringRef GetSimpleTypeName
 return "__int128";
   case SimpleTypeKind::Int64:
   case SimpleTypeKind::Int64Quad:
-return "__int64";
+return "int64_t";
   case SimpleTypeKind::Int32:
 return "int";
   case SimpleTypeKind::Int16:
@@ -341,7 +341,7 @@ static llvm::StringRef GetSimpleTypeName
 return "unsigned __int128";
   case SimpleTypeKind::UInt64:
   case SimpleTypeKind::UInt64Quad:
-return "unsigned __int64";
+return "uint64_t";
   case SimpleTypeKind::HResult:
 return "HRESULT";
   case SimpleTypeKind::UInt32:
@@ -644,7 +644,7 @@ lldb::TypeSP SymbolFileNativePDB::Create
 TypeSP direct_sp = GetOrCreateType(ti.makeDirect());
 CompilerType ct = direct_sp->GetFullCompilerType();
 ct = ct.GetPointerType();
-uint32_t pointer_size = 4;
+uint32_t pointer_size = 0;
 switch (ti.getSimpleMode()) {
 case SimpleTypeMode::FarPointer32:
 case SimpleTypeMode::NearPointer32:


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


Re: [Lldb-commits] [PATCH] D53532: [FileSpec] Add VFS support to FileSpec convenience methods.

2018-10-24 Thread Zachary Turner via lldb-commits
It seems like FileSpec was moved out of Utility and into Host. I’m not a
fan of this change, because it took a lot of effort to get it into Utility,
which helped break a lot of bad dependencies. Can we invert this dependency
and move FileSpec back into Utility?
On Wed, Oct 24, 2018 at 5:53 PM Jonas Devlieghere via Phabricator <
revi...@reviews.llvm.org> wrote:

> JDevlieghere added a comment.
>
> Note that there's also a File class which we'll need to patch up
> separately together with all other uses that actually open or read a file.
> For this class we can do the same as we did for FileSpec: deferring
> relevant operations to the FileSystem class.
>
>
> https://reviews.llvm.org/D53532
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53597: Don't type-erase the SymbolContextItem enum

2018-10-25 Thread Zachary Turner via lldb-commits
I guess the question is, How is that hash and the bucket computed?  If it's
based on the full name, then you should be able to get fast exact lookup.
If it's based on the based name, then it will indeed be slow.

On Thu, Oct 25, 2018 at 11:33 AM Jim Ingham via Phabricator via
lldb-commits  wrote:

> jingham added a comment.
>
> Ah, right...  Too many patches (a good problem!)
>
> The standard as I read it says that the name entry points into the general
> string table, but doesn't specify which entry it points to.  However, the
> current DWARF debug_info doesn't ever emit a string for the fully qualified
> name, so you would have to construct it specially to have an exact name to
> refer to.  I also couldn't see anything that said specifically whether the
> DW_AT_name for a type has to be the full name or a base name, it just says:
>
> If a name has been given to the structure, union, or class in the source
> program, then the corresponding structure type, union type, or class type
> entry has a DW_AT_name attribute whose value is a null-terminated string
> containing the type name.
>
> But it would bloat the name tables to use the full name, and since you can
> reconstruct it from the context it's not needed...  So I've only seen base
> names in the name entry for types in the debug_info.
>
> Anyway, current clang for -gdwarf-5 produces:
>
>   Bucket 1 [
> Name 2 {
>   Hash: 0xB887389
>   String: 0x00c3 "Foo"
>   Entry @ 0x92 {
> Abbrev: 0x39
> Tag: DW_TAG_namespace
> DW_IDX_die_offset: 0x004c
>   }
> }
>   ]
>   Bucket 2 [
> Name 3 {
>   Hash: 0xB8860BA
>   String: 0x00c7 "Bar"
>   Entry @ 0x9b {
> Abbrev: 0x13
> Tag: DW_TAG_structure_type
> DW_IDX_die_offset: 0x004e
>   }
> }
> Name 4 {
>   Hash: 0x7C9A7F6A
>   String: 0x00b5 "main"
>   Entry @ 0xa4 {
> Abbrev: 0x2E
> Tag: DW_TAG_subprogram
> DW_IDX_die_offset: 0x0026
>   }
> }
>
> For:
>
> namespace Foo
> {
>
>   struct Bar
>   {
> int First;
>   };
>
> }
>
> int
> main()
> {
>
>   Foo::Bar mine = {10};
>   return mine.First;
>
> }
>
> Jim
>
>
> https://reviews.llvm.org/D53597
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53597: Don't type-erase the SymbolContextItem enum

2018-10-25 Thread Zachary Turner via lldb-commits
Yes, it's an interesting dichotomy how the two formats have evolved.  PDB
was designed with IDEs in mind so it's optimized around exact matches.  For
example, you press a key on a specific line of code.  Nobody ever is
entering commands to do fuzzy lookups based on base names, so this was
never really considered a use case.  And if you go and try to use Windows
command line debuggers, it's indeed slow.

On Thu, Oct 25, 2018 at 11:51 AM Jim Ingham  wrote:

> I am pretty sure the has is computed from the name string.  And BTW,
> having the base name in the quick lookup tables (either with or alongside
> the full name) is a really good thing.  People using the debugger really
> don't want to type out fully qualified names as a general rule.  So you
> have to quickly support incomplete name searches, and the best way to do
> that is grab the base name, and start matching up to where the input
> stopped specifying the name.  So if you're only going to have one entry per
> type, having the base name be the quick lookup is more flexible, though it
> does have the cost that fully specified names are slower to lookup.  But
> the slowness is not O(number of symbols) which would be horrible but
> O(number of symbols with this base name).  That can get bad for all the
> commonly used type names in C++ templates - the STL seems to produce
> boatloads of types of the same base name.  But still isn't that bad.
>
> Jim
>
>
> > On Oct 25, 2018, at 11:40 AM, Zachary Turner  wrote:
> >
> > I guess the question is, How is that hash and the bucket computed?  If
> it's based on the full name, then you should be able to get fast exact
> lookup.  If it's based on the based name, then it will indeed be slow.
> >
> > On Thu, Oct 25, 2018 at 11:33 AM Jim Ingham via Phabricator via
> lldb-commits  wrote:
> > jingham added a comment.
> >
> > Ah, right...  Too many patches (a good problem!)
> >
> > The standard as I read it says that the name entry points into the
> general string table, but doesn't specify which entry it points to.
> However, the current DWARF debug_info doesn't ever emit a string for the
> fully qualified name, so you would have to construct it specially to have
> an exact name to refer to.  I also couldn't see anything that said
> specifically whether the DW_AT_name for a type has to be the full name or a
> base name, it just says:
> >
> > If a name has been given to the structure, union, or class in the source
> program, then the corresponding structure type, union type, or class type
> entry has a DW_AT_name attribute whose value is a null-terminated string
> containing the type name.
> >
> > But it would bloat the name tables to use the full name, and since you
> can reconstruct it from the context it's not needed...  So I've only seen
> base names in the name entry for types in the debug_info.
> >
> > Anyway, current clang for -gdwarf-5 produces:
> >
> >   Bucket 1 [
> > Name 2 {
> >   Hash: 0xB887389
> >   String: 0x00c3 "Foo"
> >   Entry @ 0x92 {
> > Abbrev: 0x39
> > Tag: DW_TAG_namespace
> > DW_IDX_die_offset: 0x004c
> >   }
> > }
> >   ]
> >   Bucket 2 [
> > Name 3 {
> >   Hash: 0xB8860BA
> >   String: 0x00c7 "Bar"
> >   Entry @ 0x9b {
> > Abbrev: 0x13
> > Tag: DW_TAG_structure_type
> > DW_IDX_die_offset: 0x004e
> >   }
> > }
> > Name 4 {
> >   Hash: 0x7C9A7F6A
> >   String: 0x00b5 "main"
> >   Entry @ 0xa4 {
> > Abbrev: 0x2E
> > Tag: DW_TAG_subprogram
> > DW_IDX_die_offset: 0x0026
> >   }
> > }
> >
> > For:
> >
> > namespace Foo
> > {
> >
> >   struct Bar
> >   {
> > int First;
> >   };
> >
> > }
> >
> > int
> > main()
> > {
> >
> >   Foo::Bar mine = {10};
> >   return mine.First;
> >
> > }
> >
> > Jim
> >
> >
> > https://reviews.llvm.org/D53597
> >
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r345312 - [NFC] Refactor SetBaseClasses and DeleteBaseClasses.

2018-10-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Oct 25 13:44:56 2018
New Revision: 345312

URL: http://llvm.org/viewvc/llvm-project?rev=345312&view=rev
Log:
[NFC] Refactor SetBaseClasses and DeleteBaseClasses.

We currently had a 2-step process where we had to call
SetBaseClassesForType and DeleteBaseClasses.  Every single caller
followed this exact 2-step process, and there was manual memory
management going on with raw pointers.  We can do better than this
by storing a vector of unique_ptrs and passing this around.
This makes for a cleaner API, and we only need to call one method
so there is no possibility of a user forgetting to call
DeleteBaseClassSpecifiers.

In addition to this, it also makes for a *simpler* API.  Part of
why I wanted to do this is because when I was implementing the native
PDB interface I had to spend some time understanding exactly what I
was deleting and why.  ClangAST has significant mental overhead
associated with it, and reducing the API surface can go along
way to making it simpler for people to understand.

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

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/unittests/Symbol/TestClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=345312&r1=345311&r2=345312&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Oct 25 13:44:56 2018
@@ -858,18 +858,14 @@ public:
   void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type);
 
   // C++ Base Classes
-  clang::CXXBaseSpecifier *
+  std::unique_ptr
   CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type,
lldb::AccessType access, bool is_virtual,
bool base_of_class);
 
-  static void DeleteBaseClassSpecifiers(clang::CXXBaseSpecifier **base_classes,
-unsigned num_base_classes);
-
-  bool
-  SetBaseClassesForClassType(lldb::opaque_compiler_type_t type,
- clang::CXXBaseSpecifier const *const 
*base_classes,
- unsigned num_base_classes);
+  bool TransferBaseClasses(
+  lldb::opaque_compiler_type_t type,
+  std::vector> bases);
 
   static bool SetObjCSuperClass(const CompilerType &type,
 const CompilerType &superclass_compiler_type);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=345312&r1=345311&r2=345312&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Thu Oct 
25 13:44:56 2018
@@ -2184,14 +2184,14 @@ bool DWARFASTParserClang::CompleteTypeFr
 }
 
 SymbolContext sc(die.GetLLDBCompileUnit());
-std::vector base_classes;
+std::vector> bases;
 std::vector member_accessibilities;
 bool is_a_class = false;
 // Parse members and base classes first
 DWARFDIECollection member_function_dies;
 
 DelayedPropertyList delayed_properties;
-ParseChildMembers(sc, die, clang_type, class_language, base_classes,
+ParseChildMembers(sc, die, clang_type, class_language, bases,
   member_accessibilities, member_function_dies,
   delayed_properties, default_accessibility, 
is_a_class,
   layout_info);
@@ -2255,11 +2255,11 @@ bool DWARFASTParserClang::CompleteTypeFr
   &member_accessibilities.front(), member_accessibilities.size());
 }
 
-if (!base_classes.empty()) {
+if (!bases.empty()) {
   // Make sure all base classes refer to complete types and not forward
   // declarations. If we don't do this, clang will crash with an
-  // assertion in the call to clang_type.SetBaseClassesForClassType()
-  for (auto &base_class : base_classes) {
+  // assertion in the call to clang_type.TransferBaseClasses()
+  for (const auto &base_class : bases) {
 clang::TypeSourceInfo *type_source_info =
 base_class->getTypeSourceInfo();
 i

[Lldb-commits] [lldb] r345313 - Don't type-erase the SymbolContextItem enumeration.

2018-10-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Oct 25 13:45:19 2018
New Revision: 345313

URL: http://llvm.org/viewvc/llvm-project?rev=345313&view=rev
Log:
Don't type-erase the SymbolContextItem enumeration.

When we get the `resolve_scope` parameter from the SB API, it's a
`uint32_t`.  We then pass it through all of LLDB this way, as a uint32.
This is unfortunate, because it means the user of an API never actually
knows what they're dealing with.  We can call it something like
`resolve_scope` and have comments saying "this is a value from the
`SymbolContextItem` enumeration, but it makes more sense to just have it
actually *be* the correct type in the actual C++ type system to begin
with.  This way the person reading the code just knows what it is.

The reason to use integers instead of enumerations for flags is because
when you do bitwise operations on enumerations they get promoted to
integers, so it makes it tedious to constantly be casting them back
to the enumeration types, so I've introduced a macro to make this
happen magically.  By writing LLDB_MARK_AS_BITMASK_ENUM after defining
an enumeration, it will define overloaded operators so that the
returned type will be the original enum.  This should address all
the mechanical issues surrounding using rich enum types directly.

This way, we get a better debugger experience, and new users to
the codebase can get more easily acquainted with the codebase because
their IDE features can help them understand what the types mean.

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

Modified:
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/ModuleList.h
lldb/trunk/include/lldb/Symbol/CompileUnit.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Core/SourceManager.cpp
lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/trunk/source/Symbol/CompileUnit.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=345313&r1=345312&r2=345313&view=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Thu Oct 25 13:45:19 2018
@@ -508,9 +508,9 @@ public:
   ///
   /// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
   //--
-  uint32_t CalculateSymbolContext(
-  SymbolContext *sc,
-  uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
+  uint32_t CalculateSymbolContext(SymbolContext *sc,
+  lldb::SymbolContextItem resolve_scope =
+  lldb::eSymbolContextEverything) const;
 
   lldb::ModuleSP CalculateSymbolContextModule() const;
 

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=345313&r1=345312&r2=345313&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Oct 25 13:45:19 2018
@@ -816,10 +816,9 @@ public:
   ///
   /// @see SymbolContext::Scope
   //---

[Lldb-commits] [lldb] r345314 - Don't type-erase the FunctionNameType or TypeClass enums.

2018-10-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Oct 25 13:45:40 2018
New Revision: 345314

URL: http://llvm.org/viewvc/llvm-project?rev=345314&view=rev
Log:
Don't type-erase the FunctionNameType or TypeClass enums.

This is similar to D53597, but following up with 2 more enums.
After this, all flag enums should be strongly typed all the way
through to the symbol files plugins.

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

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/ModuleList.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h?rev=345314&r1=345313&r2=345314&view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h Thu Oct 25 
13:45:40 2018
@@ -31,20 +31,23 @@ namespace lldb_private {
 class BreakpointResolverName : public BreakpointResolver {
 public:
   BreakpointResolverName(Breakpoint *bkpt, const char *name,
- uint32_t name_type_mask, lldb::LanguageType language,
+ lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language,
  Breakpoint::MatchType type, lldb::addr_t offset,
  bool skip_prologue);
 
   // This one takes an array of names.  It is always MatchType = Exact.
   BreakpointResolverName(Breakpoint *bkpt, const char *names[],
- size_t num_names, uint32_t name_type_mask,
+ size_t num_names,
+ lldb::FunctionNameType name_type_mask,
  lldb::LanguageType language, lldb::addr_t offset,
  bool skip_prologue);
 
   // This one takes a C++ array of names.  It is always MatchType = Exact.
   BreakpointResolverName(Breakpoint *bkpt, std::vector names,
- uint32_t name_type_mask, lldb::LanguageType language,
- lldb::addr_t offset, bool skip_prologue);
+ lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language, lldb::addr_t offset,
+ bool skip_prologue);
 
   // Creates a function breakpoint by regular expression.  Takes over control
   // of the lifespan of func_regex.
@@ -89,7 +92,8 @@ protected:
   lldb::LanguageType m_language;
   bool m_skip_prologue;
 
-  void AddNameLookup(const ConstString &name, uint32_t name_type_mask);
+  void AddNameLookup(const ConstString &name,
+ lldb::FunctionNameType name_type_mask);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=345314&r1=345313&r2=345314&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Oct 25 13:45:40 2018
@@ -380,7 +380,7 @@ public:
   //--
   size_t FindFunctions(const ConstString &name,
const CompilerDeclContext *parent_decl_ctx,
-   uint32_t name_type_mask, bool symbols_ok,
+   lldb::FunctionNameType name_type_mask, bool symbols_ok,
 

[Lldb-commits] [lldb] r345373 - [NativePDB] Add the ability to dump dump global variables.

2018-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 26 02:06:38 2018
New Revision: 345373

URL: http://llvm.org/viewvc/llvm-project?rev=345373&view=rev
Log:
[NativePDB] Add the ability to dump dump global variables.

LLDB has the ability to display global variables, even without a running
process, via the target variable command. This is because global
variables are linker initialized, so their values are embedded directly
into the executables. This gives us great power for testing native PDB
functionality in a cross-platform manner, because we don't actually need
a running process. We can just create a target using an EXE file, and
display global variables. And global variables can have arbitrarily
complex types, so in theory we can fully exercise the type system,
record layout, and data formatters for native PDB files and PE/COFF
executables on any host platform, as long as our type does not require a
dynamic initializer.

This patch adds basic support for finding variables by name, and adds an
exhaustive test for fundamental data types and pointers / references to
fundamental data types.

Subsequent patches will extend this to typedefs, classes, pointers to
functions, and other cases.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit?rev=345373&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit 
(added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit Fri 
Oct 26 02:06:38 2018
@@ -0,0 +1,220 @@
+target variable BFalse
+target variable BTrue
+target variable CA
+target variable CZ
+target variable SCa
+target variable SCz
+target variable UC24
+target variable UC42
+target variable C16_24
+target variable C32_42
+target variable WC1
+target variable WCP
+target variable SMax
+target variable SMin
+target variable USMax
+target variable USMin
+target variable IMax
+target variable IMin
+target variable UIMax
+target variable UIMin
+target variable LMax
+target variable LMin
+target variable ULMax
+target variable ULMin
+target variable LLMax
+target variable LLMin
+target variable ULLMax
+target variable ULLMin
+target variable F
+target variable D
+
+target variable CBFalse
+target variable CBTrue
+target variable CCA
+target variable CCZ
+target variable CSCa
+target variable CSCz
+target variable CUC24
+target variable CUC42
+target variable CC16_24
+target variable CC32_42
+target variable CWC1
+target variable CWCP
+target variable CSMax
+target variable CSMin
+target variable CUSMax
+target variable CUSMin
+target variable CIMax
+target variable CIMin
+target variable CUIMax
+target variable CUIMin
+target variable CLMax
+target variable CLMin
+target variable CULMax
+target variable CULMin
+target variable CLLMax
+target variable CLLMin
+target variable CULLMax
+target variable CULLMin
+target variable CF
+target variable CD
+
+target variable ConstexprBFalse
+target variable ConstexprBTrue
+target variable ConstexprCA
+target variable ConstexprCZ
+target variable ConstexprSCa
+target variable ConstexprSCz
+target variable ConstexprUC24
+target variable ConstexprUC42
+target variable ConstexprC16_24
+target variable ConstexprC32_42
+target variable ConstexprWC1
+target variable ConstexprWCP
+target variable ConstexprSMax
+target variable ConstexprSMin
+target variable ConstexprUSMax
+target variable ConstexprUSMin
+target variable ConstexprIMax
+target variable ConstexprIMin
+target variable ConstexprUIMax
+target variable ConstexprUIMin
+target variable ConstexprLMax
+target variable ConstexprLMin
+target variable ConstexprULMax
+target variable ConstexprULMin
+target variable ConstexprLLMax
+target variable ConstexprLLMin
+target variable ConstexprULLMax
+target variable ConstexprULLMin
+target variable ConstexprF
+target variable ConstexprD
+
+target variable PBFalse
+target variable PBTrue
+target variable PCA
+target variable PCZ
+target variable PSCa
+target variable PSCz
+target variable PUC24
+target variable PUC42
+target variable PC16_24
+target variable PC32_42
+target variable PWC1
+target variable PWCP
+target variable PSMax
+target variable PSMin
+target variable PUSMax
+target variable PUSMin
+target variable PIMax
+target variable PIMin
+target variable PUIMax
+target variable PUIMin
+target variable PLMax
+target variable PLMin
+target variable PULMax
+target variable PULMin
+target variable PLLMax
+target 

Re: [Lldb-commits] [PATCH] D53749: [PDB] Fix `SymbolFilePDBTests` after r345313

2018-10-26 Thread Zachary Turner via lldb-commits
Ahh, I meant to remind you, because I noticed this when I was looking
through the SymbolFilePDB code recently.  I think the LLVM guideline is not
to use so much auto.  The generally accepted rule is that we can use for
the result of make_shared, make_unique, and result of iterator types, but
otherwise we prefer to explicitly spell the types out.  You don't have to
go and submit another patch on top of this one to fix it again, it's just
something to keep in mind.

That said, thanks for fixing this for me.  Sorry for the break.

On Fri, Oct 26, 2018 at 2:11 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov created this revision.
> aleksandr.urakov added reviewers: zturner, stella.stamenova.
> aleksandr.urakov added a project: LLDB.
> Herald added a subscriber: lldb-commits.
>
> This one fixes tests compilation preserving the type of the `scope`
> parameter.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D53749
>
> Files:
>   unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>
>
> Index: unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> ===
> --- unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> +++ unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> @@ -270,7 +270,7 @@
>EXPECT_EQ(2u, cus);
>
>SymbolContextList sc_list;
> -  uint32_t scope = lldb::eSymbolContextCompUnit |
> lldb::eSymbolContextLineEntry;
> +  auto scope = lldb::eSymbolContextCompUnit |
> lldb::eSymbolContextLineEntry;
>
>uint32_t count =
>symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
> @@ -319,7 +319,7 @@
>EXPECT_EQ(2u, cus);
>
>SymbolContextList sc_list;
> -  uint32_t scope = lldb::eSymbolContextCompUnit |
> lldb::eSymbolContextLineEntry;
> +  auto scope = lldb::eSymbolContextCompUnit |
> lldb::eSymbolContextLineEntry;
>
>// First test with line 7, and verify that only line 7 entries are
> added.
>uint32_t count =
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53749: [PDB] Fix `SymbolFilePDBTests` after r345313

2018-10-26 Thread Zachary Turner via lldb-commits
For trivial changes it's ok to submit without review.  This is true for
cleanup and trivial refactor, but especially for build break like this
one., and even more so if you consider yourself code owner in the
corresponding code area.

On Fri, Oct 26, 2018 at 2:29 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov added a comment.
>
> Ok, thanks! I didn't know about such rule. I'll reduce usages of auto :)
>
> As for such an obvious changes, is it ok to commit them without a review?
> Or is it still preferable to create reviews for them?
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D53749
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D53662: Give the SymbolFile plugin enough information to efficiently do exact match lookups

2018-10-26 Thread Zachary Turner via lldb-commits
Ok, that reasoning makes sense, I’ll see what i can do
On Fri, Oct 26, 2018 at 9:25 AM Greg Clayton via Phabricator <
revi...@reviews.llvm.org> wrote:

> clayborg added a comment.
>
> My issue with adding "exact_match" is it renders a few of the arguments
> useless:
>
>   size_t FindTypes(
> const SymbolContext &sc,
> llvm::StringRef name,
> const CompilerDeclContext *parent_decl_ctx,
> bool exact_match,
> ...);
>
> With exact_match "parent_decl_ctx" is useless and possible the symbol
> context too. The FindTypes as written today was used for two cases which
> evolved over time:
>
> - finding types for users without needing to be fully qualified
> - finding types for the expression parser in a specific context
>
> To fulfill these two cases, arguments have been added over time. As we
> keep adding arguments we make the function even harder to implement for
> SymbolFile subclasses. So as long as we are cleaning things up, it might be
> time to factor this out by making changes now.
>
> Another complexity is that we can either search a single module or
> multiple modules when doing searches, and that is why we have
> Module::FindTypes_Impl(...) in since there is some work that needs to be
> done when we are searching by basename only (strip the context and search
> by basename, then filters matches afterward.
>
> That is why I was thinking we might want to make changes. Seems like
> having:
>
>   size_t FindTypesByBasename(
> const SymbolContext &sc,
> llvm::StringRef name,
> const CompilerDeclContext *parent_decl_ctx
> ...);
>
>   size_t FindTypesByFullname(llvm::StringRef name, ...);
>
> Clients of the first call must strip a typename to its identifier name
> prior to calling, and clients of the second can call with a fully qualified
> typename.
>
>
> https://reviews.llvm.org/D53662
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-10-29 Thread Zachary Turner via lldb-commits
Even in this exact case we have the multiple variants situation. If we use
the substitutions method we would reduce the test coverage by half, which
doesn’t seem like a good idea.

Similarly, in the target variables tests i added to the native pdb plugin
Jim was asking if I could also enable that exact same test for other
platforms. But it’s not possible without a way to run multiple variants.
And for tests where no running process is required I think it’s a worthy
goal to try to do that.
On Mon, Oct 29, 2018 at 6:04 AM Pavel Labath  wrote:

> On 26/10/18 18:34, Zachary Turner wrote:
> > I was thinking about this some more and I’m not sure simple
> > substitutions will suffice.
> >
> > We can provide substitutions to abstract away the command line, but that
> > doesn’t doesn’t really address the issue that we still need to have a
> > way to then run the the test program with each of the build outputs.
> > Keep in mind that it might take more than one compiler and/or linker
> > invocation to generate an output, and more than one lldb-test invocation
> > for the checks.
> >
> > The best idea I have for now is to split the check file into a common
> > file that everyone can share, but the lldb-test lines can be copied.  So
> > there is one .test file for windows, one for non windows, each with only
> > RUN lines, both sharing a common check file.
> >
> > I don’t think we should block this patch on coming up with something
> > more complicated than this though
> >
>
> The substitutions won't help if you're planning to run multiple variants
> of the same test (e.g. a DWARF and a PDB version) on all hosts. However,
> if you always just want to run a single version of the test (e.g., for
> the host), then it's enough to have a substitution which builds the
> given version of the executable.
>
> Given how the memory map tests are implemented right now (they require a
> running process, and they don't care too much about the details of how
> the debugee was built), this should be sufficient. I don't think we will
> ever have two flavours of these tests run in the same instance of the
> test suite, as it would require us the specify how to launch and debug
> an executable on multiple hosts.
>
> So, I'd recommend to stick with the substitution idea until we come up
> with something better.
>
> pl
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r345629 - [NativePDB] Add support for dumping global variables of class type.

2018-10-30 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Oct 30 11:57:08 2018
New Revision: 345629

URL: http://llvm.org/viewvc/llvm-project?rev=345629&view=rev
Log:
[NativePDB] Add support for dumping global variables of class type.

Previous patches added support for dumping global variables of
primitive types, so we now do the same for class types.

For the most part, everything just worked, there was only one
minor bug needing fixed, which was that for variables of modified
types (e.g. const, volatile, etc) we can't resolve the forward
decl in CreateAndCacheType because the PdbSymUid must point to the
LF_MODIFIER which must point to the forward decl.  So when it comes
time to call CompleteType, an assert was firing because we expected
to get a class, struct, union, or enum, but we were getting an
LF_MODIFIER instead.

The other issue is that one the newly added tests is for an array
member, which was not yet supported, so we add support for that
now in this patch.

There's probably room for other interesting layout test cases
here, but this at least should test the basics.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit?rev=345629&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit Tue Oct 
30 11:57:08 2018
@@ -0,0 +1,14 @@
+settings set auto-one-line-summaries false
+
+target variable -T ClassWithPaddingInstance
+target variable -T ClassNoPaddingInstance
+target variable -T DC
+target variable -T EBOC
+target variable -T PBC
+
+target variable -T UnnamedClassInstance
+
+target variable -T PointersInstance
+target variable -T ReferencesInstance
+
+quit
\ No newline at end of file

Added: lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp?rev=345629&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp Tue Oct 30 11:57:08 
2018
@@ -0,0 +1,275 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test that we can display tag types.
+// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-classes.lldbinit | FileCheck %s
+
+enum class EnumType : unsigned {
+  A = 1,
+  B = 2
+};
+
+class ClassNoPadding {
+  /* [ 0] */ unsigned char a = 86;
+  /* [ 1] */ char b = 'a';
+  /* [ 2] */ bool c = false;
+  /* [ 3] */ bool d = true;
+  /* [ 4] */ short e = -1234;
+  /* [ 6] */ unsigned short f = 8123;
+  /* [ 8] */ unsigned int g = 123908;
+  /* [12] */ int h = -890234;
+  /* [16] */ unsigned long i = 2908234;
+  /* [20] */ long j = 7234890;
+  /* [24] */ float k = 908234.12392;
+  /* [28] */ EnumType l = EnumType::A;
+  /* [32] */ double m = 23890.897423;
+  /* [40] */ unsigned long long n = 23490782;
+  /* [48] */ long long o = -923409823;
+  /* [56] */ int p[5] = { 2, 3, 5, 8, 13 };
+};
+
+class ClassWithPadding {
+  /* [ 0] */ char a = '0';
+  // char padding[1];
+  /* [ 2] */ short b = 50;
+  /* [ 4] */ char c[2] = { '0', '1' };
+  // char padding[2];
+  /* [ 8] */ int d = 100;
+  /* [12] */ char e = '0';
+  // char padding[3];
+  /* [16] */ int f = 200;
+  // char padding[4];
+  /* [24] */ long long g = 300;
+  /* [32] */ char h[3] = { '0', '1', '2' };
+  // char padding[5];
+  /* [40] */ long long i = 400;
+  /* [48] */ char j[2] = { '0', '1' };
+  // char padding[6];
+  /* [56] */ long long k = 500;
+  /* [64] */ char l = '0';
+  // char padding[7];
+  /* [72] */ long long m = 600;
+} ;
+
+struct EmptyBase {};
+
+template
+struct BaseClass {
+  constexpr BaseClass(int N)
+: BaseMember(N) {}
+
+  int BaseMember;
+};
+
+struct DerivedClass : public BaseClass {
+  constexpr DerivedClass(int Base, int Derived)
+: BaseClass(Base), DerivedMember(Derived) {}
+
+  int DerivedMember;
+};
+
+struct EBO : public EmptyBase {
+  constexpr EBO(int N) : Member(N) {}
+  int Member;
+};
+
+struct PaddedBases : public BaseClass, public BaseClass, 
BaseCl

[Lldb-commits] [lldb] r345848 - [NativePDB] Get LLDB types from PDB function types.

2018-11-01 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  1 09:37:29 2018
New Revision: 345848

URL: http://llvm.org/viewvc/llvm-project?rev=345848&view=rev
Log:
[NativePDB] Get LLDB types from PDB function types.

This adds basic support for getting function signature types
into LLDB's type system, including into clang's AST.  There are
a few edge cases which are not correctly handled, mostly dealing
with nested classes, but this isn't specific to functions and
apply equally to variable types.  Note that no attempt has been
made yet to deal with member function types, which will happen
in subsequent patches.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit

lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp
lldb/trunk/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit?rev=345848&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit 
(added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit 
Thu Nov  1 09:37:29 2018
@@ -0,0 +1,70 @@
+command alias dv target variable
+
+dv aa
+dv ab
+dv ac
+dv ad
+dv ae
+dv af
+dv ag
+dv ah
+dv ai
+dv aj
+dv ak
+dv al
+dv am
+dv an
+dv ao
+dv aq
+dv ar
+dv as
+dv at
+dv au
+dv av
+dv aw
+dv ax
+dv ay
+dv az
+dv aaa
+dv aab
+dv aac
+dv aad
+dv ra
+dv rb
+dv rc
+dv rd
+dv re
+dv rf
+dv rg
+dv rh
+dv ri
+dv rj
+dv rk
+dv rl
+dv rm
+dv rn
+dv ro
+dv rq
+dv rr
+dv rs
+dv rt
+dv ru
+dv rv
+dv rw
+dv rx
+dv ry
+dv rz
+dv raa
+dv rab
+dv rac
+dv rad
+dv ref
+dv ref2
+dv ref3
+dv binp
+dv binr
+dv null
+dv rae
+dv aae
+
+quit

Added: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit?rev=345848&view=auto
==
--- 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit 
(added)
+++ 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit 
Thu Nov  1 09:37:29 2018
@@ -0,0 +1,7 @@
+target variable sfn
+target variable ffn
+target variable tfn
+target variable cfn
+target variable vfn
+
+quit

Added: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit?rev=345848&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
(added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
Thu Nov  1 09:37:29 2018
@@ -0,0 +1,12 @@
+target variable a
+target variable b
+target variable c
+target variable d
+target variable e
+target variable f
+target variable g
+target variable h
+target variable i
+target variable incomplete
+
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp?rev=345848&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp Thu Nov  1 
09:37:29 2018
@@ -0,0 +1,215 @@
+// clang-format off
+// REQUIRES: lld
+
+// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/function-types-builtins.lldbinit | FileCheck %s
+
+// Test that we can display function signatures with simple builtin
+// and pointer types.  We do this by using `target variable` in lldb
+// with global variables of type ptr-to-function or reference-to-function.
+// This technique in general allows us to exercise most of LLDB's type
+// system without a running process.
+
+template
+struct MakeResult {
+  static T result() {
+return T{};
+  }
+};
+
+template
+struct MakeResult {
+  static T& result(

Re: [Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too

2018-11-02 Thread Zachary Turner via lldb-commits
Lgtm
On Fri, Nov 2, 2018 at 3:03 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov created this revision.
> aleksandr.urakov added reviewers: zturner, stella.stamenova.
> aleksandr.urakov added a project: LLDB.
> Herald added subscribers: lldb-commits, teemperor.
>
> This patch fixes the NativePDB tests to make them work from x86 command
> line too.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54031
>
> Files:
>   lit/SymbolFile/NativePDB/disassembly.cpp
>   lit/SymbolFile/NativePDB/simple-breakpoints.cpp
>   lit/SymbolFile/NativePDB/tag-types.cpp
>
>
> Index: lit/SymbolFile/NativePDB/tag-types.cpp
> ===
> --- lit/SymbolFile/NativePDB/tag-types.cpp
> +++ lit/SymbolFile/NativePDB/tag-types.cpp
> @@ -141,7 +141,7 @@
>  }
>
>  // CHECK:  (lldb) target create "{{.*}}tag-types.cpp.tmp.exe"
> -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe'
> (x86_64).
> +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe'
>  // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit'
>  // CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'.
>  // CHECK-NEXT: (lldb) type lookup -- Struct
> Index: lit/SymbolFile/NativePDB/simple-breakpoints.cpp
> ===
> --- lit/SymbolFile/NativePDB/simple-breakpoints.cpp
> +++ lit/SymbolFile/NativePDB/simple-breakpoints.cpp
> @@ -35,30 +35,30 @@
>
>
>  // CHECK:  (lldb) target create "{{.*}}simple-breakpoints.cpp.tmp.exe"
> -// CHECK:  Current executable set to
> '{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64).
> +// CHECK:  Current executable set to
> '{{.*}}simple-breakpoints.cpp.tmp.exe'
>  // CHECK:  (lldb) break set -n main
> -// CHECK:  Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main
> + 21
> +// CHECK:  Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main
> + {{[0-9]+}}
>  // CHECK-SAME:   at simple-breakpoints.cpp:31
>  // CHECK:  (lldb) break set -n OvlGlobalFn
>  // CHECK:  Breakpoint 2: 3 locations.
>  // CHECK:  (lldb) break set -n StaticFn
> -// CHECK:  Breakpoint 3: where =
> simple-breakpoints.cpp.tmp.exe`StaticFn + 5
> +// CHECK:  Breakpoint 3: where =
> simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}}
>  // CHECK-SAME:   at simple-breakpoints.cpp:24
>  // CHECK:  (lldb) break set -n DoesntExist
>  // CHECK:  Breakpoint 4: no locations (pending).
>  // CHECK:  (lldb) break list
>  // CHECK:  Current breakpoints:
>  // CHECK:  1: name = 'main', locations = 1
> -// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21
> +// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main +
> {{[0-9]+}}
>  // CHECK-SAME:at simple-breakpoints.cpp:31
>  // CHECK:  2: name = 'OvlGlobalFn', locations = 3
> -// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
> + 5
> +// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
> + {{[0-9]+}}
>  // CHECK-SAME:at simple-breakpoints.cpp:13
>  // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
>  // CHECK-SAME:at simple-breakpoints.cpp:16
> -// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
> + 17
> +// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn
> + {{[0-9]+}}
>  // CHECK-SAME:at simple-breakpoints.cpp:20
>  // CHECK:  3: name = 'StaticFn', locations = 1
> -// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5
> +// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn +
> {{[0-9]+}}
>  // CHECK-SAME:at simple-breakpoints.cpp:24
>  // CHECK:  4: name = 'DoesntExist', locations = 0 (pending)
> Index: lit/SymbolFile/NativePDB/disassembly.cpp
> ===
> --- lit/SymbolFile/NativePDB/disassembly.cpp
> +++ lit/SymbolFile/NativePDB/disassembly.cpp
> @@ -2,7 +2,7 @@
>  // REQUIRES: lld
>
>  // Test that we can show disassembly and source.
> -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
> +// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s
>  // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb
> -- %t.obj
>  // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
>  // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346008 - Refactor the lit configuration files

2018-11-02 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  2 10:49:01 2018
New Revision: 346008

URL: http://llvm.org/viewvc/llvm-project?rev=346008&view=rev
Log:
Refactor the lit configuration files

A year or so ago, I re-wrote most of the lit infrastructure in LLVM so
that it wasn't so boilerplate-y. I added lots of common helper type
stuff, simplifed usage patterns, and made the code more elegant and
maintainable.

We migrated to this in LLVM, clang, and lld's lit files, but not in
LLDBs. This started to bite me recently, as the 4 most recent times I
tried to run the lit test suite in LLDB on a fresh checkout the first
thing that would happen is that python would just start crashing with
unhelpful backtraces and I would have to spend time investigating.

You can reproduce this today by doing a fresh cmake generation, doing
ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at
which point you'll get a segfault that tells you nothing about what your
problem is.

I started trying to fix the issues with bandaids, but it became clear
that the proper solution was to just bring in the work I did in the rest
of the projects. The side benefit of this is that the lit configuration
files become much cleaner and more understandable as a result.

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

Added:
lldb/trunk/lit/Unit/lit.cfg.py
lldb/trunk/lit/Unit/lit.site.cfg.py.in
lldb/trunk/lit/lit.cfg.py
lldb/trunk/lit/lit.site.cfg.py.in
Removed:
lldb/trunk/lit/Breakpoint/lit.local.cfg
lldb/trunk/lit/Expr/lit.local.cfg
lldb/trunk/lit/Quit/lit.local.cfg
lldb/trunk/lit/Settings/lit.local.cfg
lldb/trunk/lit/SymbolFile/NativePDB/lit.local.cfg
lldb/trunk/lit/SymbolFile/PDB/lit.local.cfg
lldb/trunk/lit/Unit/lit.cfg
lldb/trunk/lit/Unit/lit.site.cfg.in
lldb/trunk/lit/lit.cfg
lldb/trunk/lit/lit.site.cfg.in
Modified:
lldb/trunk/lit/Breakpoint/case-insensitive.test
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test
lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
lldb/trunk/lit/SymbolFile/PDB/calling-conventions.test
lldb/trunk/lit/SymbolFile/PDB/class-layout.test
lldb/trunk/lit/SymbolFile/PDB/compilands.test
lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test
lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test
lldb/trunk/lit/SymbolFile/PDB/pointers.test
lldb/trunk/lit/SymbolFile/PDB/type-quals.test
lldb/trunk/lit/SymbolFile/PDB/typedefs.test
lldb/trunk/lit/SymbolFile/PDB/udt-layout.test
lldb/trunk/lit/SymbolFile/PDB/variables-locations.test
lldb/trunk/lit/SymbolFile/PDB/variables.test
lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test
lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test
lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test
lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test

Modified: lldb/trunk/lit/Breakpoint/case-insensitive.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/case-insensitive.test?rev=346008&r1=346007&r2=346008&view=diff
==
--- lldb/trunk/lit/Breakpoint/case-insensitive.test (original)
+++ lldb/trunk/lit/Breakpoint/case-insensitive.test Fri Nov  2 10:49:01 2018
@@ -1,5 +1,5 @@
-# REQUIRES: windows
-# XFAIL: windows
+# REQUIRES: system-windows
+# XFAIL: system-windows
 # -> llvm.org/pr24528
 #
 # RUN: %cc %p/Inputs/case-sensitive.c -g -o %t

Removed: lldb/trunk/lit/Breakpoint/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/lit.local.cfg?rev=346007&view=auto
==
--- lldb/trunk/lit/Breakpoint/lit.local.cfg (original)
+++ lldb/trunk/lit/Breakpoint/lit.local.cfg (removed)
@@ -1 +0,0 @@
-config.suffixes = ['.test']

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346008&r1=346007&r2=346008&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Nov  2 10:49:01 2018
@@ -51,11 +51,13 @@ llvm_canonicalize_cmake_booleans(
   LLVM_ENABLE_ZLIB)
 
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BIN

[Lldb-commits] [lldb] r346035 - Fix a bug in the lit test suite generation.

2018-11-02 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  2 12:55:15 2018
New Revision: 346035

URL: http://llvm.org/viewvc/llvm-project?rev=346035&view=rev
Log:
Fix a bug in the lit test suite generation.

I'm not sure why this has to be CMAKE_CURRENT_SOURCE_DIR, but
it causes all kinds of strange cmake generation errors when it's
the binary dir.

Modified:
lldb/trunk/lit/CMakeLists.txt

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346035&r1=346034&r2=346035&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Nov  2 12:55:15 2018
@@ -83,6 +83,6 @@ if (TARGET clang)
 endif()
 
 add_lit_testsuites(LLDB
-  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}
   DEPENDS ${LLDB_TEST_DEPS}
   )


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


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-02 Thread Zachary Turner via lldb-commits
Fix incoming, sorry about that.

On Fri, Nov 2, 2018 at 2:57 PM Jonas Devlieghere via Phabricator <
revi...@reviews.llvm.org> wrote:

> JDevlieghere added a comment.
>
> Hi Zachary, looks like this broke GreenDragon:
> http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12087/console
>
> Can you have a look please?
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346046 - Fix the lit test suite.

2018-11-02 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  2 15:02:09 2018
New Revision: 346046

URL: http://llvm.org/viewvc/llvm-project?rev=346046&view=rev
Log:
Fix the lit test suite.

This change was accidentally missed from the original changeset.

Modified:
lldb/trunk/lit/lit.site.cfg.py.in

Modified: lldb/trunk/lit/lit.site.cfg.py.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.site.cfg.py.in?rev=346046&r1=346045&r2=346046&view=diff
==
--- lldb/trunk/lit/lit.site.cfg.py.in (original)
+++ lldb/trunk/lit/lit.site.cfg.py.in Fri Nov  2 15:02:09 2018
@@ -28,5 +28,8 @@ except KeyError as e:
 key, = e.args
 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % 
(key,key))
 
+import lit.llvm
+lit.llvm.initialize(lit_config, config)
+
 # Let the main config do the real work.
 lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg.py")


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


[Lldb-commits] [lldb] r346057 - Make sure to have lit load the configured site config first.

2018-11-02 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  2 17:06:37 2018
New Revision: 346057

URL: http://llvm.org/viewvc/llvm-project?rev=346057&view=rev
Log:
Make sure to have lit load the configured site config first.

For the lldb unit test suite, we forgot to add the mapping from
site config to main config, so when it found the main config in
the source tree, it wasn't going and loading the configured version
in the build tree first, so the required properties weren't getting
set up properly.

Modified:
lldb/trunk/lit/CMakeLists.txt

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346057&r1=346056&r2=346057&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Nov  2 17:06:37 2018
@@ -57,7 +57,9 @@ configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
-  ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py)
+  ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py)
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in
   ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg)


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


[Lldb-commits] [lldb] r346058 - Fix some windows-specific fallout from the FileSpec change.

2018-11-02 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  2 17:07:03 2018
New Revision: 346058

URL: http://llvm.org/viewvc/llvm-project?rev=346058&view=rev
Log:
Fix some windows-specific fallout from the FileSpec change.

Modified:
lldb/trunk/source/Host/windows/Host.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=346058&r1=346057&r2=346058&view=diff
==
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Fri Nov  2 17:07:03 2018
@@ -37,8 +37,9 @@ namespace {
 bool GetTripleForProcess(const FileSpec &executable, llvm::Triple &triple) {
   // Open the PE File as a binary file, and parse just enough information to
   // determine the machine type.
-  File imageBinary(executable.GetPath().c_str(), File::eOpenOptionRead,
-   lldb::eFilePermissionsUserRead);
+  File imageBinary;
+  FileSystem::Instance().Open(imageBinary, executable, File::eOpenOptionRead,
+  lldb::eFilePermissionsUserRead);
   imageBinary.SeekFromStart(0x3c);
   int32_t peOffset = 0;
   uint32_t peHead = 0;

Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=346058&r1=346057&r2=346058&view=diff
==
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Fri Nov  2 
17:07:03 2018
@@ -147,7 +147,7 @@ protected:
 
 TEST_F(SymbolFilePDBTests, TestAbilitiesForPDB) {
   // Test that when we have PDB debug info, SymbolFilePDB is used.
-  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  FileSpec fspec(m_pdb_test_exe);
   ArchSpec aspec("i686-pc-windows");
   lldb::ModuleSP module = std::make_shared(fspec, aspec);
 
@@ -165,7 +165,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy
   // Test that attempting to call ResolveSymbolContext with only a basename
   // finds all full paths
   // with the same basename
-  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  FileSpec fspec(m_pdb_test_exe);
   ArchSpec aspec("i686-pc-windows");
   lldb::ModuleSP module = std::make_shared(fspec, aspec);
 
@@ -173,7 +173,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy
   EXPECT_NE(nullptr, plugin);
   SymbolFile *symfile = plugin->GetSymbolFile();
 
-  FileSpec header_spec("test-pdb.cpp", false);
+  FileSpec header_spec("test-pdb.cpp");
   SymbolContextList sc_list;
   uint32_t result_count = symfile->ResolveSymbolContext(
   header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
@@ -185,7 +185,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy
   // Test that attempting to call ResolveSymbolContext with a full path only
   // finds the one source
   // file that matches the full path.
-  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  FileSpec fspec(m_pdb_test_exe);
   ArchSpec aspec("i686-pc-windows");
   lldb::ModuleSP module = std::make_shared(fspec, aspec);
 
@@ -194,8 +194,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy
   SymbolFile *symfile = plugin->GetSymbolFile();
 
   FileSpec header_spec(
-  
R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec",
-  false);
+  
R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec");
   SymbolContextList sc_list;
   uint32_t result_count = symfile->ResolveSymbolContext(
   header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
@@ -209,7 +208,7 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH
   // compiled, but only contributes to the combined code of other source 
files),
   // a SymbolContext is returned
   // for each compiland which has line contributions from the requested header.
-  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  FileSpec fspec(m_pdb_test_exe);
   ArchSpec aspec("i686-pc-windows");
   lldb::ModuleSP module = std::make_shared(fspec, aspec);
 
@@ -217,10 +216,10 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH
   EXPECT_NE(nullptr, plugin);
   SymbolFile *symfile = plugin->GetSymbolFile();
 
-  FileSpec header_specs[] = {FileSpec("test-pdb.h", false),
- FileSpec("test-pdb-nested.h", false)};
-  FileSpec main_cpp_spec("test-pdb.cpp", false);
-  FileSpec alt_cpp_spec("test-pdb-alt.cpp", false);
+  FileSpec header_specs[] = {FileSpec("test-pdb.h"),
+ FileSpec("test-pdb-nested.h")};
+  FileSpec main_cpp_spec("test-pdb.cpp");
+  FileSpec alt_cpp_spec("test-pdb-alt.cpp");
   for (const auto &hspec : header_specs) {
 SymbolContextList sc_list;
 uint32_t result_count = symfile->ResolveSymbolContext(
@@ -237,7 +236,7 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH
   // compiled, but only contributes to the combin

Re: [Lldb-commits] [PATCH] D54072: Add a command to dump a module's clang ast.

2018-11-04 Thread Zachary Turner via lldb-commits
Unfortunately then color output is impossible. Where else would the output
be expected to go?
On Sun, Nov 4, 2018 at 2:23 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added inline comments.
>
>
> 
> Comment at: lldb/source/Commands/CommandObjectTarget.cpp:2275
> +SymbolFile *sf = m->GetSymbolVendor()->GetSymbolFile();
> +sf->DumpClangAST();
> +  }
> 
> The dump function should take the output stream from the `result` object,
> so the output ends up where it's expected to go. (`clang::DeclBase::dump`
> has an overload which takes a `raw_ostream`, and lldb streams have a
> `raw_ostream` accessor now).
>
>
> https://reviews.llvm.org/D54072
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54072: Add a command to dump a module's clang ast.

2018-11-04 Thread Zachary Turner via lldb-commits
Ok so probably this commands output will not go to a log file when logging
is enabled? I can’t think of any other side effects.

Given that the immediate use case for this is interactive investigation and
testing, the first of which is helped by color output and the second of
which doesn’t need logging, what do you think of allowing it as is?
On Sun, Nov 4, 2018 at 5:19 AM Zachary Turner via Phabricator <
revi...@reviews.llvm.org> wrote:

> zturner added a subscriber: vsk.
> zturner added a comment.
>
> Unfortunately then color output is impossible. Where else would the output
> be expected to go?
>
>
> https://reviews.llvm.org/D54072
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54072: Add a command to dump a module's clang ast.

2018-11-04 Thread Zachary Turner via lldb-commits
The issue is that clang writes directly to stderr
On Sun, Nov 4, 2018 at 5:38 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added a comment.
>
> In https://reviews.llvm.org/D54072#1286748, @zturner wrote:
>
> > Unfortunately then color output is impossible. Where else would the
> output
> >  be expected to go?
>
>
> If you execute the command over the SB API
> (SBCommandInterpreter::HandleCommand) then it will go into the provided
> result object. Also, some clients (typically IDEs) use
> SetInput/Output/ErrorFileHandle to set what is considered to be the default
> input/output streams for a given debugger instance (typically, to redirect
> these to some console window).
>
> I don't think this directly precludes colored output, although it may
> require a bit more plumbing to pass the information whether the final
> consumer is willing to accept color escape codes. (We can already get that
> via `StreamFile->GetFile().GetIsTerminalWithColors()`, so you would just
> need to somehow pass this information to the proxy raw_ostream you give to
> the clang dump function.)
>
>
> https://reviews.llvm.org/D54072
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54072: Add a command to dump a module's clang ast.

2018-11-04 Thread Zachary Turner via lldb-commits
I tried that one and it didn’t show color, bit maybe I need to add an
overload of dumpColor that allows to pass a raw_ostream
On Sun, Nov 4, 2018 at 6:25 AM Raphael Isemann via Phabricator <
revi...@reviews.llvm.org> wrote:

> teemperor added a comment.
>
> I think Pavel's point is to call the `dump` overload which allows
> specifying our own custom raw_ostream:
> https://clang.llvm.org/doxygen/classclang_1_1Decl.html#a278b3b87b6f9d3b20ed566a8684341a6
> And our raw_ostream is configured by LLDB to correctly choose if we want
> color or not.
>
>
> https://reviews.llvm.org/D54072
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346149 - Add a target modules dump ast command.

2018-11-05 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov  5 09:40:28 2018
New Revision: 346149

URL: http://llvm.org/viewvc/llvm-project?rev=346149&view=rev
Log:
Add a target modules dump ast command.

This is useful for investigating the clang ast as you reconstruct
it via by parsing debug info.  It can also be used to write tests
against.

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

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=346149&r1=346148&r2=346149&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Nov  5 09:40:28 2018
@@ -194,9 +194,10 @@ public:
 
   uint32_t GetPointerByteSize() override;
 
-  static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
+  static clang::TranslationUnitDecl *
+  GetTranslationUnitDecl(clang::ASTContext *ast);
 
-  clang::DeclContext *GetTranslationUnitDecl() {
+  clang::TranslationUnitDecl *GetTranslationUnitDecl() {
 return GetTranslationUnitDecl(getASTContext());
   }
 
@@ -926,6 +927,8 @@ public:
   //--
   // Dumping types
   //--
+  void Dump(Stream &s);
+
   void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
  Stream *s, lldb::Format format, const DataExtractor &data,
  lldb::offset_t data_offset, size_t data_byte_size,

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=346149&r1=346148&r2=346149&view=diff
==
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Mon Nov  5 09:40:28 2018
@@ -161,6 +161,8 @@ public:
 uint32_t line, bool check_inlines,
 lldb::SymbolContextItem resolve_scope,
 SymbolContextList &sc_list);
+
+  virtual void DumpClangAST(Stream &s) {}
   virtual uint32_t
   FindGlobalVariables(const ConstString &name,
   const CompilerDeclContext *parent_decl_ctx,

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=346149&r1=346148&r2=346149&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Nov  5 09:40:28 2018
@@ -2227,6 +2227,85 @@ protected:
   }
 };
 
+#pragma mark CommandObjectTargetModulesDumpSections
+
+//--
+// Clang AST dumping command
+//--
+
+class CommandObjectTargetModulesDumpClangAST
+: public CommandObjectTargetModulesModuleAutoComplete {
+public:
+  CommandObjectTargetModulesDumpClangAST(CommandInterpreter &interpreter)
+  : CommandObjectTargetModulesModuleAutoComplete(
+interpreter, "target modules dump ast",
+"Dump the clang ast for a given module's symbol file.",
+//"target modules dump ast [ ...]")
+nullptr) {}
+
+  ~CommandObjectTargetModulesDumpClangAST() override = default;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr) {
+  result.AppendError("invalid target, create a debug target using the "
+ "'target create' command");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+const size_t num_modules = target->GetImages().GetSize();
+if (num_mod

[Lldb-commits] [lldb] r346156 - Properly cast from DeclContext to Decl.

2018-11-05 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov  5 11:25:39 2018
New Revision: 346156

URL: http://llvm.org/viewvc/llvm-project?rev=346156&view=rev
Log:
Properly cast from DeclContext to Decl.

Apparently there's a special procedure for doing this.  Not
following this silently breaks builds.

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=346156&r1=346155&r2=346156&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Nov  5 11:25:39 2018
@@ -194,10 +194,9 @@ public:
 
   uint32_t GetPointerByteSize() override;
 
-  static clang::TranslationUnitDecl *
-  GetTranslationUnitDecl(clang::ASTContext *ast);
+  static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
 
-  clang::TranslationUnitDecl *GetTranslationUnitDecl() {
+  clang::DeclContext *GetTranslationUnitDecl() {
 return GetTranslationUnitDecl(getASTContext());
   }
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=346156&r1=346155&r2=346156&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Nov  5 11:25:39 2018
@@ -1285,7 +1285,7 @@ CompilerType ClangASTContext::GetCString
   return CompilerType(ast, ast->getPointerType(char_type));
 }
 
-clang::TranslationUnitDecl *
+clang::DeclContext *
 ClangASTContext::GetTranslationUnitDecl(clang::ASTContext *ast) {
   return ast->getTranslationUnitDecl();
 }
@@ -8966,7 +8966,7 @@ ClangASTContext::ConvertStringToFloatVal
 #define DEPTH_INCREMENT 2
 
 void ClangASTContext::Dump(Stream &s) {
-  TranslationUnitDecl *tu = GetTranslationUnitDecl();
+  Decl *tu = Decl::castFromDeclContext(GetTranslationUnitDecl());
   tu->dump(s.AsRawOstream());
 }
 


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


Re: [Lldb-commits] [lldb] r346149 - Add a target modules dump ast command.

2018-11-05 Thread Zachary Turner via lldb-commits
r346156.

On Mon, Nov 5, 2018 at 11:09 AM Davide Italiano 
wrote:

> On Mon, Nov 5, 2018 at 9:42 AM Zachary Turner via lldb-commits
>  wrote:
> >
> > Author: zturner
> > Date: Mon Nov  5 09:40:28 2018
> > New Revision: 346149
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=346149&view=rev
> > Log:
> > Add a target modules dump ast command.
> >
> > This is useful for investigating the clang ast as you reconstruct
> > it via by parsing debug info.  It can also be used to write tests
> > against.
> >
>
> Zachary, this broke one of our bots
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-clang-6.0.1/1275/
>
> Can you please take a look?
>
> Thanks,
>
> --
> Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-07 Thread Zachary Turner via lldb-commits
I have not run the dotest suite recently, is that where you’re seeing the
failures? I successfully ran the lit suite and unit tests though
On Wed, Nov 7, 2018 at 1:32 PM Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> wrote:

> stella.stamenova added a comment.
>
> Several of the windows tests that invoke clang-cl have started failing
> recently (I am not sure exactly when) and I suspect this change is the
> culprit. Were you able to run the tests successfully with this change?
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-07 Thread Zachary Turner via lldb-commits
It’s possible we lost some environment variable propagation, that would do
it. But I’m curious how it was finding the visual studio installation
before my patch.

It also looks like it’s failing finding link.exe (we really should make
lld-link the default). Another fix is to pass -fuse-ld=lld or split the
clang-cl line to separate compiler and linker invocations
On Wed, Nov 7, 2018 at 1:44 PM Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> wrote:

> stella.stamenova added a comment.
>
> In https://reviews.llvm.org/D54009#1290644, @zturner wrote:
>
> > I have not run the dotest suite recently, is that where you’re seeing the
> >  failures? I successfully ran the lit suite and unit tests though
>
>
> Yes, they are primarily in the lldb-suite but not only:
>
>
> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1129/steps/test/logs/stdio
>
> There are some other failures, but what I suspect happened after this
> change is that the tests are now not picking up clang-cl correctly:
>
>   $ "clang-cl" "/Zi"
> "E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\lit\Expr/Inputs/call-function.cpp"
> "-o"
> "E:\build_slave\lldb-x64-windows-ninja\build\tools\lldb\lit\Expr\Output\TestIRMemoryMapWindows.test.tmp"
>   # command stderr:
>   clang-cl: warning: unable to find a Visual Studio installation; try
> running Clang from a developer command prompt [-Wmsvc-not-found]
>
>   clang-cl: error: unable to execute command: program not executable
>
>   clang-cl: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> I will have some time to have a look in more detail tomorrow.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-07 Thread Zachary Turner via lldb-commits
Actually maybe it’s the other way around. Are you specifying
LLDB_TEST_COMPILER? If it’s picking up VS’s version, it would definitely be
able to find link.exe
On Wed, Nov 7, 2018 at 2:07 PM Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> wrote:

> stella.stamenova added a comment.
>
> I haven't verified this yet - but I suspect it is now picking up the
> clang-cl that comes with VS rather than the one that was just built.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter

2018-11-07 Thread Zachary Turner via lldb-commits
I meant the folder. It’s the first result in your search results. Just
curious, why does your build successfully complete without fixing that
instance?
On Wed, Nov 7, 2018 at 2:20 PM Shafik Yaghmour via Phabricator <
revi...@reviews.llvm.org> wrote:

> shafik added a comment.
>
> @zturner I don't see `AddEnumerationValueToEnumerationType` being called
> in `SymbolFile/NativePDB.cpp`
> https://github.com/llvm-mirror/lldb/search?q=AddEnumerationValueToEnumerationType&unscoped_q=AddEnumerationValueToEnumerationType
>
>
> https://reviews.llvm.org/D54003
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346429 - [NativePDB] Higher fidelity reconstruction of AST from Debug Info.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 10:50:11 2018
New Revision: 346429

URL: http://llvm.org/viewvc/llvm-project?rev=346429&view=rev
Log:
[NativePDB] Higher fidelity reconstruction of AST from Debug Info.

In order to accurately put a type into the correct location in the AST
we construct from debug info, we need to be able to determine what
DeclContext (namespace, global, nested class, etc) that it goes into.
PDB doesn't contain this mapping.  It does, however, contain the reverse
mapping.  That is, for a given class type T, you can determine all
classes Q1, Q2, ..., Qn that are nested inside of T.  We need to know,
for a given class type Q, what type T is it nested inside of.

This patch builds this map as a pre-processing step when we first
load the PDB by scanning every type.  Initial tests show that while
this can be slow in debug builds of LLDB, it is quite fast in release
builds (less than 2 seconds for a ~1GB PDB, and it only needs to happen
once).

Furthermore, having this pre-processing step in place allows us to
repurpose it for building up other kinds of indexing to it down the
line.  For the time being, this gives us very accurate reconstruction
of the DeclContext hierarchy.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit?rev=346429&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit 
(added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit Thu 
Nov  8 10:50:11 2018
@@ -0,0 +1,20 @@
+target variable TC
+target variable TS
+target variable TU
+target variable TE
+
+target variable ABCInt
+target variable ABCFloat
+target variable ABCVoid
+
+target variable AC0
+target variable ACNeg1
+
+target variable AC0D
+target variable ACNeg1D
+target variable AD
+target variable ADE
+
+target modules dump ast
+
+quit

Modified: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit?rev=346429&r1=346428&r2=346429&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
(original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
Thu Nov  8 10:50:11 2018
@@ -9,4 +9,6 @@ target variable h
 target variable i
 target variable incomplete
 
+target modules dump ast
+
 quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit?rev=346429&r1=346428&r2=346429&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit 
(original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit Thu Nov 
 8 10:50:11 2018
@@ -11,4 +11,6 @@ target variable -T UnnamedClassInstance
 target variable -T PointersInstance
 target variable -T ReferencesInstance
 
+target modules dump ast
+
 quit
\ No newline at end of file

Added: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346429&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
10:50:11 2018
@@ -0,0 +1,131 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/ast-reconstruction.lldbinit 2>&1 | FileCheck %s
+
+// Test trivial versions of each tag type.
+class TrivialC {};
+stru

[Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 10:50:31 2018
New Revision: 346430

URL: http://llvm.org/viewvc/llvm-project?rev=346430&view=rev
Log:
Fix bug in PE/COFF plugin and ValueObjectVariable.

There are two bugs here.  The first is that MSVC and clang-cl
emit their bss section under the name '.data' instead of '.bss'
but with the size and file offset set to 0.  ObjectFilePECOFF
didn't handle this, and would only recognize a section as bss
if it was actually called '.bss'.  The effect of this is that
if we tried to print the value of a variable that lived in BSS
we would fail.

The second bug is that ValueObjectVariable was only returning
the forward type, which is insufficient to print the value of an
enum.  So we bump this up to the layout type.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346430&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Thu Nov  8 
10:50:31 2018
@@ -0,0 +1,3 @@
+target variable GlobalVariable
+
+quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346430&r1=346429&r2=346430&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
10:50:31 2018
@@ -89,22 +89,23 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (TrivialE) TE = TE_A
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition

Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346430&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Thu Nov  8 10:50:31 2018
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can read variables from BSS
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
+
+int GlobalVariable = 0;
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+// BSS:   Section {
+// BSS: Number: 3
+// BSS: Name: .data
+// BSS-NEXT:VirtualSize: 0x4
+// BSS-NEXT:VirtualAddress:
+// BSS-NEXT:RawDataSize: 0
+// BSS-NEXT:PointerToRawData: 0x0
+// BSS-NEXT:PointerToRelocations: 0x0
+// BSS-NEXT:PointerToLineNumbers: 0x0
+// BSS-NEXT:RelocationCount: 0
+// BSS-NEXT:LineNumberCount: 0
+// BSS-NEXT:Characteristics [ (0xC040)
+// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
+// BSS-NEXT:  

Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?
On Thu, Nov 8, 2018 at 12:56 PM Davide Italiano 
wrote:

> Zach, either this or your previous commit broke MacOS.
> Can you please take a look?
> Feel free to ping me (here or on IRC) if you need any help.
>
> http://green.lab.llvm.org/green/job/lldb-cmake/12343/
>
> --
> Davide
> On Thu, Nov 8, 2018 at 10:52 AM Zachary Turner via lldb-commits
>  wrote:
> >
> > Author: zturner
> > Date: Thu Nov  8 10:50:31 2018
> > New Revision: 346430
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=346430&view=rev
> > Log:
> > Fix bug in PE/COFF plugin and ValueObjectVariable.
> >
> > There are two bugs here.  The first is that MSVC and clang-cl
> > emit their bss section under the name '.data' instead of '.bss'
> > but with the size and file offset set to 0.  ObjectFilePECOFF
> > didn't handle this, and would only recognize a section as bss
> > if it was actually called '.bss'.  The effect of this is that
> > if we tried to print the value of a variable that lived in BSS
> > we would fail.
> >
> > The second bug is that ValueObjectVariable was only returning
> > the forward type, which is insufficient to print the value of an
> > enum.  So we bump this up to the layout type.
> >
> > Differential Revision: https://reviews.llvm.org/D54241
> >
> > Added:
> > lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> > lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
> > Modified:
> > lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> > lldb/trunk/source/Core/ValueObjectVariable.cpp
> > lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
> >
> > Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346430&view=auto
> >
> ==
> > --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> (added)
> > +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Thu
> Nov  8 10:50:31 2018
> > @@ -0,0 +1,3 @@
> > +target variable GlobalVariable
> > +
> > +quit
> >
> > Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346430&r1=346429&r2=346430&view=diff
> >
> ==
> > --- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
> > +++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov
> 8 10:50:31 2018
> > @@ -89,22 +89,23 @@ Anonymous>::D AnonABCVoidD;
> >  // CHECK: (TrivialC) TC = {}
> >  // CHECK: (TrivialS) TS = {}
> >  // CHECK: (TrivialU) TU = {}
> > -// CHECK: (TrivialE) TE = 
> > -// CHECK: (A::B::C) ABCInt = (ABCMember =  failed>)
> > -// CHECK: (A::B::C) ABCFloat = (ABCMember =  {{.*}} failed>)
> > -// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember =  memory from {{.*}} failed>)
> > +// CHECK: (TrivialE) TE = TE_A
> > +// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
> > +// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
> > +// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember =
> 0x)
> >  // CHECK: (A::C<0>) AC0 = {}
> >  // CHECK: (A::C<-1>) ACNeg1 = {}
> > -// CHECK: (A::C<0>::D) AC0D = (ACDMember =  failed>, CPtr = )
> > -// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember =  failed>, CPtr = )
> > +// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
> > +// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr =
> 0x)
> >  // CHECK: (A::D) AD = {}
> > -// CHECK: (A::D::E) ADE = (ADDMember = )
> > +// CHECK: (A::D::E) ADE = (ADDMember = 0)
> >  // CHECK: Dumping clang ast for 1 modules.
> >  // CHECK: TranslationUnitDecl {{.*}}
> >  // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
> >  // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
> >  // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
> >  // CHECK: |-EnumDecl {{.*}} TrivialE
> > +// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
> >  // CHECK: |-NamespaceDecl {{.*}} A
> >  // CHECK: | |-NamespaceDecl {{.*}} B
> >  // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition
> >

Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
+greg.

Greg, is the test wrong here or the patch?  If it’s the test let’s just fix
the test, otherwise we can revert the patch until we figure it out.

It seems related to my change to use the layout type instead of the forward
type.

On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
wrote:

> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner  wrote:
> >
> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
> failure?
>
>
> FAIL: test_with_run_command_gmodules
> (TestTypeCompletion.TypeCompletionTestCase)
>
>Check that types only get completed when necessary.
> --
> Traceback (most recent call last):
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 1744, in test_method
> return attrvalue(self)
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
> line 113, in wrapper
> func(*args, **kwargs)
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
> line 55, in test_with_run_command 'vector complete but it should
> not be')
> AssertionError: True is not False : vector complete but it should not be
>
>
> Do you want me to revert this in the meanwhile?
>
> --Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
Go ahead and revert to green until i get back
On Thu, Nov 8, 2018 at 1:17 PM Zachary Turner  wrote:

> +greg.
>
> Greg, is the test wrong here or the patch?  If it’s the test let’s just
> fix the test, otherwise we can revert the patch until we figure it out.
>
> It seems related to my change to use the layout type instead of the
> forward type.
>
> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
> wrote:
>
>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner 
>> wrote:
>> >
>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
>> failure?
>>
>>
>> FAIL: test_with_run_command_gmodules
>> (TestTypeCompletion.TypeCompletionTestCase)
>>
>>Check that types only get completed when necessary.
>> --
>> Traceback (most recent call last):
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>> line 1744, in test_method
>> return attrvalue(self)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>> line 113, in wrapper
>> func(*args, **kwargs)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>> line 55, in test_with_run_command 'vector complete but it should
>> not be')
>> AssertionError: True is not False : vector complete but it should not
>> be
>>
>>
>> Do you want me to revert this in the meanwhile?
>>
>> --Davide
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346459 - Fix a test whose output changed.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 17:09:10 2018
New Revision: 346459

URL: http://llvm.org/viewvc/llvm-project?rev=346459&view=rev
Log:
Fix a test whose output changed.

A previous commit fixed an issue with our AST generation where
we were outputting enum decls incorrectly.  But we forgot to
update the test output.  This patch updates the test output
accordingly.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp?rev=346459&r1=346458&r2=346459&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp Thu Nov  8 17:09:10 
2018
@@ -304,8 +304,8 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} o 'long long'
 // CHECK: | `-FieldDecl {{.*}} p 'int [5]'
 // CHECK: |-EnumDecl {{.*}} EnumType
-// CHECK: | |-EnumConstantDecl {{.*}} A 'unsigned int'
-// CHECK: | `-EnumConstantDecl {{.*}} B 'unsigned int'
+// CHECK: | |-EnumConstantDecl {{.*}} A 'EnumType'
+// CHECK: | `-EnumConstantDecl {{.*}} B 'EnumType'
 // CHECK: |-CXXRecordDecl {{.*}} struct DerivedClass definition
 // CHECK: | |-public 'BaseClass'
 // CHECK: | `-FieldDecl {{.*}} DerivedMember 'int'


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


[Lldb-commits] [lldb] r346505 - Resubmit "Fix bug in PE/COFF plugin."

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 08:06:44 2018
New Revision: 346505

URL: http://llvm.org/viewvc/llvm-project?rev=346505&view=rev
Log:
Resubmit "Fix bug in PE/COFF plugin."

The original commit was actually 2 unrelated bug fixes, but it turns
out the second bug fix wasn't quite correct, so the entire patch was
reverted.  Resubmitting this half of the patch by itself, then will
follow up with a new patch which fixes the rest of the issue in a
more appropriate way.

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346505&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Fri Nov  9 
08:06:44 2018
@@ -0,0 +1,3 @@
+target variable GlobalVariable
+
+quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346505&r1=346504&r2=346505&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov  9 
08:06:44 2018
@@ -90,15 +90,15 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
 // CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition

Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346505&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Fri Nov  9 08:06:44 2018
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can read variables from BSS
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
+
+int GlobalVariable = 0;
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+// BSS:   Section {
+// BSS: Number: 3
+// BSS: Name: .data
+// BSS-NEXT:VirtualSize: 0x4
+// BSS-NEXT:VirtualAddress:
+// BSS-NEXT:RawDataSize: 0
+// BSS-NEXT:PointerToRawData: 0x0
+// BSS-NEXT:PointerToRelocations: 0x0
+// BSS-NEXT:PointerToLineNumbers: 0x0
+// BSS-NEXT:RelocationCount: 0
+// BSS-NEXT:LineNumberCount: 0
+// BSS-NEXT:Characteristics [ (0xC040)
+// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
+// BSS-NEXT:  IMAGE_SCN_MEM_WRITE (0x8000)
+// BSS-NEXT:]
+// BSS-NEXT:  }
+
+// CHECK: (int) GlobalVariable = 0

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=346505&r1=346504&r2=346505&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Fri Nov  9 
08:06:44 2018
@@ -710,7 +710,10 @@ void ObjectFilePECOFF::CreateSections(Se
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
((const_sect_name == g_data_sect_name) ||
  

[Lldb-commits] [lldb] r346511 - [NativePDB] Add support for bitfield records.

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 08:29:19 2018
New Revision: 346511

URL: http://llvm.org/viewvc/llvm-project?rev=346511&view=rev
Log:
[NativePDB] Add support for bitfield records.

Bitfields are represented as LF_MEMBER records whose TypeIndex
points to an LF_BITFIELD record that describes the bit width,
bit offset, and underlying type of the bitfield.  All we need to
do is resolve these when resolving record types.

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit?rev=346511&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit Fri Nov  9 
08:29:19 2018
@@ -0,0 +1,5 @@
+settings set auto-one-line-summaries false
+
+target variable -T TheStruct
+
+target modules dump ast

Added: lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp?rev=346511&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp Fri Nov  9 08:29:19 2018
@@ -0,0 +1,61 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// RUN: clang-cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c 
/Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
+
+// Test trivial versions of each tag type.
+struct Struct {
+  int A : 5 = 6;
+  int B : 7 = 8;
+  unsigned C : 3 = 2;
+  unsigned D : 15 = 12345;
+  char E : 1 = 0;
+  char F : 2 = 1;
+  char G : 3 = 2;
+  // H should be at offset 0 of a new byte.
+  char H : 3 = 3;
+};
+
+constexpr Struct TheStruct;
+
+
+int main(int argc, char **argv) {
+  return TheStruct.A;
+}
+
+// CHECK: (lldb) target variable -T TheStruct
+// CHECK: (const Struct) TheStruct = {
+// CHECK:   (int:5) A = 6
+// CHECK:   (int:7) B = 8
+// CHECK:   (unsigned int:3) C = 2
+// CHECK:   (unsigned int:15) D = 12345
+// CHECK:   (char:1) E = '\0'
+// CHECK:   (char:2) F = '\x01'
+// CHECK:   (char:3) G = '\x02'
+// CHECK:   (char:3) H = '\x03'
+// CHECK: }
+//
+// CHECK: target modules dump ast
+// CHECK: Dumping clang ast for 1 modules.
+// CHECK: TranslationUnitDecl {{.*}}
+// CHECK: |-CXXRecordDecl {{.*}} struct Struct definition
+// CHECK: | |-FieldDecl {{.*}} A 'int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 5
+// CHECK: | |-FieldDecl {{.*}} B 'int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 7
+// CHECK: | |-FieldDecl {{.*}} C 'unsigned int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
+// CHECK: | |-FieldDecl {{.*}} D 'unsigned int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 15
+// CHECK: | |-FieldDecl {{.*}} E 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 1
+// CHECK: | |-FieldDecl {{.*}} F 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 2
+// CHECK: | |-FieldDecl {{.*}} G 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
+// CHECK: | `-FieldDecl {{.*}} H 'char'
+// CHECK: |   `-IntegerLiteral {{.*}} 'int' 3

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp?rev=346511&r1=346510&r2=346511&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp Fri 
Nov  9 08:29:19 2018
@@ -123,17 +123,33 @@ Error UdtRecordCompleter::visitKnownMemb
 Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
DataMemberRecord &data_member) {
 
-  TypeSP member_type = m_symbol_file.GetOrCreateType(data_member.Type);
-  CompilerType complete_member_type = member_type->GetFullCompilerType();
+  uint64_t offset = data_member.FieldOffset * 8;
+  uint32_t bitfield_width = 0;
+
+  TypeSP member_type;
+  TpiStream &tpi = m_symbol_file.m_index->tpi();
+  TypeIndex ti(data_member.Type);
+  if (!ti.isSimple()) {
+CVType cvt = tpi.getType(ti);
+if (cvt.kind() == LF_BITFIELD) {
+  BitFieldRecord bfr;
+  llvm::cantFail(TypeDeserializer::deserializeAs(cvt, 
bfr));
+  offset += bfr.BitOffset;
+  bitfield_width = bfr.BitSize;
+  ti = bfr.Type;
+}
+  }
 
+  member_type = 

[Lldb-commits] [lldb] r346517 - [NativePDB] Fix completion of enum types.

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 09:08:26 2018
New Revision: 346517

URL: http://llvm.org/viewvc/llvm-project?rev=346517&view=rev
Log:
[NativePDB] Fix completion of enum types.

This was originally submitted in a patch which fixed two unrelated
bugs at the same time.  This portion of the fix was reverted because
it broke several other things.  However, the fix employed originally
was totally wrong, and attempted to change something in the ValueObject
printer when actually the bug was in the NativePDB plugin.  We need
to mark forward enum decls as having external storage, otherwise
we won't be asked to complete them when the time comes.  This patch
implements the proper fix, and updates tests accordingly.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346517&r1=346516&r2=346517&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov  9 
09:08:26 2018
@@ -89,7 +89,7 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
+// CHECK: (TrivialE) TE = TE_A
 // CHECK: (A::B::C) ABCInt = (ABCMember = 0)
 // CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
 // CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
@@ -105,6 +105,7 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'TrivialE'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=346517&r1=346516&r2=346517&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Fri 
Nov  9 09:08:26 2018
@@ -913,6 +913,7 @@ lldb::TypeSP SymbolFileNativePDB::Create
   underlying_type->GetFullCompilerType(), er.isScoped());
 
   ClangASTContext::StartTagDeclarationDefinition(enum_ct);
+  ClangASTContext::SetHasExternalStorage(enum_ct.GetOpaqueQualType(), true);
 
   // We're just going to forward resolve this for now.  We'll complete
   // it only if the user requests.


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


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-09 Thread Zachary Turner via lldb-commits
The problem was actually in the native pdb plugin.  I forgot to call
ClangASTContext::SetHasExternalStorage with true on the enum decls when i
created it, so it wasn't getting completed.  I submitted a fix in r346517.

On Thu, Nov 8, 2018 at 2:00 PM Greg Clayton  wrote:

> Another way to think about this is if you have a SBValue that represents a
> class instances in an IDE, if no one turns it open to see the children, why
> do we need to complete the type? We should have to. The type should be able
> to complete itself if and when we need to know some information. This
> already works fine for classes, we just need to make it work for enums.
> Just complete the type before we need access to the enumerators. For a
> SBValue that contains a enum type:
>
> SBValue var = frame.FindVariable("myEnumVar");
>
> If I call:
>
> SBType var_type = var.GetType();
>
> "var_type" doesn't need be completed yet. Even:
>
> const char *n = var_type.GetName();
>
> Doesn't require a full type. Now for getting the value:
>
> const char *value = var.GetValue();
>
> We don't need to complete a class type as the class has no value. If this
> is a pointer to anything (enum, class, struct, union) we don't need to
> complete the type to show the pointer value. For an enum we do need it. But
> the type should complete itself in the code that knows it needs to full
> type.
>
> Asking the type about itself might also cause the type to complete itself:
>
> auto num_fields = var_type.GetNumFields();
>
> Would cause a class type to complete itself probably down in the
> TypeSystem class (ClangASTContext).
>
> So after thinking about this some more, the proposed fix you had was not
> the right one. We just need to fix the ClangASTContext to complete the type
> before it tries to use it.
>
> Question: did you use the clang external AST source like the DWARF plug-in
> stuff did to complete the types?
>
> On Nov 8, 2018, at 1:40 PM, Greg Clayton  wrote:
>
> Looks like this test was testing the functionality that you changed. It it
> expecting that a type won't be complete until you ask for more info about
> it (like asking about a child). Since PDB is not completing the type up
> front, we need to change LLDB or make your previous case work even when
> handing out a forward type.
>
> So the question is: do we expect types to be able to complete themselves
> on the fly anywhere? I believe we should be able to hand out a type as a
> forward declaration and have it complete itself at any point when it is
> needed. I know classes already do this when they need to know more. Maybe
> the AST doesn't treat enums like classes where it will complete the type
> through the external AST class.
>
> The correct fix is to probably call
>
> bool CompilerType::GetCompleteType() const;
>
> Before you need to access the enumerators in an enumeration.
>
>
>
> On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
> +greg.
>
> Greg, is the test wrong here or the patch?  If it’s the test let’s just
> fix the test, otherwise we can revert the patch until we figure it out.
>
> It seems related to my change to use the layout type instead of the
> forward type.
>
> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
> wrote:
>
>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner 
>> wrote:
>> >
>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
>> failure?
>>
>>
>> FAIL: test_with_run_command_gmodules
>> (TestTypeCompletion.TypeCompletionTestCase)
>>
>>Check that types only get completed when necessary.
>> --
>> Traceback (most recent call last):
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>> line 1744, in test_method
>> return attrvalue(self)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>> line 113, in wrapper
>> func(*args, **kwargs)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>> line 55, in test_with_run_command 'vector complete but it should
>> not be')
>> AssertionError: True is not False : vector complete but it should not
>> be
>>
>>
>> Do you want me to revert this in the meanwhile?
>>
>> --Davide
>>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54357: [NativePDB] Improved support for nested type reconstruction

2018-11-12 Thread Zachary Turner via lldb-commits
On Mon, Nov 12, 2018 at 6:51 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov added a comment.
>
> This change looks reasonable to me for solving the problem with the
> current `LF_NESTTYPE` approach. But I'm not sure... Now we all the same
> need to analyze mangled names and make a decision based on this. Does the
> current `LF_NESTTYPE` approach still has advantages over the "parse-scope"
> approach? I'm afraid that we will have to fully analyze a mangled name in
> the future for scoped types, so if the `LF_NESTTYPE` approach doesn't have
> a significant advantages over the "parse-scope" approach, do we really need
> to support them both?

I think we need to support both.  Certain pieces of information are not
represented in the mangling at all, so if we rely purely on the mangling we
will never be able to perfectly reconstruct the DeclContext hierarchy.  So
I think each approach by itself would be imperfect, but combined it will be
very good.



>
>
>
> 
> Comment at:
> lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:560-576
> +  // If it's an inner definition, then treat whatever name we have here
> as a
> +  // single component of a mangled name.  So we can inject it into the
> parent's
> +  // mangled name to see if it matches.
> +  CVTagRecord child = CVTagRecord::create(tpi.getType(Record.Type));
> +  std::string qname = parent.asTag().getUniqueName();
> +  if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4)
> +return llvm::None;
> 
> May be it would be a good idea to make the demangler (or to implement a
> mangler) more flexible to hide these details there? I do not mean to do it
> exactly in this commit, but what do you think about this at all?
>
>
> 
> Comment at:
> lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:881-887
> +// If there is no parent in the debug info, but some of the scopes
> have
> +// template params, then this is a case of bad debug info.  See, for
> +// example, llvm.org/pr39607.  We don't want to create an ambiguity
> between
> +// a NamespaceDecl and a CXXRecordDecl, so instead we create a class
> at
> +// global scope with the fully qualified name.
> +if (AnyScopesHaveTemplateParams(scopes))
> +  return {context, record.Name};
> 
> Is this a clang only bug, or MSVC also does so? I do not have anything
> against this solution for now, I just mean, may be we'll replace it with an
> `assert` when the bug will be fixed?


Clang only.  But I don’t think we can ever replace it with an assert, debug
info is basically user input, so we have to be able to handle every manner
of malformed input.  In fact, when this bug is fixed in clang, i will
probably try to keep a test case around that manually generates the bad
debug info using llvm-mc or something, just to make sure it will not
break.  Because, for example, someone could be debugging a program that was
built with the buggy compiler version.

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


Re: [Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.

2018-11-12 Thread Zachary Turner via lldb-commits
I know when I stepped through it with the Pi example, it was returning all
matches, but not filtering down the results based on the template parameter
first, so you’d get back every instantiation but the template parameter
would be treated as a subexpression.

I think the SymbolFile plugin should just get the whole string though and
do this filtering itself. Might be hard for complicated template arguments.
But if it’s too hard the plugin can always just give up and do what it
currently does.

For PDB it’s the other way around, without this information lookup is
actually impossible, because you have to hash the record name, and the
template parameters are part of the hash
On Mon, Nov 12, 2018 at 6:34 PM Greg Clayton via Phabricator <
revi...@reviews.llvm.org> wrote:

> clayborg added a comment.
>
> In https://reviews.llvm.org/D54454#1296392, @zturner wrote:
>
> > BTW, I will have to see if it's possible to write a test for this.  Even
> when I compiled and built a program with DWARF on Linux, the `target
> variable Pi` example didn't "just work" for me, because
> `FindGlobalVariables` wasn't returning the variable.  So I think this part
> actually needs to be fixed in the DWARF plugin, which I'm not equipped to
> fix.  I can try something that is not a variable template, such as the
> `Foo::StaticMember` example, but if that also doesn't work, then there
> might not be a good way to write a general purpose test for this until this
> is fixed in the DWARF plugin.
> >
> > I can definitely add a test in the native pdb plugin though, and
> technically that runs everywhere (although it would only test `target
> variable` and not `frame variable`, maybe that's ok though?).
>
>
> It is the template stuff that throws things off. Can't remember if there
> is an accelerator table entry for those. Global variables in general work.
> It would be good to figure out what this doesn't work for DWARF. I will
> take a look.
>
>
> https://reviews.llvm.org/D54454
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346787 - [NativePDB] Add support for S_CONSTANT records.

2018-11-13 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Nov 13 12:07:57 2018
New Revision: 346787

URL: http://llvm.org/viewvc/llvm-project?rev=346787&view=rev
Log:
[NativePDB] Add support for S_CONSTANT records.

clang-cl does not emit these, but MSVC does, so we need to be able to
handle them.

Because clang-cl does not generate them, it was a bit hard to write a
test. So what I had to do was get an PDB file with some S_CONSTANT
records in using cl and link, dump it using llvm-pdbutil dump -globals
-sym-data to get the bytes of the records, generate the same object file
using clang-cl but with -S to emit an assembly file, and replace all the
S_LDATA32 records with the bytes of the S_CONSTANT records. This way, we
can compile the file using llvm-mc and link it with lld-link.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.s
lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit?rev=346787&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit Tue Nov 13 
12:07:57 2018
@@ -0,0 +1,25 @@
+target variable GlobalLUEA
+target variable GlobalLUEB
+target variable GlobalLUEC
+
+target variable GlobalLSEA
+target variable GlobalLSEB
+target variable GlobalLSEC
+
+target variable GlobalUEA
+target variable GlobalUEB
+target variable GlobalUEC
+
+target variable GlobalSEA
+target variable GlobalSEB
+target variable GlobalSEC
+
+target variable GlobalSUEA
+target variable GlobalSUEB
+target variable GlobalSUEC
+
+target variable GlobalSSEA
+target variable GlobalSSEB
+target variable GlobalSSEC
+
+quit

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.s?rev=346787&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.s (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/s_constant.s Tue Nov 13 12:07:57 
2018
@@ -0,0 +1,971 @@
+   .text
+   .def @feat.00;
+   .scl3;
+   .type   0;
+   .endef
+   .globl  @feat.00
+.set @feat.00, 0
+   .intel_syntax noprefix
+   .def main;
+   .scl2;
+   .type   32;
+   .endef
+   .globl  main# -- Begin function main
+   .p2align4, 0x90
+main:   # @main
+.Lfunc_begin0:
+   .cv_func_id 0
+   .cv_file1 
"D:\\src\\llvm-mono\\lldb\\lit\\SymbolFile\\NativePDB\\s_constant.cpp" 
"7F1DA683A9B72A1360C1FDEDD7550E06" 1
+   .cv_loc 0 1 79 0# 
D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp:79:0
+.seh_proc main
+# %bb.0:# %entry
+   sub rsp, 24
+   .seh_stackalloc 24
+   .seh_endprologue
+   xor eax, eax
+   mov dword ptr [rsp + 20], 0
+   mov qword ptr [rsp + 8], rdx
+   mov dword ptr [rsp + 4], ecx
+.Ltmp0:
+   .cv_loc 0 1 80 0# 
D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp:80:0
+   add rsp, 24
+   ret
+.Ltmp1:
+.Lfunc_end0:
+   .seh_handlerdata
+   .text
+   .seh_endproc
+# -- End function
+   .section.rdata,"dr"
+   .p2align3   # @GlobalLUEA
+GlobalLUEA:
+   .quad   0   # 0x0
+
+   .p2align3   # @GlobalLUEB
+GlobalLUEB:
+   .quad   1000# 0x3e8
+
+   .p2align3   # @GlobalLUEC
+GlobalLUEC:
+   .quad   -16 # 0xfff0
+
+   .p2align3   # @GlobalLSEA
+GlobalLSEA:
+   .quad   0   # 0x0
+
+   .p2align3   # @GlobalLSEB
+GlobalLSEB:
+   .quad   9223372036854775000 # 0x7cd8
+
+   .p2align3   # @GlobalLSEC
+GlobalLSEC:
+   .quad   -9223372036854775000# 0x8328
+
+   .p2align2   # @GlobalUEA
+GlobalUEA:
+   .long   0   # 0x0
+
+   .p2align2   # @GlobalUEB
+GlobalUEB:
+   .long   1000# 0x3e8
+
+   .p2align2   # @GlobalUEC
+GlobalUEC:
+   .long   429400  # 0

[Lldb-commits] [lldb] r346786 - [NativePDB] Improved support for nested type reconstruction.

2018-11-13 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Nov 13 12:07:32 2018
New Revision: 346786

URL: http://llvm.org/viewvc/llvm-project?rev=346786&view=rev
Log:
[NativePDB] Improved support for nested type reconstruction.

In a previous patch, we pre-processed the TPI stream in order to build
the reverse mapping from nested type -> parent type so that we could
accurately reconstruct a DeclContext hierarchy.

However, there were some issues. An LF_NESTTYPE record is really just a
typedef, so although it happens to be used to indicate the name of the
nested type and referring to the global record which defines the type,
it is also used for every other kind of nested typedef. When we rebuild
the DeclContext hierarchy, we want it to be as accurate as possible,
which means that if we have something like:

  struct A {
struct B {};
using C = B;
  };

We don't want to create two CXXRecordDecls in the AST each with the
exact same definition. We just want to create one for B and then
define C as an alias to B. Previously, however, it would not be able
to distinguish between the two cases and it would treat A::B and
A::C as being two classes each with separate definitions. We address
the first half of improving the pre-processing logic so that only
actual definitions are treated this way.

Later, in a followup patch, we can handle the case of nested
typedefs since we're already going to be enumerating the field list
anyway and this patch introduces the general framework for
distinguishing between the two cases.

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

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit?rev=346786&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit Tue Nov 13 
12:07:32 2018
@@ -0,0 +1,12 @@
+settings set auto-one-line-summaries false
+
+target variable -T GlobalA
+target variable -T GlobalB
+target variable -T GlobalC
+target variable -T GlobalD
+target variable -T GlobalE
+target variable -T GlobalF
+target variable -T GlobalG
+target variable -T GlobalH
+
+target modules dump ast

Added: lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp?rev=346786&view=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp Tue Nov 13 12:07:32 
2018
@@ -0,0 +1,139 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// RUN: clang-cl /Z7 /GS- /GR- -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/nested-types.lldbinit 2>&1 | FileCheck %s
+
+struct S {
+  struct NestedStruct {
+int A = 0;
+int B = 1;
+  };
+  int C = 2;
+  int D = 3;
+};
+struct T {
+  using NestedTypedef = int;
+  using NestedTypedef2 = S;
+
+  struct NestedStruct {
+int E = 4;
+int F = 5;
+  };
+
+  using NestedStructAlias = NestedStruct;
+  using NST = S::NestedStruct;
+
+  NestedTypedef NT = 4;
+
+  using U = struct {
+int G = 6;
+int H = 7;
+  };
+};
+
+template
+class U {
+public:
+  // See llvm.org/pr39607.  clang-cl currently doesn't emit an important debug
+  // info record for nested template instantiations, so we can't reconstruct
+  // a proper DeclContext hierarchy for these.  As such, U::V will show 
up
+  // in the global namespace.
+  template
+  struct V {
+Param I = 8;
+Param J = 9;
+
+using W = T::NestedTypedef;
+using X = U;
+  };
+
+  struct W {
+Param M = 12;
+Param N = 13;
+  };
+  Param K = 10;
+  Param L = 11;
+  using Y = V;
+  using Z = V;
+};
+
+constexpr S GlobalA;
+constexpr S::NestedStruct GlobalB;
+constexpr T GlobalC;
+constexpr T::NestedStruct GlobalD;
+constexpr T::U GlobalE;
+constexpr U GlobalF;
+constexpr U::V GlobalG;
+constexpr U::W GlobalH;
+
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+
+
+// CHECK: (lldb) target variable -T GlobalA
+// CHECK: (const S) GlobalA = {
+// CHECK:   (int) C = 2
+// CHECK:   (int) D = 3
+// CHECK: }
+// CHECK: (lldb) target variable -T GlobalB
+// CHECK: (const S::NestedStruct) GlobalB = {
+// CHECK:   (int) A = 0
+// CHECK:   (int) B = 1
+// CHECK: }
+// CHECK: (lldb) target variable -T GlobalC
+// CHECK: (const T) GlobalC = {
+// CHECK:   (int) N

Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-13 Thread Zachary Turner via lldb-commits
I think it must be related to setting up the environment in which to run
clang.  In all other projects we call llvm_config.use_clang() which is in
llvm/utils/lit/lit/llvm/config.py, but because here we have an exact path
of a clang we are trying to use, we skip this function in LLDB's lit
configuration files.  But there is also a lot of other logic in that
function, so perhaps it's some of that logic that's necessary.

On Mon, Nov 12, 2018 at 9:02 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov added a comment.
>
> But all compiles without errors if I run this manually:
>
>   clang-cl -m32 /Z7 /c /GS-
> C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp /o
> C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-13 Thread Zachary Turner via lldb-commits
I believe that is correct, and perhaps part of the problem.  In other
projects we call llvm_config.use_clang(), and that actually explicitly
creates a substitution so that if someone writes "clang" they'll get an
error that says "use %clang instead".  Because we have the exact path, that
isn't happening here.  Perhaps the proper fix is to add a keyword argument
to llvm_config.use_clang() so that it can be called as
llvm_config.use_clang(path=p).  This way we can get the proper
substitutions created and we would find out about this.

I can play around with this some, but does it sound reasonable to you?  I'm
not sure how to hit all the edge cases because everything is already
working for me (for some reason), so it won't be obvious if I fix the
problem for those people for whom it's broken.

On Tue, Nov 13, 2018 at 3:16 PM Stella Stamenova 
wrote:

> I took a brief look and I have a question about the usage of clang (rather
> than clang-cl).
>
>
>
> In general I would agree that we have an exact path of clang (or gcc) that
> we are trying to use and they’re specified by using %cc and %cxx in the
> test files, but there are a number of test files that simply use clang e.g.:
>
>
>
> SymbolFile\DWARF\find-variable-dwo.cpp:3:// RUN: clang %s -g -gsplit-dwarf
> -c -emit-llvm -o - --target=x86_64-pc-linux -DONE
>
>
>
> In this case, are we not going to pick up whatever clang happens to be in
> the path instead of one that was explicitly specified? Is this intentional?
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* Zachary Turner 
> *Sent:* Tuesday, November 13, 2018 2:46 PM
> *To:* reviews+d54009+public+0e164460da8f1...@reviews.llvm.org
> *Cc:* Stella Stamenova ; pa...@labath.sk;
> chris.biene...@me.com; dccitali...@gmail.com;
> aleksandr.ura...@jetbrains.com; jdevliegh...@apple.com;
> abidh@gmail.com; teempe...@gmail.com; ki.s...@gmail.com;
> mgo...@gentoo.org; d...@su-root.co.uk; jfbast...@apple.com;
> lldb-commits@lists.llvm.org; l...@inglorion.net
> *Subject:* Re: [PATCH] D54009: Refactor LLDB lit configuration files
>
>
>
> I think it must be related to setting up the environment in which to run
> clang.  In all other projects we call llvm_config.use_clang() which is in
> llvm/utils/lit/lit/llvm/config.py, but because here we have an exact path
> of a clang we are trying to use, we skip this function in LLDB's lit
> configuration files.  But there is also a lot of other logic in that
> function, so perhaps it's some of that logic that's necessary.
>
>
>
> On Mon, Nov 12, 2018 at 9:02 AM Aleksandr Urakov via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> aleksandr.urakov added a comment.
>
> But all compiles without errors if I run this manually:
>
>   clang-cl -m32 /Z7 /c /GS-
> C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp /o
> C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54009
> 
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-13 Thread Zachary Turner via lldb-commits
On Tue, Nov 13, 2018 at 3:47 PM Stella Stamenova 
wrote:

> I am not sure if that’s the right solution for a couple of reasons:
>
>1. As far as I can tell only clang calls use_clang (and only lld calls
>use_lld), while the other projects such as lld and llvm rely on the
>environment to be setup correctly
>2. Lld also has tests that invoke clang-cl and they pass – while the
>ones in LLDB do not, so the invocation of use_clang is not necessary for
>the tests to pass (maybe?)
>3. LLDB allows us to specify whether to use gcc or clang as well as
>the path and it can also have a test compiler specified via
>LLDB_USE_TEST_*_COMPILER, so we should first decide what scenarios we want
>to support before trying to make this work and possibly making it even more
>confusing and complicated
>
>
>
> Do you know what the answer for 3) is? What compilers are valid to specify
> for the lit/suite/unittests via the various parameters?
>

For the unit tests, I don't think we ever specify a compiler, or we don't
ever read the value.  Because a unit test shouldn't be compiling anything,
it's a different kind of test.

For the dotest suite, specifying the compiler is important and it can
definitely be gcc, but I don't think this uses the same method of going
through config.cc.  In fact, I'm not sure how it determines what compiler
to use at the moment, as it's been a number of years since I've looked at
the dotest suite.

For the lit tests, I'm inclined to say we should keep things simple and
only support clang for now, and add support for new compilers such as gcc
if and when someone actually wants it.  Otherwise YAGNI.

Definitely that time will come, but it doesn't make sense to support it
immediately if nobody is using it today and nobody is planning to enable it
immediately.

So I'm tempted to say that perhaps we should just call
llvm_config.use_clang() and llvm_config.use_lld() and ignore
LLDB_TEST_COMPILER, which in my experience has only been a source of
unnecessary complexity that never actually gets used in practice.

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


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-13 Thread Zachary Turner via lldb-commits
Ok so for dotest, it seems to be ignoring the config.cc and config.cxx
entirely.  So we can theoretically do whatever we want with it, or change
around the directory structure so that it's more like:

lldb
* lit
* * Dotest
* * Unit
* * Tests

and put the config.cc / config.cxx logic under Tests.  That's a large
change though and probably not worth making such a large change right away.

dotest tests manually construct the command line directly in CMake via this
`LLDB_DOTEST_ARGS_PROPERTY` global property, and then in
lldb/lit/Suite/lit.cfg we have this line:

dotest_cmd = [config.dotest_path, '-q']
dotest_cmd.extend(config.dotest_args_str.split(';'))


So pretty much everythign the parent lit file has done is totally ignored.

With that in mind, **for the lit tests only** I propose dropping support
for non-clang compilers and ignoring LLDB_TEST_C_COMPILER and
LLDB_TEST_CXX_COMPILER (you can still have a custom path to clang
executable via an environment variable, which is consistent with how
clang's test suite works).

Note that when you run ninja check-lldb-lit you will now get messages that
tell you the exact path to the clang executable, so you can see what the
PATH resolution is doing.

On Tue, Nov 13, 2018 at 4:02 PM Zachary Turner  wrote:

> On Tue, Nov 13, 2018 at 3:47 PM Stella Stamenova 
> wrote:
>
>> I am not sure if that’s the right solution for a couple of reasons:
>>
>>1. As far as I can tell only clang calls use_clang (and only lld
>>calls use_lld), while the other projects such as lld and llvm rely on the
>>environment to be setup correctly
>>2. Lld also has tests that invoke clang-cl and they pass – while the
>>ones in LLDB do not, so the invocation of use_clang is not necessary for
>>the tests to pass (maybe?)
>>3. LLDB allows us to specify whether to use gcc or clang as well as
>>the path and it can also have a test compiler specified via
>>LLDB_USE_TEST_*_COMPILER, so we should first decide what scenarios we want
>>to support before trying to make this work and possibly making it even 
>> more
>>confusing and complicated
>>
>>
>>
>> Do you know what the answer for 3) is? What compilers are valid to
>> specify for the lit/suite/unittests via the various parameters?
>>
>
> For the unit tests, I don't think we ever specify a compiler, or we don't
> ever read the value.  Because a unit test shouldn't be compiling anything,
> it's a different kind of test.
>
> For the dotest suite, specifying the compiler is important and it can
> definitely be gcc, but I don't think this uses the same method of going
> through config.cc.  In fact, I'm not sure how it determines what compiler
> to use at the moment, as it's been a number of years since I've looked at
> the dotest suite.
>
> For the lit tests, I'm inclined to say we should keep things simple and
> only support clang for now, and add support for new compilers such as gcc
> if and when someone actually wants it.  Otherwise YAGNI.
>
> Definitely that time will come, but it doesn't make sense to support it
> immediately if nobody is using it today and nobody is planning to enable it
> immediately.
>
> So I'm tempted to say that perhaps we should just call
> llvm_config.use_clang() and llvm_config.use_lld() and ignore
> LLDB_TEST_COMPILER, which in my experience has only been a source of
> unnecessary complexity that never actually gets used in practice.
>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-13 Thread Zachary Turner via lldb-commits
use_clang() already will fall back on searching the environment variable
'CLANG' to find a path to it.

self.config.clang = self.use_llvm_tool(
'clang', search_env='CLANG', required=required)

But we could make this environment variable a parameter to use_clang() if
we wanted to.  As long as we can agree that we don't need to worry about
gcc -- at least for now -- then it should all simplify down quite a bit.
And AFAICT, there's nobody using gcc with the lit tests right now, so it
just adds unnecessary complexity.  And if and when we do have people using
it, there is even more work to be done.

If someone only wants a clang that isn't the just-built clang (for example
a release version to make sure the tests run faster), all they need to do
is set the environment variable 'CLANG' and it should be fine.

Since the lit suite is still very new and developing, I'm not too concerned
about regressing a feature (especially one with zero users), because the
important thing to me is that it's designed right so that the feature can
grow in organically and not be "forced" in with a subpar implementation.

On Tue, Nov 13, 2018 at 4:23 PM Stella Stamenova 
wrote:

> The plan for the lit tests sounds reasonable to me. I would also remove
> LLDB_TEST_C/CXX_COMPILER entirely so that we can reduce confusion since
> they’re only used for the lit tests, right?
>
>
>
> My only concern is that I’ve been told that there are people who will
> build lldb with a different compiler than the tests – so the properties for
> LLDB_TEST_C/CXX_COMPILER might actually be used especially in cases where
> clang is not built alongside lldb.
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* Zachary Turner 
> *Sent:* Tuesday, November 13, 2018 4:16 PM
>
>
> *To:* Stella Stamenova 
> *Cc:* reviews+d54009+public+0e164460da8f1...@reviews.llvm.org;
> pa...@labath.sk; chris.biene...@me.com; dccitali...@gmail.com;
> aleksandr.ura...@jetbrains.com; jdevliegh...@apple.com;
> abidh@gmail.com; teempe...@gmail.com; ki.s...@gmail.com;
> mgo...@gentoo.org; d...@su-root.co.uk; jfbast...@apple.com;
> lldb-commits@lists.llvm.org; l...@inglorion.net
> *Subject:* Re: [PATCH] D54009: Refactor LLDB lit configuration files
>
>
>
> Ok so for dotest, it seems to be ignoring the config.cc and config.cxx
> entirely.  So we can theoretically do whatever we want with it, or change
> around the directory structure so that it's more like:
>
>
>
> lldb
>
> * lit
>
> * * Dotest
>
> * * Unit
>
> * * Tests
>
>
>
> and put the config.cc / config.cxx logic under Tests.  That's a large
> change though and probably not worth making such a large change right away.
>
>
>
> dotest tests manually construct the command line directly in CMake via
> this `LLDB_DOTEST_ARGS_PROPERTY` global property, and then in
> lldb/lit/Suite/lit.cfg we have this line:
>
>
>
> dotest_cmd = [config.dotest_path, '-q']
>
> dotest_cmd.extend(config.dotest_args_str.split(';'))
>
>
>
>
>
> So pretty much everythign the parent lit file has done is totally
> ignored.
>
>
>
> With that in mind, **for the lit tests only** I propose dropping support
> for non-clang compilers and ignoring LLDB_TEST_C_COMPILER and
> LLDB_TEST_CXX_COMPILER (you can still have a custom path to clang
> executable via an environment variable, which is consistent with how
> clang's test suite works).
>
>
>
> Note that when you run ninja check-lldb-lit you will now get messages that
> tell you the exact path to the clang executable, so you can see what the
> PATH resolution is doing.
>
>
>
> On Tue, Nov 13, 2018 at 4:02 PM Zachary Turner  wrote:
>
> On Tue, Nov 13, 2018 at 3:47 PM Stella Stamenova 
> wrote:
>
> I am not sure if that’s the right solution for a couple of reasons:
>
>1. As far as I can tell only clang calls use_clang (and only lld calls
>use_lld), while the other projects such as lld and llvm rely on the
>environment to be setup correctly
>2. Lld also has tests that invoke clang-cl and they pass – while the
>ones in LLDB do not, so the invocation of use_clang is not necessary for
>the tests to pass (maybe?)
>3. LLDB allows us to specify whether to use gcc or clang as well as
>the path and it can also have a test compiler specified via
>LLDB_USE_TEST_*_COMPILER, so we should first decide what scenarios we want
>to support before trying to make this work and possibly making it even more
>confusing and complicated
>
>
>
> Do you know what the answer for 3) is? What compilers are valid to specify
> for the lit/suite/unittests via the various parameters?
>
>
>
> For the unit tests, I don't think we ever specify a compiler, or we don't
> ever read the value.  Because a unit test shouldn't be compiling anything,
> it's a different kind of test.
>
>
>
> For the dotest suite, specifying the compiler is important and it can
> definitely be gcc, but I don't think this uses the same method of going
> through config.cc.  In fact, I'm not sure how it determines what compiler
>

Re: [Lldb-commits] [lldb] r346783 - [Cocoa] Implement formatter for the new NSDate representation.

2018-11-14 Thread Zachary Turner via lldb-commits
On Tue, Nov 13, 2018 at 11:46 AM Davide Italiano via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: davide
> Date: Tue Nov 13 11:43:43 2018
> New Revision: 346783
>
> URL: http://llvm.org/viewvc/llvm-project?rev=346783&view=rev
> Log:
> [Cocoa] Implement formatter for the new NSDate representation.
>
> 
>
> Modified:
> lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
>
> Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=346783&r1=346782&r2=346783&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
> +++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Nov 13 11:43:43
> 2018
> @@ -742,6 +742,60 @@ bool lldb_private::formatters::NSURLSumm
>return false;
>  }
>
> +/// Bias value for tagged pointer exponents.
> +/// Recommended values:
> +/// 0x3e3: encodes all dates between distantPast and distantFuture
> +///   except for the range within about 1e-28 second of the reference
> date.
> +/// 0x3ef: encodes all dates for a few million years beyond distantPast
> and
> +///   distantFuture, except within about 1e-25 second of the reference
> date.
> +const int TAGGED_DATE_EXPONENT_BIAS = 0x3ef;
> +
> +typedef union {
> +  struct {
> +uint64_t fraction:52;  // unsigned
> +uint64_t exponent:11;  // signed
> +uint64_t sign:1;
> +  };
> +  uint64_t i;
> +  double d;
> +} DoubleBits;
> +typedef union {
> +  struct {
> +uint64_t fraction:52;  // unsigned
> +uint64_t exponent:7;   // signed
> +uint64_t sign:1;
> +uint64_t unused:4;  // placeholder for pointer tag bits
> +  };
>
MSVC gives:

warning C4201: nonstandard extension used: nameless struct/union


> +  uint64_t i;
> +} TaggedDoubleBits;
> +
> +static uint64_t decodeExponent(uint64_t exp) {
> +  int64_t exp7 = exp;
> +  // Tagged exponent field is 7-bit signed. Sign-extend the value to 64
> bits
> +  // before performing arithmetic.
> +  int64_t exp11 = ((exp7 << 57) >> 57) + TAGGED_DATE_EXPONENT_BIAS;
> +  return exp11;
> +}
>
this should probably be:

return llvm::SignExtend64<7>(exp) + TAGGED_DATE_EXPONENT_BIAS;


> +
> +static uint64_t decodeTaggedTimeInterval(uint64_t encodedTimeInterval) {
> +  if (encodedTimeInterval == 0)
> +return 0.0;
> +  if (encodedTimeInterval == std::numeric_limits::max())
> +return -0.0;
> +
> +  TaggedDoubleBits encodedBits = { .i = encodedTimeInterval };
>
Designated initializers are C++20 which are not allowed in LLVM.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346783 - [Cocoa] Implement formatter for the new NSDate representation.

2018-11-14 Thread Zachary Turner via lldb-commits
On Tue, Nov 13, 2018 at 11:46 AM Davide Italiano via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: davide
> Date: Tue Nov 13 11:43:43 2018
> New Revision: 346783
>
> URL: http://llvm.org/viewvc/llvm-project?rev=346783&view=rev
> Log:
> [Cocoa] Implement formatter for the new NSDate representation.
>
> 
>
> Modified:
> lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
>
> Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=346783&r1=346782&r2=346783&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
> +++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Nov 13 11:43:43
> 2018
> @@ -742,6 +742,60 @@ bool lldb_private::formatters::NSURLSumm
>return false;
>  }
>
> +/// Bias value for tagged pointer exponents.
> +/// Recommended values:
> +/// 0x3e3: encodes all dates between distantPast and distantFuture
> +///   except for the range within about 1e-28 second of the reference
> date.
> +/// 0x3ef: encodes all dates for a few million years beyond distantPast
> and
> +///   distantFuture, except within about 1e-25 second of the reference
> date.
> +const int TAGGED_DATE_EXPONENT_BIAS = 0x3ef;
> +
> +typedef union {
> +  struct {
> +uint64_t fraction:52;  // unsigned
> +uint64_t exponent:11;  // signed
> +uint64_t sign:1;
> +  };
> +  uint64_t i;
> +  double d;
> +} DoubleBits;
> +typedef union {
> +  struct {
> +uint64_t fraction:52;  // unsigned
> +uint64_t exponent:7;   // signed
> +uint64_t sign:1;
> +uint64_t unused:4;  // placeholder for pointer tag bits
> +  };
> +  uint64_t i;
> +} TaggedDoubleBits;
> +
> +static uint64_t decodeExponent(uint64_t exp) {
> +  int64_t exp7 = exp;
> +  // Tagged exponent field is 7-bit signed. Sign-extend the value to 64
> bits
> +  // before performing arithmetic.
> +  int64_t exp11 = ((exp7 << 57) >> 57) + TAGGED_DATE_EXPONENT_BIAS;
> +  return exp11;
> +}
> +
> +static uint64_t decodeTaggedTimeInterval(uint64_t encodedTimeInterval) {
> +  if (encodedTimeInterval == 0)
> +return 0.0;
> +  if (encodedTimeInterval == std::numeric_limits::max())
> +return -0.0;
> +
> +  TaggedDoubleBits encodedBits = { .i = encodedTimeInterval };
> +  DoubleBits decodedBits;
> +
> +  // Sign and fraction are represented exactly.
> +  // Exponent is encoded.
> +  assert(encodedBits.unused == 0);
> +  decodedBits.sign = encodedBits.sign;
> +  decodedBits.fraction = encodedBits.fraction;
> +  decodedBits.exponent = decodeExponent(encodedBits.exponent);
> +
> +  return decodedBits.d;
>
This is undefined behavior since it's type punning through a union.
Normally this is harmless and all compilers actually do what you would
expect them to do.  In this case, however, it isn't because bitfield layout
is implementation defined so not every compiler will lay the bitfield out
in the way you expect.  So if you want this to be correct you have to
explicitly construct the bits of the double using bitshifts, going through
a union will fail on some implementations.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346873 - Fix some compilation failures introduced in recent patches.

2018-11-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Nov 14 09:22:09 2018
New Revision: 346873

URL: http://llvm.org/viewvc/llvm-project?rev=346873&view=rev
Log:
Fix some compilation failures introduced in recent patches.

This fixes two compilation failures:

  1) Designated initializers are C++20.  We can't use them in LLVM.
  2) thread_result_t is not a pointer type on all platforms, so
 returning nullptr is an error.

Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

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

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=346873&r1=346872&r2=346873&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Wed Nov 14 09:22:09 2018
@@ -783,7 +783,8 @@ static uint64_t decodeTaggedTimeInterval
   if (encodedTimeInterval == std::numeric_limits::max())
 return (uint64_t)-0.0;
 
-  TaggedDoubleBits encodedBits = { .i = encodedTimeInterval };
+  TaggedDoubleBits encodedBits = {};
+  encodedBits.i = encodedTimeInterval;
   DoubleBits decodedBits;
 
   // Sign and fraction are represented exactly.

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp?rev=346873&r1=346872&r2=346873&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
 Wed Nov 14 09:22:09 2018
@@ -190,15 +190,15 @@ thread_result_t GDBRemoteCommunicationRe
 case eBroadcastBitAsyncContinue:
   ReceivePacket(*server, done);
   if (done)
-return nullptr;
+return {};
   break;
 case eBroadcastBitAsyncThreadShouldExit:
 default:
-  return nullptr;
+  return {};
 }
   }
 }
   }
 
-  return nullptr;
+  return {};
 }


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


Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files

2018-11-14 Thread Zachary Turner via lldb-commits
I think I have a pretty good handle on what the problems are.  I'm honestly
surprised the lit test suite ever worked, even before my patch that "broke"
it.  We were basically just picking up whatever the system PATH was and
just going with it, so a lot of the substitutions weren't actually
substitutions at all, they were just random executables found on path.
That's totally not how this is supposed to work at all.

The idea is to set up a hermetic environment where we we create
substitutions for everything we care about, those resolve to things in the
build tree (with suitable hooks for overriding the search path where that's
desired), and we actually delete the system path entirely so that it's
impossible to find anything on PATH.

So I'm currently working through getting all this working the way it's
supposed to, hopefully I can have something by tomorrow.

On Wed, Nov 14, 2018 at 9:21 AM Stella Stamenova 
wrote:

> Simplifying (and making things more robust in the process) sounds great to
> me. I think the current iteration of how parameters are passed to the tests
> is quite complicated and unclear, so this will be a step in the right
> direction and if there’s a need for gcc later, we can take the time to
> design the feature properly so that it works across the lit tests and the
> test suite both.
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* Zachary Turner 
> *Sent:* Tuesday, November 13, 2018 4:30 PM
>
>
> *To:* Stella Stamenova 
> *Cc:* reviews+d54009+public+0e164460da8f1...@reviews.llvm.org;
> pa...@labath.sk; chris.biene...@me.com; dccitali...@gmail.com;
> aleksandr.ura...@jetbrains.com; jdevliegh...@apple.com;
> abidh@gmail.com; teempe...@gmail.com; ki.s...@gmail.com;
> mgo...@gentoo.org; d...@su-root.co.uk; jfbast...@apple.com;
> lldb-commits@lists.llvm.org; l...@inglorion.net
> *Subject:* Re: [PATCH] D54009: Refactor LLDB lit configuration files
>
>
>
> use_clang() already will fall back on searching the environment variable
> 'CLANG' to find a path to it.
>
>
>
> self.config.clang = self.use_llvm_tool(
>
> 'clang', search_env='CLANG', required=required)
>
>
>
> But we could make this environment variable a parameter to use_clang() if
> we wanted to.  As long as we can agree that we don't need to worry about
> gcc -- at least for now -- then it should all simplify down quite a bit.
> And AFAICT, there's nobody using gcc with the lit tests right now, so it
> just adds unnecessary complexity.  And if and when we do have people using
> it, there is even more work to be done.
>
>
>
> If someone only wants a clang that isn't the just-built clang (for example
> a release version to make sure the tests run faster), all they need to do
> is set the environment variable 'CLANG' and it should be fine.
>
>
>
> Since the lit suite is still very new and developing, I'm not too
> concerned about regressing a feature (especially one with zero users),
> because the important thing to me is that it's designed right so that the
> feature can grow in organically and not be "forced" in with a subpar
> implementation.
>
>
>
> On Tue, Nov 13, 2018 at 4:23 PM Stella Stamenova 
> wrote:
>
> The plan for the lit tests sounds reasonable to me. I would also remove
> LLDB_TEST_C/CXX_COMPILER entirely so that we can reduce confusion since
> they’re only used for the lit tests, right?
>
>
>
> My only concern is that I’ve been told that there are people who will
> build lldb with a different compiler than the tests – so the properties for
> LLDB_TEST_C/CXX_COMPILER might actually be used especially in cases where
> clang is not built alongside lldb.
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* Zachary Turner 
> *Sent:* Tuesday, November 13, 2018 4:16 PM
>
>
> *To:* Stella Stamenova 
> *Cc:* reviews+d54009+public+0e164460da8f1...@reviews.llvm.org;
> pa...@labath.sk; chris.biene...@me.com; dccitali...@gmail.com;
> aleksandr.ura...@jetbrains.com; jdevliegh...@apple.com;
> abidh@gmail.com; teempe...@gmail.com; ki.s...@gmail.com;
> mgo...@gentoo.org; d...@su-root.co.uk; jfbast...@apple.com;
> lldb-commits@lists.llvm.org; l...@inglorion.net
> *Subject:* Re: [PATCH] D54009: Refactor LLDB lit configuration files
>
>
>
> Ok so for dotest, it seems to be ignoring the config.cc and config.cxx
> entirely.  So we can theoretically do whatever we want with it, or change
> around the directory structure so that it's more like:
>
>
>
> lldb
>
> * lit
>
> * * Dotest
>
> * * Unit
>
> * * Tests
>
>
>
> and put the config.cc / config.cxx logic under Tests.  That's a large
> change though and probably not worth making such a large change right away.
>
>
>
> dotest tests manually construct the command line directly in CMake via
> this `LLDB_DOTEST_ARGS_PROPERTY` global property, and then in
> lldb/lit/Suite/lit.cfg we have this line:
>
>
>
> dotest_cmd = [config.dotest_path, '-q']
>
> dotest_cmd.extend(config.dotest_args_str.split(';'))
>
>
>
>
>
> So pretty much everythign the parent lit file has done is totally
> igno

[Lldb-commits] [lldb] r346932 - Fix a use-after-free of the ABI plugin.

2018-11-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Nov 14 21:06:59 2018
New Revision: 346932

URL: http://llvm.org/viewvc/llvm-project?rev=346932&view=rev
Log:
Fix a use-after-free of the ABI plugin.

This was introduced in r346775.  Previously the ABI shared_ptr
was declared as a function local static meaning it would live
forever.  After the change, someone has to create a strong
reference to it or it will go away.  In this code, we were
calling ABI::FindPlugin(...).get(), so it was being immediately
destroyed and we were holding onto a dangling pointer.

Modified:
lldb/trunk/source/Symbol/Variable.cpp

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=346932&r1=346931&r2=346932&view=diff
==
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Wed Nov 14 21:06:59 2018
@@ -156,14 +156,14 @@ void Variable::Dump(Stream *s, bool show
 .GetBaseAddress()
 .GetFileAddress();
 }
-ABI *abi = nullptr;
+ABISP abi;
 if (m_owner_scope) {
   ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
   if (module_sp)
-abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get();
+abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture());
 }
 m_location.GetDescription(s, lldb::eDescriptionLevelBrief,
-  loclist_base_addr, abi);
+  loclist_base_addr, abi.get());
   }
 
   if (m_external)
@@ -458,11 +458,11 @@ bool Variable::DumpLocationForAddress(St
 SymbolContext sc;
 CalculateSymbolContext(&sc);
 if (sc.module_sp == address.GetModule()) {
-  ABI *abi = nullptr;
+  ABISP abi;
   if (m_owner_scope) {
 ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
 if (module_sp)
-  abi = ABI::FindPlugin(ProcessSP(), 
module_sp->GetArchitecture()).get();
+  abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture());
   }
 
   const addr_t file_addr = address.GetFileAddress();
@@ -474,11 +474,12 @@ bool Variable::DumpLocationForAddress(St
 return false;
   return m_location.DumpLocationForAddress(s, eDescriptionLevelBrief,
loclist_base_file_addr,
-   file_addr, abi);
+   file_addr, abi.get());
 }
   }
-  return m_location.DumpLocationForAddress(
-  s, eDescriptionLevelBrief, LLDB_INVALID_ADDRESS, file_addr, abi);
+  return m_location.DumpLocationForAddress(s, eDescriptionLevelBrief,
+   LLDB_INVALID_ADDRESS, file_addr,
+   abi.get());
 }
   }
   return false;


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


[Lldb-commits] [lldb] r346999 - Fix compilation failure in unit tests on Windows.

2018-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov 15 14:03:49 2018
New Revision: 346999

URL: http://llvm.org/viewvc/llvm-project?rev=346999&view=rev
Log:
Fix compilation failure in unit tests on Windows.

Modified:
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp

Modified: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp?rev=346999&r1=346998&r2=346999&view=diff
==
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp (original)
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp Thu Nov 15 
14:03:49 2018
@@ -9,6 +9,11 @@
 
 #include "GDBRemoteTestUtils.h"
 
+#if defined(_MSC_VER)
+#include "lldb/Host/windows/windows.h"
+#include 
+#endif
+
 namespace lldb_private {
 namespace process_gdb_remote {
 


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


[Lldb-commits] [lldb] r347018 - [NativePDB] Rewrite the PdbSymUid to use our own custom namespacing scheme.

2018-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov 15 18:42:32 2018
New Revision: 347018

URL: http://llvm.org/viewvc/llvm-project?rev=347018&view=rev
Log:
[NativePDB] Rewrite the PdbSymUid to use our own custom namespacing scheme.

Originally we created our 64-bit UID scheme by using the first byte as
sort of a "tag" to represent what kind of symbol this was, and we
re-used the PDB_SymType enumeration for this.  For native pdb support,
this is not really the right abstraction layer, because what we really
want is something that tells us *how* to find the symbol.  This means,
specifically, is in the globals stream / public stream / module stream /
TPI stream / etc, and for whichever one it is in, where is it within
that stream?

A good example of why the old namespacing scheme was insufficient is
that it is more or less impossible to create a uid for a field list
member of a class/struction/union/enum that tells you how to locate
the original record.

With this new scheme, the first byte is no longer a PDB_SymType enum
but a new enum created specifically to identify where in the PDB
this record lives.  This gives us much better flexibility in
what kinds of symbols the uids can identify.

Added:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt?rev=347018&r1=347017&r2=347018&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt Thu Nov 15 
18:42:32 2018
@@ -1,6 +1,7 @@
 add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
   CompileUnitIndex.cpp
   PdbIndex.cpp
+  PdbSymUid.cpp
   PdbUtil.cpp
   SymbolFileNativePDB.cpp
   UdtRecordCompleter.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp?rev=347018&r1=347017&r2=347018&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp Thu Nov 
15 18:42:32 2018
@@ -108,26 +108,19 @@ static void ParseExtendedInfo(PdbIndex &
 }
 
 CompilandIndexItem::CompilandIndexItem(
-PdbSymUid uid, llvm::pdb::ModuleDebugStreamRef debug_stream,
+PdbCompilandId id, llvm::pdb::ModuleDebugStreamRef debug_stream,
 llvm::pdb::DbiModuleDescriptor descriptor)
-: m_uid(uid), m_debug_stream(std::move(debug_stream)),
+: m_id(id), m_debug_stream(std::move(debug_stream)),
   m_module_descriptor(std::move(descriptor)) {}
 
 CompilandIndexItem &CompileUnitIndex::GetOrCreateCompiland(uint16_t modi) {
-  PdbSymUid uid = PdbSymUid::makeCompilandId(modi);
-  return GetOrCreateCompiland(uid);
-}
-
-CompilandIndexItem &
-CompileUnitIndex::GetOrCreateCompiland(PdbSymUid compiland_uid) {
-  auto result = m_comp_units.try_emplace(compiland_uid.toOpaqueId(), nullptr);
+  auto result = m_comp_units.try_emplace(modi, nullptr);
   if (!result.second)
 return *result.first->second;
 
   // Find the module list and load its debug information stream and cache it
   // since we need to use it for almost all interesting operations.
   const DbiModuleList &modules = m_index.dbi().modules();
-  uint16_t modi = compiland_uid.asCompiland().modi;
   llvm::pdb::DbiModuleDescriptor descriptor = 
modules.getModuleDescriptor(modi);
   uint16_t stream = descriptor.getModuleStreamIndex();
   std::unique_ptr stream_data =
@@ -139,7 +132,7 @@ CompileUnitIndex::GetOrCreateCompiland(P
   std::unique_ptr &cci = result.first->second;
 
   cci = llvm::make_unique(
-  compiland_uid, std::move(debug_stream), std::move(descriptor));
+  PdbCompilandId{modi}, std::move(debug_stream), std::move(descriptor));
   ParseExtendedInfo(m_index, *cci);
 
   cci->m_strings.initialize(debug_stream.getSubsectionsArray());
@@ -172,23 +16

[Lldb-commits] [lldb] r347020 - Don't use uniform initialization syntax.

2018-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov 15 19:16:27 2018
New Revision: 347020

URL: http://llvm.org/viewvc/llvm-project?rev=347020&view=rev
Log:
Don't use uniform initialization syntax.

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp?rev=347020&r1=347019&r2=347020&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp Thu Nov 15 
19:16:27 2018
@@ -134,7 +134,7 @@ void PdbIndex::BuildAddrToSymbolMap(Comp
 // We need to add 4 here to adjust for the codeview debug magic
 // at the beginning of the debug info stream.
 uint32_t sym_offset = iter.offset() + 4;
-PdbCompilandSymId cu_sym_id{modi, sym_offset};
+PdbCompilandSymId cu_sym_id(modi, sym_offset);
 
 // If the debug info is incorrect, we could have multiple symbols with the
 // same address.  So use try_emplace instead of insert, and the first one

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h?rev=347020&r1=347019&r2=347020&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h Thu Nov 15 
19:16:27 2018
@@ -43,6 +43,9 @@ struct PdbCompilandId {
 };
 
 struct PdbCompilandSymId {
+  PdbCompilandSymId() = default;
+  PdbCompilandSymId(uint16_t modi, uint32_t offset)
+  : modi(modi), offset(offset) {}
   // 0-based index of module in PDB
   uint16_t modi = 0;
 
@@ -53,6 +56,10 @@ struct PdbCompilandSymId {
 };
 
 struct PdbGlobalSymId {
+  PdbGlobalSymId() = default;
+  PdbGlobalSymId(uint32_t offset, bool is_public)
+  : offset(offset), is_public(is_public) {}
+
   // Offset of symbol's record in globals or publics stream.
   uint32_t offset = 0;
 
@@ -62,6 +69,10 @@ struct PdbGlobalSymId {
 };
 
 struct PdbTypeSymId {
+  PdbTypeSymId() = default;
+  PdbTypeSymId(llvm::codeview::TypeIndex index, bool is_ipi = false)
+  : index(index), is_ipi(is_ipi) {}
+
   // The index of the of the type in the TPI or IPI stream.
   llvm::codeview::TypeIndex index;
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=347020&r1=347019&r2=347020&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Thu 
Nov 15 19:16:27 2018
@@ -729,7 +729,7 @@ lldb::FunctionSP SymbolFileNativePDB::Cr
   Type *func_type = nullptr;
 
   // FIXME: Resolve types and mangled names.
-  PdbTypeSymId sig_id{TypeIndex::None(), false};
+  PdbTypeSymId sig_id(TypeIndex::None(), false);
   Mangled mangled(getSymbolName(sym_record));
   FunctionSP func_sp = std::make_shared(
   sc.comp_unit, toOpaqueUid(func_id), toOpaqueUid(sig_id), mangled,
@@ -830,7 +830,7 @@ lldb::TypeSP SymbolFileNativePDB::Create
 }
 
 lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti) {
-  uint64_t uid = toOpaqueUid(PdbTypeSymId{ti, false});
+  uint64_t uid = toOpaqueUid(PdbTypeSymId(ti, false));
   if (ti == TypeIndex::NullptrT()) {
 CompilerType ct = m_clang->GetBasicType(eBasicTypeNullPtr);
 Declaration decl;
@@ -1163,7 +1163,7 @@ TypeSP SymbolFileNativePDB::CreateAndCac
 if (!expected_full_ti)
   llvm::consumeError(expected_full_ti.takeError());
 else if (*expected_full_ti != type_id.index) {
-  full_decl_uid = PdbTypeSymId{*expected_full_ti, false};
+  full_decl_uid = PdbTypeSymId(*expected_full_ti, false);
 
   // It's possible that a lookup would occur for the full decl causing it
   // to be cached, then a second lookup would occur for the forward decl.
@@ -1197,7 +1197,6 @@ TypeSP SymbolFileNativePDB::CreateAndCac
 m_clang->GetAsTagDecl(result->GetForwardCompilerType());
 lldbassert(record_decl);
 
-TypeIndex ti(type_id.index);
 m_uid_to_decl[best_uid] = record_decl;
 m_decl_to_status[record_decl] =
 DeclStatus(best_uid, Type::eResolveStateForward);
@@ -1343,7 +1342,7 @@ VariableSP SymbolFileNativePDB::CreateGl
   }
 
   Declaration decl;
-  PdbTypeSymId tid{ti, false};
+  PdbTypeSymId tid(ti, false);
   SymbolFileTypeSP type_sp =
   std::make_shared(*this, toOpaqueUid(tid));

Re: [Lldb-commits] [lldb] r346783 - [Cocoa] Implement formatter for the new NSDate representation.

2018-11-16 Thread Zachary Turner via lldb-commits
Did this fix the bitfield problem too? I didn’t fix that one.
On Fri, Nov 16, 2018 at 11:56 AM Davide Italiano  wrote:

> I saw you partially fixed this.
>
> I addressed the remaining problem in:
> Davides-Mac-Pro:lldb davide$ git llvm push
> Pushing 1 commit:
>   b6fd30d9119 [Cocoa] Prefer llvm::SignExtend64. Pointed out by zturner.
> Sendinglldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
> Transmitting file data .done
> Committing transaction...
> Committed revision 347087.
> Committed b6fd30d9119 to svn.
>
>
> --
> Davide
> On Fri, Nov 16, 2018 at 10:09 AM Davide Italiano 
> wrote:
> >
> > Sorry Zach, I was sick for the past few days. I'll look into this one
> now.
> >
> > --
> > Davide
> > On Wed, Nov 14, 2018 at 9:16 AM Zachary Turner 
> wrote:
> > >
> > >
> > >
> > > On Tue, Nov 13, 2018 at 11:46 AM Davide Italiano via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> > >>
> > >> Author: davide
> > >> Date: Tue Nov 13 11:43:43 2018
> > >> New Revision: 346783
> > >>
> > >> URL: http://llvm.org/viewvc/llvm-project?rev=346783&view=rev
> > >> Log:
> > >> [Cocoa] Implement formatter for the new NSDate representation.
> > >>
> > >> 
> > >>
> > >> Modified:
> > >> lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
> > >>
> > >> Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
> > >> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=346783&r1=346782&r2=346783&view=diff
> > >>
> ==
> > >> --- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
> > >> +++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Nov 13
> 11:43:43 2018
> > >> @@ -742,6 +742,60 @@ bool lldb_private::formatters::NSURLSumm
> > >>return false;
> > >>  }
> > >>
> > >> +/// Bias value for tagged pointer exponents.
> > >> +/// Recommended values:
> > >> +/// 0x3e3: encodes all dates between distantPast and distantFuture
> > >> +///   except for the range within about 1e-28 second of the
> reference date.
> > >> +/// 0x3ef: encodes all dates for a few million years beyond
> distantPast and
> > >> +///   distantFuture, except within about 1e-25 second of the
> reference date.
> > >> +const int TAGGED_DATE_EXPONENT_BIAS = 0x3ef;
> > >> +
> > >> +typedef union {
> > >> +  struct {
> > >> +uint64_t fraction:52;  // unsigned
> > >> +uint64_t exponent:11;  // signed
> > >> +uint64_t sign:1;
> > >> +  };
> > >> +  uint64_t i;
> > >> +  double d;
> > >> +} DoubleBits;
> > >> +typedef union {
> > >> +  struct {
> > >> +uint64_t fraction:52;  // unsigned
> > >> +uint64_t exponent:7;   // signed
> > >> +uint64_t sign:1;
> > >> +uint64_t unused:4;  // placeholder for pointer tag bits
> > >> +  };
> > >
> > > MSVC gives:
> > >
> > > warning C4201: nonstandard extension used: nameless struct/union
> > >
> > >>
> > >> +  uint64_t i;
> > >> +} TaggedDoubleBits;
> > >> +
> > >> +static uint64_t decodeExponent(uint64_t exp) {
> > >> +  int64_t exp7 = exp;
> > >> +  // Tagged exponent field is 7-bit signed. Sign-extend the value to
> 64 bits
> > >> +  // before performing arithmetic.
> > >> +  int64_t exp11 = ((exp7 << 57) >> 57) + TAGGED_DATE_EXPONENT_BIAS;
> > >> +  return exp11;
> > >> +}
> > >
> > > this should probably be:
> > >
> > > return llvm::SignExtend64<7>(exp) + TAGGED_DATE_EXPONENT_BIAS;
> > >
> > >>
> > >> +
> > >> +static uint64_t decodeTaggedTimeInterval(uint64_t
> encodedTimeInterval) {
> > >> +  if (encodedTimeInterval == 0)
> > >> +return 0.0;
> > >> +  if (encodedTimeInterval == std::numeric_limits::max())
> > >> +return -0.0;
> > >> +
> > >> +  TaggedDoubleBits encodedBits = { .i = encodedTimeInterval };
> > >
> > > Designated initializers are C++20 which are not allowed in LLVM.
> >
> >
> >
> > --
> > Davide
> >
> > "There are no solved problems; there are only problems that are more
> > or less solved" -- Henri Poincare
>
>
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347114 - Add missing triple from llvm-mc command line.

2018-11-16 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov 16 16:05:06 2018
New Revision: 347114

URL: http://llvm.org/viewvc/llvm-project?rev=347114&view=rev
Log:
Add missing triple from llvm-mc command line.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp?rev=347114&r1=347113&r2=347114&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp Fri Nov 16 16:05:06 2018
@@ -3,7 +3,7 @@
 
 // Test that we can display S_CONSTANT records.
 
-// RUN: llvm-mc -filetype=obj %p/Inputs/s_constant.s > %t.obj
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > 
%t.obj
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s


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


Re: [Lldb-commits] [PATCH] D54567: Fix LLDB's lit files

2018-11-16 Thread Zachary Turner via lldb-commits
Well msvc implies system-windows, but i can have both
On Fri, Nov 16, 2018 at 7:37 PM Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> wrote:

> stella.stamenova accepted this revision.
> stella.stamenova added a comment.
> This revision is now accepted and ready to land.
>
> Feel free to check this in. At this point this will only improve the
> results on Windows and it works correctly on Linux.
>
>
>
> 
> Comment at: lldb/lit/SymbolFile/PDB/class-layout.test:1
> -REQUIRES: system-windows
> -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o
> %T/ClassLayoutTest.cpp.obj
> -RUN: link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main
> /OUT:%T/ClassLayoutTest.cpp.exe
> +REQUIRES: msvc
> +RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o
> %T/ClassLayoutTest.cpp.obj
> 
> Why only msvc and not system-windows like the rest of the tests?
>
>
> https://reviews.llvm.org/D54567
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347174 - Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"

2018-11-18 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Sun Nov 18 12:48:25 2018
New Revision: 347174

URL: http://llvm.org/viewvc/llvm-project?rev=347174&view=rev
Log:
Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"

This breaks many tests on Windows, which now all fail with an error such
as "Unable to read memory at address ".

Removed:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/windows_dyld/
Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=347174&r1=347173&r2=347174&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Sun Nov 18 
12:48:25 2018
@@ -535,7 +535,7 @@ EXE = $(DYLIB_FILENAME)
 endif
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
-   "$(LD)" $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
+   $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
 ifneq "$(CODESIGN)" ""
$(CODESIGN) -s - "$(EXE)"
 endif
@@ -592,7 +592,7 @@ ifneq "$(DS)" ""
 endif
 endif
 else
-   "$(LD)" $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
+   $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp?rev=347174&r1=347173&r2=347174&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 Sun Nov 18 12:48:25 2018
@@ -10,14 +10,12 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
-#include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
-#include "lldb/Utility/Log.h"
 
 #include "llvm/ADT/Triple.h"
 
@@ -62,49 +60,9 @@ DynamicLoader *DynamicLoaderWindowsDYLD:
   return nullptr;
 }
 
-void DynamicLoaderWindowsDYLD::DidAttach() {
-  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+void DynamicLoaderWindowsDYLD::DidAttach() {}
 
-  DidLaunch();
-
-  m_process->LoadModules();
-}
-
-void DynamicLoaderWindowsDYLD::DidLaunch() {
-  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
-
-  ModuleSP executable = GetTargetExecutable();
-
-  if (!executable.get())
-return;
-
-  // Try to fetch the load address of the file from the process, since there
-  // could be randomization of the load address.
-
-  // It might happen that the remote has a different dir for the file, so we
-  // only send the basename of the executable in the query. I think this is 
safe
-  // because I doubt that two executables with the same basenames are loaded in
-  // memory...
-  FileSpec file_spec(
-  executable->GetPlatformFileSpec().GetFilename().GetCString());
-  bool is_loaded;
-  addr_t base_addr = 0;
-  lldb::addr_t load_addr;
-  Status error = m_process->GetFileLoadAddress(file_spec, is_loaded, 
load_addr);
-  if (error.Success() && is_loaded) {
-base_addr = load_addr;
-  }
-
-  UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, base_addr, false);
-
-  ModuleList module_list;
-  module_list.Append(executable);
-  m_process->GetTarget().ModulesDidLoad(module_list);
-}
+void DynamicLoaderWindowsDYLD::DidLaunch() {}
 
 Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); }
 


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


Re: [Lldb-commits] [PATCH] D54544: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD

2018-11-18 Thread Zachary Turner via lldb-commits
I had to revert this because it breaks many tests on Windows (found by
bisecting).  It was reverted in r347174.

You can reproduce one of the failures by building with this patch applied,
then doing python bin/llvm-lit.py -sv ~/src/lldb/lit/SymbolFile/PDB.

2 of the tests should fail and you see an error about unable to read memory
location.

On Thu, Nov 15, 2018 at 1:38 PM Hui Huang via Phabricator <
revi...@reviews.llvm.org> wrote:

> Hui added inline comments.
>
>
> 
> Comment at:
> source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp:75
> +
> +void DynamicLoaderWindowsDYLD::DidLaunch() {
> +  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
> 
> I think DynamicLoaderWindowsDYLD::DidAttach & DidLaunch are intended for
> remote debugging. As the similar functionalities have been done in
> ProcessWindows::DidLaunch & DidAttach, the test in here is actually testing
> those native ones and they happen to be correct.
>
>
> 
> Comment at:
> source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp:102
> +
> +  UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, base_addr,
> false);
>
> 
> A remote debugging shows if the 'qFileLoadAddress' remote packet is not
> implemented or incorrectly handled, GetFileLoadAddress by the remote
> process will return error resulting base_addr stay '0. Since you are
> calling with the last argument 'false' to indicate it is not an offset,
> that will be an issue. Better to move it to line 99 and check if the
> load_addr is LLDB_INVALID_ADDRESS.
>
> Moreover, if the load_addr is changed, make sure all the breakpoint
> address is recalculated. This feature could be a little bit complicated.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54544
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r347109 - Rewrite stop-hook tests as a couple of FileCheck tests

2018-11-18 Thread Zachary Turner via lldb-commits
Different shells have different quoting rules, so unfortunately something
like this:

# RUN: %lldb -b -s %s -O 'target create %t' -O 'target stop-hook add -n b
-o "expr ptr"'

is non-portable.  For example, on Windows all single quotes are converted
to double quotes before running, so this is effectively:
lldb.EXE
  -S lit-lldb-init
  -b
  -s stop-hook.test
  -O "target create stop-hook.test.tmp"
  -O "target stop-hook add -n b -o expr"  // expr gets concatenated
to the previous quoted string since there is no space separating expr and
the closing quote from the previous arg.
  ptr

If we're going to be writing more of these kinds of tests (and I think we
should!), I think we need to agree that we should not be using -O, instead
we should source the commands from a file.

I'll prepare a patch that converts these two tests to do just that and add
you as a reviewer.


On Fri, Nov 16, 2018 at 3:09 PM Frederic Riss via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: friss
> Date: Fri Nov 16 15:07:28 2018
> New Revision: 347109
>
> URL: http://llvm.org/viewvc/llvm-project?rev=347109&view=rev
> Log:
> Rewrite stop-hook tests as a couple of FileCheck tests
>
> Those tests were using pexpect and being flaky on some of ours bots.
> This patch reimplmeents the tests usinf FileCheck, and it also
> extends the test coverage to a few more stop-hook options.
>
> Added:
> lldb/trunk/lit/ExecControl/
> lldb/trunk/lit/ExecControl/StopHook/
> lldb/trunk/lit/ExecControl/StopHook/Inputs/
> lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
>   - copied, changed from r347104,
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp
> lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c
>   - copied, changed from r347104,
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp
> lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
> lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
> Removed:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/Makefile
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/Makefile
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp
>
> Copied: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
> (from r347104,
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp?p2=lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp&p1=lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp&r1=347104&r2=347109&rev=347109&view=diff
>
> ==
> ---
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp
> (original)
> +++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp Fri
> Nov 16 15:07:28 2018
> @@ -14,7 +14,7 @@
>  #include 
>
>  std::default_random_engine g_random_engine{std::random_device{}()};
> -std::uniform_int_distribution<> g_distribution{0, 300};
> +std::uniform_int_distribution<> g_distribution{0, 3000};
>
>  uint32_t g_val = 0;
>
> @@ -42,14 +42,14 @@ thread_func (uint32_t thread_index)
>
>  uint32_t count = 0;
>  uint32_t val;
> -while (count++ < 15)
> +while (count++ < 4)
>  {
> -// random micro second sleep from zero to 3 seconds
> +// random micro second sleep from zero to .3 seconds
>  int usec = g_distribution(g_random_engine);
>  printf ("%s (thread = %u) doing a usleep (%d)...\n",
> __FUNCTION__, thread_index, usec);
> -std::this_thread::sleep_for(std::chrono::microseconds{usec});
> +std::this_thread::sleep_for(std::chrono::microseconds{usec}); //
> Set break point at this line
>
> -if (count < 7)
> +if (count < 2)
>  val = access_pool ();
>  else
>  val = access_pool (true);
> @@ -64,7 +64,6 @@ int main (int argc, char const *argv[])
>  {
>  std::thread threads[3];
>
> -printf ("Before turning all three threads loose...\n"); // Set break
> point at this line, and add a stop-hook.
>  // Create 3 threads
>  for (auto &thread : threads)
>  thread = std::thread{thread_func, std::distance(threads,
> &thread)};
>
> Copied: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c (from
> r347104,

Re: [Lldb-commits] [PATCH] D54682: [Driver] Extract option parsing and option processing.

2018-11-18 Thread Zachary Turner via lldb-commits
I’ve often thought we should convert LLDB’s command line parsing code over
to use either cl::opt or lib/Option. This would also solve the problem you
describe here at the same time.

Do you think it’s worth trying to do this?
On Sun, Nov 18, 2018 at 7:17 PM Jonas Devlieghere via Phabricator <
revi...@reviews.llvm.org> wrote:

> JDevlieghere created this revision.
> JDevlieghere added reviewers: clayborg, labath, zturner, jingham.
> JDevlieghere added a project: LLDB.
>
> In order to deal consistently with global state in LLDB, the reproducer
> feature affects LLDB's initialization. For example, when replaying, the
> FileSystem singleton is initialized with a virtual file system.
>
> This is a problem for the driver because it initialized the debugger
> before parsing command line options. The reason is that the driver, among
> other things, checks whether files exists (e.g. core files, target, files
> to be sourced). It also relies on the debugger to parse things like the
> (scripting) language, the architecture, etc.
>
> In an initial attempt I tried to populate the OptionData before the
> debugger is initialized. This proved to be complicated, because of the
> sanity checks that are performed by calling into the debugger of the
> filesystem. Although it would be possible to perform these checks after
> parsing, it would cause errors to no longer appear in the same order as
> specified by the user, but in an arbitrary order specified by the driver
> implementation. Although I like the idea conceptually I don't believe this
> is an acceptable regression.
>
> Implemented in this patch is a new `ArgParser` class that extracts the
> existing argument parsing logic. Basically it calls `getopt_long_only`
> repeatedly and populates a list with the short option and its value.
> Because the `ArgParser` is //dumb// it can do all its work before the
> debugger is initialized. Afterwards the driver iterates over the options
> from the argparser (instead of calling `getopt_long_only` every time) and
> do whatever is needed.
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54682
>
> Files:
>   tools/driver/Driver.cpp
>   tools/driver/Driver.h
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54682: [Driver] Extract option parsing and option processing.

2018-11-18 Thread Zachary Turner via lldb-commits
Lib option definitely does, as its entire purpose is to be powerful and
flexible enough to mimic arbitrary command line tools.

cl::opt is a little less powerful but it still preserves order among
multiple options with the same flag, just not multiple options with
different flags.

I don’t have a strong opinion that this particular change should be gated
on that, it’s just nice when we can reuse llvm logic. Sometimes it fixes
latent bugs, sometimes it enables new functionality that wasn’t possible
before, etc. up to you if you wanna give it a shot
On Sun, Nov 18, 2018 at 7:39 PM Jonas Devlieghere via Phabricator <
revi...@reviews.llvm.org> wrote:

> JDevlieghere added a comment.
>
> In https://reviews.llvm.org/D54682#1302436, @zturner wrote:
>
> > I’ve often thought we should convert LLDB’s command line parsing code
> over
> >  to use either cl::opt or lib/Option. This would also solve the problem
> you
> >  describe here at the same time.
> >
> > Do you think it’s worth trying to do this?
>
>
> I believe both would have the issue that options are not processed in the
> order specified. I guess it depends on whether people care about this?
> Happy to give that a shot if the consensus is "nobody cares" :-)
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D54682
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347213 - Don't use -O in lit tests.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 07:06:10 2018
New Revision: 347213

URL: http://llvm.org/viewvc/llvm-project?rev=347213&view=rev
Log:
Don't use -O in lit tests.

Because of different shell quoting rules, and the fact that LLDB
commands often contain spaces, -O is not portable for writing command
lines. Instead, we should use explicit lldbinit files.

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

Added:
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
Modified:
lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
lldb/trunk/lit/ExecControl/StopHook/stop-hook.test

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1 @@
+target stop-hook add -n b -o "expr ptr"

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34 -o "expr ptr"
\ No newline at end of file

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1,3 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34
+expr ptr
+DONE
\ No newline at end of file

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit 
(added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit Mon 
Nov 19 07:06:10 2018
@@ -0,0 +1,7 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add
+frame variable --show-globals g_val
+thread list
+continue
+DONE

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit 
(added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit Mon 
Nov 19 07:06:10 2018
@@ -0,0 +1,4 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add -x 2 -o "frame variable thread_index"
+target stop-hook add -o continue

Modified: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test?rev=347213&r1=347212&r2=347213&view=diff
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test (original)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test Mon Nov 19 
07:06:10 2018
@@ -1,19 +1,7 @@
 # RUN: %cxx %p/Inputs/stop-hook-threads.cpp -g -o %t
-# RUN: %lldb -b -s %s -O 'target create %t' \
-# RUN: -O 'break set -f stop-hook-threads.cpp -p "Break here to test that 
the stop-hook"' \
-# RUN: -O run \
-# RUN: -O 'target stop-hook add' \
-# RUN:-O "frame variable --show-globals g_val" \
-# RUN:-O "thread list" \
-# RUN:-O continue \
-# RUN:-O DONE \
+# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
-# RUN: %lldb -b -s %s \
-# RUN: -O 'target create %t' \
-# RUN: -O 'break set -f stop-h

[Lldb-commits] [lldb] r347216 - Fix some issues with LLDB's lit configuration files.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 07:12:34 2018
New Revision: 347216

URL: http://llvm.org/viewvc/llvm-project?rev=347216&view=rev
Log:
Fix some issues with LLDB's lit configuration files.

Recently I tried to port LLDB's lit configuration files over to use a
on the surface, but broke some cases that weren't broken before and also
exposed some additional problems with the old approach that we were just
getting lucky with.

When we set up a lit environment, the goal is to make it as hermetic as
possible. We should not be relying on PATH and enabling the use of
arbitrary shell commands. Instead, only whitelisted commands should be
allowed. These are, generally speaking, the lit builtins such as echo,
cd, etc, as well as anything for which substitutions have been
explicitly set up for. These substitutions should map to the build
output directory, but in some cases it's useful to be able to override
this (for example to point to an installed tools directory).

This is, of course, how it's supposed to work. What was actually
happening is that we were bringing in PATH and LD_LIBRARY_PATH and then
just running the given run line as a shell command. This led to problems
such as finding the wrong version of clang-cl on PATH since it wasn't
even a substitution, and flakiness / non-determinism since the
environment the tests were running in would change per-machine. On the
other hand, it also made other things possible. For example, we had some
tests that were explicitly running cl.exe and link.exe instead of
clang-cl and lld-link and the only reason it worked at all is because it
was finding them on PATH. Unfortunately we can't entirely get rid of
these tests, because they support a few things in debug info that
clang-cl and lld-link don't (notably, the LF_UDT_MOD_SRC_LINE record
which makes some of the tests fail.

The high level changes introduced in this patch are:

1. Removal of functionality - The lit test suite no longer respects
   LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. This means there is no
   more support for gcc, but nobody was using this anyway (note: The
   functionality is still there for the dotest suite, just not the lit test
   suite). There is no longer a single substitution %cxx and %cc which maps
   to , you now explicitly specify the compiler with a
   substitution like %clang or %clangxx or %clang_cl. We can revisit this
   in the future when someone needs gcc.

2. Introduction of the LLDB_LIT_TOOLS_DIR directory. This does in spirit
   what LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER used to do, but now
   more friendly. If this is not specified, all tools are expected to be
   the just-built tools. If it is specified, the tools which are not
   themselves being tested but are being used to construct and run checks
   (e.g. clang, FileCheck, llvm-mc, etc) will be searched for in this
   directory first, then the build output directory.

3. Changes to core llvm lit files. The use_lld() and use_clang()
   functions were introduced long ago in anticipation of using them in
   lldb, but since they were never actually used anywhere but their
   respective problems, there were some issues to be resolved regarding
   generality and ability to use them outside their project.

4. Changes to .test files - These are all just replacing things like
   clang-cl with %clang_cl and %cxx with %clangxx, etc.

5. Changes to lit.cfg.py - Previously we would load up some system
   environment variables and then add some new things to them. Then do a
   bunch of work building out our own substitutions. First, we delete the
   system environment variable code, making the environment hermetic. Then,
   we refactor the substitution logic into two separate helper functions,
   one which sets up substitutions for the tools we want to test (which
   must come from the build output directory), and another which sets up
   substitutions for support tools (like compilers, etc).

6. New substitutions for MSVC -- Previously we relied on location of
   MSVC by bringing in the entire parent's PATH and letting
   subprocess.Popen just run the command line. Now we set up real
   substitutions that should have the same effect. We use PATH to find
   them, and then look for INCLUDE and LIB to construct a substitution
   command line with appropriate /I and /LIBPATH: arguments. The nice thing
   about this is that it opens the door to having separate %msvc-cl32 and
   %msvc-cl64 substitutions, rather than only requiring the user to run
   vcvars first. Because we can deduce the path to 32-bit libraries from
   64-bit library directories, and vice versa. Without these substitutions
   this would have been impossible.

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

Added:
lldb/trunk/lit/helper/
lldb/trunk/lit/helper/__init__.py
lldb/trunk/lit/helper/toolchain.py
Modified:
lldb/trunk/lit/Breakpoint/case-insensitive.test
lldb/trunk/lit/Breakpoint/case-sensitive.test
lldb/trunk/lit/ExecContro

[Lldb-commits] [lldb] r347223 - Remove non-ASCII characters at the beginning of file.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 08:41:31 2018
New Revision: 347223

URL: http://llvm.org/viewvc/llvm-project?rev=347223&view=rev
Log:
Remove non-ASCII characters at the beginning of file.

It's not clear how these ended up in the file, but this fixes it.

Modified:
lldb/trunk/lit/helper/toolchain.py

Modified: lldb/trunk/lit/helper/toolchain.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/toolchain.py?rev=347223&r1=347222&r2=347223&view=diff
==
--- lldb/trunk/lit/helper/toolchain.py (original)
+++ lldb/trunk/lit/helper/toolchain.py Mon Nov 19 08:41:31 2018
@@ -1,4 +1,4 @@
-import os
+import os
 import platform
 import subprocess
 import sys


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


  1   2   3   4   5   6   7   8   9   10   >