[Lldb-commits] [PATCH] D78801: [LLDB] Add class ProcessWasm for WebAssembly debugging

2020-04-24 Thread Paolo Severini via Phabricator via lldb-commits
paolosev created this revision.
paolosev added reviewers: clayborg, labath.
paolosev added a project: LLDB.
Herald added subscribers: lldb-commits, sunfish, aheejin, jgravelle-google, 
sbc100, aprantl, mgorny.
paolosev marked 2 inline comments as done.
paolosev added a comment.

What is the best way to test classes WasmProcessGDBRemote and UnwindWasm?




Comment at: lldb/source/Plugins/Process/wasm/ProcessWasm.cpp:92
+size_t buffer_size, size_t &size) {
+  // TODO(paolosev): Implement in GDBRemoteComunicationClient
+  return false;

This will be implemented as:
```
  return GetGDBRemote().GetWasmLocal(frame_index, index, buf, buffer_size, 
size);
```
as soon as `GetWasmLocal` can be added to GDBRemoteCommunicationClient.



Comment at: lldb/source/Plugins/Process/wasm/UnwindWasm.cpp:34-35
+
+IWasmProcess *wasm_process =
+static_cast(GetThread().GetProcess().get());
+if (wasm_process)

This cast works but it is ugly. Is there a better coding pattern I could use 
here?


This is the fourth in a series of patches to enable LLDB debugging of 
WebAssembly code that runs in a WebAssembly engine. Previous patches added 
ObjectFile, SymbolVendor and DynamicLoader plugin classes for Wasm, see:  
D71575 , D72751 
, D72650 .

The idea is to use the GDB-remote protocol to connect to a Wasm engine that 
implements a GDB-remote stub that offers the ability to access the engine 
runtime internal state. This patch introduce a new Process plugin //wasm//, 
with:

- class `IWasmProcess` that defines the interface with functions to access the 
Wasm engine state.
- class `WasmProcessGDBRemote` that inherits from `ProcessGDBRemote` and that 
will implement `IWasmProcess` by forwarding requests to the Wasm engine through 
a GDBRemote connection.
- class `UnwindWasm` that manages stack unwinding for Wasm.

Note that the GDB-remote protocol needs to be extended with a few Wasm-specific 
custom query commands, used to access Wasm-specific constructs like the Wasm 
memory, Wasm locals and globals. A patch for this with changes to 
`GDBRemoteCommunicationClient` will be proposed separately, like also a patch 
to `DWARFExpression` to handle Wasm-specific DWARF location expression 
operators, like `DW_OP_WASM_location`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78801

Files:
  lldb/source/Plugins/CMakeLists.txt
  lldb/source/Plugins/Plugins.def.in
  lldb/source/Plugins/Process/CMakeLists.txt
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
  lldb/source/Plugins/Process/wasm/CMakeLists.txt
  lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
  lldb/source/Plugins/Process/wasm/ProcessWasm.h
  lldb/source/Plugins/Process/wasm/UnwindWasm.cpp
  lldb/source/Plugins/Process/wasm/UnwindWasm.h
  lldb/source/Target/Thread.cpp

Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "lldb/Target/Thread.h"
+#include "Plugins/Process/wasm/UnwindWasm.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/FormatEntity.h"
@@ -1853,8 +1854,13 @@
 }
 
 Unwind &Thread::GetUnwinder() {
-  if (!m_unwinder_up)
-m_unwinder_up.reset(new UnwindLLDB(*this));
+  if (!m_unwinder_up) {
+if (CalculateTarget()->GetArchitecture().GetMachine() ==
+llvm::Triple::wasm32)
+  m_unwinder_up.reset(new wasm::UnwindWasm(*this));
+else
+  m_unwinder_up.reset(new UnwindLLDB(*this));
+  }
   return *m_unwinder_up;
 }
 
