[Lldb-commits] [PATCH] D62211: Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

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

Isn't all of this dead code? These functions seem to be only called from 
`DWARFDebugInfoEntry::Dump`, and I can find no callers of the Dump method.

If that's the case, what I'd do is delete all of this stuff, and then if we 
ever need to dump debug info entries again, implement a llvm-style `dump` 
method on the `DWARFDIE` class. This will move us closer to aligning lldb and 
llvm versions of these two classes.

In D62211#1510974 , @clayborg wrote:

> In D62211#1510903 , @clayborg wrote:
>
> > We really shouldn't have any DWARFDIE references inside 
> > DWARFDebugInfoEntry.h. I noticed there are a lot now which is wrong.
>
>
> I take this back. Many uses are good inside of DWARFDebugInfoEntry as I ok'ed 
> patches when I looked at them. Initially this file was intended to be the 
> level below DWARFDIE, but that has changed, and for good reason: make sure we 
> never use the wrong DWARFUnit with a DWARFDebugInfoEntry. But my initial 
> comment about moving the GetName and AppendTypeName still stand. If we aren't 
> using these for forward references when we don't have all of the 
> DWARFDebugInfoEntry objects parsed already, then they should be moved to 
> DWARFDIE and removed from here.


I think it is still possible (and desirable) to maintain (or restore) the 
"DWARFDIE >> DWARFDebugInfoEntry" invariant, while still making sure that users 
don't have to remember which entry goes with which compile unit. The way to 
achieve that is by making that nobody (outside the DWARFDIE class, and maybe 
some other low-level stuff) deals with DWARFDebugInfoEntries directly). That's 
pretty much what was done in the llvm's version of the parser where 
DWARFDebugInfoEntry is an extremely dumb class with just 5 simple accessor 
functions, and all of the interesting stuff happens in `DWARFDie`.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62211



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


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

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/unittests/Host/SocketTest.cpp:172-178
+  std::unique_ptr socket_a_up;
+  std::unique_ptr socket_b_up;
+  if (!IsAddressFamilySupported("127.0.0.1")) {
+GTEST_LOG_(WARNING) << "Skipping test due to missing IPv4 support.";
+return;
+  }
+  Socket *socket;

You have a bunch of unused variables here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62089



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


[Lldb-commits] [PATCH] D62235: [ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE extensions

2019-05-22 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added a reviewer: labath.
Herald added subscribers: kristof.beyls, tschuett, javed.absar.
Herald added a project: LLDB.

This patch updates assembler attributes for AArch64 targets so we can 
disassemble newer instructions supported in ISA version 8.5 and SVE extensions.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D62235

Files:
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp


Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
===
--- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -1188,10 +1188,10 @@
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can
-  // disassemble newer instructions.
+  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
+  // can disassemble newer instructions.
   if (triple.getArch() == llvm::Triple::aarch64)
-features_str += "+v8.2a";
+features_str += "+v8.5a,+sve2";
 
   if (triple.getArch() == llvm::Triple::aarch64
   && triple.getVendor() == llvm::Triple::Apple) {


Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
===
--- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -1188,10 +1188,10 @@
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can
-  // disassemble newer instructions.
+  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
+  // can disassemble newer instructions.
   if (triple.getArch() == llvm::Triple::aarch64)
-features_str += "+v8.2a";
+features_str += "+v8.5a,+sve2";
 
   if (triple.getArch() == llvm::Triple::aarch64
   && triple.getVendor() == llvm::Triple::Apple) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: mgorny.
labath added a comment.

I think it would be good to split this patch into two:

- implementing `g` packet in lldb-server
- deciding when lldb sends the `g` packet

For the first part, I don't see any reason why lldb-server should *not* support 
the `g` packet.

The second part, as others have pointed out is a bit more tricky, as the `g` 
packet may not always be a win. For that, it would be nice to know more about 
your use case. When you say "all registers are being fetched every step", do 
you mean that lldb does that on its own, or that you (as in, something external 
to lldb) for whatever reason want to have all registers read out after each 
step?

If it's the first thing, then we can probably do something even better, and 
make sure that lldb-server sends the required registers directly in the 
stop-reply packet.

If it's the second thing then we can play around with the conditions under 
which lldb can use the `g` packet. Eg. it definitely sounds like `register read 
--all` would benefit from this packet, but maybe `register read 
$specific_register` might not. Or this may not even matter, as for the most 
common values of `$specific_register`, we should have the data available from 
the stop-reply packets, and others aren't really used that often...




Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py:14
 
-def run_test_g_packet(self):
+def run_test_g_packet(self, read, write):
 self.build()

This test is pretty weak, as all it does is check that "some" data was 
received. It would be much better to implement something similar to what 
@mgorny did in  and other patches, only at 
lldb-server level. I.e., have an inferior which sets as many registers as 
possible to known values, and then have the test assert that. There should 
already be some code which parses `qRegisterInfo` responses in the test suite 
somewhere, so all you'd need is to fetch the offsets from there, and check that 
the values are indeed correct.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1912-1954
+  NativeRegisterContext ®_ctx = thread->GetRegisterContext();
+
+  // As the register offsets are not necessarily sorted,
+  // use a map to store all registers data.
+  std::map regs_buffer;
+  for (uint32_t reg_num = 0; reg_num < reg_ctx.GetUserRegisterCount();
+   ++reg_num) {

There's a `NativeRegisterContext::ReadAllRegisterValues` function. Can you 
check if that returns the data in the format that you need here?

Even if it doesn't, there's a good chance we could tweak it so that it does, as 
I believe it's now only used for implementing QSave/RestoreRegisterState, and 
the format we use for saving that is completely up to us.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [PATCH] D62216: [EditLine] Rewrite GetHistoryFilePath

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks good to me.

In D62216#1511101 , @JDevlieghere 
wrote:

> In D62216#1511092 , @jingham wrote:
>
> > Most other programs write their history files in ~.  So we are being a 
> > little odd in offering to put them in ~/.lldb, though I agree that is 
> > convenient.
> >
> > But if putting files in ~/.lldb ticked somebody off enough that they made a 
> > .lldb directory that was read only, your create_directory would fail - 
> > since it explicitly asks for x & w - and I don't think we should punish 
> > them with no history...
> >  If ~ is not writeable, then for now we should return an empty path and not 
> > do history.
>
>
> This sounds contrived at best. Who would even expect that there would be a 
> fallback for that? If somebody really did create a read-only `.lldb` 
> directory, it sounds to me like they don't want history at all.


My thoughts exactly. :)

Also, when we say "no history", we mean "no persistent history", right? I'd 
expect one would still be able to use the history of commands typed in the 
current session in this scenario...


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

https://reviews.llvm.org/D62216



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


[Lldb-commits] [lldb] r361358 - Delete unnecessary copy ctors

2019-05-22 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Wed May 22 01:38:23 2019
New Revision: 361358

URL: http://llvm.org/viewvc/llvm-project?rev=361358&view=rev
Log:
Delete unnecessary copy ctors

Modified:
lldb/trunk/include/lldb/Core/SearchFilter.h
lldb/trunk/include/lldb/Utility/FileSpec.h
lldb/trunk/include/lldb/Utility/Scalar.h
lldb/trunk/source/Core/SearchFilter.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/trunk/source/Utility/FileSpec.cpp
lldb/trunk/source/Utility/Scalar.cpp
lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp
lldb/trunk/tools/debugserver/source/StdStringExtractor.h
lldb/trunk/tools/intel-features/intel-pt/PTDecoder.cpp
lldb/trunk/tools/intel-features/intel-pt/PTDecoder.h

Modified: lldb/trunk/include/lldb/Core/SearchFilter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=361358&r1=361357&r2=361358&view=diff
==
--- lldb/trunk/include/lldb/Core/SearchFilter.h (original)
+++ lldb/trunk/include/lldb/Core/SearchFilter.h Wed May 22 01:38:23 2019
@@ -364,8 +364,6 @@ public:
const FileSpecList &module_list,
enum FilterTy filter_ty);
 
-  SearchFilterByModuleList(const SearchFilterByModuleList &rhs);
-
   ~SearchFilterByModuleList() override;
 
   SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs);

Modified: lldb/trunk/include/lldb/Utility/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=361358&r1=361357&r2=361358&view=diff
==
--- lldb/trunk/include/lldb/Utility/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed May 22 01:38:23 2019
@@ -77,14 +77,6 @@ public:
 
   /// Copy constructor
   ///
-  /// Makes a copy of the uniqued directory and filename strings from \a rhs.
-  ///
-  /// \param[in] rhs
-  /// A const FileSpec object reference to copy.
-  FileSpec(const FileSpec &rhs);
-
-  /// Copy constructor
-  ///
   /// Makes a copy of the uniqued directory and filename strings from \a rhs
   /// if it is not nullptr.
   ///

Modified: lldb/trunk/include/lldb/Utility/Scalar.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Scalar.h?rev=361358&r1=361357&r2=361358&view=diff
==
--- lldb/trunk/include/lldb/Utility/Scalar.h (original)
+++ lldb/trunk/include/lldb/Utility/Scalar.h Wed May 22 01:38:23 2019
@@ -115,7 +115,6 @@ public:
 }
 lldbassert(false && "unsupported bitwidth");
   }
-  Scalar(const Scalar &rhs);
   // Scalar(const RegisterValue& reg_value);
   virtual ~Scalar();
 

Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=361358&r1=361357&r2=361358&view=diff
==
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Wed May 22 01:38:23 2019
@@ -524,9 +524,6 @@ SearchFilterByModuleList::SearchFilterBy
 enum FilterTy filter_ty)
 : SearchFilter(target_sp, filter_ty), m_module_spec_list(module_list) {}
 
-SearchFilterByModuleList::SearchFilterByModuleList(
-const SearchFilterByModuleList &rhs) = default;
-
 SearchFilterByModuleList &SearchFilterByModuleList::
 operator=(const SearchFilterByModuleList &rhs) {
   m_target_sp = rhs.m_target_sp;

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=361358&r1=361357&r2=361358&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Wed May 22 01:38:23 2019
@@ -215,8 +215,6 @@ PythonBytes::PythonBytes(PyRefType type,
   Reset(type, py_obj); // Use "Reset()" to ensure that py_obj is a string
 }
 
-PythonBytes::PythonBytes(const PythonBytes &object) : PythonObject(object) {}
-
 PythonBytes::~PythonBytes() {}
 
 bool PythonBytes::Check(PyObject *py_obj) {
@@ -340,8 +338,6 @@ PythonString::PythonString(PyRefType typ
   Reset(type, py_obj); // Use "Reset()" to ensure that py_obj is a string
 }
 
-PythonString::PythonString(const PythonString &object) : PythonObject(object) 
{}
-
 PythonString::PythonString(llvm::StringRef string) : PythonObject() {
   SetString(string);
 }
@@ -441,9 +437,6 @@ PythonInteger::PythonInteger(PyRefType t
   Reset(type, py_obj); // Use "Reset()" to ensure that py_obj is a integer type
 }

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

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

- Remove superflous '.c_str()'


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62061

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


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


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

[Lldb-commits] [lldb] r361360 - DWARF: Introduce DWARFTypeUnit class

2019-05-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 22 02:09:39 2019
New Revision: 361360

URL: http://llvm.org/viewvc/llvm-project?rev=361360&view=rev
Log:
DWARF: Introduce DWARFTypeUnit class

Summary:
This patch introduces the DWARFTypeUnit class, and teaches lldb to parse
type units out of both the debug_types section (DWARF v4), and from the
regular debug_info section (DWARF v5).

The most important piece of functionality - resolving DW_AT_signatures
to connect type forward declarations to their definitions - is not
implemented here, but even without that, a lot of functionality becomes
available. I've added tests for the commands that start to work after
this patch.

The changes in this patch were greatly inspired by D61505, which in turn took
over changes from D32167.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: mgorny, jankratochvil, lldb-commits

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

Added:
lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp
lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp
lldb/trunk/lit/SymbolFile/DWARF/debug-types-basic.test
lldb/trunk/lit/SymbolFile/DWARF/debug-types-expressions.test
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
Modified:
lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Added: lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp?rev=361360&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp Wed May 22 
02:09:39 2019
@@ -0,0 +1,13 @@
+struct A {
+  int i;
+  long l;
+  float f;
+  double d;
+};
+
+enum E { e1, e2, e3 };
+enum class EC { e1, e2, e3 };
+
+extern constexpr A a{42, 47l, 4.2f, 4.7};
+extern constexpr E e(e2);
+extern constexpr EC ec(EC::e2);

Added: lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp?rev=361360&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp Wed May 
22 02:09:39 2019
@@ -0,0 +1,25 @@
+struct A {
+  int i = 47;
+  int f() { return i; }
+  virtual ~A() = default;
+};
+
+struct B: public A {
+  int j = 42;
+};
+
+namespace ns {
+struct A {
+  int i = 147;
+  A();
+};
+A::A() = default;
+}
+
+int foo(A *a) {
+  return a->f();
+}
+
+int main() {
+  return foo(new B);
+}

Added: lldb/trunk/lit/SymbolFile/DWARF/debug-types-basic.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug-types-basic.test?rev=361360&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug-types-basic.test (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-types-basic.test Wed May 22 02:09:39 
2019
@@ -0,0 +1,46 @@
+# REQUIRES: lld
+
+# Make sure DWARF v4 type units work.
+# RUN: %clangxx -target x86_64-pc-linux %S/Inputs/debug-types-basic.cpp \
+# RUN:   -g -gdwarf-4 -fdebug-types-section -c -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+# Now do the same for DWARF v5.
+# RUN: %clangxx -target x86_64-pc-linux %S/Inputs/debug-types-basic.cpp \
+# RUN:   -g -gdwarf-5 -fdebug-types-section -c -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+type lookup A
+# CHECK-LABEL: type lookup A
+# CHECK:  struct A {
+# CHECK-NEXT:   int i;
+# CHECK-NEXT:   long l;
+# CHECK-NEXT:   float f;
+# CHECK-NEXT:   double d;
+# CHECK-NEXT: }
+
+type lookup E
+# CHECK-LABEL: type lookup E
+# CHECK:  enum E {
+# CHECK-NEXT:   e1,
+# CHECK-NEXT:   e2,
+# CHECK-NEXT:   e3
+# CHECK-NEXT: }
+
+type lookup EC
+# CHECK-LABEL: type lookup EC
+# CHECK:  enum class EC {
+# CHECK-NEXT:   e1,
+# CHECK-NEXT:   e2,
+# CHECK-NEXT:   e3
+# CHECK-NEXT: }
+
+print (E) 1
+# CHECK-LABEL: print (E) 1
+# CHECK: (E) $0 = e2
+
+print (EC) 1
+# CHECK-LABEL: print (EC) 1
+# CHECK: (EC) $1 = e2

Added: lldb/trunk/lit/SymbolFile/DWARF/debug-types-expressions.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trun

[Lldb-commits] [lldb] r361361 - DWARFDebugInfoEntry: remove unused variable

2019-05-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 22 02:09:44 2019
New Revision: 361361

URL: http://llvm.org/viewvc/llvm-project?rev=361361&view=rev
Log:
DWARFDebugInfoEntry: remove unused variable

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=361361&r1=361360&r2=361361&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed May 
22 02:09:44 2019
@@ -725,13 +725,10 @@ void DWARFDebugInfoEntry::DumpAttribute(
 size_t DWARFDebugInfoEntry::GetAttributes(
 const DWARFUnit *cu, DWARFFormValue::FixedFormSizes fixed_form_sizes,
 DWARFAttributes &attributes, uint32_t curr_depth) const {
-  SymbolFileDWARF *dwarf2Data = nullptr;
   const DWARFAbbreviationDeclaration *abbrevDecl = nullptr;
   lldb::offset_t offset = 0;
-  if (cu) {
-dwarf2Data = cu->GetSymbolFileDWARF();
+  if (cu)
 abbrevDecl = GetAbbreviationDeclarationPtr(cu, offset);
-  }
 
   if (abbrevDecl) {
 const DWARFDataExtractor &debug_info_data = cu->GetData();


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


[Lldb-commits] [PATCH] D62008: DWARF: Introduce DWARFTypeUnit class

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361360: DWARF: Introduce DWARFTypeUnit class (authored by 
labath, committed by ).
Herald added a subscriber: teemperor.
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D62008?vs=200230&id=200669#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62008

Files:
  lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp
  lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp
  lit/SymbolFile/DWARF/debug-types-basic.test
  lit/SymbolFile/DWARF/debug-types-expressions.test
  lit/SymbolFile/DWARF/lit.local.cfg
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
  source/Plugins/SymbolFile/DWARF/DWARFContext.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -16,15 +16,12 @@
 public:
   void Dump(lldb_private::Stream *s) const override;
 
-  DIERef::Section GetDebugSection() const override {
-return DIERef::Section::DebugInfo;
-  }
-
 private:
   DWARFCompileUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
const DWARFUnitHeader &header,
-   const DWARFAbbreviationDeclarationSet &abbrevs)
-  : DWARFUnit(dwarf, uid, header, abbrevs) {}
+   const DWARFAbbreviationDeclarationSet &abbrevs,
+   DIERef::Section section)
+  : DWARFUnit(dwarf, uid, header, abbrevs, section) {}
 
   DISALLOW_COPY_AND_ASSIGN(DWARFCompileUnit);
 
Index: source/Plugins/SymbolFile/DWARF/DWARFContext.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFContext.h
+++ source/Plugins/SymbolFile/DWARF/DWARFContext.h
@@ -29,6 +29,7 @@
   llvm::Optional m_data_debug_macro;
   llvm::Optional m_data_debug_str;
   llvm::Optional m_data_debug_str_offsets;
+  llvm::Optional m_data_debug_types;
 
   bool isDwo() { return m_dwo_section_list != nullptr; }
 
@@ -47,6 +48,7 @@
   const DWARFDataExtractor &getOrLoadMacroData();
   const DWARFDataExtractor &getOrLoadStrData();
   const DWARFDataExtractor &getOrLoadStrOffsetsData();
+  const DWARFDataExtractor &getOrLoadDebugTypesData();
 };
 } // namespace lldb_private
 
Index: source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
@@ -0,0 +1,29 @@
+//===-- DWARFTypeUnit.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 SymbolFileDWARF_DWARFTypeUnit_h_
+#define SymbolFileDWARF_DWARFTypeUnit_h_
+
+#include "DWARFUnit.h"
+#include "llvm/Support/Error.h"
+
+class DWARFTypeUnit : public DWARFUnit {
+public:
+  void Dump(lldb_private::Stream *s) const override;
+
+private:
+  DWARFTypeUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
+const DWARFUnitHeader &header,
+const DWARFAbbreviationDeclarationSet &abbrevs,
+DIERef::Section section)
+  : DWARFUnit(dwarf, uid, header, abbrevs, section) {}
+
+  friend class DWARFUnit;
+};
+
+#endif // SymbolFileDWARF_DWARFTypeUnit_h_
Index: source/Plugins/SymbolFile/DWARF/CMakeLists.txt
===
--- source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -22,6 +22,7 @@
   DWARFDIE.cpp
   DWARFFormValue.cpp
   DWARFIndex.cpp
+  DWARFTypeUnit.cpp
   DWARFUnit.cpp
   HashedNameToDIE.cpp
   LogChannelDWARF.cpp
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -439,20 +439,6 @@
 if (section_list == NULL)
   return 0;
 
-// On non Apple platforms we might have .debug_types debug info that is
-// created by using "-fdebug-types-section". LLDB currently will try to
-// load this debug info, but it causes crashes during debugging when types
- 

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

2019-05-22 Thread Gabor Marton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361362: Add AST logging (authored by martong, committed 
by ).
Herald added a subscriber: teemperor.

Changed prior to commit:
  https://reviews.llvm.org/D62061?vs=200666&id=200670#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62061

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


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


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

[Lldb-commits] [PATCH] D62178: DWARF: Don't compute address ranges for type units

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 200672.
labath added a comment.

- rebase and modernize the code as suggested


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

https://reviews.llvm.org/D62178

Files:
  lit/SymbolFile/DWARF/debug-types-address-ranges.s
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -135,7 +135,7 @@
   friend class DebugMapModule;
   friend struct DIERef;
   friend class DWARFASTParserClang;
-  friend class DWARFUnit;
+  friend class DWARFCompileUnit;
   friend class SymbolFileDWARF;
   struct OSOInfo {
 lldb::ModuleSP module_sp;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -62,7 +62,7 @@
   friend class SymbolFileDWARFDwo;
   friend class DebugMapModule;
   friend struct DIERef;
-  friend class DWARFUnit;
+  friend class DWARFCompileUnit;
   friend class DWARFDIE;
   friend class DWARFASTParserClang;
 
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -143,7 +143,7 @@
   void SetRangesBase(dw_addr_t ranges_base);
   void SetBaseObjOffset(dw_offset_t base_obj_offset);
   void SetStrOffsetsBase(dw_offset_t str_offsets_base);
-  void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges);
+  virtual void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges) = 0;
 
   lldb::ByteOrder GetByteOrder() const;
 
@@ -215,6 +215,24 @@
 const lldb_private::DWARFDataExtractor &data,
 lldb::offset_t *offset_ptr);
 
+  // Get the DWARF unit DWARF debug information entry. Parse the single DIE
+  // if needed.
+  const DWARFDebugInfoEntry *GetUnitDIEPtrOnly() {
+ExtractUnitDIEIfNeeded();
+// m_first_die_mutex is not required as m_first_die is never cleared.
+if (!m_first_die)
+  return NULL;
+return &m_first_die;
+  }
+
+  // Get all DWARF debug informration entries. Parse all DIEs if needed.
+  const DWARFDebugInfoEntry *DIEPtr() {
+ExtractDIEsIfNeeded();
+if (m_die_array.empty())
+  return NULL;
+return &m_die_array[0];
+  }
+
   SymbolFileDWARF *m_dwarf = nullptr;
   std::unique_ptr m_dwo_symbol_file;
   DWARFUnitHeader m_header;
@@ -257,24 +275,6 @@
   void ExtractDIEsRWLocked();
   void ClearDIEsRWLocked();
 
-  // Get the DWARF unit DWARF debug informration entry. Parse the single DIE
-  // if needed.
-  const DWARFDebugInfoEntry *GetUnitDIEPtrOnly() {
-ExtractUnitDIEIfNeeded();
-// m_first_die_mutex is not required as m_first_die is never cleared.
-if (!m_first_die)
-  return NULL;
-return &m_first_die;
-  }
-
-  // Get all DWARF debug informration entries. Parse all DIEs if needed.
-  const DWARFDebugInfoEntry *DIEPtr() {
-ExtractDIEsIfNeeded();
-if (m_die_array.empty())
-  return NULL;
-return &m_die_array[0];
-  }
-
   void AddUnitDIE(const DWARFDebugInfoEntry &cu_die);
 
   void ComputeCompDirAndGuessPathStyle();
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -10,8 +10,6 @@
 
 #include "lldb/Core/Module.h"
 #include "lldb/Host/StringConvert.h"
-#include "lldb/Symbol/CompileUnit.h"
-#include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/StreamString.h"
@@ -23,7 +21,6 @@
 #include "DWARFDebugInfo.h"
 #include "DWARFTypeUnit.h"
 #include "LogChannelDWARF.h"
-#include "SymbolFileDWARFDebugMap.h"
 #include "SymbolFileDWARFDwo.h"
 
 using namespace lldb;
@@ -407,98 +404,6 @@
 m_dwo_symbol_file->GetCompileUnit()->ClearDIEsRWLocked();
 }
 