Index: lldb/source/Plugins/Process/wasm/UnwindWasm.h
===
--- /dev/null
+++ lldb/source/Plugins/Process/wasm/UnwindWasm.h
@@ -0,0 +1,49 @@
+//===-- UnwindWasm.h *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef lldb_UnwindWasm_h_
+#define lldb_UnwindWasm_h_
+
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Unwind.h"
+#include 
+
+namespace lldb_private {
+namespace wasm {
+
+class UnwindWasm : public lldb_private::Unwind {
+public:
+  UnwindWasm(lldb_private::Thread &thread)
+  : Unwind(thread), m_frames(), m_unwind_complete(false) {}
+  ~UnwindWasm() override = default;
+
+protected:
+  void DoClear() override {
+m_frames.clear();
+m_unwind_complete = false;
+  }
+
+  uint32_t DoGetFrameCount() override;
+

[Lldb-commits] [PATCH] D78801: [LLDB] Add class ProcessWasm for WebAssembly debugging

2020-04-24 Thread Paolo Severini via Phabricator via lldb-commits
paolosev marked 2 inline comments as done.
paolosev added a comment.

What is the best way to test classes WasmProcessGDBRemote and UnwindWasm?




Comment at: lldb/source/Plugins/Process/wasm/ProcessWasm.cpp:92
+size_t buffer_size, size_t &size) {
+  // TODO(paolosev): Implement in GDBRemoteComunicationClient
+  return false;

This will be implemented as:
```
  return GetGDBRemote().GetWasmLocal(frame_index, index, buf, buffer_size, 
size);
```
as soon as `GetWasmLocal` can be added to GDBRemoteCommunicationClient.



Comment at: lldb/source/Plugins/Process/wasm/UnwindWasm.cpp:34-35
+
+IWasmProcess *wasm_process =
+static_cast(GetThread().GetProcess().get());
+if (wasm_process)

This cast works but it is ugly. Is there a better coding pattern I could use 
here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78801



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


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/test/API/lang/cpp/typedef/TestCppTypedef.py:33
+expr_result = frame.EvaluateExpression("(SF)s")
+self.assertTrue(expr_result.IsValid(), "Can't evaluate an expression 
with result type `SF`")
+

teemperor wrote:
> I know we do this (sadly) really often in LLDB, but these static error 
> messages are just not useful. If my expression fails and the error message is 
> "expression failed" then that doesn't help me with debugging the issue 
> (especially when it's the only thing some remote bot sends back to me after a 
> commit).
> 
> You could do `self.assertTrue(expr_result.IsValid(), "Expression failed 
> with:" + expr_result.GetError().GetCString())` instead and then people see 
> the actual compiler output in the error log. Same for the other expr 
> evaluation below.
One of these days, I'm going to write `assertSuccess/assertFailure` functions 
which know how to test&print SBError objects. But I'm fairly busy these days, 
so if someone wants to beat me to it, be my guest.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697



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


[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

Still looks good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462



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


[Lldb-commits] [PATCH] D78588: [lldb/Core] Don't crash in GetSoftwareBreakpointTrapOpcode for unknown triples

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This makes sense to me.

(If we are able to reach this deep into the code with an invalid archspec by 
just issuing (sb or cli) commands, it sounds like there should be some check 
(and a bail out) very early on in the call stack.)


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

https://reviews.llvm.org/D78588



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


[Lldb-commits] [PATCH] D78712: [lldb/Host] Improve error messages on unowned read files

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'm not very fond of this reverse engineering of the checks that os performs 
when opening a file (this is not the only place doing it). Could we just make 
sure that the operation for opening a file returns a reasonable error message, 
and then do something like

  Status /*or Error, or Expected...*/ error = File::Open(core);
  if (error)
SetErrorStringWithFormatv("Cannot open {0}: {1}.", core, error);

?

If done right, that should produce messages like:

  Cannot open /my/core.file: File does not exist.
  Cannot open /my/core.file: Permission denied.
  Cannot open /my/core.file: Is a directory.
  ...

It may not as "user friendly" as "file is not readable by the current user", 
but it will at least be correct (it's not a problem to come up with situations 
where this file will be readable by the "current user", but we will not print 
this error message, and vice-versa), and it will also match what other tools 
are likely to print. Plus it will be composable, and involve less code at each 
call site.




Comment at: lldb/source/Host/common/FileSystem.cpp:503
+bool FileSystem::ReadableByCurrentUser(const llvm::Twine &file_path) const {
+  const FileSpec file_spec(file_path.getSingleStringRef());
+  return ReadableByCurrentUser(file_spec);

This is not the correct way to work with `Twine`s. If you want to try to be 
efficient, you should call `toStringRef` (there are examples of how to do that 
throughout llvm). If you don't care about that, you can call `str()`.



Comment at: lldb/test/API/commands/target/basic/TestTargetCommand.py:343
+def test_target_create_unowned_core_file(self):
+self.expect("target create -c ~root", error=True,
+substrs=["core file '", "' is not readable"])

mib wrote:
> Currently, I try to open the root user home directory, since I sure it's not 
> readable by other users on UNIX systems.
> 
> I went this route, because doing a `os.chown` requires privileges, and the 
> test suites doesn't run in a privileged mode.
> 
> I'm open to suggestions on how I could test this on different platforms.
if you set the mode of a file to ``, you won't be able to open it even if 
you are still its owner.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78712



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


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov updated this revision to Diff 259864.
aleksandr.urakov added a comment.

Thanks! Fixed. The only thing is that `GetCString()` can return `nullptr`, 
which leads to `None` in Python, so I made a simple wrapper for that.

I'm not very deep into the testing infrastructure, so I'm not sure that I am a 
right person to implement `assertSuccess` etc. Sorry about that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/lang/cpp/typedef/Makefile
  lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
  lldb/test/API/lang/cpp/typedef/main.cpp

Index: lldb/test/API/lang/cpp/typedef/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/typedef/main.cpp
@@ -0,0 +1,13 @@
+template
+struct S {
+  typedef T V;
+
+  V value;
+};
+
+typedef S SF;
+
+int main (int argc, char const *argv[]) {
+  SF s{ .5 };
+  return 0; // Set a breakpoint here
+}
Index: lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
@@ -0,0 +1,61 @@
+"""
+Test that we can retrieve typedefed types correctly
+"""
+
+
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import decorators
+
+def get_error_description(error):
+s = error.GetCString()
+if s is None:
+  return ""
+return s
+
+class TestCppTypedef(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_typedef(self):
+"""
+Test that we retrieve typedefed types correctly
+"""
+
+# Build and run until the breakpoint
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.cpp")
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+self, "Set a breakpoint here", self.main_source_file)
+
+# Get the current frame
+frame = thread.GetSelectedFrame()
+
+# First of all, check that we can get a typedefed type correctly in a simple case
+
+expr_result = frame.EvaluateExpression("(SF)s")
+self.assertTrue(expr_result.IsValid(), "Expression failed with: " + get_error_description(expr_result.GetError()))
+
+typedef_type = expr_result.GetType();
+self.assertTrue(typedef_type.IsValid(), "Can't get `SF` type of evaluated expression")
+self.assertTrue(typedef_type.IsTypedefType(), "Type `SF` should be a typedef")
+
+typedefed_type = typedef_type.GetTypedefedType()
+self.assertTrue(typedefed_type.IsValid(), "Can't get `SF` typedefed type")
+self.assertEqual(typedefed_type.GetName(), "S", "Got invalid `SF` typedefed type")
+
+# Check that we can get a typedefed type correctly in the case
+# when an elaborated type is created during the parsing
+
+expr_result = frame.EvaluateExpression("(SF::V)s.value")
+self.assertTrue(expr_result.IsValid(), "Expression failed with: " + get_error_description(expr_result.GetError()))
+
+typedef_type = expr_result.GetType();
+self.assertTrue(typedef_type.IsValid(), "Can't get `SF::V` type of evaluated expression")
+self.assertTrue(typedef_type.IsTypedefType(), "Type `SF::V` should be a typedef")
+
+typedefed_type = typedef_type.GetTypedefedType()
+self.assertTrue(typedefed_type.IsValid(), "Can't get `SF::V` typedefed type")
+self.assertEqual(typedefed_type.GetName(), "float", "Got invalid `SF::V` typedefed type")
Index: lldb/test/API/lang/cpp/typedef/Makefile
===
--- /dev/null
+++ lldb/test/API/lang/cpp/typedef/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3539,7 +3539,8 @@
 bool TypeSystemClang::IsTypedefType(lldb::opaque_compiler_type_t type) {
   if (!type)
 return false;
-  return GetQualType(type)->getTypeClass() == clang::Type::Typedef;
+  return RemoveWrappingTypes(GetQualType(type), {clang::Type::Typedef})
+ ->getTypeClass() == clang::Type::Typedef;
 }
 
 bool TypeSystemClang::IsVoidType(lldb::opaque_compiler_type_t type) {
@@ -4523,8 +4524,8 @@
 CompilerType
 TypeSystemClang::GetTypedefedType(lldb::opaque_compiler_type_t type) {
   if (type) {
-const clang::TypedefType *typedef_type =
-llvm::dyn_cast(GetQualType(type));
+const clang::TypedefType *typedef_type = llvm::dyn_cast(
+RemoveWrappingTypes(GetQualType(type), {clang::Type::Typedef}));
 if (typedef_type)
 

[Lldb-commits] [PATCH] D78807: Fix gendered documentation

2020-04-24 Thread Pedro Gonnet via Phabricator via lldb-commits
pedro.gonnet created this revision.
pedro.gonnet added reviewers: JDevlieghere, hokein.
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.

Changed two references to developers as "he" or "him" to the more neutral 
"they".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78807

Files:
  
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
  lldb/docs/use/variable.rst


Index: lldb/docs/use/variable.rst
===
--- lldb/docs/use/variable.rst
+++ lldb/docs/use/variable.rst
@@ -993,7 +993,7 @@
 user to see.
 
 A filter will solve this issue by only letting the user see those member
-variables he cares about. Of course, the equivalent of a filter can be
+variables they care about. Of course, the equivalent of a filter can be
 implemented easily using synthetic children, but a filter lets you get the job
 done without having to write Python code.
 
Index: 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
===
--- 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
@@ -44,4 +44,4 @@
   static NSString* __anotherString = @"world";
 
 The check will give a warning message but will not be able to suggest a fix. 
The
-user need to fix it on his own.
+user needs to fix it on their own.


Index: lldb/docs/use/variable.rst
===
--- lldb/docs/use/variable.rst
+++ lldb/docs/use/variable.rst
@@ -993,7 +993,7 @@
 user to see.
 
 A filter will solve this issue by only letting the user see those member
-variables he cares about. Of course, the equivalent of a filter can be
+variables they care about. Of course, the equivalent of a filter can be
 implemented easily using synthetic children, but a filter lets you get the job
 done without having to write Python code.
 
Index: clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
@@ -44,4 +44,4 @@
   static NSString* __anotherString = @"world";
 
 The check will give a warning message but will not be able to suggest a fix. The
-user need to fix it on his own.
+user needs to fix it on their own.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D78697#2001682 , @aleksandr.urakov 
wrote:

> Thanks! Fixed. The only thing is that `GetCString()` can return `nullptr`, 
> which leads to `None` in Python, so I made a simple wrapper for that.


I think GetCString should always return something when the expression fails 
unless something really goes wrong. I think the wrapper is a good idea for a 
more generic error handling code but in this case it just makes the test 
verbose and doesn't really add any new information (with and without the 
wrapper the program aborts with the same backtrace from what I can see. I would 
even say the concatenation with None error is a bit clearer in this situation, 
as we have a failure without an error string). Otherwise this is good to go.

> I'm not very deep into the testing infrastructure, so I'm not sure that I am 
> a right person to implement `assertSuccess` etc. Sorry about that.

Sure, I don't think that was meant to be a suggested enhancement for this 
specific line of patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697



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


[Lldb-commits] [PATCH] D73206: Pass `CompileUnit *` along `DWARFDIE` for DWZ

2020-04-24 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

@labath now with existing callbacks

  llvm::function_ref callback

I am going to add `DWARFCompileUnit *main_unit` somewhere. BTW it can be 
`nullptr`, for example for DIES from type units. In my WIP patches I was 
putting it in front (as `main_unit` sort of contains the `die`):

  llvm::function_ref callback

or do you prefer it added at the end?

  llvm::function_ref callback

This applies also to API like:

  clang::BlockDecl *DWARFASTParserClang::ResolveBlockDIE(DWARFCompileUnit 
*main_unit, const DWARFDIE &die) {

vs..

  clang::BlockDecl *DWARFASTParserClang::ResolveBlockDIE(const DWARFDIE &die, 
DWARFCompileUnit *main_unit) {

I want to prevent using default parameters:

  clang::BlockDecl *DWARFASTParserClang::ResolveBlockDIE(const DWARFDIE &die, 
DWARFCompileUnit *main_unit = nullptr) {

as that would easily lead to forgetting to delegate `main_unit` which would 
only be discovered during DWZ tests (and only if they test such specific API 
function).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73206



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


[Lldb-commits] [PATCH] D78801: [LLDB] Add class ProcessWasm for WebAssembly debugging

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Before we get into the details of this patch (with all the criss-cross friends 
and dependencies there's a lot to talk about there too), could you give an 
overview of how do you imagine this working as a whole, and why it is necessary 
to create these new classes. Having spoken to some wasm folks, I think I know 
the answers to some of the "why"s. However, I don't think other developers do, 
and even I don't know the "how" story.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78801



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


[Lldb-commits] [PATCH] D78807: Fix gendered documentation

2020-04-24 Thread Sylvestre Ledru via Phabricator via lldb-commits
sylvestre.ledru accepted this revision.
sylvestre.ledru added a comment.
This revision is now accepted and ready to land.

thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78807



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


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

The problem here is that in the case of success `GetCString()` returns 
`nullptr`, and we fail on concatenation with `None` even if the expression was 
evaluated successfully.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697



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


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

In D78697#2001751 , @aleksandr.urakov 
wrote:

> The problem here is that in the case of success `GetCString()` returns 
> `nullptr`, and we fail on concatenation with `None` even if the expression 
> was evaluated successfully.


Oh true, totally missed that. I think we usually solved that by putting the 
assert in some 'if', but that's not much better than the wrapper. And this 
hopefully anyway goes away with the discussed utility method. So let's just 
leave it at that for now and no longer delay this patch.

LGTM, thanks for the quick turnaround!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697



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


[Lldb-commits] [PATCH] D78697: [lldb][TypeSystemClang] Desugar an elaborated type before checking if it's a typedef or getting a typedefed type

2020-04-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D78697#2001751 , @aleksandr.urakov 
wrote:

> The problem here is that in the case of success `GetCString()` returns 
> `nullptr`, and we fail on concatenation with `None` even if the expression 
> was evaluated successfully.


You should be able to use `str(sb_error)`

In D78697#2001735 , @teemperor wrote:

> > I'm not very deep into the testing infrastructure, so I'm not sure that I 
> > am a right person to implement `assertSuccess` etc. Sorry about that.
>
> Sure, I don't think that was meant to be a suggested enhancement for this 
> specific line of patches.


yep.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78697



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


[Lldb-commits] [PATCH] D78333: Add Objective-C property accessors loaded from Clang module DWARF to lookup

2020-04-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

So it seems there aren't any alternative solutions that are less invasive, so I 
think this can go in.




Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:348
+  if (auto *nd = llvm::dyn_cast(member))
+if (auto *dc = llvm::dyn_cast(parent)) {
+  // This triggers ExternalASTSource::FindExternalVisibleDeclsByName() to 
be

teemperor wrote:
> SetMemberOwningModule is called really often and these two conditions are 
> always met in our code, so we are now constantly resetting 
> setHasExternalVisibleStorage to true?
Actually this probably can stay. It's not perfect that we keep resetting, but 
we should usually add all members at once I think, so it's not really making 
this thing more complicated.



Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:351
+  // called when searching for members.
+  dc->setHasExternalLexicalStorage(true);
+  dc->setHasExternalVisibleStorage(true);

teemperor wrote:
> You shouldn't need this to get FindExternalVisibleDeclsByName and all this 
> seems to work without it?
So if you move this above the comment this is already good enough. It's not 
needed for FindExternalVisibleDeclsByName but it makes sense that this has 
external lexical storage.


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

https://reviews.llvm.org/D78333



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


[Lldb-commits] [PATCH] D78588: [lldb/Core] Don't crash in GetSoftwareBreakpointTrapOpcode for unknown triples

2020-04-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1fcd234ac54a: [lldb/Core] Don't crash in 
GetSoftwareBreakpointTrapOpcode for unknown triples (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78588

Files:
  lldb/source/Target/Platform.cpp


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,7 @@
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  assert(arch.IsValid());
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 
@@ -1918,8 +1919,7 @@
   } break;
 
   default:
-llvm_unreachable(
-"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
+return 0;
   }
 
   assert(bp_site);


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,7 @@
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  assert(arch.IsValid());
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 
@@ -1918,8 +1919,7 @@
   } break;
 
   default:
-llvm_unreachable(
-"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
+return 0;
   }
 
   assert(bp_site);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1fcd234 - [lldb/Core] Don't crash in GetSoftwareBreakpointTrapOpcode for unknown triples

2020-04-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-24T09:10:41-07:00
New Revision: 1fcd234ac54a0bb9dcb14338db5a336d80321662

URL: 
https://github.com/llvm/llvm-project/commit/1fcd234ac54a0bb9dcb14338db5a336d80321662
DIFF: 
https://github.com/llvm/llvm-project/commit/1fcd234ac54a0bb9dcb14338db5a336d80321662.diff

LOG: [lldb/Core] Don't crash in GetSoftwareBreakpointTrapOpcode for unknown 
triples

This patch ensures we don't crash in GetSoftwareBreakpointTrapOpcode for
not-yet-supported architectures but rather continue with degraded
behavior.

I found the issue in the context of an invalid ArchSpec, which should be
handled further up the chain. In this patch I've also added an assert to
cover that, so we can still catch those issues.

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

Added: 


Modified: 
lldb/source/Target/Platform.cpp

Removed: 




diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 3069a363736f..3e3c476d72f8 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,7 @@ size_t 
Platform::ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  assert(arch.IsValid());
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 
@@ -1918,8 +1919,7 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target 
&target,
   } break;
 
   default:
-llvm_unreachable(
-"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
+return 0;
   }
 
   assert(bp_site);



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


[Lldb-commits] [PATCH] D78807: Fix gendered documentation

2020-04-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78807



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


Re: [Lldb-commits] [PATCH] D78807: Fix gendered documentation

2020-04-24 Thread Jim Ingham via lldb-commits
A lot of our comments and documentation was written a while ago when the “good” 
practice was to be careful to use “he” and “she” in equal measure when 
referring to our users.  The consensus has shifted to using “they” instead, so 
there are probably a bunch of other places using he and she.  Please feel free 
to fix this wherever you see it!

Thanks!

Jim

> On Apr 24, 2020, at 9:43 AM, Jonas Devlieghere via Phabricator via 
> lldb-commits  wrote:
> 
> JDevlieghere accepted this revision.
> JDevlieghere added a comment.
> 
> Thank you!
> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D78807/new/
> 
> https://reviews.llvm.org/D78807
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 259916.
lawrence_danna added a comment.

rebased


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462

Files:
  lldb/bindings/python/python-typemaps.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -123,13 +123,11 @@
   EXPECT_TRUE(major_version_field.IsAllocated());
   EXPECT_TRUE(minor_version_field.IsAllocated());
 
-  PythonInteger major_version_value =
-  major_version_field.AsType();
-  PythonInteger minor_version_value =
-  minor_version_field.AsType();
+  auto major_version_value = As(major_version_field);
+  auto minor_version_value = As(minor_version_field);
 
-  EXPECT_EQ(PY_MAJOR_VERSION, major_version_value.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, minor_version_value.GetInteger());
+  EXPECT_THAT_EXPECTED(major_version_value, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(minor_version_value, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionWithDot) {
@@ -137,16 +135,14 @@
   EXPECT_TRUE(sys_path.IsAllocated());
   EXPECT_TRUE(PythonList::Check(sys_path.get()));
 
-  PythonInteger version_major =
-  m_main_module.ResolveName("sys.version_info.major")
-  .AsType();
-  PythonInteger version_minor =
-  m_main_module.ResolveName("sys.version_info.minor")
-  .AsType();
-  EXPECT_TRUE(version_major.IsAllocated());
-  EXPECT_TRUE(version_minor.IsAllocated());
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major =
+  As(m_main_module.ResolveName("sys.version_info.major"));
+
+  auto version_minor =
+  As(m_main_module.ResolveName("sys.version_info.minor"));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestDictionaryResolutionWithDot) {
@@ -155,14 +151,14 @@
   dict.SetItemForKey(PythonString("sys"), m_sys_module);
 
   // Now use that dictionary to resolve `sys.version_info.major`
-  PythonInteger version_major =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict)
-  .AsType();
-  PythonInteger version_minor =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict)
-  .AsType();
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict));
+
+  auto version_minor = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonInteger) {
@@ -176,7 +172,8 @@
   PythonInteger python_int(PyRefType::Owned, py_int);
 
   EXPECT_EQ(PyObjectType::Integer, python_int.GetObjectType());
-  EXPECT_EQ(12, python_int.GetInteger());
+  auto python_int_value = As(python_int);
+  EXPECT_THAT_EXPECTED(python_int_value, llvm::HasValue(12));
 #endif
 
   // Verify that `PythonInteger` works correctly when given a PyLong object.
@@ -187,12 +184,14 @@
 
   // Verify that you can reset the value and that it is reflected properly.
   python_long.SetInteger(40);
-  EXPECT_EQ(40, python_long.GetInteger());
+  auto e = As(python_long);
+  EXPECT_THAT_EXPECTED(e, llvm::HasValue(40));
 
   // Test that creating a `PythonInteger` object works correctly with the
   // int constructor.
   PythonInteger constructed_int(7);
-  EXPECT_EQ(7, constructed_int.GetInteger());
+  auto value = As(constructed_int);
+  EXPECT_THAT_EXPECTED(value, llvm::HasValue(7));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonBoolean) {
@@ -339,7 +338,8 @@
   PythonInteger chk_int(PyRefType::Borrowed, chk_value1.get());
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
-  EXPECT_EQ(long_value0, chk_int.GetInteger());
+  auto chkint = As(chk_value1);
+  ASSERT_THAT_EXPECTED(chkint, llvm::HasValue(long_value0));
   EXPECT_EQ(string_value1, chk_str.GetString());
 }
 
@@ -367,7 +367,8 @@
   PythonInteger chk_int(PyRefType::Borrowed, chk_value1.get());
   PythonString chk_str(PyRefType::Borrowe

[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna added a comment.

@omjavaid ok to re-land?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462



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


[Lldb-commits] [lldb] ef423a3 - Add Objective-C property accessors loaded from Clang module DWARF to lookup

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T11:10:50-07:00
New Revision: ef423a3ba57045f80b0fcafce72121449a8b54d4

URL: 
https://github.com/llvm/llvm-project/commit/ef423a3ba57045f80b0fcafce72121449a8b54d4
DIFF: 
https://github.com/llvm/llvm-project/commit/ef423a3ba57045f80b0fcafce72121449a8b54d4.diff

LOG: Add Objective-C property accessors loaded from Clang module DWARF to lookup

This patch fixes a bug when synthesizing an ObjC property from
-gmodules debug info. Because the method declaration that is injected
via the non-modular property implementation is not added to the
ObjCInterfaceDecl's lookup pointer, a second copy of the accessor
would be generated when processing the ObjCPropertyDecl. This can be
avoided by finding the existing method decl in
ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName() and
adding it to the LookupPtr.

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

Added: 


Modified: 

lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
index 943058fde5ad..e4054b441d55 100644
--- 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
+++ 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
@@ -10,6 +10,7 @@
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
 
 using namespace lldb_private;
 
@@ -46,6 +47,19 @@ void 
ClangExternalASTSourceCallbacks::FindExternalLexicalDecls(
   }
 }
 
+bool ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(
+const clang::DeclContext *DC, clang::DeclarationName Name) {
+  llvm::SmallVector decls;
+  // Objective-C methods are not added into the LookupPtr when they originate
+  // from an external source. SetExternalVisibleDeclsForName() adds them.
+  if (auto *oid = llvm::dyn_cast(DC)) {
+for (auto *omd : oid->methods())
+  if (omd->getDeclName() == Name)
+decls.push_back(omd);
+  }
+  return !SetExternalVisibleDeclsForName(DC, Name, decls).empty();
+}
+
 OptionalClangModuleID
 ClangExternalASTSourceCallbacks::RegisterModule(clang::Module *module) {
   m_modules.push_back(module);

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
index fc6ba0d3327c..69088d9c82a5 100644
--- 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
+++ 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
@@ -30,6 +30,9 @@ class ClangExternalASTSourceCallbacks : public 
clang::ExternalASTSource {
   llvm::function_ref IsKindWeWant,
   llvm::SmallVectorImpl &Result) override;
 
+  bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
+  clang::DeclarationName Name) override;
+
   void CompleteType(clang::TagDecl *tag_decl) override;
 
   void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 20b06c6e62d2..3446db0b1214 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -344,6 +344,13 @@ static void SetMemberOwningModule(clang::Decl *member,
   member->setFromASTFile();
   member->setOwningModuleID(id.GetValue());
   member->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
+  if (auto *nd = llvm::dyn_cast(member))
+if (auto *dc = llvm::dyn_cast(parent)) {
+  dc->setHasExternalVisibleStorage(true);
+  // This triggers ExternalASTSource::FindExternalVisibleDeclsByName() to 
be
+  // called when searching for members.
+  dc->setHasExternalLexicalStorage(true);
+}
 }
 
 char TypeSystemClang::ID;

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm 
b/lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
index 5fccc44c34ef..f6522e1a808c 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
+++ b/lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
@@ -33,14 +33,21 @@
 // CHECK-DAG: EnumDecl {{.*}} imported in A {{.*}} Enum_e
 // FIXME: -EnumConstantDecl {{.*}} imported in A a
 
+@implementation SomeClass {
+  int private_ivar;
+}
+@synthesize number = private_ivar;
+@end
+
 SomeClass *obj1;
 // RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \
 // RUN:   -compiler-contex

[Lldb-commits] [PATCH] D78333: Add Objective-C property accessors loaded from Clang module DWARF to lookup

2020-04-24 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef423a3ba570: Add Objective-C property accessors loaded from 
Clang module DWARF to lookup (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D78333?vs=258177&id=259945#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78333

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm


Index: lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
===
--- lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
+++ lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
@@ -33,14 +33,21 @@
 // CHECK-DAG: EnumDecl {{.*}} imported in A {{.*}} Enum_e
 // FIXME: -EnumConstantDecl {{.*}} imported in A a
 
+@implementation SomeClass {
+  int private_ivar;
+}
+@synthesize number = private_ivar;
+@end
+
 SomeClass *obj1;
 // RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \
 // RUN:   -compiler-context 'Module:A,Struct:SomeClass' %t.o \
 // RUN:   | FileCheck %s --check-prefix=CHECK-OBJC
 // CHECK-OBJC: ObjCInterfaceDecl {{.*}} imported in A SomeClass
-// CHECK-OBJC: |-ObjCPropertyDecl {{.*}} imported in A number 'int' readonly
-// CHECK-OBJC: | `-getter ObjCMethod {{.*}} 'number'
-// CHECK-OBJC: `-ObjCMethodDecl {{.*}} imported in A implicit - number 'int'
+// CHECK-OBJC-NEXT: |-ObjCIvarDecl
+// CHECK-OBJC-NEXT: |-ObjCMethodDecl 0x[[NUMBER:[0-9a-f]+]]{{.*}} imported in A
+// CHECK-OBJC-NEXT: `-ObjCPropertyDecl {{.*}} imported in A number 'int' 
readonly
+// CHECK-OBJC-NEXT:   `-getter ObjCMethod 0x[[NUMBER]] 'number'
 
 // Template specializations are not yet supported, so they lack the ownership 
info:
 Template t2;
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -344,6 +344,13 @@
   member->setFromASTFile();
   member->setOwningModuleID(id.GetValue());
   member->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
+  if (auto *nd = llvm::dyn_cast(member))
+if (auto *dc = llvm::dyn_cast(parent)) {
+  dc->setHasExternalVisibleStorage(true);
+  // This triggers ExternalASTSource::FindExternalVisibleDeclsByName() to 
be
+  // called when searching for members.
+  dc->setHasExternalLexicalStorage(true);
+}
 }
 
 char TypeSystemClang::ID;
Index: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
@@ -30,6 +30,9 @@
   llvm::function_ref IsKindWeWant,
   llvm::SmallVectorImpl &Result) override;
 
+  bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
+  clang::DeclarationName Name) override;
+
   void CompleteType(clang::TagDecl *tag_decl) override;
 
   void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
Index: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
===
--- 
lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
+++ 
lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
@@ -10,6 +10,7 @@
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
 
 using namespace lldb_private;
 
@@ -46,6 +47,19 @@
   }
 }
 
+bool ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(
+const clang::DeclContext *DC, clang::DeclarationName Name) {
+  llvm::SmallVector decls;
+  // Objective-C methods are not added into the LookupPtr when they originate
+  // from an external source. SetExternalVisibleDeclsForName() adds them.
+  if (auto *oid = llvm::dyn_cast(DC)) {
+for (auto *omd : oid->methods())
+  if (omd->getDeclName() == Name)
+decls.push_back(omd);
+  }
+  return !SetExternalVisibleDeclsForName(DC, Name, decls).empty();
+}
+
 OptionalClangModuleID
 ClangExternalASTSourceCallbacks::RegisterModule(clang::Module *module) {
   m_modules.push_back(module);


Index: lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
===
--- lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
+++ lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
@@ -33,14 +33,2

[Lldb-commits] [lldb] 304ba5d - Delete cargo-cult code that doesn't affect the testsuite.

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T11:54:52-07:00
New Revision: 304ba5d4c6bc48853832e4fc4666f8e37308d7a4

URL: 
https://github.com/llvm/llvm-project/commit/304ba5d4c6bc48853832e4fc4666f8e37308d7a4
DIFF: 
https://github.com/llvm/llvm-project/commit/304ba5d4c6bc48853832e4fc4666f8e37308d7a4.diff

LOG: Delete cargo-cult code that doesn't affect the testsuite.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3446db0b1214..4f35d8ac51f0 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1231,11 +1231,6 @@ void TypeSystemClang::SetOwningModule(clang::Decl *decl,
   decl->setFromASTFile();
   decl->setOwningModuleID(owning_module.GetValue());
   decl->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
-  if (auto *decl_ctx = llvm::dyn_cast(decl)) {
-decl_ctx->setHasExternalVisibleStorage();
-if (auto *ns = llvm::dyn_cast(decl_ctx))
-  ns->getPrimaryContext()->setMustBuildLookupTable();
-  }
 }
 
 OptionalClangModuleID



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


Re: [Lldb-commits] [lldb] 304ba5d - Delete cargo-cult code that doesn't affect the testsuite.

2020-04-24 Thread Davidino Italiano via lldb-commits


> On Apr 24, 2020, at 11:55 AM, Adrian Prantl via lldb-commits 
>  wrote:
> 
> 
> Author: Adrian Prantl
> Date: 2020-04-24T11:54:52-07:00
> New Revision: 304ba5d4c6bc48853832e4fc4666f8e37308d7a4
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/304ba5d4c6bc48853832e4fc4666f8e37308d7a4
> DIFF: 
> https://github.com/llvm/llvm-project/commit/304ba5d4c6bc48853832e4fc4666f8e37308d7a4.diff
> 
> LOG: Delete cargo-cult code that doesn't affect the testsuite.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
> b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
> index 3446db0b1214..4f35d8ac51f0 100644
> --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
> +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
> @@ -1231,11 +1231,6 @@ void TypeSystemClang::SetOwningModule(clang::Decl 
> *decl,
>   decl->setFromASTFile();
>   decl->setOwningModuleID(owning_module.GetValue());
>   decl->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
> -  if (auto *decl_ctx = llvm::dyn_cast(decl)) {
> -decl_ctx->setHasExternalVisibleStorage();
> -if (auto *ns = llvm::dyn_cast(decl_ctx))
> -  ns->getPrimaryContext()->setMustBuildLookupTable();
> -  }
> }

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


[Lldb-commits] [lldb] 0d671db - [lldb/Driver] Remove level of indentation (NFC)

2020-04-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-24T12:50:53-07:00
New Revision: 0d671dbca949e70536da371a43dc55248301705f

URL: 
https://github.com/llvm/llvm-project/commit/0d671dbca949e70536da371a43dc55248301705f
DIFF: 
https://github.com/llvm/llvm-project/commit/0d671dbca949e70536da371a43dc55248301705f.diff

LOG: [lldb/Driver] Remove level of indentation (NFC)

Use an early return for when we couldn't create a pipe to source the
commands.

Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 670361787f1f..56f181597b18 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -592,57 +592,54 @@ int Driver::MainLoop() {
   bool quit_requested = false;
   bool stopped_for_crash = false;
   if ((commands_data != nullptr) && (commands_size != 0u)) {
-bool success = true;
 FILE *commands_file =
 PrepareCommandsForSourcing(commands_data, commands_size);
-if (commands_file != nullptr) {
-  m_debugger.SetInputFileHandle(commands_file, true);
-
-  // Set the debugger into Sync mode when running the command file.
-  // Otherwise command files
-  // that run the target won't run in a sensible way.
-  bool old_async = m_debugger.GetAsync();
-  m_debugger.SetAsync(false);
-  int num_errors = 0;
-
-  SBCommandInterpreterRunOptions options;
-  options.SetStopOnError(true);
-  if (m_option_data.m_batch)
-options.SetStopOnCrash(true);
-
-  m_debugger.RunCommandInterpreter(handle_events, spawn_thread, options,
-   num_errors, quit_requested,
-   stopped_for_crash);
-
-  if (m_option_data.m_batch && stopped_for_crash &&
-  !m_option_data.m_after_crash_commands.empty()) {
-SBStream crash_commands_stream;
-WriteCommandsForSourcing(eCommandPlacementAfterCrash,
- crash_commands_stream);
-const char *crash_commands_data = crash_commands_stream.GetData();
-const size_t crash_commands_size = crash_commands_stream.GetSize();
-commands_file = PrepareCommandsForSourcing(crash_commands_data,
-   crash_commands_size);
-if (commands_file != nullptr) {
-  bool local_quit_requested;
-  bool local_stopped_for_crash;
-  m_debugger.SetInputFileHandle(commands_file, true);
-
-  m_debugger.RunCommandInterpreter(handle_events, spawn_thread, 
options,
-   num_errors, local_quit_requested,
-   local_stopped_for_crash);
-  if (local_quit_requested)
-quit_requested = true;
-}
-  }
-  m_debugger.SetAsync(old_async);
-} else
-  success = false;
 
-// Something went wrong with command pipe
-if (!success) {
+if (commands_file == nullptr) {
+  // We should have already printed an error in PrepareCommandsForSourcing.
   exit(1);
 }
+
+m_debugger.SetInputFileHandle(commands_file, true);
+
+// Set the debugger into Sync mode when running the command file.
+// Otherwise command files
+// that run the target won't run in a sensible way.
+bool old_async = m_debugger.GetAsync();
+m_debugger.SetAsync(false);
+int num_errors = 0;
+
+SBCommandInterpreterRunOptions options;
+options.SetStopOnError(true);
+if (m_option_data.m_batch)
+  options.SetStopOnCrash(true);
+
+m_debugger.RunCommandInterpreter(handle_events, spawn_thread, options,
+ num_errors, quit_requested,
+ stopped_for_crash);
+
+if (m_option_data.m_batch && stopped_for_crash &&
+!m_option_data.m_after_crash_commands.empty()) {
+  SBStream crash_commands_stream;
+  WriteCommandsForSourcing(eCommandPlacementAfterCrash,
+   crash_commands_stream);
+  const char *crash_commands_data = crash_commands_stream.GetData();
+  const size_t crash_commands_size = crash_commands_stream.GetSize();
+  commands_file =
+  PrepareCommandsForSourcing(crash_commands_data, crash_commands_size);
+  if (commands_file != nullptr) {
+bool local_quit_requested;
+bool local_stopped_for_crash;
+m_debugger.SetInputFileHandle(commands_file, true);
+
+m_debugger.RunCommandInterpreter(handle_events, spawn_thread, options,
+ num_errors, local_quit_requested,
+ local_stopped_for_crash);
+if (local_quit_requested)
+  quit_requested = true;
+  }
+}
+m_debugger.SetAsync(old_async);
   }
 
   // Now set the input file handle to STDIN and run the command



_

[Lldb-commits] [lldb] 79feafa - Add an internal bit to the XcodeSDK class.

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T12:55:53-07:00
New Revision: 79feafa5147af3cfaa821a5488ac40ed8b79b072

URL: 
https://github.com/llvm/llvm-project/commit/79feafa5147af3cfaa821a5488ac40ed8b79b072
DIFF: 
https://github.com/llvm/llvm-project/commit/79feafa5147af3cfaa821a5488ac40ed8b79b072.diff

LOG: Add an internal bit to the XcodeSDK class.

For developing the OS itself there exists an "internal" variant of
each SDK. This patch adds support for these SDK directories to the
XcodeSDK class.

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

Added: 


Modified: 
lldb/include/lldb/Utility/XcodeSDK.h
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Utility/XcodeSDK.cpp
lldb/unittests/Host/HostInfoTest.cpp
lldb/unittests/Utility/XcodeSDKTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/XcodeSDK.h 
b/lldb/include/lldb/Utility/XcodeSDK.h
index 552c51c36844..24ab5b1fdf7a 100644
--- a/lldb/include/lldb/Utility/XcodeSDK.h
+++ b/lldb/include/lldb/Utility/XcodeSDK.h
@@ -22,6 +22,9 @@ class XcodeSDK {
 
 public:
   XcodeSDK() = default;
+  /// Initialize an XcodeSDK object with an SDK name. The SDK name is the last
+  /// directory component of a path one would pass to clang's -isysroot
+  /// parameter. For example, "MacOSX.10.14.sdk".
   XcodeSDK(std::string &&name) : m_name(std::move(name)) {}
   static XcodeSDK GetAnyMacOS() { return XcodeSDK("MacOSX.sdk"); }
 
@@ -38,7 +41,6 @@ class XcodeSDK {
 numSDKTypes,
 unknown = -1
   };
-  static llvm::StringRef GetNameForType(Type type);
 
   /// The merge function follows a strict order to maintain monotonicity:
   /// 1. SDK with the higher SDKType wins.
@@ -49,15 +51,27 @@ class XcodeSDK {
   XcodeSDK(const XcodeSDK&) = default;
   bool operator==(XcodeSDK other);
 
-  /// Return parsed SDK number, and SDK version number.
-  std::tuple Parse() const;
+  /// A parsed SDK directory name.
+  struct Info {
+Type type = unknown;
+llvm::VersionTuple version;
+bool internal = false;
+
+Info() = default;
+bool operator<(const Info &other) const;
+  };
+
+  /// Return parsed SDK type and version number.
+  Info Parse() const;
+  bool IsAppleInternalSDK() const;
   llvm::VersionTuple GetVersion() const;
   Type GetType() const;
   llvm::StringRef GetString() const;
 
   static bool SDKSupportsModules(Type type, llvm::VersionTuple version);
   static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path);
-  static llvm::StringRef GetSDKNameForType(Type type);
+  /// Return the canonical SDK name, such as "macosx" for the macOS SDK.
+  static std::string GetCanonicalName(Info info);
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm 
b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index c09339e8c673..e495c752cb19 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -298,37 +298,66 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
 }
 
 std::string HostInfoMacOSX::GetXcodeSDK(XcodeSDK sdk) {
-  std::string xcrun_cmd = "xcrun --show-sdk-path --sdk " +
-  XcodeSDK::GetSDKNameForType(sdk.GetType()).str();
-  llvm::VersionTuple version = sdk.GetVersion();
-  if (!version.empty())
-xcrun_cmd += version.getAsString();
-
-  int status = 0;
-  int signo = 0;
-  std::string output_str;
-  lldb_private::Status error =
-  Host::RunShellCommand(xcrun_cmd.c_str(), FileSpec(), &status, &signo,
-&output_str, std::chrono::seconds(15));
-
-  // Check that xcrun return something useful.
-  if (status != 0 || output_str.empty())
-return {};
-
-  // Convert to a StringRef so we can manipulate the string without modifying
-  // the underlying data.
-  llvm::StringRef output(output_str);
-
-  // Remove any trailing newline characters.
-  output = output.rtrim();
+  XcodeSDK::Info info = sdk.Parse();
+  std::string sdk_name = XcodeSDK::GetCanonicalName(info);
+  auto find_sdk = [](std::string sdk_name) -> std::string {
+std::string xcrun_cmd = "xcrun --show-sdk-path --sdk " + sdk_name;
+int status = 0;
+int signo = 0;
+std::string output_str;
+lldb_private::Status error =
+Host::RunShellCommand(xcrun_cmd.c_str(), FileSpec(), &status, &signo,
+  &output_str, std::chrono::seconds(15));
+
+// Check that xcrun return something useful.
+if (status != 0 || output_str.empty())
+  return {};
+
+// Convert to a StringRef so we can manipulate the string without modifying
+// the underlying data.
+llvm::StringRef output(output_str);
+
+// Remove any trailing newline characters.
+output = output.rtrim();
+
+// Strip any leading newline characters and everything before them.
+const size_t last_newline = output.rfind('\n');
+if (la

[Lldb-commits] [PATCH] D78825: [lldb/Driver] Exit with a non-zero exit code in batch mode when stopping because of an error.

2020-04-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, labath, clayborg, jingham, teemperor.

We have the option to stop running commands in batch mode when an error occurs. 
Currently we still exit with a zero exit code when that happens. This is 
counter intuitive and not very POSIX-y.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D78825

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/Shell/Commands/command-source.test
  lldb/test/Shell/Driver/TestProcessAttach.test
  lldb/test/Shell/Host/TestCustomShell.test
  lldb/test/Shell/Quit/TestQuitExitCodeNonInt.test
  lldb/test/Shell/Quit/TestQuitExitCodeTooManyArgs.test
  lldb/test/Shell/Reproducer/TestDiscard.test
  lldb/test/Shell/Reproducer/TestDump.test
  lldb/test/Shell/Settings/TestSettingsSet.test
  lldb/test/Shell/Settings/TestStopCommandSourceOnError.test
  lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
  lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -591,8 +591,8 @@
   // track that.
   bool quit_requested = false;
   bool stopped_for_crash = false;
+  bool stopped_for_error = false;
   if ((commands_data != nullptr) && (commands_size != 0u)) {
-bool success = true;
 FILE *commands_file =
 PrepareCommandsForSourcing(commands_data, commands_size);
 if (commands_file != nullptr) {
@@ -612,7 +612,7 @@
 
   m_debugger.RunCommandInterpreter(handle_events, spawn_thread, options,
num_errors, quit_requested,
-   stopped_for_crash);
+   stopped_for_crash, stopped_for_error);
 
   if (m_option_data.m_batch && stopped_for_crash &&
   !m_option_data.m_after_crash_commands.empty()) {
@@ -626,21 +626,31 @@
 if (commands_file != nullptr) {
   bool local_quit_requested;
   bool local_stopped_for_crash;
+  bool local_stopped_for_error;
   m_debugger.SetInputFileHandle(commands_file, true);
 
   m_debugger.RunCommandInterpreter(handle_events, spawn_thread, options,
num_errors, local_quit_requested,
-   local_stopped_for_crash);
+   local_stopped_for_crash,
+   local_stopped_for_error);
   if (local_quit_requested)
 quit_requested = true;
+
+  // When running in batch mode and an error occurred while sourcing
+  // the crash commands, exit with a non-zero exit status.
+  if (m_option_data.m_batch && local_stopped_for_error)
+exit(1);
 }
   }
-  m_debugger.SetAsync(old_async);
-} else
-  success = false;
 
-// Something went wrong with command pipe
-if (!success) {
+  // When running in batch mode and stopped because of an error, exit with
+  // a non-zero exit status.
+  if (m_option_data.m_batch && stopped_for_error)
+exit(1);
+
+  m_debugger.SetAsync(old_async);
+} else {
+  // Something went wrong with command pipe.
   exit(1);
 }
   }
Index: lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
===
--- lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -5,7 +5,7 @@
 # UNSUPPORTED: system-windows
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp %p/Inputs/thread-step-out-ret-addr-check.s -o %t
-# RUN: %lldb %t -s %s -b 2>&1 | FileCheck %s
+# RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
 
 breakpoint set -n nonstandard_stub
 # CHECK: Breakpoint 1: where = {{.*}}`nonstandard_stub
Index: lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
===
--- lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
+++ lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
@@ -14,10 +14,10 @@
 RUN: %lldb %t -b -o "type lookup EC" | FileCheck --check-prefix=LOOKUPEC %s
 LOOKUPEC: no type was found matching 'EC'
 
-RUN: %lldb %t -b -o "print (E) 1" 2>&1 | FileCheck --check-prefix=PRINTE %s
+RUN: not %lldb %t -b -o "print (E) 1" 2>&1 | FileCheck --check-prefix=PRINTE %s
 PRINTE: use of undeclared identifier 'E'
 
-RUN: %lldb %t -b -o "print (EC) 1" 2>&1 | FileCheck --check-prefix=PRINTEC %s
+RUN: not %lldb %t -b -o "print (EC) 1" 2>&1 | FileCheck --check-prefix=PRINTEC %s
 PRINTEC: use of undeclared identifier 'EC'
 
 RUN: %lldb %t -b -o "target va

[Lldb-commits] [PATCH] D78675: Add an internal bit to the XcodeSDK class

2020-04-24 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG79feafa5147a: Add an internal bit to the XcodeSDK class. 
(authored by aprantl).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D78675?vs=259614&id=259973#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78675

Files:
  lldb/include/lldb/Utility/XcodeSDK.h
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  lldb/source/Utility/XcodeSDK.cpp
  lldb/unittests/Host/HostInfoTest.cpp
  lldb/unittests/Utility/XcodeSDKTest.cpp

Index: lldb/unittests/Utility/XcodeSDKTest.cpp
===
--- lldb/unittests/Utility/XcodeSDKTest.cpp
+++ lldb/unittests/Utility/XcodeSDKTest.cpp
@@ -30,6 +30,11 @@
   EXPECT_EQ(XcodeSDK("MacOSX.sdk").GetVersion(), llvm::VersionTuple());
   EXPECT_EQ(XcodeSDK("MacOSX10.9.sdk").GetVersion(), llvm::VersionTuple(10, 9));
   EXPECT_EQ(XcodeSDK("MacOSX10.15.4.sdk").GetVersion(), llvm::VersionTuple(10, 15));
+  EXPECT_EQ(XcodeSDK("MacOSX.sdk").IsAppleInternalSDK(), false);
+  EXPECT_EQ(XcodeSDK("MacOSX10.15.Internal.sdk").GetType(), XcodeSDK::MacOSX);
+  EXPECT_EQ(XcodeSDK("MacOSX10.15.Internal.sdk").GetVersion(),
+llvm::VersionTuple(10, 15));
+  EXPECT_EQ(XcodeSDK("MacOSX10.15.Internal.sdk").IsAppleInternalSDK(), true);
   EXPECT_EQ(XcodeSDK().GetType(), XcodeSDK::unknown);
   EXPECT_EQ(XcodeSDK().GetVersion(), llvm::VersionTuple());
 }
@@ -46,6 +51,12 @@
   EXPECT_EQ(sdk.GetVersion(), llvm::VersionTuple(1, 1));
   sdk.Merge(XcodeSDK("WatchOS2.0.sdk"));
   EXPECT_EQ(sdk.GetVersion(), llvm::VersionTuple(2, 0));
+  sdk.Merge(XcodeSDK("WatchOS1.1.Internal.sdk"));
+  EXPECT_EQ(sdk.GetVersion(), llvm::VersionTuple(2, 0));
+  EXPECT_EQ(sdk.IsAppleInternalSDK(), true);
+  XcodeSDK empty;
+  empty.Merge(XcodeSDK("MacOSX10.14.Internal.sdk"));
+  EXPECT_EQ(empty.GetString(), llvm::StringRef("MacOSX10.14.Internal.sdk"));
 }
 
 TEST(XcodeSDKTest, SDKSupportsModules) {
@@ -55,6 +66,10 @@
   FileSpec(
   base +
   "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk")));
+  EXPECT_TRUE(XcodeSDK::SDKSupportsModules(
+  XcodeSDK::Type::iPhoneSimulator,
+  FileSpec(base + "iPhoneSimulator.platform/Developer/SDKs/"
+  "iPhoneSimulator12.0.Internal.sdk")));
   EXPECT_FALSE(XcodeSDK::SDKSupportsModules(
   XcodeSDK::Type::iPhoneSimulator,
   FileSpec(
@@ -68,19 +83,65 @@
   FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")));
 }
 
-TEST(XcodeSDKTest, GetSDKNameForType) {
-  EXPECT_EQ("macosx", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::MacOSX));
-  EXPECT_EQ("iphonesimulator",
-XcodeSDK::GetSDKNameForType(XcodeSDK::Type::iPhoneSimulator));
-  EXPECT_EQ("iphoneos", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::iPhoneOS));
-  EXPECT_EQ("appletvsimulator",
-XcodeSDK::GetSDKNameForType(XcodeSDK::Type::AppleTVSimulator));
-  EXPECT_EQ("appletvos",
-XcodeSDK::GetSDKNameForType(XcodeSDK::Type::AppleTVOS));
-  EXPECT_EQ("watchsimulator",
-XcodeSDK::GetSDKNameForType(XcodeSDK::Type::WatchSimulator));
-  EXPECT_EQ("watchos", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::watchOS));
-  EXPECT_EQ("linux", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::Linux));
-  EXPECT_EQ("", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::numSDKTypes));
-  EXPECT_EQ("", XcodeSDK::GetSDKNameForType(XcodeSDK::Type::unknown));
+TEST(XcodeSDKTest, GetCanonicalName) {
+  XcodeSDK::Info info;
+  info.type = XcodeSDK::Type::MacOSX;
+  EXPECT_EQ("macosx", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::iPhoneSimulator;
+  EXPECT_EQ("iphonesimulator", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::iPhoneOS;
+  EXPECT_EQ("iphoneos", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::AppleTVSimulator;
+  EXPECT_EQ("appletvsimulator", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::AppleTVOS;
+  EXPECT_EQ("appletvos", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::WatchSimulator;
+  EXPECT_EQ("watchsimulator", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::watchOS;
+  EXPECT_EQ("watchos", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::Linux;
+  EXPECT_EQ("linux", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::numSDKTypes;
+  EXPECT_EQ("", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::unknown;
+  EXPECT_EQ("", XcodeSDK::GetCanonicalName(info));
+
+  info.internal = true;
+  info.type = XcodeSDK::Type::MacOSX;
+  EXPECT_EQ("macosx.internal", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::iPhoneSimulator;
+  EXPECT_EQ("iphonesimulator.internal", XcodeSDK::GetCanonicalName(info));
+
+  info.type = XcodeSDK::Type::

[Lldb-commits] [PATCH] D78825: [lldb/Driver] Exit with a non-zero exit code in batch mode when stopping because of an error.

2020-04-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Can we delete an override of SBDebugger::RunCommandInterpreter, or are they all 
part of the stable API? If we can, it'd be nice to get rid of the one with 6 
args.

Otherwise this lgtm.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D78825



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


[Lldb-commits] [lldb] b9c7e27 - Disable path-sensitive test on Windows.

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T15:21:54-07:00
New Revision: b9c7e276bdc42c3f3f58e494ac87c3fcce0422a2

URL: 
https://github.com/llvm/llvm-project/commit/b9c7e276bdc42c3f3f58e494ac87c3fcce0422a2
DIFF: 
https://github.com/llvm/llvm-project/commit/b9c7e276bdc42c3f3f58e494ac87c3fcce0422a2.diff

LOG: Disable path-sensitive test on Windows.

Added: 


Modified: 
lldb/unittests/Utility/XcodeSDKTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/XcodeSDKTest.cpp 
b/lldb/unittests/Utility/XcodeSDKTest.cpp
index 95b909e70018..0cc353aa1ff7 100644
--- a/lldb/unittests/Utility/XcodeSDKTest.cpp
+++ b/lldb/unittests/Utility/XcodeSDKTest.cpp
@@ -59,6 +59,7 @@ TEST(XcodeSDKTest, MergeTest) {
   EXPECT_EQ(empty.GetString(), llvm::StringRef("MacOSX10.14.Internal.sdk"));
 }
 
+#ifndef _WIN32
 TEST(XcodeSDKTest, SDKSupportsModules) {
   std::string base = "/Applications/Xcode.app/Contents/Developer/Platforms/";
   EXPECT_TRUE(XcodeSDK::SDKSupportsModules(
@@ -82,6 +83,7 @@ TEST(XcodeSDKTest, SDKSupportsModules) {
   XcodeSDK::Type::MacOSX,
   FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")));
 }
+#endif
 
 TEST(XcodeSDKTest, GetCanonicalName) {
   XcodeSDK::Info info;



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


[Lldb-commits] [lldb] d8fb631 - Relax testcase. The Clang module debug info may return additional

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T15:50:26-07:00
New Revision: d8fb631d13d7b23780063a9c6000ae8208f84f8c

URL: 
https://github.com/llvm/llvm-project/commit/d8fb631d13d7b23780063a9c6000ae8208f84f8c
DIFF: 
https://github.com/llvm/llvm-project/commit/d8fb631d13d7b23780063a9c6000ae8208f84f8c.diff

LOG: Relax testcase. The Clang module debug info may return additional
attributes such as __unsafe_unretained that is not present in DWARF.

Added: 


Modified: 
lldb/test/API/lang/objc/foundation/TestObjCMethods.py

Removed: 




diff  --git a/lldb/test/API/lang/objc/foundation/TestObjCMethods.py 
b/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
index 7d4990c4f38f..675c130d7bd3 100644
--- a/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
+++ b/lldb/test/API/lang/objc/foundation/TestObjCMethods.py
@@ -184,7 +184,7 @@ def test_data_type_and_expr(self):
 
 # isa should be accessible.
 self.expect("expression self->isa", VARIABLES_DISPLAYED_CORRECTLY,
-substrs=["(Class)"])
+substrs=["Class)"])
 
 # This should fail expectedly.
 self.expect(



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


[Lldb-commits] [lldb] 6a9edce - Fix a dangling-gsl warning and avoid transitively including string.

2020-04-24 Thread Eric Christopher via lldb-commits

Author: Eric Christopher
Date: 2020-04-24T16:03:17-07:00
New Revision: 6a9edce25778e6c131914ab2e6c3f8528785a8df

URL: 
https://github.com/llvm/llvm-project/commit/6a9edce25778e6c131914ab2e6c3f8528785a8df
DIFF: 
https://github.com/llvm/llvm-project/commit/6a9edce25778e6c131914ab2e6c3f8528785a8df.diff

LOG: Fix a dangling-gsl warning and avoid transitively including string.

Added: 


Modified: 
lldb/source/Utility/XcodeSDK.cpp

Removed: 




diff  --git a/lldb/source/Utility/XcodeSDK.cpp 
b/lldb/source/Utility/XcodeSDK.cpp
index a34eac6b2c95..197eef182f69 100644
--- a/lldb/source/Utility/XcodeSDK.cpp
+++ b/lldb/source/Utility/XcodeSDK.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Utility/XcodeSDK.h"
 
 #include "lldb/lldb-types.h"
+#include 
 
 using namespace lldb;
 using namespace lldb_private;
@@ -187,7 +188,7 @@ bool XcodeSDK::SDKSupportsModules(XcodeSDK::Type 
desired_type,
 const std::string sdk_name_lower = sdk_name.lower();
 Info info;
 info.type = desired_type;
-const llvm::StringRef sdk_string = GetCanonicalName(info);
+const std::string sdk_string = GetCanonicalName(info);
 if (!llvm::StringRef(sdk_name_lower).startswith(sdk_string))
   return false;
 



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


[Lldb-commits] [PATCH] D78396: [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets

2020-04-24 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 260012.
mib added a comment.

After playing with `llvm::sys::swapByteOrder` and the `DataExtractor` getters 
(GetU8, GetU16, GetU32 ), it looks like neither of these supports bitfields.

Since the `CFBasicHash` struct relies heavily on bitfields, it won't support 
mixed endianness.

I changed the patch so if the host and the target have different byte orders,  
lldb will abort the data formatting.
I also removed all the DataBuffer and DataExtractor logic since it's not needed 
anymore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78396

Files:
  lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
  lldb/source/Plugins/Language/ObjC/CFBasicHash.h
  lldb/source/Plugins/Language/ObjC/CMakeLists.txt
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.h
  lldb/source/Plugins/Language/ObjC/NSSet.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
  lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m

Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
@@ -376,13 +376,19 @@
 	[newMutableDictionary setObject:@"foo" forKey:@"bar19"];
 	[newMutableDictionary setObject:@"foo" forKey:@"bar20"];
 
-	id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" };
-	id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" };
-	NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
-	CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
-
-	NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
-	[attrString isEqual:nil];
+id cfKeys[4] = {@"foo", @"bar", @"baz", @"quux"};
+id cfValues[4] = {@"foo", @"bar", @"baz", @"quux"};
+NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
+NSDictionary *nscfDictionary = CFBridgingRelease(CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil));
+CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
+
+NSAttributedString *attrString = [[NSAttributedString alloc]
+initWithString:@"hello world from foo"
+attributes:newDictionary];
+[attrString isEqual:nil];
 	NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
 	[mutableAttrString isEqual:nil];
 
@@ -411,9 +417,11 @@
 
 	NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil];
 	NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil];
-	[nsmutableset addObject:str4];
+[nsmutableset addObject:str4];
+NSSet *nscfSet =
+CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil));
 
-	CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
+CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
 
 	CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8);
 	CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5);
Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
@@ -29,6 +29,8 @@
 ' 2 key/value pairs',
 '(NSDictionary *) newDictionary = ',
 ' 12 key/value pairs',
+'(NSDictionary *) nscfDictionary = ',
+' 4 key/value pairs',
 '(CFDictionaryRef) cfDictionaryRef = ',
 ' 3 key/value pairs',
 '(NSDictionary *) newMutableDictionary = ',
@@ -39,6 +41,36 @@
 ' @"11 elements"',
 ])
 
+self.expect(
+'frame variable -d run-target *nscfDictionary',
+patterns=[
+'\(__NSCFDictionary\) \*nscfDictionary =',
+'key = 0x.* @"foo"',
+'value = 0x.* @"foo"',
+'k

[Lldb-commits] [PATCH] D78839: [lldb-vscode] Add an option for loading core files

2020-04-24 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added reviewers: labath, clayborg.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Currently loading core files on lldb-vscode is broken because there's a check 
in the attach workflow that asserts that the PID is valid, which of course 
fails for this case.
Hence, I'm adding a "coreFile" argument for the attach request, which does the 
work correctly.

I don't know how to test it effectively so that it runs on the buildbots and 
the debugger can in fact makes sense of it. Anyway, the change has been 
relatively simple.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78839

Files:
  lldb/tools/lldb-vscode/README.md
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -218,8 +218,12 @@
},
"exitCommands": {
"type": "array",
-   
"description": "Commands executed at the end of debugging session.",
-   
"default": []
+   "description": 
"Commands executed at the end of debugging session.",
+   "default": []
+   },
+   "coreFile": {
+   "type": 
"string",
+   "description": 
"Path to the core file to debug. It's necessary to specify the \"program\" 
argument as well."
}
}
}
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -530,7 +530,9 @@
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
   auto attachCommands = GetStrings(arguments, "attachCommands");
-  g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
+  auto core_file = GetString(arguments, "coreFile");
+  g_vsc.stop_at_entry =
+  core_file.empty() ? GetBoolean(arguments, "stopOnEntry", false) : true;
   const auto debuggerRoot = GetString(arguments, "debuggerRoot");
 
   // This is a hack for loading DWARF in .o files on Mac where the .o files
@@ -569,7 +571,10 @@
 // Disable async events so the attach will be successful when we return 
from
 // the launch call and the launch will happen synchronously
 g_vsc.debugger.SetAsync(false);
-g_vsc.target.Attach(attach_info, error);
+if (core_file.empty())
+  g_vsc.target.Attach(attach_info, error);
+else
+  g_vsc.target.LoadCore(core_file.data(), error);
 // Reenable async events
 g_vsc.debugger.SetAsync(true);
   } else {
@@ -584,7 +589,7 @@
 
   SetSourceMapFromArguments(*arguments);
 
-  if (error.Success()) {
+  if (error.Success() && core_file.empty()) {
 auto attached_pid = g_vsc.target.GetProcess().GetProcessID();
 if (attached_pid == LLDB_INVALID_PROCESS_ID) {
   if (attachCommands.empty())
Index: lldb/tools/lldb-vscode/README.md
===
--- lldb/tools/lldb-vscode/README.md
+++ lldb/tools/lldb-vscode/README.md
@@ -181,15 +181,15 @@
 
 ### Loading a Core File
 
-Loading a core file can use the `"attach"` request along with the
-`"attachCommands"` to implement a custom attach:
+This loads the coredump file `/cores/123.core` associated with the program
+`/tmp/a.out`:
 
 ```javascript
 {
-  "name": "Attach to Name (wait)",
+  "name": "Load coredump",
   "type": "lldb-vscode",
   "request": "attach",
-  "attachCommands": ["target create -c /path/to/123.core /path/to/executable"],
-  "stopOnEntry": false
+  "coreFile": "/cores/123.core",
+  "program": "/tmp/a.out"
 }
 ```


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -218,8 +218,12 @@
 			},
 			"exitCommands": {
 "type": "array",
-	"description": "Commands executed at the end of debugging session.",
-	"default": []
+"description": "Commands executed at the end of debugging session.",
+"default": []
+			},
+			"coreFil

[Lldb-commits] [lldb] 345df86 - Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T16:51:54-07:00
New Revision: 345df863ce649860bea9040fe5c2f10780d29080

URL: 
https://github.com/llvm/llvm-project/commit/345df863ce649860bea9040fe5c2f10780d29080
DIFF: 
https://github.com/llvm/llvm-project/commit/345df863ce649860bea9040fe5c2f10780d29080.diff

LOG: Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)

This API is used by swift-lldb.

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 35d00d295fa8..c8cb03e2dee8 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -864,6 +864,11 @@ class Module : public std::enable_shared_from_this,
   bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
   bool RemapSourceFile(const char *, std::string &) const = delete;
 
+  /// Return the Xcode SDK this module was compiled against.  This
+  /// is computed by merging the SDKs from each compilation unit in
+  /// the module.
+  XcodeSDK GetXcodeSDK() const { return m_xcode_sdk; }
+
   /// Update the ArchSpec to a more specific variant.
   bool MergeArchitecture(const ArchSpec &arch_spec);
 

diff  --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index 0a4d3cc2938d..ece8266d7ffd 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_lldb_unittest(SymbolFileDWARFTests
   DWARFASTParserClangTests.cpp
   SymbolFileDWARFTests.cpp
+  XcodeSDKModuleTests.cpp
 
   LINK_LIBS
 lldbCore

diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 4ec76bda8646..21c2d165c37b 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "gmock/gmock.h"
@@ -114,3 +115,47 @@ TEST_F(DWARFASTParserClangTests,
   EXPECT_THAT(ast_parser.GetDeclContextToDIEMapKeys(),
   testing::UnorderedElementsAre(decl_ctxs[0], decl_ctxs[3]));
 }
+
+
+#ifndef __APPLE__
+TEST_F(DWARFASTParserClangTests, TestXcodeSDK) {
+  PlatformDarwin::Initialize();
+  const char *yamldata = R"(
+debug_str:
+  - MacOSX10.9.sdk
+debug_abbrev:
+  - Code:0x0001
+Tag: DW_TAG_compile_unit
+Children:DW_CHILDREN_no
+Attributes:
+  - Attribute:   DW_AT_language
+Form:DW_FORM_data2
+  - Attribute:   DW_AT_APPLE_sdk
+Form:DW_FORM_strp
+debug_info:
+  - Length:
+  TotalLength: 8
+Version: 2
+AbbrOffset:  0
+AddrSize:8
+Entries:
+  - AbbrCode:0x0001
+Values:
+  - Value:   0x000C
+  - Value:   0x
+  - AbbrCode:0x
+Values:  []
+...
+)";
+
+  YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
+  auto dwarf_unit_sp = t.GetDwarfUnit();
+  auto *dwarf_cu = llvm::cast(dwarf_unit_sp.get());
+  ASSERT_TRUE((bool)dwarf_cu);
+  ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
+  *dwarf_cu));
+  auto module = t.GetModule();
+  XcodeSDK sdk = module->GetXcodeSDK();
+  ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
+}
+#endif

diff  --git a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp 
b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
index 59b6bcc123ea..f40ff1db8232 100644
--- a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
+++ b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
@@ -51,7 +51,8 @@ class YAMLObjectFile : public lldb_private::ObjectFile {
   lldb::SectionType sect_type =
   llvm::StringSwitch(name)
   .Case("debug_info", lldb::eSectionTypeDWARFDebugInfo)
-  .Case("debug_abbrev", lldb::eSectionTypeDWARFDebugAbbrev);
+  .Case("debug_abbrev", lldb::eSectionTypeDWARFDebugAbbrev)
+  .Case("debug_str", lldb::eSectionTypeDWARFDebugStr);
   auto &membuf = entry.getValue();
   lldb::addr_t file_vm_addr = 0;
   lldb::addr_t vm_size = 0;

diff  --git a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTe

[Lldb-commits] [lldb] 06e4f69 - Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T17:00:34-07:00
New Revision: 06e4f69b225753af396a28be69637f4fc2d8839d

URL: 
https://github.com/llvm/llvm-project/commit/06e4f69b225753af396a28be69637f4fc2d8839d
DIFF: 
https://github.com/llvm/llvm-project/commit/06e4f69b225753af396a28be69637f4fc2d8839d.diff

LOG: Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)

This API is used by swift-lldb.

(Recommit with missing file git-added)

Added: 
lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp

Modified: 
lldb/include/lldb/Core/Module.h
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 35d00d295fa8..c8cb03e2dee8 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -864,6 +864,11 @@ class Module : public std::enable_shared_from_this,
   bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
   bool RemapSourceFile(const char *, std::string &) const = delete;
 
+  /// Return the Xcode SDK this module was compiled against.  This
+  /// is computed by merging the SDKs from each compilation unit in
+  /// the module.
+  XcodeSDK GetXcodeSDK() const { return m_xcode_sdk; }
+
   /// Update the ArchSpec to a more specific variant.
   bool MergeArchitecture(const ArchSpec &arch_spec);
 

diff  --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index 0a4d3cc2938d..ece8266d7ffd 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_lldb_unittest(SymbolFileDWARFTests
   DWARFASTParserClangTests.cpp
   SymbolFileDWARFTests.cpp
+  XcodeSDKModuleTests.cpp
 
   LINK_LIBS
 lldbCore

diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 4ec76bda8646..21c2d165c37b 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "gmock/gmock.h"
@@ -114,3 +115,47 @@ TEST_F(DWARFASTParserClangTests,
   EXPECT_THAT(ast_parser.GetDeclContextToDIEMapKeys(),
   testing::UnorderedElementsAre(decl_ctxs[0], decl_ctxs[3]));
 }
+
+
+#ifndef __APPLE__
+TEST_F(DWARFASTParserClangTests, TestXcodeSDK) {
+  PlatformDarwin::Initialize();
+  const char *yamldata = R"(
+debug_str:
+  - MacOSX10.9.sdk
+debug_abbrev:
+  - Code:0x0001
+Tag: DW_TAG_compile_unit
+Children:DW_CHILDREN_no
+Attributes:
+  - Attribute:   DW_AT_language
+Form:DW_FORM_data2
+  - Attribute:   DW_AT_APPLE_sdk
+Form:DW_FORM_strp
+debug_info:
+  - Length:
+  TotalLength: 8
+Version: 2
+AbbrOffset:  0
+AddrSize:8
+Entries:
+  - AbbrCode:0x0001
+Values:
+  - Value:   0x000C
+  - Value:   0x
+  - AbbrCode:0x
+Values:  []
+...
+)";
+
+  YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
+  auto dwarf_unit_sp = t.GetDwarfUnit();
+  auto *dwarf_cu = llvm::cast(dwarf_unit_sp.get());
+  ASSERT_TRUE((bool)dwarf_cu);
+  ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
+  *dwarf_cu));
+  auto module = t.GetModule();
+  XcodeSDK sdk = module->GetXcodeSDK();
+  ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
+}
+#endif

diff  --git a/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
new file mode 100644
index ..43c67c65bfe7
--- /dev/null
+++ b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
@@ -0,0 +1,67 @@
+//===-- XcodeSDKModuleTests.cpp 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
+#include "Plugins/SymbolFile/DWARF/DWARFD

[Lldb-commits] [lldb] af015c1 - Revert "Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)"

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T16:59:48-07:00
New Revision: af015c1a33b772502be579eb5f62ae3847f27d97

URL: 
https://github.com/llvm/llvm-project/commit/af015c1a33b772502be579eb5f62ae3847f27d97
DIFF: 
https://github.com/llvm/llvm-project/commit/af015c1a33b772502be579eb5f62ae3847f27d97.diff

LOG: Revert "Add a getter to retrieve the XcodeSDK from Module and unit-test 
it. (NFC)"

This reverts commit 345df863ce649860bea9040fe5c2f10780d29080.

(Forgot to git-add the new file)

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index c8cb03e2dee8..35d00d295fa8 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -864,11 +864,6 @@ class Module : public std::enable_shared_from_this,
   bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
   bool RemapSourceFile(const char *, std::string &) const = delete;
 
-  /// Return the Xcode SDK this module was compiled against.  This
-  /// is computed by merging the SDKs from each compilation unit in
-  /// the module.
-  XcodeSDK GetXcodeSDK() const { return m_xcode_sdk; }
-
   /// Update the ArchSpec to a more specific variant.
   bool MergeArchitecture(const ArchSpec &arch_spec);
 

diff  --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index ece8266d7ffd..0a4d3cc2938d 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,7 +1,6 @@
 add_lldb_unittest(SymbolFileDWARFTests
   DWARFASTParserClangTests.cpp
   SymbolFileDWARFTests.cpp
-  XcodeSDKModuleTests.cpp
 
   LINK_LIBS
 lldbCore

diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 21c2d165c37b..4ec76bda8646 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
-#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "gmock/gmock.h"
@@ -115,47 +114,3 @@ TEST_F(DWARFASTParserClangTests,
   EXPECT_THAT(ast_parser.GetDeclContextToDIEMapKeys(),
   testing::UnorderedElementsAre(decl_ctxs[0], decl_ctxs[3]));
 }
-
-
-#ifndef __APPLE__
-TEST_F(DWARFASTParserClangTests, TestXcodeSDK) {
-  PlatformDarwin::Initialize();
-  const char *yamldata = R"(
-debug_str:
-  - MacOSX10.9.sdk
-debug_abbrev:
-  - Code:0x0001
-Tag: DW_TAG_compile_unit
-Children:DW_CHILDREN_no
-Attributes:
-  - Attribute:   DW_AT_language
-Form:DW_FORM_data2
-  - Attribute:   DW_AT_APPLE_sdk
-Form:DW_FORM_strp
-debug_info:
-  - Length:
-  TotalLength: 8
-Version: 2
-AbbrOffset:  0
-AddrSize:8
-Entries:
-  - AbbrCode:0x0001
-Values:
-  - Value:   0x000C
-  - Value:   0x
-  - AbbrCode:0x
-Values:  []
-...
-)";
-
-  YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
-  auto dwarf_unit_sp = t.GetDwarfUnit();
-  auto *dwarf_cu = llvm::cast(dwarf_unit_sp.get());
-  ASSERT_TRUE((bool)dwarf_cu);
-  ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
-  *dwarf_cu));
-  auto module = t.GetModule();
-  XcodeSDK sdk = module->GetXcodeSDK();
-  ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
-}
-#endif

diff  --git a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp 
b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
index f40ff1db8232..59b6bcc123ea 100644
--- a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
+++ b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
@@ -51,8 +51,7 @@ class YAMLObjectFile : public lldb_private::ObjectFile {
   lldb::SectionType sect_type =
   llvm::StringSwitch(name)
   .Case("debug_info", lldb::eSectionTypeDWARFDebugInfo)
-  .Case("debug_abbrev", lldb::eSectionTypeDWARFDebugAbbrev)
-  .Case("debug_str", lldb::eSectionTypeDWARFDebugStr);
+  .Case("debug_abbrev", lldb::eSectionTypeDWARFDebugAbbrev);
   auto &membuf = entry.getValue();
   lldb::addr_t file_vm_addr = 0;
   lldb::addr_t vm_

[Lldb-commits] [lldb] a0919ac - Invert an #ifdef in XcodeSDKModuleTests.cpp and actually make the test work.

2020-04-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-04-24T18:39:40-07:00
New Revision: a0919ac080951dec5047f18319a2974b6c6258e5

URL: 
https://github.com/llvm/llvm-project/commit/a0919ac080951dec5047f18319a2974b6c6258e5
DIFF: 
https://github.com/llvm/llvm-project/commit/a0919ac080951dec5047f18319a2974b6c6258e5.diff

LOG: Invert an #ifdef in XcodeSDKModuleTests.cpp and actually make the test 
work.

Added: 


Modified: 
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp

Removed: 




diff  --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index ece8266d7ffd..64a7b78c478a 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -12,6 +12,7 @@ add_lldb_unittest(SymbolFileDWARFTests
 lldbPluginSymbolFilePDB
 lldbPluginTypeSystemClang
 lldbUtilityHelpers
+lldbPluginPlatformMacOSX
   LINK_COMPONENTS
 Support
 DebugInfoPDB

diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 21c2d165c37b..44251e944df6 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -116,46 +116,3 @@ TEST_F(DWARFASTParserClangTests,
   testing::UnorderedElementsAre(decl_ctxs[0], decl_ctxs[3]));
 }
 
-
-#ifndef __APPLE__
-TEST_F(DWARFASTParserClangTests, TestXcodeSDK) {
-  PlatformDarwin::Initialize();
-  const char *yamldata = R"(
-debug_str:
-  - MacOSX10.9.sdk
-debug_abbrev:
-  - Code:0x0001
-Tag: DW_TAG_compile_unit
-Children:DW_CHILDREN_no
-Attributes:
-  - Attribute:   DW_AT_language
-Form:DW_FORM_data2
-  - Attribute:   DW_AT_APPLE_sdk
-Form:DW_FORM_strp
-debug_info:
-  - Length:
-  TotalLength: 8
-Version: 2
-AbbrOffset:  0
-AddrSize:8
-Entries:
-  - AbbrCode:0x0001
-Values:
-  - Value:   0x000C
-  - Value:   0x
-  - AbbrCode:0x
-Values:  []
-...
-)";
-
-  YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
-  auto dwarf_unit_sp = t.GetDwarfUnit();
-  auto *dwarf_cu = llvm::cast(dwarf_unit_sp.get());
-  ASSERT_TRUE((bool)dwarf_cu);
-  ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
-  *dwarf_cu));
-  auto module = t.GetModule();
-  XcodeSDK sdk = module->GetXcodeSDK();
-  ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
-}
-#endif

diff  --git a/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
index 43c67c65bfe7..efc9fe1763a5 100644
--- a/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
@@ -6,21 +6,29 @@
 //
 
//===--===//
 
-#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
 #include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
+#include "lldb/Core/PluginManager.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-#ifndef __APPLE__
+#ifdef __APPLE__
 namespace {
 class XcodeSDKModuleTests : public testing::Test {
-  void SetUp() override { PlatformDarwin::Initialize(); }
-  void TearDown() override { PlatformDarwin::Terminate(); }
+  void SetUp() override {
+HostInfoBase::Initialize();
+PlatformMacOSX::Initialize();
+  }
+  void TearDown() override {
+PlatformMacOSX::Terminate();
+HostInfoBase::Terminate();
+  }
 };
 } // namespace
 
@@ -54,13 +62,14 @@ TEST_F(XcodeSDKModuleTests, TestModuleGetXcodeSDK) {
 ...
 )";
 
-  YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
+  auto triple = "x86_64-apple-macosx";
+  YAMLModuleTester t(yamldata, triple);
+  auto module = t.GetModule();
   auto dwarf_unit_sp = t.GetDwarfUnit();
   auto *dwarf_cu = llvm::cast(dwarf_unit_sp.get());
   ASSERT_TRUE((bool)dwarf_cu);
   ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
   *dwarf_cu));
-  auto module = t.GetModule();
   XcodeSDK sdk = module->GetXcodeSDK();
   ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
 }



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


[Lldb-commits] [PATCH] D78648: [CMake] Bump CMake minimum version to 3.13.4

2020-04-24 Thread Shoaib Meenai via Phabricator via lldb-commits
smeenai accepted this revision.
smeenai added a comment.
This revision is now accepted and ready to land.

With the newer minimum CMake version, we can eliminate a bunch of the policy 
settings as well, but that can be a follow-up (especially given this isn't 
gonna ship for a few months).

(Another followup would be to add a `max` version to our 
`cmake_minimum_required`, to streamline policy settings even further. See 
https://cmake.org/cmake/help/latest/command/cmake_policy.html for details.)




Comment at: llvm/docs/CMakePrimer.rst:57
 
-   cmake_minimum_required(VERSION 3.2)
+   cmake_minimum_required(VERSION 3.15)
project(HelloWorld)

Is the higher minimum here for future-proofing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78648



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