-void DWARFUnit::BuildAddressRangeTable(DWARFDebugAranges *debug_aranges) {
-  // This function is usually called if there in no .debug_aranges section in
-  // order to produce a compile unit level set of address ranges that is
-  // accurate.
-
-  size_t num_debug_aranges = debug_aranges->GetNumRanges();
-
-  // First get the compile unit DIE only and check if it has a DW_AT_ranges
-  const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly()

[Lldb-commits] [PATCH] D62243: Added a dot at the end of comment

2019-05-22 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
kwk added a reviewer: jankratochvil.

to test SVN commit access with a simple change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62243

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -172,7 +172,7 @@
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} 
${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -172,7 +172,7 @@
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} ${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62243: Added a dot at the end of comment

2019-05-22 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil requested changes to this revision.
jankratochvil added a comment.
This revision now requires changes to proceed.

When committing it, there are two more comments without dot in this file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62243



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


[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere, aprantl.
Herald added a subscriber: mgrang.
Herald added a reviewer: alexshap.
labath added a subscriber: jankratochvil.

This patch implements the main feature of type units. When completing a
type, if we encounter a DW_AT_signature attribute, we use it's value to
lookup the complete definition of the type in the relevant type unit.

To enable this lookup, we build up a map of all type units in a symbol
file when parsing the units. Then we consult this map when resolving the
DW_AT_signature attribute.

I include add a couple of tests which exercise the type lookup feature,
including one that ensure we do something reasonable in case we fail to
lookup the type.

A lot of the ideas in this patch have been taken from D32167 
 and D61505 .


https://reviews.llvm.org/D62246

Files:
  lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp
  lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp
  lit/SymbolFile/DWARF/debug-types-basic.test
  lit/SymbolFile/DWARF/debug-types-expressions.test
  lit/SymbolFile/DWARF/debug-types-missing-signature.test
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -41,6 +41,10 @@
   dw_offset_t m_abbr_offset = 0;
   uint8_t m_unit_type = 0;
   uint8_t m_addr_size = 0;
+
+  uint64_t m_type_hash = 0;
+  uint32_t m_type_offset = 0;
+
   uint64_t m_dwo_id = 0;
 
   DWARFUnitHeader() = default;
@@ -52,6 +56,8 @@
   dw_offset_t GetLength() const { return m_length; }
   dw_offset_t GetAbbrOffset() const { return m_abbr_offset; }
   uint8_t GetUnitType() const { return m_unit_type; }
+  uint64_t GetTypeHash() const { return m_type_hash; }
+  dw_offset_t GetTypeOffset() const { return m_type_offset; }
   bool IsTypeUnit() const {
 return m_unit_type == DW_UT_type || m_unit_type == DW_UT_split_type;
   }
@@ -205,6 +211,8 @@
 
   DIERef::Section GetDebugSection() const { return m_section; }
 
+  uint8_t GetUnitType() const { return m_header.GetUnitType(); }
+
 protected:
   DWARFUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
 const DWARFUnitHeader &header,
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -714,9 +714,16 @@
 section == DIERef::Section::DebugTypes ? DW_UT_type : DW_UT_compile;
   }
 
+  if (header.IsTypeUnit()) {
+header.m_type_hash = data.GetU64(offset_ptr);
+header.m_type_offset = data.GetDWARFOffset(offset_ptr);
+  }
+
   bool length_OK = data.ValidOffset(header.GetNextUnitOffset() - 1);
   bool version_OK = SymbolFileDWARF::SupportedVersion(header.m_version);
   bool addr_size_OK = (header.m_addr_size == 4) || (header.m_addr_size == 8);
+  bool type_offset_OK =
+  !header.IsTypeUnit() || (header.m_type_offset <= header.GetLength());
 
   if (!length_OK)
 return llvm::make_error(
@@ -727,6 +734,9 @@
   if (!addr_size_OK)
 return llvm::make_error(
 "Invalid unit address size");
+  if (!type_offset_OK)
+return llvm::make_error(
+"Type offset out of range");
 
   return header;
 }
Index: source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
@@ -18,6 +18,14 @@
 
   void Dump(lldb_private::Stream *s) const override;
 
+  uint64_t GetTypeHash() { return m_header.GetTypeHash(); }
+
+  dw_offset_t GetTypeOffset() { return GetOffset() + m_header.GetTypeOffset(); }
+
+  static bool classof(const DWARFUnit *unit) {
+return unit->GetUnitType() == DW_UT_type;
+  }
+
 private:
   DWARFTypeUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
 const DWARFUnitHeader &header,
Index: source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
@@ -14,7 +14,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
 void DWARFTypeUnit::Dump(Stream *s) const {
   s->Printf("0x%8.8x: Type Unit: length = 0x%8.8x, version = 0x%4.4x, "
 "abbr_offset = 0x%8.8x, addr_size = 0x%2.2x (next CU at "
Ind

[Lldb-commits] [lldb] r361373 - DWARF: Add debug_ranges/rnglists tests

2019-05-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 22 04:44:36 2019
New Revision: 361373

URL: http://llvm.org/viewvc/llvm-project?rev=361373&view=rev
Log:
DWARF: Add debug_ranges/rnglists tests

.debug_ranges parsing is not well tested [citation needed] because this
section tends to be only used in optimized code, and we don't build
optimized executables in our tests, as they produce unpredictable
results.

This patch aims to add some very simple tests for parsing static range
data, which can serve as a first line of defense in case things break.

I also include one XFAILed test, which demonstrates that we don't
correctly handle mixed DWARF v5 and v4 ranges in a single file.

Added:
lldb/trunk/lit/SymbolFile/DWARF/debug_ranges.s
lldb/trunk/lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
lldb/trunk/lit/SymbolFile/DWARF/debug_rnglists.s

Added: lldb/trunk/lit/SymbolFile/DWARF/debug_ranges.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug_ranges.s?rev=361373&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug_ranges.s (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug_ranges.s Wed May 22 04:44:36 2019
@@ -0,0 +1,92 @@
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit | FileCheck %s
+
+# CHECK:  Function: id = {0x7fff001c}, name = "ranges", range = 
[0x-0x0004)
+# CHECK:Blocks: id = {0x7fff001c}, range = [0x-0x0004)
+# CHECK-NEXT:   id = {0x7fff002d}, ranges = 
[0x0001-0x0002)[0x0003-0x0004)
+
+.text
+.p2align 12
+.globl  ranges
+.type   ranges,@function
+ranges:# @ranges
+.Lfoo_begin:
+nop
+.Lblock1_begin:
+lookup_ranges:
+nop
+.Lblock1_end:
+nop
+.Lblock2_begin:
+nop
+.Lblock2_end:
+.Lfunc_end0:
+.size   ranges, .Lfunc_end0-ranges
+# -- End function
+.section.debug_str,"MS",@progbits,1
+.Lproducer:
+.asciz  "Hand-written DWARF"
+.Lranges:
+.asciz  "ranges"
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   14  # DW_FORM_strp
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_CHILDREN_yes
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   3   # DW_AT_name
+.byte   14  # DW_FORM_strp
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   5   # Abbreviation Code
+.byte   11  # DW_TAG_lexical_block
+.byte   0   # DW_CHILDREN_no
+.byte   85  # DW_AT_ranges
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  4   # DWARF version number
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.byte   8   # Address Size (in bytes)
+.byte   1   # Abbrev [1] 0xb:0x7b 
DW_TAG_compile_unit
+.long   .Lproducer  # DW_AT_producer
+.quad   .Lfoo_begin # DW_AT_low_pc
+.long   .Lfunc_end0-.Lfoo_begin # DW_AT_high_pc
+.byte   2   # Abbrev [2] 0x2a:0x4d 
DW_TAG_subprogram
+.quad   .Lfoo_begin # DW_AT_low_pc
+.long   .Lfunc_end0-.Lfoo_begin # DW_AT_high_pc
+.long   .Lranges# DW_AT_name
+.byte   5   # Abbrev [5] 0x61:0x15 
DW_TAG_lexical_block
+.long   .Ldebug_ranges0 # DW_AT_ranges
+.by

[Lldb-commits] [lldb] r361383 - Added a dot at the end of comment

2019-05-22 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed May 22 06:23:15 2019
New Revision: 361383

URL: http://llvm.org/viewvc/llvm-project?rev=361383&view=rev
Log:
Added a dot at the end of comment

Summary: to test SVN commit access with a simple change.

Reviewers: jankratochvil

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=361383&r1=361382&r2=361383&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed May 22 06:23:15 2019
@@ -4,7 +4,7 @@ if(POLICY CMP0075)
   cmake_policy(SET CMP0075 NEW)
 endif()
 
-# Add path for custom modules
+# Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -15,7 +15,7 @@ include(LLDBStandalone)
 include(LLDBConfig)
 include(AddLLDB)
 
-# Define the LLDB_CONFIGURATION_xxx matching the build type
+# Define the LLDB_CONFIGURATION_xxx matching the build type.
 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions( -DLLDB_CONFIGURATION_DEBUG )
 else()
@@ -172,7 +172,7 @@ if (NOT LLDB_DISABLE_PYTHON)
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} 
${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py


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


[Lldb-commits] [PATCH] D62243: Added a dot at the end of comment

2019-05-22 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Revision".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361383: Added a dot at the end of comment (authored by 
kwk, committed by ).
Herald added a subscriber: abidh.

Changed prior to commit:
  https://reviews.llvm.org/D62243?vs=200696&id=200720#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62243

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -4,7 +4,7 @@
   cmake_policy(SET CMP0075 NEW)
 endif()
 
-# Add path for custom modules
+# Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -15,7 +15,7 @@
 include(LLDBConfig)
 include(AddLLDB)
 
-# Define the LLDB_CONFIGURATION_xxx matching the build type
+# Define the LLDB_CONFIGURATION_xxx matching the build type.
 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions( -DLLDB_CONFIGURATION_DEBUG )
 else()
@@ -172,7 +172,7 @@
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} 
${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -4,7 +4,7 @@
   cmake_policy(SET CMP0075 NEW)
 endif()
 
-# Add path for custom modules
+# Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -15,7 +15,7 @@
 include(LLDBConfig)
 include(AddLLDB)
 
-# Define the LLDB_CONFIGURATION_xxx matching the build type
+# Define the LLDB_CONFIGURATION_xxx matching the build type.
 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions( -DLLDB_CONFIGURATION_DEBUG )
 else()
@@ -172,7 +172,7 @@
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} ${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61853: [FuncUnwinders] Use "symbol file" unwind plans for unwinding

2019-05-22 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 200737.
labath added a comment.

- use (reduced) yaml form of the minidump now that yaml2obj supports memory 
regions
- move the symbol file unwind plan to the top of the list. I agree with the 
reasoning behind this and with the debug_frame>eh_frame (which I'll create a 
separate patch for) idea, though I think this is mostly academic, as we're 
unlikely to ever have two of these plans describing the same function.


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

https://reviews.llvm.org/D61853

Files:
  include/lldb/Symbol/FuncUnwinders.h
  lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-cfi.syms
  lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-cfi.yaml
  lit/SymbolFile/Breakpad/stack-cfi-parsing.test
  lit/SymbolFile/Breakpad/unwind-via-stack-cfi.test
  source/Commands/CommandObjectTarget.cpp
  source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  source/Symbol/FuncUnwinders.cpp

Index: source/Symbol/FuncUnwinders.cpp
===
--- source/Symbol/FuncUnwinders.cpp
+++ source/Symbol/FuncUnwinders.cpp
@@ -54,9 +54,12 @@
 
 FuncUnwinders::~FuncUnwinders() {}
 
-UnwindPlanSP FuncUnwinders::GetUnwindPlanAtCallSite(Target &target) {
+UnwindPlanSP FuncUnwinders::GetUnwindPlanAtCallSite(Target &target,
+Thread &thread) {
   std::lock_guard guard(m_mutex);
 
+  if (UnwindPlanSP plan_sp = GetSymbolFileUnwindPlan(thread))
+return plan_sp;
   if (UnwindPlanSP plan_sp = GetEHFrameUnwindPlan(target))
 return plan_sp;
   if (UnwindPlanSP plan_sp = GetDebugFrameUnwindPlan(target))
@@ -357,6 +360,8 @@
 return eh_frame_sp;
   }
 
+  if (UnwindPlanSP plan_sp = GetSymbolFileUnwindPlan(thread))
+return plan_sp;
   if (UnwindPlanSP plan_sp = GetEHFrameAugmentedUnwindPlan(target, thread))
 return plan_sp;
   if (UnwindPlanSP plan_sp = GetDebugFrameAugmentedUnwindPlan(target, thread))
Index: source/Plugins/Process/Utility/RegisterContextLLDB.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -244,8 +244,8 @@
 }
 
 if (func_unwinders_sp.get() != nullptr)
-  call_site_unwind_plan =
-  func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget());
+  call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(
+  process->GetTarget(), m_thread);
 
 if (call_site_unwind_plan.get() != nullptr) {
   m_fallback_unwind_plan_sp = call_site_unwind_plan;
@@ -873,7 +873,8 @@
 // location what helps in the most common cases when the instruction
 // emulation fails.
 UnwindPlanSP call_site_unwind_plan =
-func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget());
+func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget(),
+   m_thread);
 if (call_site_unwind_plan &&
 call_site_unwind_plan.get() != unwind_plan_sp.get() &&
 call_site_unwind_plan->GetSourceName() !=
@@ -909,8 +910,8 @@
   // Typically this is unwind info from an eh_frame section intended for
   // exception handling; only valid at call sites
   if (process) {
-unwind_plan_sp =
-func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget());
+unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite(
+process->GetTarget(), m_thread);
   }
   int valid_offset = -1;
   if (IsUnwindPlanValidForCurrentPC(unwind_plan_sp, valid_offset)) {
@@ -940,7 +941,8 @@
 // code it is often written in a way that it valid at all location what
 // helps in the most common cases when the instruction emulation fails.
 UnwindPlanSP call_site_unwind_plan =
-func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget());
+func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget(),
+   m_thread);
 if (call_site_unwind_plan &&
 call_site_unwind_plan.get() != unwind_plan_sp.get() &&
 call_site_unwind_plan->GetSourceName() !=
Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -3521,7 +3521,7 @@
 non_callsite_unwind_plan->GetSourceName().AsCString());
   }
   UnwindPlanSP callsite_unwind_plan =
-  func_unwinders_sp->GetUnwindPlanAtCallSite(*target);
+  func_unwinders_sp->GetUnwindPlanAtCallSite(*target, *thread);
   if (callsite_unwind_plan) {
 result.GetOutputStream().Printf(
 "Synchronous (restricted to call-sites) UnwindPlan is '%s'\n",
Index: lit/SymbolFile/Breakpad/unwind-via-stack-cfi.test
==

[Lldb-commits] [PATCH] D62211: Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

2019-05-22 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 200769.
jankratochvil added a comment.

I have moved it to `DWARFDIE.cpp`.  I agree that it is probably all irrelevant 
after moving to the LLVM `DWARF/` part. I have also removed return type as (1) 
it was wrong in one case and (2) no existing caller used the return type. I 
also refactored the deep nesting noted by @JDevlieghere.
I can also remove all the dumping code instead upon request, @labath.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62211

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -126,12 +126,6 @@
 
   const char *GetPubname(const DWARFUnit *cu) const;
 
-  static bool GetName(const DWARFUnit *cu, const dw_offset_t die_offset,
-  lldb_private::Stream &s);
-
-  static bool AppendTypeName(const DWARFUnit *cu, const dw_offset_t die_offset,
- lldb_private::Stream &s);
-
   const char *GetQualifiedName(DWARFUnit *cu, std::string &storage) const;
 
   const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -693,13 +693,13 @@
 DWARFDIE abstract_die = form_value.Reference();
 form_value.Dump(s);
 //  *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( ";
-GetName(abstract_die.GetCU(), abstract_die.GetOffset(), s);
+abstract_die.GetName(s);
   } break;
 
   case DW_AT_type: {
 DWARFDIE type_die = form_value.Reference();
 s.PutCString(" ( ");
-AppendTypeName(type_die.GetCU(), type_die.GetOffset(), s);
+type_die.AppendTypeName(s);
 s.PutCString(" )");
   } break;
 
@@ -1038,166 +1038,6 @@
   return name;
 }
 
-// GetName
-//
-// Get value of the DW_AT_name attribute for a debug information entry that
-// exists at offset "die_offset" and place that value into the supplied stream
-// object. If the DIE is a NULL object "NULL" is placed into the stream, and if
-// no DW_AT_name attribute exists for the DIE then nothing is printed.
-bool DWARFDebugInfoEntry::GetName(const DWARFUnit *cu,
-  const dw_offset_t die_offset, Stream &s) {
-  if (cu == NULL) {
-s.PutCString("NULL");
-return false;
-  }
-
-  DWARFDebugInfoEntry die;
-  lldb::offset_t offset = die_offset;
-  if (die.Extract(cu, &offset)) {
-if (die.IsNULL()) {
-  s.PutCString("NULL");
-  return true;
-} else {
-  const char *name =
-  die.GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
-  if (name) {
-s.PutCString(name);
-return true;
-  }
-}
-  }
-  return false;
-}
-
-// AppendTypeName
-//
-// Follows the type name definition down through all needed tags to end up with
-// a fully qualified type name and dump the results to the supplied stream.
-// This is used to show the name of types given a type identifier.
-bool DWARFDebugInfoEntry::AppendTypeName(const DWARFUnit *cu,
- const dw_offset_t die_offset,
- Stream &s) {
-  if (cu == NULL) {
-s.PutCString("NULL");
-return false;
-  }
-
-  DWARFDebugInfoEntry die;
-  lldb::offset_t offset = die_offset;
-  if (die.Extract(cu, &offset)) {
-if (die.IsNULL()) {
-  s.PutCString("NULL");
-  return true;
-} else {
-  const char *name = die.GetPubname(cu);
-  if (name)
-s.PutCString(name);
-  else {
-bool result = true;
-const DWARFAbbreviationDeclaration *abbrevDecl =
-die.GetAbbreviationDeclarationPtr(cu, offset);
-
-if (abbrevDecl == NULL)
-  return false;
-
-switch (abbrevDecl->Tag()) {
-case DW_TAG_array_type:
-  break; // print out a "[]" after printing the full type of the element
- // below
-case DW_TAG_base_type:
-  s.PutCString("base ");
-  break;
-case DW_TAG_class_type:
-  s.PutCString("class ");
-  break;
-case DW_TAG_const_type:
-  s.PutCString("const ");
-  break;
-case DW_TAG_enumeration_type:
-  s.PutCString("enum ");
-  break;
-case DW_TAG_file_type:
-  s.PutCString("file ");
-  break;
-case DW_TAG_interface_type:
-

[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

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



Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:255
 TypeList *type_list = dwarf->GetTypeList();
 if (type_ptr == NULL) {
+

Not your code, but it would be easier to follow the logic if we pulled these 
cases up front:

```
  if (type_ptr == DIE_IS_BEING_PARSED)
 return type_sp;
  if (type_ptr)
  return type_ptr->shared_from_this();
...
```



Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:258
+  if (DWARFDIE signature_die = 
die.GetAttributeValueAsReferenceDIE(DW_AT_signature)) {
+type_sp = ParseTypeFromDWARF(sc, signature_die, log, type_is_new_ptr);
+if (type_sp) {

`if (type_sp = ParseTypeFromDWARF(sc, signature_die, log, type_is_new_ptr))`


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

https://reviews.llvm.org/D62246



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


[Lldb-commits] [PATCH] D62216: [EditLine] Rewrite GetHistoryFilePath

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

> Also, when we say "no history", we mean "no persistent history", right? I'd 
> expect one would still be able to use the history of commands typed in the 
> current session in this scenario...

Yup!


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

https://reviews.llvm.org/D62216



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


[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

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

Just fix the return when we have a DW_AT_signature and this is good to go.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:267
+}
+  }
+

We should return before the } on line 267, not on line 265. If we have a 
DW_AT_signature and we fail to parse a type we won't do any better below when 
there is no type info right?



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h:74
 
+  std::vector> m_type_hash_to_unit_index;
+

llvm::DenseMap?


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

https://reviews.llvm.org/D62246



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


[Lldb-commits] [lldb] r361412 - [EditLine] Rewrite GetHistoryFilePath

2019-05-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed May 22 10:46:59 2019
New Revision: 361412

URL: http://llvm.org/viewvc/llvm-project?rev=361412&view=rev
Log:
[EditLine] Rewrite GetHistoryFilePath

Rewrite the GetHistoryFilePath implementation without relying on
FileSpec in the spirit of our discussion in D61994.

It changes LLDBs behavior in two ways:

1. We now only use the -widehistory suffix when LLDB is built with wchar
   support, instead of as the fallback from when the ~/.lldb directory
   isn't writable.

2. When the ~/.lldb directory isn't writable, we don't write any history
   files at all. Previously we would write them to the user's home
   directory (with the incorrect wide suffix), polluting ~ with a
   different file for every IO handler.

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

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

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=361412&r1=361411&r2=361412&view=diff
==
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Wed May 22 10:46:59 2019
@@ -171,23 +171,28 @@ private:
   }
 
   const char *GetHistoryFilePath() {
+// Compute the history path lazily.
 if (m_path.empty() && m_history && !m_prefix.empty()) {
-  FileSpec parent_path("~/.lldb");
-  FileSystem::Instance().Resolve(parent_path);
-  char history_path[PATH_MAX];
-  if (!llvm::sys::fs::create_directory(parent_path.GetPath())) {
-snprintf(history_path, sizeof(history_path), "~/.lldb/%s-history",
- m_prefix.c_str());
-  } else {
-snprintf(history_path, sizeof(history_path), "~/%s-widehistory",
- m_prefix.c_str());
+  llvm::SmallString<128> lldb_history_file;
+  llvm::sys::path::home_directory(lldb_history_file);
+  llvm::sys::path::append(lldb_history_file, ".lldb");
+
+  // LLDB stores its history in ~/.lldb/. If for some reason this directory
+  // isn't writable or cannot be created, history won't be available.
+  if (!llvm::sys::fs::create_directory(lldb_history_file)) {
+#if LLDB_EDITLINE_USE_WCHAR
+std::string filename = m_prefix + "-widehistory";
+#else
+std::string filename = m_prefix + "-history";
+#endif
+llvm::sys::path::append(lldb_history_file, filename);
+m_path = lldb_history_file.str();
   }
-  auto file_spec = FileSpec(history_path);
-  FileSystem::Instance().Resolve(file_spec);
-  m_path = file_spec.GetPath();
 }
+
 if (m_path.empty())
-  return NULL;
+  return nullptr;
+
 return m_path.c_str();
   }
 


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


[Lldb-commits] [PATCH] D62216: [EditLine] Rewrite GetHistoryFilePath

2019-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361412: [EditLine] Rewrite GetHistoryFilePath (authored 
by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62216?vs=200603&id=200791#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62216

Files:
  source/Host/common/Editline.cpp


Index: source/Host/common/Editline.cpp
===
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -171,23 +171,28 @@
   }
 
   const char *GetHistoryFilePath() {
+// Compute the history path lazily.
 if (m_path.empty() && m_history && !m_prefix.empty()) {
-  FileSpec parent_path("~/.lldb");
-  FileSystem::Instance().Resolve(parent_path);
-  char history_path[PATH_MAX];
-  if (!llvm::sys::fs::create_directory(parent_path.GetPath())) {
-snprintf(history_path, sizeof(history_path), "~/.lldb/%s-history",
- m_prefix.c_str());
-  } else {
-snprintf(history_path, sizeof(history_path), "~/%s-widehistory",
- m_prefix.c_str());
+  llvm::SmallString<128> lldb_history_file;
+  llvm::sys::path::home_directory(lldb_history_file);
+  llvm::sys::path::append(lldb_history_file, ".lldb");
+
+  // LLDB stores its history in ~/.lldb/. If for some reason this directory
+  // isn't writable or cannot be created, history won't be available.
+  if (!llvm::sys::fs::create_directory(lldb_history_file)) {
+#if LLDB_EDITLINE_USE_WCHAR
+std::string filename = m_prefix + "-widehistory";
+#else
+std::string filename = m_prefix + "-history";
+#endif
+llvm::sys::path::append(lldb_history_file, filename);
+m_path = lldb_history_file.str();
   }
-  auto file_spec = FileSpec(history_path);
-  FileSystem::Instance().Resolve(file_spec);
-  m_path = file_spec.GetPath();
 }
+
 if (m_path.empty())
-  return NULL;
+  return nullptr;
+
 return m_path.c_str();
   }
 


Index: source/Host/common/Editline.cpp
===
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -171,23 +171,28 @@
   }
 
   const char *GetHistoryFilePath() {
+// Compute the history path lazily.
 if (m_path.empty() && m_history && !m_prefix.empty()) {
-  FileSpec parent_path("~/.lldb");
-  FileSystem::Instance().Resolve(parent_path);
-  char history_path[PATH_MAX];
-  if (!llvm::sys::fs::create_directory(parent_path.GetPath())) {
-snprintf(history_path, sizeof(history_path), "~/.lldb/%s-history",
- m_prefix.c_str());
-  } else {
-snprintf(history_path, sizeof(history_path), "~/%s-widehistory",
- m_prefix.c_str());
+  llvm::SmallString<128> lldb_history_file;
+  llvm::sys::path::home_directory(lldb_history_file);
+  llvm::sys::path::append(lldb_history_file, ".lldb");
+
+  // LLDB stores its history in ~/.lldb/. If for some reason this directory
+  // isn't writable or cannot be created, history won't be available.
+  if (!llvm::sys::fs::create_directory(lldb_history_file)) {
+#if LLDB_EDITLINE_USE_WCHAR
+std::string filename = m_prefix + "-widehistory";
+#else
+std::string filename = m_prefix + "-history";
+#endif
+llvm::sys::path::append(lldb_history_file, filename);
+m_path = lldb_history_file.str();
   }
-  auto file_spec = FileSpec(history_path);
-  FileSystem::Instance().Resolve(file_spec);
-  m_path = file_spec.GetPath();
 }
+
 if (m_path.empty())
-  return NULL;
+  return nullptr;
+
 return m_path.c_str();
   }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2019-05-22 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 200800.
aadsm added a comment.

Remove unused variables


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62089

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

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

[Lldb-commits] [lldb] r361420 - Add DWARFTypeUnit to the Xcode project.

2019-05-22 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed May 22 12:05:59 2019
New Revision: 361420

URL: http://llvm.org/viewvc/llvm-project?rev=361420&view=rev
Log:
Add DWARFTypeUnit to the Xcode project.

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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=361420&r1=361419&r2=361420&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 22 12:05:59 2019
@@ -269,6 +269,7 @@
268900C613353E5F00698AC0 /* DWARFFormValue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* DWARFFormValue.cpp 
*/; };
4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
4C38996421B9AECD002BAEF4 /* DWARFLocationExpression.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4C38996221B9AECC002BAEF4 /* 
DWARFLocationExpression.cpp */; };
+   4C645D042295D3B600D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
*/; };
AFE228832060699D0042D0C8 /* DWARFUnit.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */; };
26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26FFC19514FC072100087D58 /* DYLDRendezvous.cpp 
*/; };
49CA96FC1E6AACC900C03FEE /* DataBufferHeap.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49CA96E61E6AAC6600C03FEE /* DataBufferHeap.cpp 
*/; };
@@ -1794,6 +1795,8 @@
4CD44CFE20B37C570003557C /* DWARFIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWARFIndex.h; 
sourceTree = ""; };
4C38996221B9AECC002BAEF4 /* DWARFLocationExpression.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = DWARFLocationExpression.cpp; path = 
source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp; sourceTree = 
SOURCE_ROOT; };
4C38996321B9AECC002BAEF4 /* DWARFLocationExpression.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name 
= DWARFLocationExpression.h; path = 
source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.h; sourceTree = 
SOURCE_ROOT; };
+   4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFTypeUnit.cpp; sourceTree = ""; };
+   4C645D032295D3B600D3C034 /* DWARFTypeUnit.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFTypeUnit.h; sourceTree = ""; };
7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFUnit.cpp; sourceTree = ""; };
7F2AAA5820601BDF00A422D8 /* DWARFUnit.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFUnit.h; sourceTree = ""; };
26FFC19514FC072100087D58 /* DYLDRendezvous.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DYLDRendezvous.cpp; sourceTree = ""; };
@@ -4160,6 +4163,8 @@
260C89D410F57C5600BB2B04 /* DWARFFormValue.h */,
4CD44CF820B37C440003557C /* DWARFIndex.cpp */,
4CD44CFE20B37C570003557C /* DWARFIndex.h */,
+   4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
*/,
+   4C645D032295D3B600D3C034 /* DWARFTypeUnit.h */,
7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */,
7F2AAA5820601BDF00A422D8 /* DWARFUnit.h */,
26A0DA4D140F721D006DA411 /* HashedNameToDIE.h 
*/,
@@ -7898,6 +7903,7 @@
26680337116005F1008E1FE4 /* SBBreakpoint.cpp in 
Sources */,
26DE204511618ADA00A093E2 /* SBAddress.cpp in 
Sources */,
26DE204711618AED00A093E2 /* SBSymbolContext.cpp 
in Sources */,
+   4C645D042295D3B600D3C034 /* DWARFTypeUnit.cpp 
in Sources */,
26DE204D11618E7A00A093E2 /* SBModule.cpp in 
Sources */,
26DE205D1161901400A093E2 /* SBFunction.cpp in 
Sources */,
26DE205F1161901B00A093E2 /* SBCompileUnit.cpp 
in Sources */,


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

[Lldb-commits] [lldb] r361440 - Actaully lock accesses to OptionValueFileSpecList objects

2019-05-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed May 22 14:58:52 2019
New Revision: 361440

URL: http://llvm.org/viewvc/llvm-project?rev=361440&view=rev
Log:
Actaully lock accesses to OptionValueFileSpecList objects

The patch in r359029 missed a few accessors and mutators. This patch
also changes the lock to a recursive one as OptionValueFileSpecList::Clear()
can be invoked from some of the other methods.

Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=361440&r1=361439&r2=361440&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Wed May 22 
14:58:52 2019
@@ -40,6 +40,7 @@ public:
  VarSetOperationType = eVarSetOperationAssign) = delete;
 
   bool Clear() override {
+std::lock_guard lock(m_mutex);
 m_current_value.Clear();
 m_value_was_set = false;
 return true;
@@ -52,22 +53,22 @@ public:
   // Subclass specific functions
 
   FileSpecList GetCurrentValue() const {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 return m_current_value;
   }
 
   void SetCurrentValue(const FileSpecList &value) {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 m_current_value = value;
   }
 
   void AppendCurrentValue(const FileSpec &value) {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 m_current_value.Append(value);
   }
 
 protected:
-  mutable std::mutex m_mutex;
+  mutable std::recursive_mutex m_mutex;
   FileSpecList m_current_value;
 };
 

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=361440&r1=361439&r2=361440&view=diff
==
--- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp Wed May 22 
14:58:52 2019
@@ -17,6 +17,7 @@ using namespace lldb_private;
 
 void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
 Stream &strm, uint32_t dump_mask) {
+  std::lock_guard lock(m_mutex);
   if (dump_mask & eDumpOptionType)
 strm.Printf("(%s)", GetTypeAsCString());
   if (dump_mask & eDumpOptionValue) {
@@ -43,6 +44,7 @@ void OptionValueFileSpecList::DumpValue(
 
 Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
+  std::lock_guard lock(m_mutex);
   Status error;
   Args args(value.str());
   const size_t argc = args.GetArgumentCount();
@@ -163,6 +165,6 @@ Status OptionValueFileSpecList::SetValue
 }
 
 lldb::OptionValueSP OptionValueFileSpecList::DeepCopy() const {
-  std::lock_guard lock(m_mutex);
+  std::lock_guard lock(m_mutex);
   return OptionValueSP(new OptionValueFileSpecList(m_current_value));
 }


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


[Lldb-commits] [lldb] r361442 - [Target] Protect Processes' language runtimes map with a mutex

2019-05-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed May 22 16:01:18 2019
New Revision: 361442

URL: http://llvm.org/viewvc/llvm-project?rev=361442&view=rev
Log:
[Target] Protect Processes' language runtimes map with a mutex

Summary:
From what I understand, it's possible for multiple threads to request
a specific language runtime (e.g. CPPLanguageRuntime). This leads to a data
race.

Reviewers: jingham, JDevlieghere, compnerd, clayborg

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

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=361442&r1=361441&r2=361442&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Wed May 22 16:01:18 2019
@@ -2701,6 +2701,7 @@ protected:
   bool m_should_detach; /// Should we detach if the process object goes away
 /// with an explicit call to Kill or Detach?
   LanguageRuntimeCollection m_language_runtimes;
+  std::recursive_mutex m_language_runtimes_mutex;
   InstrumentationRuntimeCollection m_instrumentation_runtimes;
   std::unique_ptr m_next_event_action_up;
   std::vector m_pre_resume_actions;

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=361442&r1=361441&r2=361442&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed May 22 16:01:18 2019
@@ -660,7 +660,10 @@ void Process::Finalize() {
   m_image_tokens.clear();
   m_memory_cache.Clear();
   m_allocated_memory_cache.Clear();
-  m_language_runtimes.clear();
+  {
+std::lock_guard guard(m_language_runtimes_mutex);
+m_language_runtimes.clear();
+  }
   m_instrumentation_runtimes.clear();
   m_next_event_action_up.reset();
   // Clear the last natural stop ID since it has a strong reference to this
@@ -1549,6 +1552,7 @@ LanguageRuntime *Process::GetLanguageRun
   if (m_finalizing)
 return nullptr;
 
+  std::lock_guard guard(m_language_runtimes_mutex);
   LanguageRuntimeCollection::iterator pos;
   pos = m_language_runtimes.find(language);
   if (pos == m_language_runtimes.end() || (retry_if_null && !(*pos).second)) {
@@ -1562,6 +1566,7 @@ LanguageRuntime *Process::GetLanguageRun
 }
 
 CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) {
+  std::lock_guard guard(m_language_runtimes_mutex);
   LanguageRuntime *runtime =
   GetLanguageRuntime(eLanguageTypeC_plus_plus, retry_if_null);
   if (runtime != nullptr &&
@@ -1571,6 +1576,7 @@ CPPLanguageRuntime *Process::GetCPPLangu
 }
 
 ObjCLanguageRuntime *Process::GetObjCLanguageRuntime(bool retry_if_null) {
+  std::lock_guard guard(m_language_runtimes_mutex);
   LanguageRuntime *runtime =
   GetLanguageRuntime(eLanguageTypeObjC, retry_if_null);
   if (runtime != nullptr && runtime->GetLanguageType() == eLanguageTypeObjC)
@@ -5604,7 +5610,10 @@ void Process::DidExec() {
   m_jit_loaders_up.reset();
   m_image_tokens.clear();
   m_allocated_memory_cache.Clear();
-  m_language_runtimes.clear();
+  {
+std::lock_guard guard(m_language_runtimes_mutex);
+m_language_runtimes.clear();
+  }
   m_instrumentation_runtimes.clear();
   m_thread_list.DiscardThreadPlans();
   m_memory_cache.Clear(true);
@@ -5673,14 +5682,17 @@ void Process::ModulesDidLoad(ModuleList
   // Iterate over a copy of this language runtime list in case the language
   // runtime ModulesDidLoad somehow causes the language runtime to be
   // unloaded.
-  LanguageRuntimeCollection language_runtimes(m_language_runtimes);
-  for (const auto &pair : language_runtimes) {
-// We must check language_runtime_sp to make sure it is not nullptr as we
-// might cache the fact that we didn't have a language runtime for a
-// language.
-LanguageRuntimeSP language_runtime_sp = pair.second;
-if (language_runtime_sp)
-  language_runtime_sp->ModulesDidLoad(module_list);
+  {
+std::lock_guard guard(m_language_runtimes_mutex);
+LanguageRuntimeCollection language_runtimes(m_language_runtimes);
+for (const auto &pair : language_runtimes) {
+  // We must check language_runtime_sp to make sure it is not nullptr as we
+  // might cache the fact that we didn't have a language runtime for a
+  // language.
+  LanguageRuntimeSP language_runtime_sp = pair.second;
+  if (language_runtime_sp)
+language_runtime_sp->ModulesDidLoad(module_list);
+}
   }
 
   // If we don't have an operating system plug-in, try to load one since


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


[Lldb-commits] [PATCH] D62273: Expression: correct relocation model for Windows

2019-05-22 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd created this revision.
compnerd added reviewers: aprantl, JDevlieghere, labath, clayborg, xiaobai, 
davide.
Herald added a project: LLDB.

The Windows CG model cannot generate code with the PIC relocation model as all 
code is implicitly PIC.  Invert the condition and inline the single use.  This 
improves expression handling on Windows.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D62273

Files:
  source/Expression/IRExecutionUnit.cpp


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -258,23 +258,17 @@
 log->Printf("Module being sent to JIT: \n%s", s.c_str());
   }

-  llvm::Triple triple(m_module->getTargetTriple());
-  llvm::Reloc::Model relocModel;
-
-  if (triple.isOSBinFormatELF()) {
-relocModel = llvm::Reloc::Static;
-  } else {
-relocModel = llvm::Reloc::PIC_;
-  }
-
   m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
   &error);

   llvm::EngineBuilder builder(std::move(m_module_up));
+  llvm::Triple triple(m_module->getTargetTriple());

   builder.setEngineKind(llvm::EngineKind::JIT)
   .setErrorStr(&error_string)
-  .setRelocationModel(relocModel)
+  .setRelocationModel(triple.isOSBinFormatMacho()
+  ? llvm::Reloc::PIC_
+  : llvm::Reloc::Static)
   .setMCJITMemoryManager(
   std::unique_ptr(new MemoryManager(*this)))
   .setOptLevel(llvm::CodeGenOpt::Less);


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -258,23 +258,17 @@
 log->Printf("Module being sent to JIT: \n%s", s.c_str());
   }

-  llvm::Triple triple(m_module->getTargetTriple());
-  llvm::Reloc::Model relocModel;
-
-  if (triple.isOSBinFormatELF()) {
-relocModel = llvm::Reloc::Static;
-  } else {
-relocModel = llvm::Reloc::PIC_;
-  }
-
   m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
   &error);

   llvm::EngineBuilder builder(std::move(m_module_up));
+  llvm::Triple triple(m_module->getTargetTriple());

   builder.setEngineKind(llvm::EngineKind::JIT)
   .setErrorStr(&error_string)
-  .setRelocationModel(relocModel)
+  .setRelocationModel(triple.isOSBinFormatMacho()
+  ? llvm::Reloc::PIC_
+  : llvm::Reloc::Static)
   .setMCJITMemoryManager(
   std::unique_ptr(new MemoryManager(*this)))
   .setOptLevel(llvm::CodeGenOpt::Less);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62273: Expression: correct relocation model for Windows

2019-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

I don't know much about this, but the change seems reasonable.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62273



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


[Lldb-commits] [lldb] r361443 - Expression: correct relocation model for Windows

2019-05-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed May 22 16:23:39 2019
New Revision: 361443

URL: http://llvm.org/viewvc/llvm-project?rev=361443&view=rev
Log:
Expression: correct relocation model for Windows

The Windows Code Generation model cannot generation code with the PIC relocation
model - all code is implicitly position independent due to the DLL load slide
that occurs if it is not loaded at the preferred base address.  Invert the
condition and inline the single use of the variable.  This should also aid the
WASM target.  This significantly improves the state of the (swift) repl on
Windows (and should aid in expression evaluation on Windows).

Modified:
lldb/trunk/source/Expression/IRExecutionUnit.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=361443&r1=361442&r2=361443&view=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed May 22 16:23:39 2019
@@ -258,23 +258,17 @@ void IRExecutionUnit::GetRunnableInfo(St
 log->Printf("Module being sent to JIT: \n%s", s.c_str());
   }
 
-  llvm::Triple triple(m_module->getTargetTriple());
-  llvm::Reloc::Model relocModel;
-
-  if (triple.isOSBinFormatELF()) {
-relocModel = llvm::Reloc::Static;
-  } else {
-relocModel = llvm::Reloc::PIC_;
-  }
-
   m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
   &error);
 
   llvm::EngineBuilder builder(std::move(m_module_up));
+  llvm::Triple triple(m_module->getTargetTriple());
 
   builder.setEngineKind(llvm::EngineKind::JIT)
   .setErrorStr(&error_string)
-  .setRelocationModel(relocModel)
+  .setRelocationModel(triple.isOSBinFormatMachO()
+  ? llvm::Reloc::PIC_
+  : llvm::Reloc::Static)
   .setMCJITMemoryManager(
   std::unique_ptr(new MemoryManager(*this)))
   .setOptLevel(llvm::CodeGenOpt::Less);


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


[Lldb-commits] [PATCH] D62273: Expression: correct relocation model for Windows

2019-05-22 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd closed this revision.
compnerd added a comment.

SVN r361443


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62273



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


[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-05-22 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd accepted this revision.
compnerd added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp:1094
+  if (arch_type == llvm::Triple::x86_64 &&
+  os_type != llvm::Triple::OSType::Win32) {
 return ABISP(new ABISysV_x86_64(process_sp));

compnerd wrote:
> This really isn't correct.  There is no reason to assume that everything on 
> x86_64 uses the SysV ABI.  Can you convert this to a switch over the OS type 
> and return it from the known OSes (Linux, BSD, and Darwin do conform to SysV, 
> the others can return `ABISP()`.
Nit: a `switch` is clearer and easier to extend.



Comment at: lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp:1096
+  if (arch_type == llvm::Triple::x86_64
+&& os_type == llvm::Triple::OSType::Win32) {
+return ABISP(new ABIWindows_x86_64(process_sp));

Nit: I think that `arch.GetTriple().isOSWindows()` is nicer than the explicit 
check of `Win32`.



Comment at: lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h:47
+ if (cfa & (16ull - 1ull))
+  return false; // Not 8 byte aligned
+if (cfa == 0)

The comment seems wrong


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [lldb] r361444 - [lldb] Fix use-of-uninitialized-value in Driver

2019-05-22 Thread Jorge Gorbe Moya via lldb-commits
Author: jgorbe
Date: Wed May 22 16:37:48 2019
New Revision: 361444

URL: http://llvm.org/viewvc/llvm-project?rev=361444&view=rev
Log:
[lldb] Fix use-of-uninitialized-value in Driver

The driver passes by reference an uninitialized num_errors variable to
RunCommandInterpreter. This should be fine, as it's supposed to be
an output argument, but the reproducer instrumentation reads it in order
to record the value of all the arguments to the function.

This change fixes it by initializing num_errors to 0 before calling
RunCommandInterpreter.

Modified:
lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=361444&r1=361443&r2=361444&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Wed May 22 16:37:48 2019
@@ -610,7 +610,7 @@ int Driver::MainLoop() {
   // that run the target won't run in a sensible way.
   bool old_async = m_debugger.GetAsync();
   m_debugger.SetAsync(false);
-  int num_errors;
+  int num_errors = 0;
 
   SBCommandInterpreterRunOptions options;
   options.SetStopOnError(true);


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


[Lldb-commits] [PATCH] D62211: Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

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

^ Feel free to address that in a follow up commit


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62211



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


[Lldb-commits] [PATCH] D62211: Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

2019-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1073
+bool DWARFDebugInfoEntry::AppendTypeName(const DWARFDIE die, Stream &s) {
+  if (die) {
+if (die.GetDIE()->IsNULL()) {

jankratochvil wrote:
> JDevlieghere wrote:
> > How about turning this into an early return?
> This deep nesting is a general coding style in LLDB so I try to keep it.  
> Yes, I would like to (and I use elsewhere) early returns to keep the nesting 
> low. I will submit another patch for it when you say it is OK to clean it up.
The deep nesting is definitely a bug and not a feature. We've been removing it 
where it makes sense. 


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62211



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


[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

2019-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:261
+  dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
+  clang::DeclContext *decl_ctx =
+  GetCachedClangDeclContextForDIE(signature_die);

Same here: `if (clang::DeclContext *decl_ctx ...`.


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

https://reviews.llvm.org/D62246



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


[Lldb-commits] [lldb] r361447 - Ack, added DWARFTypeUnit to the wrong target...

2019-05-22 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed May 22 17:12:45 2019
New Revision: 361447

URL: http://llvm.org/viewvc/llvm-project?rev=361447&view=rev
Log:
Ack, added DWARFTypeUnit to the wrong target...

LLDB -> liblldbcore.a

Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=361447&r1=361446&r2=361447&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Wed May 22 
17:12:45 2019
@@ -441,7 +441,7 @@ public:
"the target.max-children-count setting.\n";
   }
 
-  const CommandHistory &GetCommandHistory() const { return m_command_history; }
+  //const CommandHistory &GetCommandHistory() const { return 
m_command_history; }
 
   CommandHistory &GetCommandHistory() { return m_command_history; }
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=361447&r1=361446&r2=361447&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 22 17:12:45 2019
@@ -269,7 +269,7 @@
268900C613353E5F00698AC0 /* DWARFFormValue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* DWARFFormValue.cpp 
*/; };
4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
4C38996421B9AECD002BAEF4 /* DWARFLocationExpression.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4C38996221B9AECC002BAEF4 /* 
DWARFLocationExpression.cpp */; };
-   4C645D042295D3B600D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
*/; };
+   4C645D0822961B3C00D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
*/; };
AFE228832060699D0042D0C8 /* DWARFUnit.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */; };
26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26FFC19514FC072100087D58 /* DYLDRendezvous.cpp 
*/; };
49CA96FC1E6AACC900C03FEE /* DataBufferHeap.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49CA96E61E6AAC6600C03FEE /* DataBufferHeap.cpp 
*/; };
@@ -7480,7 +7480,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
-   shellScript = "# Run the just-built gtest 
executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
conflict with finding the lldb module later,\n# which causes the python 
exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; then\n   
 mv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to find 
the lldb package\nexport 
PYTHONPATH=${BUILT_PRODUCTS_DIR}/LLDB.framework/Resources/Python\n\n# Set the 
terminal to VT100 so that the editline internals don't\n# fail.\nexport 
TERM=vt100\n\n# We must redirect stdin to /dev/null: without this, 
xcodebuild\n# will wait forever for input when we run the 
TestExceptionStateChecking\n# test.\n${BUILT_PRODUCTS_DIR}/lldb-gtest 
--gtest_output=xml:${BUILD_DIR}/gtest-results.xml < /dev/null\nRETCODE=$?\n\nif 
[ -f \"${BUILT_PRODUCTS_DIR}/park.lldb.py\" ]; then\nmv -f 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\" 
\"${BUILT_PRODUCTS_DIR}/lldb.py\"\nfi\n\nexit ${RETCODE}";
+   shellScript = "# Run the just-built gtest 
executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
conflict with finding the lldb module later,\n# which causes the python 
exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; then\n   
 mv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to find 
the lldb package\nexport 
PYTHONPATH=${BUILT_PRODUCTS_DIR}/LLDB.framework/Resources/Python\n\n# Set the 
terminal to VT100 so that the editline internals don't\n# fail.\nexport 
TERM=vt100\n\n# We must redirect stdin to /dev/null: without this, 
xcodebuild\n# will wait forever for inpu

[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-05-22 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour marked an inline comment as done.
kusmour added inline comments.



Comment at: lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp:1096
+  if (arch_type == llvm::Triple::x86_64
+&& os_type == llvm::Triple::OSType::Win32) {
+return ABISP(new ABIWindows_x86_64(process_sp));

compnerd wrote:
> Nit: I think that `arch.GetTriple().isOSWindows()` is nicer than the explicit 
> check of `Win32`.
got it



Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-05-22 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour updated this revision to Diff 200844.
kusmour added a comment.

update nit


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
  lldb/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
  lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

Index: lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -133,14 +133,14 @@
  nullptr,
  0},
 {DEFINE_GPR(r10, nullptr),
- {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_REGNUM_GENERIC_ARG5,
+ {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r10_x86_64},
  nullptr,
  nullptr,
  nullptr,
  0},
 {DEFINE_GPR(r11, nullptr),
- {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_REGNUM_GENERIC_ARG6,
+ {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r11_x86_64},
  nullptr,
  nullptr,
Index: lldb/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
===
--- /dev/null
+++ lldb/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_lldb_library(lldbPluginABIWindows_x86_64 PLUGIN
+  ABIWindows_x86_64.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Support
+  )
Index: lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
@@ -0,0 +1,99 @@
+//===-- ABIWindows_x86_64.h *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ABIWindows_x86_64_h_
+#define liblldb_ABIWindows_x86_64_h_
+
+#include "lldb/Target/ABI.h"
+#include "lldb/lldb-private.h"
+
+class ABIWindows_x86_64 : public lldb_private::ABI {
+public:
+  ~ABIWindows_x86_64() override = default;
+
+  size_t GetRedZoneSize() const override;
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  // In Windows_x86_64 ABI, stack will always be maintained 16-byte aligned
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+	  if (cfa & (16ull - 1ull))
+  return false; // Not 16 byte aligned
+if (cfa == 0)
+  return false; // Zero is not a valid stack address
+return true;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// We have a 64 bit address space, so anything is valid as opcodes
+// aren't fixed width...
+return true;
+  }
+
+  const lldb_private::RegisterInfo *
+  GetRegisterInfoArray(uint32_t &count) override;
+
+  bool GetPointerReturnRegister(const char *&name) override;
+
+  //--
+  // Static Functions
+  //--
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //--
+  // PluginInterface protocol
+  //--
+
+  lldb_private::ConstString GetPlug

Re: [Lldb-commits] [lldb] r361447 - Ack, added DWARFTypeUnit to the wrong target...

2019-05-22 Thread Frédéric Riss via lldb-commits


> On May 22, 2019, at 5:12 PM, Jim Ingham via lldb-commits 
>  wrote:
> 
> Author: jingham
> Date: Wed May 22 17:12:45 2019
> New Revision: 361447
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=361447&view=rev
> Log:
> Ack, added DWARFTypeUnit to the wrong target...
> 
> LLDB -> liblldbcore.a
> 
> Modified:
>lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
>lldb/trunk/lldb.xcodeproj/project.pbxproj
>lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
>lldb/trunk/source/Host/common/Editline.cpp
> 
> Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=361447&r1=361446&r2=361447&view=diff
> ==
> --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Wed May 22 
> 17:12:45 2019
> @@ -441,7 +441,7 @@ public:
>"the target.max-children-count setting.\n";
>   }
> 
> -  const CommandHistory &GetCommandHistory() const { return 
> m_command_history; }
> +  //const CommandHistory &GetCommandHistory() const { return 
> m_command_history; }
> 
>   CommandHistory &GetCommandHistory() { return m_command_history; }

I don’t think you meant to commit this ^^ ?

> 
> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=361447&r1=361446&r2=361447&view=diff
> ==
> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 22 17:12:45 2019
> @@ -269,7 +269,7 @@
>   268900C613353E5F00698AC0 /* DWARFFormValue.cpp in Sources */ = 
> {isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* DWARFFormValue.cpp 
> */; };
>   4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
> = PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
>   4C38996421B9AECD002BAEF4 /* DWARFLocationExpression.cpp in 
> Sources */ = {isa = PBXBuildFile; fileRef = 4C38996221B9AECC002BAEF4 /* 
> DWARFLocationExpression.cpp */; };
> - 4C645D042295D3B600D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
> {isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
> */; };
> + 4C645D0822961B3C00D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
> {isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
> */; };
>   AFE228832060699D0042D0C8 /* DWARFUnit.cpp in Sources */ = {isa 
> = PBXBuildFile; fileRef = 7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */; };
>   26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
> {isa = PBXBuildFile; fileRef = 26FFC19514FC072100087D58 /* DYLDRendezvous.cpp 
> */; };
>   49CA96FC1E6AACC900C03FEE /* DataBufferHeap.cpp in Sources */ = 
> {isa = PBXBuildFile; fileRef = 49CA96E61E6AAC6600C03FEE /* DataBufferHeap.cpp 
> */; };
> @@ -7480,7 +7480,7 @@
>   );
>   runOnlyForDeploymentPostprocessing = 0;
>   shellPath = "/bin/sh -x";
> - shellScript = "# Run the just-built gtest 
> executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
> need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
> conflict with finding the lldb module later,\n# which causes the python 
> exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; then\n 
>mv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
> \"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to find 
> the lldb package\nexport 
> PYTHONPATH=${BUILT_PRODUCTS_DIR}/LLDB.framework/Resources/Python\n\n# Set the 
> terminal to VT100 so that the editline internals don't\n# fail.\nexport 
> TERM=vt100\n\n# We must redirect stdin to /dev/null: without this, 
> xcodebuild\n# will wait forever for input when we run the 
> TestExceptionStateChecking\n# test.\n${BUILT_PRODUCTS_DIR}/lldb-gtest 
> --gtest_output=xml:${BUILD_DIR}/gtest-results.xml < 
> /dev/null\nRETCODE=$?\n\nif [ -f \"${BUILT_PRODUCTS_DIR}/park.lldb.py\" ]; 
> then\nmv -f \"${BUILT_PRODUCTS_DIR}/park.lldb.py\" 
> \"${BUILT_PRODUCTS_DIR}/lldb.py\"\nfi\n\nexit ${RETCODE}";
> + shellScript = "# Run the just-built gtest 
> executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
> need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
> conflict with finding the lldb module later,\n# which causes the python 
> exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; then\n 
>mv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
> \"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to find 
> the lldb pack

Re: [Lldb-commits] [lldb] r361447 - Ack, added DWARFTypeUnit to the wrong target...

2019-05-22 Thread Jim Ingham via lldb-commits
I was also eliminating unused const versions of functions in that tree.  It 
wasn't used, so I don't think it matters, but I shouldn't have done it at the 
same time...

Jim


> On May 22, 2019, at 5:24 PM, Frédéric Riss  wrote:
> 
> 
> 
>> On May 22, 2019, at 5:12 PM, Jim Ingham via lldb-commits 
>>  wrote:
>> 
>> Author: jingham
>> Date: Wed May 22 17:12:45 2019
>> New Revision: 361447
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=361447&view=rev
>> Log:
>> Ack, added DWARFTypeUnit to the wrong target...
>> 
>> LLDB -> liblldbcore.a
>> 
>> Modified:
>>   lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
>>   lldb/trunk/lldb.xcodeproj/project.pbxproj
>>   lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
>>   lldb/trunk/source/Host/common/Editline.cpp
>> 
>> Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=361447&r1=361446&r2=361447&view=diff
>> ==
>> --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
>> +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Wed May 22 
>> 17:12:45 2019
>> @@ -441,7 +441,7 @@ public:
>>   "the target.max-children-count setting.\n";
>>  }
>> 
>> -  const CommandHistory &GetCommandHistory() const { return 
>> m_command_history; }
>> +  //const CommandHistory &GetCommandHistory() const { return 
>> m_command_history; }
>> 
>>  CommandHistory &GetCommandHistory() { return m_command_history; }
> 
> I don’t think you meant to commit this ^^ ?
> 
>> 
>> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=361447&r1=361446&r2=361447&view=diff
>> ==
>> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
>> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 22 17:12:45 2019
>> @@ -269,7 +269,7 @@
>>  268900C613353E5F00698AC0 /* DWARFFormValue.cpp in Sources */ = 
>> {isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* 
>> DWARFFormValue.cpp */; };
>>  4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
>> = PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
>>  4C38996421B9AECD002BAEF4 /* DWARFLocationExpression.cpp in 
>> Sources */ = {isa = PBXBuildFile; fileRef = 4C38996221B9AECC002BAEF4 /* 
>> DWARFLocationExpression.cpp */; };
>> -4C645D042295D3B600D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
>> {isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
>> */; };
>> +4C645D0822961B3C00D3C034 /* DWARFTypeUnit.cpp in Sources */ = 
>> {isa = PBXBuildFile; fileRef = 4C645D022295D3B500D3C034 /* DWARFTypeUnit.cpp 
>> */; };
>>  AFE228832060699D0042D0C8 /* DWARFUnit.cpp in Sources */ = {isa 
>> = PBXBuildFile; fileRef = 7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */; };
>>  26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
>> {isa = PBXBuildFile; fileRef = 26FFC19514FC072100087D58 /* 
>> DYLDRendezvous.cpp */; };
>>  49CA96FC1E6AACC900C03FEE /* DataBufferHeap.cpp in Sources */ = 
>> {isa = PBXBuildFile; fileRef = 49CA96E61E6AAC6600C03FEE /* 
>> DataBufferHeap.cpp */; };
>> @@ -7480,7 +7480,7 @@
>>  );
>>  runOnlyForDeploymentPostprocessing = 0;
>>  shellPath = "/bin/sh -x";
>> -shellScript = "# Run the just-built gtest 
>> executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
>> need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
>> conflict with finding the lldb module later,\n# which causes the python 
>> exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; 
>> then\nmv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
>> \"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to 
>> find the lldb package\nexport 
>> PYTHONPATH=${BUILT_PRODUCTS_DIR}/LLDB.framework/Resources/Python\n\n# Set 
>> the terminal to VT100 so that the editline internals don't\n# fail.\nexport 
>> TERM=vt100\n\n# We must redirect stdin to /dev/null: without this, 
>> xcodebuild\n# will wait forever for input when we run the 
>> TestExceptionStateChecking\n# test.\n${BUILT_PRODUCTS_DIR}/lldb-gtest 
>> --gtest_output=xml:${BUILD_DIR}/gtest-results.xml < 
>> /dev/null\nRETCODE=$?\n\nif [ -f \"${BUILT_PRODUCTS_DIR}/park.lldb.py\" ]; 
>> then\nmv -f \"${BUILT_PRODUCTS_DIR}/park.lldb.py\" 
>> \"${BUILT_PRODUCTS_DIR}/lldb.py\"\nfi\n\nexit ${RETCODE}";
>> +shellScript = "# Run the just-built gtest 
>> executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
>> need to hide the lldb.py that goes into BUILT_PRODUCTS\n# bec

[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-22 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 200846.
guiandrade marked an inline comment as done.
guiandrade edited the summary of this revision.
guiandrade added a comment.

Making this revision be responsible only for adding the 'g' packet handler and 
tests. Also, I'm starting to implement a stronger test to verify the actual 
content of the packets returned by the new handler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/source/Utility/StringExtractorGDBRemote.cpp

Index: lldb/source/Utility/StringExtractorGDBRemote.cpp
===
--- lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -377,9 +377,7 @@
 break;
 
   case 'g':
-if (packet_size == 1)
-  return eServerPacketType_g;
-break;
+return eServerPacketType_g;
 
   case 'G':
 return eServerPacketType_G;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -178,6 +178,8 @@
 
   PacketResult Handle_QPassSignals(StringExtractorGDBRemote &packet);
 
+  PacketResult Handle_g(StringExtractorGDBRemote &packet);
+
   void SetCurrentThreadID(lldb::tid_t tid);
 
   lldb::tid_t GetCurrentThreadID() const;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -187,6 +187,9 @@
   StringExtractorGDBRemote::eServerPacketType_jTraceConfigRead,
   &GDBRemoteCommunicationServerLLGS::Handle_jTraceConfigRead);
 
+  RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_g,
+&GDBRemoteCommunicationServerLLGS::Handle_g);
+
   RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_k,
 [this](StringExtractorGDBRemote packet, Status &error,
bool &interrupt, bool &quit) {
@@ -1891,6 +1894,68 @@
   return SendPacketNoLock("l");
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) {
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
+
+  // Move past packet name.
+  packet.SetFilePos(strlen("g"));
+
+  // Get the thread to use.
+  NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
+  if (!thread) {
+LLDB_LOG(log, "failed, no thread available");
+return SendErrorResponse(0x15);
+  }
+
+  // Get the thread's register context.
+  NativeRegisterContext ®_ctx = thread->GetRegisterContext();
+
+  // As the register offsets are not necessarily sorted,
+  // use a map to store all registers data.
+  std::map regs_buffer;
+  for (uint32_t reg_num = 0; reg_num < reg_ctx.GetUserRegisterCount();
+   ++reg_num) {
+const RegisterInfo *reg_info = reg_ctx.GetRegisterInfoAtIndex(reg_num);
+
+if (reg_info == nullptr) {
+  LLDB_LOG(log, "failed to get register info for register index {0}",
+   reg_num);
+  return SendErrorResponse(0x15);
+}
+
+if (reg_info->value_regs != nullptr)
+  continue; // skip registers that are contained in other registers
+
+RegisterValue reg_value;
+Status error = reg_ctx.ReadRegister(reg_info, reg_value);
+if (error.Fail()) {
+  LLDB_LOG(log, "failed to read register at index {0}", reg_num);
+  return SendErrorResponse(0x15);
+}
+
+// Write the register data to the buffer.
+const uint8_t *const data =
+reinterpret_cast(reg_value.GetBytes());
+for (uint32_t i = 0; i < reg_info->byte_size; ++i)
+  regs_buffer[reg_info->byte_offset + i] = data[i];
+  }
+
+  // Write the response.
+  StreamGDBRemote response;
+  uint32_t next_pos = 0;
+  for (const auto &it : regs_buffer) {
+// Populate the gap between the last and the current position
+// with zeroes.
+while (next_pos++ < it.first)
+  response.PutHex8(0);
+
+response.PutHex8(it.second);
+  }
+
+  return SendPacketNoLock(response.GetString());
+}
+
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
=

[Lldb-commits] [lldb] r361451 - [ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE extensions

2019-05-22 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Wed May 22 17:46:34 2019
New Revision: 361451

URL: http://llvm.org/viewvc/llvm-project?rev=361451&view=rev
Log:
[ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE 
extensions

This patch updates assembler attributes for AArch64 targets so we can 
disassemble newer instructions supported in ISA version 8.5 and SVE extensions.

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



Modified:
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=361451&r1=361450&r2=361451&view=diff
==
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Wed May 
22 17:46:34 2019
@@ -1188,10 +1188,10 @@ DisassemblerLLVMC::DisassemblerLLVMC(con
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can
-  // disassemble newer instructions.
+  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
+  // can disassemble newer instructions.
   if (triple.getArch() == llvm::Triple::aarch64)
-features_str += "+v8.2a";
+features_str += "+v8.5a,+sve2";
 
   if (triple.getArch() == llvm::Triple::aarch64
   && triple.getVendor() == llvm::Triple::Apple) {


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


[Lldb-commits] [PATCH] D62235: [ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE extensions

2019-05-22 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361451: [ARM64][AArch64] Update disassembler attributes 
to ARMv8.5 ISA with SVE… (authored by omjavaid, committed by ).

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62235

Files:
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp


Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
===
--- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -1188,10 +1188,10 @@
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can
-  // disassemble newer instructions.
+  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
+  // can disassemble newer instructions.
   if (triple.getArch() == llvm::Triple::aarch64)
-features_str += "+v8.2a";
+features_str += "+v8.5a,+sve2";
 
   if (triple.getArch() == llvm::Triple::aarch64
   && triple.getVendor() == llvm::Triple::Apple) {


Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
===
--- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -1188,10 +1188,10 @@
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can
-  // disassemble newer instructions.
+  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
+  // can disassemble newer instructions.
   if (triple.getArch() == llvm::Triple::aarch64)
-features_str += "+v8.2a";
+features_str += "+v8.5a,+sve2";
 
   if (triple.getArch() == llvm::Triple::aarch64
   && triple.getVendor() == llvm::Triple::Apple) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-22 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Thank you so much for the feedback!

In D62221#1511035 , @clayborg wrote:

> Using 'g' packets seems fine to me and we might be able to just enable it. We 
> will need to ensure that this doesn't regress stepping times so we will need 
> to get people to try this out on their systems first. Most of our targets 
> expedite enough registers in the stop reply packet where we don't need to 
> read that many registers. Are you using lldb-server as your GDB remote binary 
> or another GDB server?


I am using lldb-server, @clayborg.

In D62221#1511499 , @labath wrote:

> I think it would be good to split this patch into two:
>
> - implementing `g` packet in lldb-server
> - deciding when lldb sends the `g` packet
>
>   For the first part, I don't see any reason why lldb-server should *not* 
> support the `g` packet.
>
>   The second part, as others have pointed out is a bit more tricky, as the 
> `g` packet may not always be a win. For that, it would be nice to know more 
> about your use case. When you say "all registers are being fetched every 
> step", do you mean that lldb does that on its own, or that you (as in, 
> something external to lldb) for whatever reason want to have all registers 
> read out after each step?
>
>   If it's the first thing, then we can probably do something even better, and 
> make sure that lldb-server sends the required registers directly in the 
> stop-reply packet.
>
>   If it's the second thing then we can play around with the conditions under 
> which lldb can use the `g` packet. Eg. it definitely sounds like `register 
> read --all` would benefit from this packet, but maybe `register read 
> $specific_register` might not. Or this may not even matter, as for the most 
> common values of `$specific_register`, we should have the data available from 
> the stop-reply packets, and others aren't really used that often...


@labath, I have a debug engine that populates a UI responsible for displaying 
register contents, hence I end up having to fetch all of them every step if the 
user decides to leave it on. I understand that using `g` packets isn't the best 
way to go every time, but I think if we can find a nice way to decide when to 
use them, it would be a win. So I will separate this patch into two as you 
suggested to make it easier to discuss each part.




Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py:585
+
+def g_returns_correct_data(self):
+procs = self.prep_debug_monitor_and_inferior()

@labath, is it something like this you have in mind? If it is, where should we 
add the file that contains the inferior that sets the registers?



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1912-1954
+  NativeRegisterContext ®_ctx = thread->GetRegisterContext();
+
+  // As the register offsets are not necessarily sorted,
+  // use a map to store all registers data.
+  std::map regs_buffer;
+  for (uint32_t reg_num = 0; reg_num < reg_ctx.GetUserRegisterCount();
+   ++reg_num) {

labath wrote:
> There's a `NativeRegisterContext::ReadAllRegisterValues` function. Can you 
> check if that returns the data in the format that you need here?
> 
> Even if it doesn't, there's a good chance we could tweak it so that it does, 
> as I believe it's now only used for implementing QSave/RestoreRegisterState, 
> and the format we use for saving that is completely up to us.
Apparently it is not:

[[ https://pastebin.com/raw/zFRQguQP | Reading each register individually ]] 
[[ https://pastebin.com/raw/t8qJAJAE | Using reg_ctx.ReadAllRegisterValues(.) 
]].

Yeah, it would be convenient to be able to reuse that function, but then 
wouldn't that involve modifying several ReadAllRegisterValues implementations 
in order to do so?



Comment at: lldb/source/Utility/StringExtractorGDBRemote.cpp:379-382
   case 'g':
-if (packet_size == 1)
-  return eServerPacketType_g;
-break;

clayborg wrote:
> What if another packet starts with 'g'?
I removed the if because I thought the packet could have the thread id appended 
to it in [[ 
https://github.com/llvm/llvm-project/blob/1f46d524a1c6ac66bbd803caf5f1206603759a5f/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp#L535
   | 
ldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp#L535 ]]. 
If that's really the case, should we still try to make it more robust to avoid 
prefix collisions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-22 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Does your feature print *all* the registers including floating point/vector 
registers?  Or just the main general purpose registers?  In debugserver, we 
expedite the register values for the stopping thread:

1558572448.355979919 < 624> read packet: 
$T05thread:3ef471;threads:3ef471;thread-pcs:10001e939;00:d803;01:0080536cff7f;02:d803;03:b0e0bfeffe7f;04:;05:2900;06:a0e2bfeffe7f;07:a8e0bfeffe7f;08:;09:;0a:;0b:;0c:00e2bfeffe7f;0d:b0e2bfeffe7f;0e:;0f:2900;10:39e901000100;11:4602;12:2b00;13:;14:;metype:6;mecount:2;medata:2;medata:0;memory:0x7ffeefbfe2a0=10e7bfeffe7f06528a6dff7f;memory:0x7ffeefbfe710=40e7bfeffe7f86838b6dff7f;#00

because the cost of sending all the register values every time is miniscule.  
When we are at a "public stop" (visible to the user), we may need to get 
information about *all* the threads - for this, we use the JSON-formatted 
jThreadsInfo packet which gives you the GPR register values for every thread 
(in this example, there is only one thread) -

1558572448.379079103 <  16> send packet: $jThreadsInfo#c1
1558572448.379371881 <1609> read packet: 
$[{"tid":4125809,"metype":6,"medata":[2,0],"reason":"exception","qaddr":4295855808,"associated_with_dispatch_queue":true,"dispatch_queue_t":140735794523072,"qname":"com.apple.main-thread","qkind":"serial","qserialnum":1,"registers":{"0":"","1":"c0f9bfeffe7f","2":"0200","3":"1000","4":"0006","5":"d34c566cff7f","6":"50e5bfeffe7f","7":"f8e4bfeffe7f","8":"4400","9":"4002","10":"0300","11":"4602","12":"583a566cff7f","13":"753a566cff7f","14":"","15":"","16":"66b7a56dff7f","17":"4602","18":"2b00","19":"","20":""}],"memory":[{"address":140732920751440,"bytes":"80e5bfeffe7f32d0846dff7f"}],{"address":140732920751488,"bytes":"a0e5bfeffe7ff490856dff7f"}],{"address":140732920751520,"bytes":"d0e5bfeffe7f91e7766aff7f"}],{"address":140732920751568,"bytes":"70e6bfeffe7ffe15896dff7f"}],{"address":140732920751728,"bytes":"b0e6bfeffe7fde14896dff7f"}],{"address":140732920751792,"bytes":"10e7bfeffe7ffd7e8a6dff7f"}],{"address":140732920751888,"bytes":"40e7bfeffe7fcf838b6dff7f"}],{"address":140732920751936,"bytes":"d0edbfeffe7f986901000100"}],{"address":140732920753616,"bytes":"40f7bfeffe7f3a4001000100"}],{"address":140732920756032,"bytes":"60f8bfeffe7f27e20100"}],{"address":140732920756320,"bytes":"88f8bfeffe7f25e00100"}],{"address":140732920756360,"bytes":"0100"}]]}]]#00

I think for your use case, having lldb-server provide all the values up front 
(if it isn't already) is the approach you should take.

(the only thing that's might be unexpected is that the register values & memory 
data are sent as *strings* - JSON only represents numbers in base10; this is 
sending the register & memory data in target-endian order, little endian here, 
in the hex-bytes strings.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [lldb] r361455 - Remove unused const version of CommandInterpreter::GetCommandHistory.

2019-05-22 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed May 22 18:40:33 2019
New Revision: 361455

URL: http://llvm.org/viewvc/llvm-project?rev=361455&view=rev
Log:
Remove unused const version of CommandInterpreter::GetCommandHistory.

Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=361455&r1=361454&r2=361455&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Wed May 22 
18:40:33 2019
@@ -441,8 +441,6 @@ public:
"the target.max-children-count setting.\n";
   }
 
-  //const CommandHistory &GetCommandHistory() const { return 
m_command_history; }
-
   CommandHistory &GetCommandHistory() { return m_command_history; }
 
   bool IsActive();


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


Re: [Lldb-commits] [lldb] r361447 - Ack, added DWARFTypeUnit to the wrong target...

2019-05-22 Thread Davide Italiano via lldb-commits
> Modified: lldb/trunk/source/Host/common/Editline.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=361447&r1=361446&r2=361447&view=diff
> ==
> --- lldb/trunk/source/Host/common/Editline.cpp (original)
> +++ lldb/trunk/source/Host/common/Editline.cpp Wed May 22 17:12:45 2019
> @@ -978,7 +978,9 @@ void Editline::ConfigureEditor(bool mult
>TerminalSizeChanged();
>
>if (m_history_sp && m_history_sp->IsValid()) {
> -m_history_sp->Load();
> +if (!m_history_sp->Load()) {
> +fputs("Could not load history file\n.", m_output_file);
> +}
>  el_wset(m_editline, EL_HIST, history, m_history_sp->GetHistoryPtr());
>}
>el_set(m_editline, EL_CLIENTDATA, this);
>
>

Did you mean to commit this part or you just had it lying around?
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-22 Thread Jason Molenda via lldb-commits
If the remote serial protocol stub includes the GPR register values in the stop 
packet / jThreadsInfo packet, lldb will pre-seed the thread's RegisterContext 
with these values. So if the user asks for rax, lldb will already have rax for 
instance. debugserver doesn't send the vector/floating point register for 
instance, so if someone monitors xmm0, lldb would need to request xmm0 after 
every step if debugserver was the remote serial protocol agent.

On 05/22/19 06:30 PM, Guilherme Andrade   wrote: 
> 
> 
> 
> Thank you for the suggestion, Jason! The feature is like this 
> https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-use-the-registers-window?view=vs-2019
>  - the user can select the register sets they want to see. There's an extra 
> complication, though. I am using the C++ API, so I actually get the registers 
> by calling SBFrame::GetRegisters(), and as I start retrieving their fields, 
> the `p` packets are lazily exchanged. Do you know if there is a way to get 
> their values up front from that API, or a way to modify that lazy behavior?
> 
> 
> 
> 
> On Wed, May 22, 2019 at 8:59 PM Jason Molenda via Phabricator 
>  wrote:
> 
> > jasonmolenda added a comment.
> > 
> > Does your feature print *all* the registers including floating point/vector 
> > registers? Or just the main general purpose registers? In debugserver, we 
> > expedite the register values for the stopping thread:
> > 
> > 1558572448.355979919 < 624> read packet: 
> > $T05thread:3ef471;threads:3ef471;thread-pcs:10001e939;00:d803;01:0080536cff7f;02:d803;03:b0e0bfeffe7f;04:;05:2900;06:a0e2bfeffe7f;07:a8e0bfeffe7f;08:;09:;0a:;0b:;0c:00e2bfeffe7f;0d:b0e2bfeffe7f;0e:;0f:2900;10:39e901000100;11:4602;12:2b00;13:;14:;metype:6;mecount:2;medata:2;medata:0;memory:0x7ffeefbfe2a0=10e7bfeffe7f06528a6dff7f;memory:0x7ffeefbfe710=40e7bfeffe7f86838b6dff7f;#00
> > 
> > because the cost of sending all the register values every time is 
> > miniscule. When we are at a "public stop" (visible to the user), we may 
> > need to get information about *all* the threads - for this, we use the 
> > JSON-formatted jThreadsInfo packet which gives you the GPR register values 
> > for every thread (in this example, there is only one thread) -
> > 
> > 1558572448.379079103 < 16> send packet: $jThreadsInfo#c1
> > 1558572448.379371881 <1609> read packet: 
> > $[{"tid":4125809,"metype":6,"medata":[2,0],"reason":"exception","qaddr":4295855808,"associated_with_dispatch_queue":true,"dispatch_queue_t":140735794523072,"qname":"com.apple.main-thread","qkind":"serial","qserialnum":1,"registers":{"0":"","1":"c0f9bfeffe7f","2":"0200","3":"1000","4":"0006","5":"d34c566cff7f","6":"50e5bfeffe7f","7":"f8e4bfeffe7f","8":"4400","9":"4002","10":"0300","11":"4602","12":"583a566cff7f","13":"753a566cff7f","14":"","15":"","16":"66b7a56dff7f","17":"4602","18":"2b00","19":"","20":""}],"memory":[{"address":140732920751440,"bytes":"80e5bfeffe7f32d0846dff7f"}],{"address":140732920751488,"bytes":"a0e5bfeffe7ff490856dff7f"}],{"address":140732920751520,"bytes":"d0e5bfeffe7f91e7766aff7f"}],{"address":140732920751568,"bytes":"70e6bfeffe7ffe15896dff7f"}],{"address":140732920751728,"bytes":"b0e6bfeffe7fde14896dff7f"}],{"address":140732920751792,"bytes":"10e7bfeffe7ffd7e8a6dff7f"}],{"address":140732920751888,"bytes":"40e7bfeffe7fcf838b6dff7f"}],{"address":140732920751936,"bytes":"d0edbfeffe7f986901000100"}],{"address":140732920753616,"bytes":"40f7bfeffe7f3a4001000100"}],{"address":140732920756032,"bytes":"60f8bfeffe7f27e20100"}],{"address":140732920756320,"bytes":"88f8bfeffe7f25e00100"}],{"address":140732920756360,"bytes":"0100"}]]}]]#00
> > 
> > I think for your use case, having lldb-server provide all the values up 
> > front (if it isn't already) is the approach you should take.
> > 
> > (the only thing that's might be unexpected is that the register values & 
> > memory data are sent as *strings* - JSON only represents numbers in base10; 
> > this is sending the register & memory data in target-endian order, little 
> > endian here, in the hex-bytes strings.)
> > 
> > 
> > Repository:
> >  rG LLVM Github Monorepo
> > 
> > CHANGES SINCE LAST ACTION
> >  https://reviews.llvm.org/D62221/new/
> > 
> > https://reviews.llvm.org/D62221
> > 
> > 
> > 
> > 
> 
> -- 
> 
> 
> 
> Guilherme Andrade |  Software Engineer |  guiandr...@google.com |  Google 
> Waterloo, Canada(https://careers.google.com/locations/waterloo/) 
>

[Lldb-commits] [lldb] r361458 - [Utility] Modernize C-style cats

2019-05-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed May 22 22:12:11 2019
New Revision: 361458

URL: http://llvm.org/viewvc/llvm-project?rev=361458&view=rev
Log:
[Utility] Modernize C-style cats

Replaces the remaining C-style casts with explicit casts in Utility. The
motivation is that they are (1) easier to spot and (2) don't have
multiple meanings.

Modified:
lldb/trunk/include/lldb/Utility/Args.h
lldb/trunk/include/lldb/Utility/Endian.h
lldb/trunk/include/lldb/Utility/Flags.h
lldb/trunk/include/lldb/Utility/RegisterValue.h
lldb/trunk/include/lldb/Utility/Scalar.h
lldb/trunk/source/Utility/Args.cpp
lldb/trunk/source/Utility/DataBufferHeap.cpp
lldb/trunk/source/Utility/DataEncoder.cpp
lldb/trunk/source/Utility/DataExtractor.cpp
lldb/trunk/source/Utility/Event.cpp
lldb/trunk/source/Utility/JSON.cpp
lldb/trunk/source/Utility/RegisterValue.cpp
lldb/trunk/source/Utility/Scalar.cpp
lldb/trunk/source/Utility/Stream.cpp
lldb/trunk/source/Utility/StreamGDBRemote.cpp
lldb/trunk/source/Utility/StringExtractor.cpp

Modified: lldb/trunk/include/lldb/Utility/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Args.h?rev=361458&r1=361457&r2=361458&view=diff
==
--- lldb/trunk/include/lldb/Utility/Args.h (original)
+++ lldb/trunk/include/lldb/Utility/Args.h Wed May 22 22:12:11 2019
@@ -267,7 +267,9 @@ public:
 if (total_byte_size == 8)
   return true;
 
-const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1;
+const uint64_t max = (static_cast(1)
+  << static_cast(total_byte_size * 8)) -
+ 1;
 return uval64 <= max;
   }
 
@@ -279,7 +281,9 @@ public:
 if (total_byte_size == 8)
   return true;
 
-const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 
1;
+const int64_t max = (static_cast(1)
+ << static_cast(total_byte_size * 8 - 1)) -
+1;
 const int64_t min = ~(max);
 return min <= sval64 && sval64 <= max;
   }

Modified: lldb/trunk/include/lldb/Utility/Endian.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Endian.h?rev=361458&r1=361457&r2=361458&view=diff
==
--- lldb/trunk/include/lldb/Utility/Endian.h (original)
+++ lldb/trunk/include/lldb/Utility/Endian.h Wed May 22 22:12:11 2019
@@ -23,7 +23,7 @@ static union EndianTest {
 } const endianTest = {0x01020304};
 
 inline lldb::ByteOrder InlHostByteOrder() {
-  return (lldb::ByteOrder)endianTest.bytes[0];
+  return static_cast(endianTest.bytes[0]);
 }
 
 //ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];

Modified: lldb/trunk/include/lldb/Utility/Flags.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Flags.h?rev=361458&r1=361457&r2=361458&view=diff
==
--- lldb/trunk/include/lldb/Utility/Flags.h (original)
+++ lldb/trunk/include/lldb/Utility/Flags.h Wed May 22 22:12:11 2019
@@ -69,7 +69,7 @@ public:
   ///
   /// \return
   /// The new flags after clearing all bits from \a mask.
-  ValueType Clear(ValueType mask = ~(ValueType)0) {
+  ValueType Clear(ValueType mask = ~static_cast(0)) {
 m_flags &= ~mask;
 return m_flags;
   }

Modified: lldb/trunk/include/lldb/Utility/RegisterValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/RegisterValue.h?rev=361458&r1=361457&r2=361458&view=diff
==
--- lldb/trunk/include/lldb/Utility/RegisterValue.h (original)
+++ lldb/trunk/include/lldb/Utility/RegisterValue.h Wed May 22 22:12:11 2019
@@ -41,7 +41,8 @@ public:
 eTypeBytes
   };
 
-  RegisterValue() : m_type(eTypeInvalid), m_scalar((unsigned long)0) {}
+  RegisterValue()
+  : m_type(eTypeInvalid), m_scalar(static_cast(0)) {}
 
   explicit RegisterValue(uint8_t inst) : m_type(eTypeUInt8) { m_scalar = inst; 
}
 

Modified: lldb/trunk/include/lldb/Utility/Scalar.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Scalar.h?rev=361458&r1=361457&r2=361458&view=diff
==
--- lldb/trunk/include/lldb/Utility/Scalar.h (original)
+++ lldb/trunk/include/lldb/Utility/Scalar.h Wed May 22 22:12:11 2019
@@ -59,22 +59,23 @@ public:
 
   // Constructors and Destructors
   Scalar();
-  Scalar(int v) : m_type(e_sint), m_float((float)0) {
+  Scalar(int v) : m_type(e_sint), m_float(static_cast(0)) {
 m_integer = llvm::APInt(sizeof(int) * 8, v, true);
   }
-  Scalar(unsigned int v) : m_type(e_uint), m_float((float)0) {
+  Scalar(unsigned int v) : m_type(e_uint), m_float(static_cast(0)) {
 m_integer = llvm::APInt(sizeof(int) * 8, v);
   }
-

[Lldb-commits] [PATCH] D62284: Replace integer literals which are cast to bool

2019-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added subscribers: atanasyan, javed.absar.
Herald added a reviewer: martong.
Herald added a reviewer: shafik.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D62284

Files:
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Core/Address.cpp
  lldb/source/Host/macosx/objcxx/Host.mm
  lldb/source/Interpreter/Options.cpp
  lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Symbol/ClangASTImporter.cpp
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Utility/JSON.cpp
  lldb/source/Utility/SelectHelper.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/JSON.cpp
  lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
  lldb/tools/debugserver/source/RNBRemote.cpp
  lldb/tools/debugserver/source/debugserver.cpp
  lldb/tools/debugserver/source/libdebugserver.cpp

Index: lldb/tools/debugserver/source/libdebugserver.cpp
===
--- lldb/tools/debugserver/source/libdebugserver.cpp
+++ lldb/tools/debugserver/source/libdebugserver.cpp
@@ -69,7 +69,7 @@
 uint32_t event_mask = RNBContext::event_read_packet_available;
 
 // Spin waiting to get the A packet.
-while (1) {
+while (true) {
   DNBLogThreadedIf(LOG_RNB_MAX,
"%s ctx.Events().WaitForSetEvents( 0x%08x ) ...",
__FUNCTION__, event_mask);
Index: lldb/tools/debugserver/source/debugserver.cpp
===
--- lldb/tools/debugserver/source/debugserver.cpp
+++ lldb/tools/debugserver/source/debugserver.cpp
@@ -96,7 +96,7 @@
   RNBContext::event_read_thread_exiting;
 
 // Spin waiting to get the A packet.
-while (1) {
+while (true) {
   DNBLogThreadedIf(LOG_RNB_MAX,
"%s ctx.Events().WaitForSetEvents( 0x%08x ) ...",
__FUNCTION__, event_mask);
Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4263,7 +4263,7 @@
   }
 
   if (interval_usec == 0) {
-enable = 0;
+enable = false;
   }
 
   DNBProcessSetEnableAsyncProfiling(pid, enable, interval_usec, scan_type);
@@ -5174,7 +5174,7 @@
 while (*c != '\0' &&
(*c == ' ' || *c == '\t' || *c == '\n' || *c == '\r'))
   c++;
-while (1) {
+while (true) {
   if (!isdigit(*c)) {
 return true;
   }
@@ -6109,7 +6109,7 @@
   cstr = data.GetCStr(&offset);
   if (cstr) {
 // Skip NULLs
-while (1) {
+while (true) {
   const char *p = data.PeekCStr(offset);
   if ((p == NULL) || (*p != '\0'))
 break;
Index: lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
===
--- lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
+++ lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
@@ -214,7 +214,7 @@
   MachThreadSP thread_sp(GetThreadByID(tid));
   if (thread_sp)
 return thread_sp->RestoreRegisterState(save_id);
-  return 0;
+  return false;
 }
 
 nub_size_t MachThreadList::NumThreads() const {
Index: lldb/tools/debugserver/source/JSON.cpp
===
--- lldb/tools/debugserver/source/JSON.cpp
+++ lldb/tools/debugserver/source/JSON.cpp
@@ -271,7 +271,7 @@
 break;
 
   case '"': {
-while (1) {
+while (true) {
   bool was_escaped = false;
   int escaped_ch = GetEscapedChar(was_escaped);
   if (escaped_ch == -1) {
@@ -483,7 +483,7 @@
 
   std::string value;
   std::string key;
-  while (1) {
+  while (tru

[Lldb-commits] [lldb] r361459 - [Reproducer] Pass FileSpec by const-ref. (NFC)

2019-05-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed May 22 22:45:49 2019
New Revision: 361459

URL: http://llvm.org/viewvc/llvm-project?rev=361459&view=rev
Log:
[Reproducer] Pass FileSpec by const-ref. (NFC)

Fix two functions where we were passing FileSpecs by value, while we
could pass by const reference.

Modified:
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Utility/Reproducer.cpp

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=361459&r1=361458&r2=361459&view=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed May 22 22:45:49 2019
@@ -113,12 +113,12 @@ private:
 
 class DataRecorder {
 public:
-  DataRecorder(FileSpec filename, std::error_code &ec)
+  DataRecorder(const FileSpec &filename, std::error_code &ec)
   : m_filename(std::move(filename)),
 m_os(m_filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) 
{}
 
   static llvm::Expected>
-  Create(FileSpec filename);
+  Create(const FileSpec &filename);
 
   template  void Record(const T &t, bool newline = false) {
 if (!m_record)

Modified: lldb/trunk/source/Utility/Reproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Reproducer.cpp?rev=361459&r1=361458&r2=361459&view=diff
==
--- lldb/trunk/source/Utility/Reproducer.cpp (original)
+++ lldb/trunk/source/Utility/Reproducer.cpp Wed May 22 22:45:49 2019
@@ -221,7 +221,7 @@ bool Loader::HasFile(StringRef file) {
 }
 
 llvm::Expected>
-DataRecorder::Create(FileSpec filename) {
+DataRecorder::Create(const FileSpec &filename) {
   std::error_code ec;
   auto recorder = llvm::make_unique(std::move(filename), ec);
   if (ec)


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