[Lldb-commits] [PATCH] D67942: Install python dll to bin

2019-09-24 Thread Haibo Huang via Phabricator via lldb-commits
hhb marked an inline comment as done.
hhb added a comment.

Arguably a correct python installation in windows should already have 
python*.dll. But then why do we copy the file to build dir above.




Comment at: lldb/CMakeLists.txt:233
 COMMENT "Copying Python DLL to LLDB binaries directory.")
+get_filename_component(PYTHON_DLL_NAME ${PYTHON_DLL} NAME)
+install(FILES ${LLDB_BIN_DIR}/${PYTHON_DLL_NAME} DESTINATION bin)

Arguably a correct python installation in windows should already have 
python*.dll. But then why do we copy the file to build dir above..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67942



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


[Lldb-commits] [PATCH] D67942: Install python dll to bin

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

Sorry, I'm not familiar with how LLDB integrates with python and how all of 
that works on Windows, so I can't really comment on this one for now...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67942



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


[Lldb-commits] [PATCH] D67903: [lldb] Add completion support for log enable/disable/list

2019-09-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor marked an inline comment as done.
teemperor added inline comments.



Comment at: lldb/source/Utility/Log.cpp:49
+
+void Log::ListCategories(llvm::raw_ostream &stream,
+ const ChannelMap::value_type &entry) {

JDevlieghere wrote:
> Is this used outside of CommandObjectLog? Otherwise this should probably go 
> there.
Yeah I think both the channel and category functions are only used once by 
CommandObjectLog. Will clean that up in a separate NFC commit.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67903



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


[Lldb-commits] [lldb] r372691 - [lldb] Add completion support for log enable/disable/list

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 00:18:09 2019
New Revision: 372691

URL: http://llvm.org/viewvc/llvm-project?rev=372691&view=rev
Log:
[lldb] Add completion support for log enable/disable/list

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

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

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Utility/Log.cpp

Modified: lldb/trunk/include/lldb/Utility/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Log.h?rev=372691&r1=372690&r2=372691&view=diff
==
--- lldb/trunk/include/lldb/Utility/Log.h (original)
+++ lldb/trunk/include/lldb/Utility/Log.h Tue Sep 24 00:18:09 2019
@@ -14,6 +14,7 @@
 #include "lldb/lldb-defines.h"
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
@@ -112,6 +113,14 @@ public:
   static bool ListChannelCategories(llvm::StringRef channel,
 llvm::raw_ostream &stream);
 
+  /// Returns the list of log channels.
+  static std::vector ListChannels();
+  /// Calls the given lambda for every category in the given channel.
+  /// If no channel with the given name exists, lambda is never called.
+  static void ForEachChannelCategory(
+  llvm::StringRef channel,
+  llvm::function_ref lambda);
+
   static void DisableAllLogChannels();
 
   static void ListAllLogChannels(llvm::raw_ostream &stream);
@@ -193,6 +202,10 @@ private:
   typedef llvm::StringMap ChannelMap;
   static llvm::ManagedStatic g_channel_map;
 
+  static void ForEachCategory(
+  const Log::ChannelMap::value_type &entry,
+  llvm::function_ref lambda);
+
   static void ListCategories(llvm::raw_ostream &stream,
  const ChannelMap::value_type &entry);
   static uint32_t GetFlags(llvm::raw_ostream &stream, const 
ChannelMap::value_type &entry,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=372691&r1=372690&r2=372691&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Tue Sep 24 00:18:09 2019
@@ -102,6 +102,38 @@ class CommandLineCompletionTestCase(Test
 self.complete_from_to('plugin load ', [])
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_log_enable(self):
+self.completions_match('log enable ',
+   ['dwarf',
+'gdb-remote',
+'kdp-remote',
+'lldb'])
+self.complete_from_to('log enable ll', ['lldb'])
+self.complete_from_to('log enable lldb al', ['all'])
+self.complete_from_to('log enable lldb sym', ['symbol'])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_log_enable(self):
+self.completions_match('log disable ',
+   ['dwarf',
+'gdb-remote',
+'kdp-remote',
+'lldb'])
+self.complete_from_to('log disable ll', ['lldb'])
+self.complete_from_to('log disable lldb al', ['all'])
+self.complete_from_to('log disable lldb sym', ['symbol'])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_log_list(self):
+self.completions_match('log list ',
+   ['dwarf',
+'gdb-remote',
+'kdp-remote',
+'lldb'])
+self.complete_from_to('log list ll', ['lldb'])
+self.complete_from_to('log list lldb dwa', ['dwarf'])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_quoted_command(self):
 self.complete_from_to('"set',
   ['"settings" '])

Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=372691&r1=372690&r2=372691&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Tue Sep 24 00:18:09 2019
@@ -34,6 +34,21 @@ using namespace lldb_private;
 #de

[Lldb-commits] [PATCH] D67903: [lldb] Add completion support for log enable/disable/list

2019-09-24 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372691: [lldb] Add completion support for log 
enable/disable/list (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67903?vs=221280&id=221476#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67903

Files:
  lldb/trunk/include/lldb/Utility/Log.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  lldb/trunk/source/Commands/CommandObjectLog.cpp
  lldb/trunk/source/Utility/Log.cpp

Index: lldb/trunk/source/Utility/Log.cpp
===
--- lldb/trunk/source/Utility/Log.cpp
+++ lldb/trunk/source/Utility/Log.cpp
@@ -9,7 +9,6 @@
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/VASPrintf.h"
 
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
@@ -38,13 +37,21 @@
 
 llvm::ManagedStatic Log::g_channel_map;
 
-void Log::ListCategories(llvm::raw_ostream &stream, const ChannelMap::value_type &entry) {
-  stream << llvm::formatv("Logging categories for '{0}':\n", entry.first());
-  stream << "  all - all available logging categories\n";
-  stream << "  default - default set of logging categories\n";
+void Log::ForEachCategory(
+const Log::ChannelMap::value_type &entry,
+llvm::function_ref lambda) {
+  lambda("all", "all available logging categories");
+  lambda("default", "default set of logging categories");
   for (const auto &category : entry.second.m_channel.categories)
-stream << llvm::formatv("  {0} - {1}\n", category.name,
-category.description);
+lambda(category.name, category.description);
+}
+
+void Log::ListCategories(llvm::raw_ostream &stream,
+ const ChannelMap::value_type &entry) {
+  ForEachCategory(entry,
+  [&stream](llvm::StringRef name, llvm::StringRef description) {
+stream << llvm::formatv("  {0} - {1}\n", name, description);
+  });
 }
 
 uint32_t Log::GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry,
@@ -237,6 +244,23 @@
 entry.second.Disable(UINT32_MAX);
 }
 
+void Log::ForEachChannelCategory(
+llvm::StringRef channel,
+llvm::function_ref lambda) {
+  auto ch = g_channel_map->find(channel);
+  if (ch == g_channel_map->end())
+return;
+
+  ForEachCategory(*ch, lambda);
+}
+
+std::vector Log::ListChannels() {
+  std::vector result;
+  for (const auto &channel : *g_channel_map)
+result.push_back(channel.first());
+  return result;
+}
+
 void Log::ListAllLogChannels(llvm::raw_ostream &stream) {
   if (g_channel_map->empty()) {
 stream << "No logging channels are currently registered.\n";
Index: lldb/trunk/source/Commands/CommandObjectLog.cpp
===
--- lldb/trunk/source/Commands/CommandObjectLog.cpp
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp
@@ -34,6 +34,21 @@
 #define LLDB_OPTIONS_log
 #include "CommandOptions.inc"
 
+/// Common completion logic for log enable/disable.
+static void CompleteEnableDisable(CompletionRequest &request) {
+  size_t arg_index = request.GetCursorIndex();
+  if (arg_index == 0) { // We got: log enable/disable x[tab]
+for (llvm::StringRef channel : Log::ListChannels())
+  request.TryCompleteCurrentArg(channel);
+  } else if (arg_index >= 1) { // We got: log enable/disable channel x[tab]
+llvm::StringRef channel = request.GetParsedLine().GetArgumentAtIndex(0);
+Log::ForEachChannelCategory(
+channel, [&request](llvm::StringRef name, llvm::StringRef desc) {
+  request.TryCompleteCurrentArg(name, desc);
+});
+  }
+}
+
 class CommandObjectLogEnable : public CommandObjectParsed {
 public:
   // Constructors and Destructors
@@ -134,6 +149,12 @@
 uint32_t log_options;
   };
 
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+   OptionElementVector &opt_element_vector) override {
+CompleteEnableDisable(request);
+  }
+
 protected:
   bool DoExecute(Args &args, CommandReturnObject &result) override {
 if (args.GetArgumentCount() < 2) {
@@ -202,6 +223,12 @@
 
   ~CommandObjectLogDisable() override = default;
 
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+   OptionElementVector &opt_element_vector) override {
+CompleteEnableDisable(request);
+  }
+
 protected:
   bool DoExecute(Args &args, CommandReturnObject &result) override {
 if (args.empty()) {
@@ -254,6 +281,13 @@
 
   ~CommandObjectLogList() override = default;
 
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+   OptionElementVector &opt_element_vector) override {
+   

[Lldb-commits] [lldb] r372692 - [lldb] Remove redundant argument lists in CompletionRequest

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 00:22:44 2019
New Revision: 372692

URL: http://llvm.org/viewvc/llvm-project?rev=372692&view=rev
Log:
[lldb] Remove redundant argument lists in CompletionRequest

We currently have two lists in the CompletionRequest that we
inherited from the old API: The complete list of arguments ignoring
where the user requested completion and the list of arguments that
stops at the cursor. Having two lists of arguments is confusing
and can lead to subtle errors, so let's remove the complete list
until we actually need it.

Modified:
lldb/trunk/include/lldb/Utility/CompletionRequest.h
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Utility/CompletionRequest.cpp
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/Utility/CompletionRequest.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/CompletionRequest.h?rev=372692&r1=372691&r2=372692&view=diff
==
--- lldb/trunk/include/lldb/Utility/CompletionRequest.h (original)
+++ lldb/trunk/include/lldb/Utility/CompletionRequest.h Tue Sep 24 00:22:44 2019
@@ -113,8 +113,6 @@ public:
 
   Args &GetParsedLine() { return m_parsed_line; }
 
-  const Args &GetPartialParsedLine() const { return m_partial_parsed_line; }
-
   const Args::ArgEntry &GetParsedArg() {
 return GetParsedLine()[GetCursorIndex()];
   }
@@ -123,7 +121,6 @@ public:
   void ShiftArguments() {
 m_cursor_index--;
 m_parsed_line.Shift();
-m_partial_parsed_line.Shift();
   }
 
   void SetCursorIndex(size_t i) { m_cursor_index = i; }
@@ -206,8 +203,6 @@ private:
   unsigned m_raw_cursor_pos;
   /// The command line parsed as arguments.
   Args m_parsed_line;
-  /// The command line until the cursor position parsed as arguments.
-  Args m_partial_parsed_line;
   /// The index of the argument in which the completion cursor is.
   size_t m_cursor_index;
   /// The cursor position in the argument indexed by m_cursor_index.

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=372692&r1=372691&r2=372692&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Sep 24 00:22:44 
2019
@@ -1756,7 +1756,7 @@ void CommandInterpreter::HandleCompletio
 
   // For any of the command completions a unique match will be a complete word.
 
-  if (request.GetPartialParsedLine().GetArgumentCount() == 0) {
+  if (request.GetParsedLine().GetArgumentCount() == 0) {
 // We got nothing on the command line, so return the list of commands
 bool include_aliases = true;
 StringList new_matches, descriptions;

Modified: lldb/trunk/source/Utility/CompletionRequest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CompletionRequest.cpp?rev=372692&r1=372691&r2=372692&view=diff
==
--- lldb/trunk/source/Utility/CompletionRequest.cpp (original)
+++ lldb/trunk/source/Utility/CompletionRequest.cpp Tue Sep 24 00:22:44 2019
@@ -21,17 +21,16 @@ CompletionRequest::CompletionRequest(llv
   // We parse the argument up to the cursor, so the last argument in
   // parsed_line is the one containing the cursor, and the cursor is after the
   // last character.
-  m_parsed_line = Args(command_line);
   llvm::StringRef partial_command(command_line.substr(0, raw_cursor_pos));
-  m_partial_parsed_line = Args(partial_command);
+  m_parsed_line = Args(partial_command);
 
-  if (m_partial_parsed_line.GetArgumentCount() == 0) {
+  if (GetParsedLine().GetArgumentCount() == 0) {
 m_cursor_index = 0;
 m_cursor_char_position = 0;
   } else {
-m_cursor_index = m_partial_parsed_line.GetArgumentCount() - 1U;
+m_cursor_index = GetParsedLine().GetArgumentCount() - 1U;
 m_cursor_char_position =
-strlen(m_partial_parsed_line.GetArgumentAtIndex(m_cursor_index));
+strlen(GetParsedLine().GetArgumentAtIndex(m_cursor_index));
   }
 
   // The cursor is after a space but the space is not part of the argument.
@@ -40,7 +39,6 @@ CompletionRequest::CompletionRequest(llv
   if (partial_command.endswith(" ") &&
   !GetCursorArgumentPrefix().endswith(" ")) {
 m_parsed_line.AppendArgument(llvm::StringRef());
-m_partial_parsed_line.AppendArgument(llvm::StringRef());
 // Set the cursor to the start of the fake argument.
 m_cursor_index++;
 m_cursor_char_position = 0;

Modified: lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CompletionRequestTest.cpp?rev=372692&r1=372691&r2=372692&view=diff
==

[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Yeah, after writing the previous comment, I realized that you'll probably want 
to subclass File to implement the python stuff (which I agree is a good idea). 
So, going for unique_ptr is probably the best way forward here. 
Nonetheless, I still believe the return type of the FileSystem method should be 
`Expected>`, as that is the direction both llvm and lldb is 
trying to move in (with llvm being much more successful at that, but lldb is 
making progress too). If it turns out that a lot of the callers are unable to 
do anything useful with the returned error (with llvm::Expected, you are forced 
to handle it somehow), we can make a special overload like `OpenIngoringErrors` 
which avoids the boilerplate needed to explicitly ignore an error (but I hope 
that won't be needed).

The other thing is that the interface changes in the Debugger class are causing 
a lot of churn, which makes it hard to figure out what exactly is changing. 
Would it be possible to split these out into a separate patch, so that the 
functional changes are more obvious here?




Comment at: lldb/source/Host/common/FileSystem.cpp:439-440
   if (!File::DescriptorIsValid(descriptor)) {
-File.SetDescriptor(-1, options, false);
+errno = EINVAL;
 error.SetErrorToErrno();
   } else {

once this returns `Expected>`, you can do a `return 
llvm::errorCodeToError(std::error_code(errno, std::generic_category()))` here.



Comment at: lldb/source/Host/common/FileSystem.cpp:444-445
   }
+  if (fileup && !fileup->IsValid())
+fileup.reset();
   return error;

I don't think this is really needed as the `else` branch is guaranteed to 
return a valid `File` object, right? (i.e., you could just do `return 
std::make_unique(...)` there...)



Comment at: lldb/source/Interpreter/CommandInterpreter.cpp:2319
   std::string cmd_file_path = cmd_file.GetPath();
-  Status error = FileSystem::Instance().Open(input_file_sp->GetFile(), 
cmd_file,
+  FileUP input_file_p;
+  Status error = FileSystem::Instance().Open(input_file_p, cmd_file,

the lldb convention would be to name these `xxx_up`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891



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


[Lldb-commits] [PATCH] D67943: documentation: update test.rst

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

This should have been done a long time ago, thanks for taking care of that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67943



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


[Lldb-commits] [PATCH] D67942: Install python dll to bin

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looking at the history   goes provide us with 
some clues. It seems it was done to ensure that during development launching 
lldb uses the same python dll that the lldb was built with. However, this was 
done in the days when one had to build a custom python2 interpreter to build 
lldb on windows, and so version mismatches were much more likely. So, it's 
possible this is no longer needed (though I expect there will be at least one 
user somewhere which has grown a dependency on this somehow).

Anyway, I don't really have a horse in this race, but my instinct would be to 
say that lldb should not attempt to install python anywhere (just as we don't 
do that on non-windows platforms). There _might_ be a case for copying it to 
the build dir, if it increases developer comfort substantially, but ideally, 
I'd try to get rid of that too...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67942



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


[Lldb-commits] [lldb] r372696 - [lldb] Fix log output and UtilityTests/LogChannelTest.List

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 01:20:05 2019
New Revision: 372696

URL: http://llvm.org/viewvc/llvm-project?rev=372696&view=rev
Log:
[lldb] Fix log output and UtilityTests/LogChannelTest.List

I refactored this code in 372691 and it seems I didn't fully
replicate the original log output, so that test was failing.

Modified:
lldb/trunk/source/Utility/Log.cpp

Modified: lldb/trunk/source/Utility/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=372696&r1=372695&r2=372696&view=diff
==
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Tue Sep 24 01:20:05 2019
@@ -48,6 +48,7 @@ void Log::ForEachCategory(
 
 void Log::ListCategories(llvm::raw_ostream &stream,
  const ChannelMap::value_type &entry) {
+  stream << llvm::formatv("Logging categories for '{0}':\n", entry.first());
   ForEachCategory(entry,
   [&stream](llvm::StringRef name, llvm::StringRef description) 
{
 stream << llvm::formatv("  {0} - {1}\n", name, 
description);


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


[Lldb-commits] [lldb] r372700 - [LLDB] Avoid warnings about redefining posix mode defines on MinGW

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 01:39:12 2019
New Revision: 372700

URL: http://llvm.org/viewvc/llvm-project?rev=372700&view=rev
Log:
[LLDB] Avoid warnings about redefining posix mode defines on MinGW

Since these defines were added in LLVM SVN r189364 in 2013,
mingw-w64 got defines for S_I?GRP, S_IRWXG, S_I?OTH and S_IRWXO
in 2015.

Also change the existing defined(_MSC_VER) into ifndef S_IRUSR, for
consistency.

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

Modified:
lldb/trunk/include/lldb/Host/windows/PosixApi.h

Modified: lldb/trunk/include/lldb/Host/windows/PosixApi.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PosixApi.h?rev=372700&r1=372699&r2=372700&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h Tue Sep 24 01:39:12 2019
@@ -31,20 +31,30 @@
 #define SIGKILL 9
 #define SIGSTOP 20
 
-#if defined(_MSC_VER)
+#ifndef S_IRUSR
 #define S_IRUSR S_IREAD  /* read, user */
 #define S_IWUSR S_IWRITE /* write, user */
 #define S_IXUSR 0/* execute, user */
 #endif
+#ifndef S_IRGRP
 #define S_IRGRP 0 /* read, group */
 #define S_IWGRP 0 /* write, group */
 #define S_IXGRP 0 /* execute, group */
+#endif
+#ifndef S_IROTH
 #define S_IROTH 0 /* read, others */
 #define S_IWOTH 0 /* write, others */
 #define S_IXOTH 0 /* execute, others */
+#endif
+#ifndef S_IRWXU
 #define S_IRWXU 0
+#endif
+#ifndef S_IRWXG
 #define S_IRWXG 0
+#endif
+#ifndef S_IRWXO
 #define S_IRWXO 0
+#endif
 
 #if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before


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


[Lldb-commits] [lldb] r372699 - [LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 01:39:06 2019
New Revision: 372699

URL: http://llvm.org/viewvc/llvm-project?rev=372699&view=rev
Log:
[LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

While debugging on those architectures might not be supported yet,
the generic code should still be buildable. This file accesses x86
specific fields in the CONTEXT struct.

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

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp?rev=372699&r1=372698&r2=372699&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp 
Tue Sep 24 01:39:06 2019
@@ -84,7 +84,7 @@ bool RegisterContextWindows::AddHardware
   case 1:
   case 2:
   case 4:
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(_WIN64)
   case 8:
 #endif
 break;
@@ -95,6 +95,7 @@ bool RegisterContextWindows::AddHardware
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 |= 1ULL << shift;
 
@@ -109,6 +110,12 @@ bool RegisterContextWindows::AddHardware
   m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
 
   return ApplyAllRegisterValues();
+
+#else
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_REGISTERS);
+  LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
+  return false;
+#endif
 }
 
 bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +125,25 @@ bool RegisterContextWindows::RemoveHardw
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 &= ~(1ULL << shift);
 
   return ApplyAllRegisterValues();
+#else
+  return false;
+#endif
 }
 
 uint32_t RegisterContextWindows::GetTriggeredHardwareBreakpointSlotId() {
   if (!CacheAllRegisterValues())
 return LLDB_INVALID_INDEX32;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   for (unsigned i = 0UL; i < NUM_HARDWARE_BREAKPOINT_SLOTS; i++)
 if (m_context.Dr6 & (1ULL << i))
   return i;
+#endif
 
   return LLDB_INVALID_INDEX32;
 }


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


[Lldb-commits] [lldb] r372701 - [lldb][NFC] Relax completion tests for log command to make them pass on Linux

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 01:41:10 2019
New Revision: 372701

URL: http://llvm.org/viewvc/llvm-project?rev=372701&view=rev
Log:
[lldb][NFC] Relax completion tests for log command to make them pass on Linux

The log channels change depending on platform, so listing them breaks on
some platforms. Let's just check that the 'lldb' and 'dwarf' channels are
there which are independent of platform.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=372701&r1=372700&r2=372701&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Tue Sep 24 01:41:10 2019
@@ -103,33 +103,22 @@ class CommandLineCompletionTestCase(Test
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_enable(self):
-self.completions_match('log enable ',
-   ['dwarf',
-'gdb-remote',
-'kdp-remote',
-'lldb'])
 self.complete_from_to('log enable ll', ['lldb'])
+self.complete_from_to('log enable dw', ['dwarf'])
 self.complete_from_to('log enable lldb al', ['all'])
 self.complete_from_to('log enable lldb sym', ['symbol'])
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_enable(self):
-self.completions_match('log disable ',
-   ['dwarf',
-'gdb-remote',
-'kdp-remote',
-'lldb'])
 self.complete_from_to('log disable ll', ['lldb'])
+self.complete_from_to('log disable dw', ['dwarf'])
 self.complete_from_to('log disable lldb al', ['all'])
 self.complete_from_to('log disable lldb sym', ['symbol'])
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_list(self):
-self.completions_match('log list ',
-   ['dwarf',
-'gdb-remote',
-'kdp-remote',
-'lldb'])
+self.complete_from_to('log list ll', ['lldb'])
+self.complete_from_to('log list dw', ['dwarf'])
 self.complete_from_to('log list ll', ['lldb'])
 self.complete_from_to('log list lldb dwa', ['dwarf'])
 


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


[Lldb-commits] [PATCH] D67910: [LLDB] Avoid warnings about redefining posix mode defines on MinGW

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372700: [LLDB] Avoid warnings about redefining posix mode 
defines on MinGW (authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67910?vs=221298&id=221481#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67910

Files:
  lldb/trunk/include/lldb/Host/windows/PosixApi.h


Index: lldb/trunk/include/lldb/Host/windows/PosixApi.h
===
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h
@@ -31,20 +31,30 @@
 #define SIGKILL 9
 #define SIGSTOP 20
 
-#if defined(_MSC_VER)
+#ifndef S_IRUSR
 #define S_IRUSR S_IREAD  /* read, user */
 #define S_IWUSR S_IWRITE /* write, user */
 #define S_IXUSR 0/* execute, user */
 #endif
+#ifndef S_IRGRP
 #define S_IRGRP 0 /* read, group */
 #define S_IWGRP 0 /* write, group */
 #define S_IXGRP 0 /* execute, group */
+#endif
+#ifndef S_IROTH
 #define S_IROTH 0 /* read, others */
 #define S_IWOTH 0 /* write, others */
 #define S_IXOTH 0 /* execute, others */
+#endif
+#ifndef S_IRWXU
 #define S_IRWXU 0
+#endif
+#ifndef S_IRWXG
 #define S_IRWXG 0
+#endif
+#ifndef S_IRWXO
 #define S_IRWXO 0
+#endif
 
 #if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before


Index: lldb/trunk/include/lldb/Host/windows/PosixApi.h
===
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h
@@ -31,20 +31,30 @@
 #define SIGKILL 9
 #define SIGSTOP 20
 
-#if defined(_MSC_VER)
+#ifndef S_IRUSR
 #define S_IRUSR S_IREAD  /* read, user */
 #define S_IWUSR S_IWRITE /* write, user */
 #define S_IXUSR 0/* execute, user */
 #endif
+#ifndef S_IRGRP
 #define S_IRGRP 0 /* read, group */
 #define S_IWGRP 0 /* write, group */
 #define S_IXGRP 0 /* execute, group */
+#endif
+#ifndef S_IROTH
 #define S_IROTH 0 /* read, others */
 #define S_IWOTH 0 /* write, others */
 #define S_IXOTH 0 /* execute, others */
+#endif
+#ifndef S_IRWXU
 #define S_IRWXU 0
+#endif
+#ifndef S_IRWXG
 #define S_IRWXG 0
+#endif
+#ifndef S_IRWXO
 #define S_IRWXO 0
+#endif
 
 #if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67911: [LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372699: [LLDB] [Windows] Add missing ifdefs to fix building 
for non-x86 architectures (authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67911?vs=221406&id=221480#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67911

Files:
  lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp


Index: 
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
@@ -84,7 +84,7 @@
   case 1:
   case 2:
   case 4:
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(_WIN64)
   case 8:
 #endif
 break;
@@ -95,6 +95,7 @@
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 |= 1ULL << shift;
 
@@ -109,6 +110,12 @@
   m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
 
   return ApplyAllRegisterValues();
+
+#else
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_REGISTERS);
+  LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
+  return false;
+#endif
 }
 
 bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +125,25 @@
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 &= ~(1ULL << shift);
 
   return ApplyAllRegisterValues();
+#else
+  return false;
+#endif
 }
 
 uint32_t RegisterContextWindows::GetTriggeredHardwareBreakpointSlotId() {
   if (!CacheAllRegisterValues())
 return LLDB_INVALID_INDEX32;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || 
defined(_M_AMD64)
   for (unsigned i = 0UL; i < NUM_HARDWARE_BREAKPOINT_SLOTS; i++)
 if (m_context.Dr6 & (1ULL << i))
   return i;
+#endif
 
   return LLDB_INVALID_INDEX32;
 }


Index: lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
@@ -84,7 +84,7 @@
   case 1:
   case 2:
   case 4:
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(_WIN64)
   case 8:
 #endif
 break;
@@ -95,6 +95,7 @@
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 |= 1ULL << shift;
 
@@ -109,6 +110,12 @@
   m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
 
   return ApplyAllRegisterValues();
+
+#else
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_REGISTERS);
+  LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
+  return false;
+#endif
 }
 
 bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +125,25 @@
   if (!CacheAllRegisterValues())
 return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 &= ~(1ULL << shift);
 
   return ApplyAllRegisterValues();
+#else
+  return false;
+#endif
 }
 
 uint32_t RegisterContextWindows::GetTriggeredHardwareBreakpointSlotId() {
   if (!CacheAllRegisterValues())
 return LLDB_INVALID_INDEX32;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   for (unsigned i = 0UL; i < NUM_HARDWARE_BREAKPOINT_SLOTS; i++)
 if (m_context.Dr6 & (1ULL << i))
   return i;
+#endif
 
   return LLDB_INVALID_INDEX32;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66638: Unwind: Add a stack scanning mechanism to support win32 unwinding

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D66638#1679440 , @clayborg wrote:

> In D66638#1679195 , @labath wrote:
>
> > Thanks for the review and sorry for the delay (I was OOO). The idea to use 
> > `Process::GetLoadAddressPermissions` makes sense, both from consistency and 
> > correctness perspectives. Unfortunately it does not work "out of the box" 
> > because minidump core files (my primary use case for this) do not currently 
> > provide enough information through the memory region info api. It tries 
> > pretty hard to achieve that, but in the case of regular (not "full memory 
> > dumps") windows minidump, all we have is the "MemoryList" stream, which 
> > only contains a couple of memory regions, and it does not include the areas 
> > covered by loaded modules (which is where PCs should point). If this is to 
> > work, we'd need to extend this memory parsing code to also take into 
> > account the module memory ranges (from the ModuleList stream).
> >
> > @clayborg, you're the one who wrote the memory region parsing code IIRC. 
> > Does that sound OK to you ?
>
>
> I am not sure if we can infer anything about permissions from the module 
> ranges. I believe this range contains everything (.text, .data, .bss, etc), 
> so it has a mixture of permissions?
>
> If we can find a way to use the module base of image, we should only parse 
> the module ranges if the /proc//maps is not in a minidump file as that 
> is the best source for mapped ranges.


If we're able to find the actual module that got mapped at this address, then 
we could use the sections of that module to reconstruct the permissions fairly 
accurately. If we can't find that module (which will unfortunately be the most 
common case for me), then we can't determine the actual permissions, but we can 
still differentiate between a piece of memory being definitely(*) not 
executable (if there is no module loaded at that address) and it being 
_potentially_ executable (if there is a module there). Given the data we have, 
I think that is the best we can do.

The MemoryRegion class already kind of supports this, because it stores the 
permissions in a ternary enum ("yes", "no", "don't know"), but the 
`Process::GetLoadAddressPermissions` interprets the permissions strictly, and 
treats "don't know" as "no". So, one way to handle that would be to return 
"don't know" for these memory ranges and then change the 
`GetLoadAddressPermissions` interface so that we're able to ask the question 
"is this address potentially executable?" (**). Or we could dumb the current 
check down even more, and just check whether there is _a_ module at the given 
address (similar to the first step of `InitializeNonZerothFrame`), and 
completely avoid permission checking. For an initial implementation, I would be 
happy with a super simple heuristic like that. WDYT?

(*) "definitively" might be too strong a word, as there might be some 
executable memory mapped there that we don't know about, but that is fairly 
unlikely. OTOH, an address belonging to a module is quite likely to be 
executable.

(**) Of course, all of this would kick in only when we don't have a source 
which can provide an exhaustive list of memory regions and their permissions. 
linux /proc/pid/maps is one such source, and I also believe the MemoryInfoList 
stream can be considered to be exhaustive.


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

https://reviews.llvm.org/D66638



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


[Lldb-commits] [PATCH] D67892: [LLDB] Fix typo in RegisterContextDarwin_arm64

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

This is definitely right. I remember running into this in the past, but I don't 
remember whether I ended up not committing the fix, or is this another instance 
of that bug.

In either case, it's sad that there are no tests breaking due to this. Ideally 
we'd have a small arm64 macho core file with well known register values that we 
could just assert are read correctly. You probably don't have the means to 
create such a core file, so it's not fair to ask you to do that, but it would 
be great if one of the apple folks added a test like that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67892



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


[Lldb-commits] [PATCH] D67953: [LLDB] [test] Allow differing order of some matches

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, compnerd, amccarth, hhb.
Herald added a subscriber: JDevlieghere.
Herald added a project: LLDB.

These can appear in a different order depending on the relative layout of the 
source and build trees.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67953

Files:
  lldb/lit/Reproducer/TestDump.test


Index: lldb/lit/Reproducer/TestDump.test
===
--- lldb/lit/Reproducer/TestDump.test
+++ lldb/lit/Reproducer/TestDump.test
@@ -8,8 +8,8 @@
 # RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' 
--capture --capture-path %t.repro %t/reproducer.out
 
 # RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s 
--check-prefix FILES
-# FILES: 'reproducer.out'
-# FILES: 'FileCapture.in'
+# FILES-DAG: 'reproducer.out'
+# FILES-DAG: 'FileCapture.in'
 
 # RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s 
--check-prefix VERSION
 # VERSION: lldb version


Index: lldb/lit/Reproducer/TestDump.test
===
--- lldb/lit/Reproducer/TestDump.test
+++ lldb/lit/Reproducer/TestDump.test
@@ -8,8 +8,8 @@
 # RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' --capture --capture-path %t.repro %t/reproducer.out
 
 # RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s --check-prefix FILES
-# FILES: 'reproducer.out'
-# FILES: 'FileCapture.in'
+# FILES-DAG: 'reproducer.out'
+# FILES-DAG: 'FileCapture.in'
 
 # RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s --check-prefix VERSION
 # VERSION: lldb version
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67951: [LLDB] Add tests for PECOFF arm architecture identification

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, compnerd, amccarth, hhb.
Herald added subscribers: JDevlieghere, abidh, kristof.beyls.
Herald added a project: LLDB.

Add a test case for the change from SVN r372657, and for the preexisting ARM 
identification.

Add a missing ArchDefinitionEntry for PECOFF/arm64, and tweak the ArmNt case to 
set the architecture to armv7 (ArmNt never ran on anything lower than that). 
(This avoids a case where ArchSpec::MergeFrom would override the arch from arm 
to armv7 and ArchSpec::CoreUpdated would reset the OS to unknown at the same 
time.)


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67951

Files:
  lldb/lit/Modules/PECOFF/basic-info-arm.yaml
  lldb/lit/Modules/PECOFF/basic-info-arm64.yaml
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Utility/ArchSpec.cpp

Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -459,7 +459,9 @@
 {ArchSpec::eCore_thumb, llvm::COFF::IMAGE_FILE_MACHINE_THUMB,
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // ARMv7
 {ArchSpec::eCore_x86_64_x86_64, llvm::COFF::IMAGE_FILE_MACHINE_AMD64,
- LLDB_INVALID_CPUTYPE, 0xu, 0xu} // AMD64
+ LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // AMD64
+{ArchSpec::eCore_arm_arm64, llvm::COFF::IMAGE_FILE_MACHINE_ARM64,
+ LLDB_INVALID_CPUTYPE, 0xu, 0xu} // ARM64
 };
 
 static const ArchDefinition g_coff_arch_def = {
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -195,7 +195,7 @@
 specs.Append(module_spec);
 break;
   case MachineArmNt:
-spec.SetTriple("arm-pc-windows");
+spec.SetTriple("armv7-pc-windows");
 specs.Append(module_spec);
 break;
   case MachineArm64:
Index: lldb/lit/Modules/PECOFF/basic-info-arm64.yaml
===
--- /dev/null
+++ lldb/lit/Modules/PECOFF/basic-info-arm64.yaml
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: aarch64-unknown-windows-msvc
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: false
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x4000
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_ARM64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 4
+SectionData: C0035FD6
+symbols: []
+...
Index: lldb/lit/Modules/PECOFF/basic-info-arm.yaml
===
--- /dev/null
+++ lldb/lit/Modules/PECOFF/basic-info-arm.yaml
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# 

[Lldb-commits] [PATCH] D67952: [LLDB] [test] Add a few missing cases of REQUIRES: python

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, compnerd, amccarth, hhb.
Herald added a subscriber: JDevlieghere.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67952

Files:
  lldb/lit/Commands/command-script-import.test
  lldb/lit/Reproducer/TestSynchronous.test


Index: lldb/lit/Reproducer/TestSynchronous.test
===
--- lldb/lit/Reproducer/TestSynchronous.test
+++ lldb/lit/Reproducer/TestSynchronous.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # Ensure that replay happens in synchronous mode.
 
 # RUN: rm -rf %t.repro
Index: lldb/lit/Commands/command-script-import.test
===
--- lldb/lit/Commands/command-script-import.test
+++ lldb/lit/Commands/command-script-import.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # RUN: echo 'b main' > %t.in
 # RUN: echo 'run' >> %t.in
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in


Index: lldb/lit/Reproducer/TestSynchronous.test
===
--- lldb/lit/Reproducer/TestSynchronous.test
+++ lldb/lit/Reproducer/TestSynchronous.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # Ensure that replay happens in synchronous mode.
 
 # RUN: rm -rf %t.repro
Index: lldb/lit/Commands/command-script-import.test
===
--- lldb/lit/Commands/command-script-import.test
+++ lldb/lit/Commands/command-script-import.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # RUN: echo 'b main' > %t.in
 # RUN: echo 'run' >> %t.in
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67953: [LLDB] [test] Allow differing order of some matches

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

I would prefer if we could have a deterministic order in the list of files when 
dumping them (e.g. sorting by name), but I'm fine with landing this because 
this test is failing on all of my machines. I'll file a radar for Jonas so that 
this will actually be properly fixed at some point. Thanks for looking into 
this!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67953



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, compnerd, amccarth, hhb, asmith.
Herald added subscribers: JDevlieghere, abidh, kristof.beyls, mgorny.
Herald added a project: LLDB.

This seems to be enough for getting a backtrace and variable values for 
MinGW-built binaries for ARM64.

This doesn't implement the intended future setup (if I understand things 
correctly) of using NativeRegisterContexts.

What's a suitable testcase for this? So far I've just built LLDB and tested 
debugging a real binary with it. I don't have the full llvm build environment 
available on the arm64 windows machine yet, so running the full testsuite isn't 
really easily feasible. (Perhaps it would be doable via WSL?)


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67954

Files:
  lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
  lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.h

Index: lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.h
===
--- /dev/null
+++ lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.h
@@ -0,0 +1,47 @@
+//===-- RegisterContextWindows_arm64.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_RegisterContextWindows_arm64_H_
+#define liblldb_RegisterContextWindows_arm64_H_
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+
+#include "RegisterContextWindows.h"
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+
+class Thread;
+
+class RegisterContextWindows_arm64 : public RegisterContextWindows {
+public:
+  // Constructors and Destructors
+  RegisterContextWindows_arm64(Thread &thread, uint32_t concrete_frame_idx);
+
+  virtual ~RegisterContextWindows_arm64();
+
+  // Subclasses must override these functions
+  size_t GetRegisterCount() override;
+
+  const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
+
+  size_t GetRegisterSetCount() override;
+
+  const RegisterSet *GetRegisterSet(size_t reg_set) override;
+
+  bool ReadRegister(const RegisterInfo *reg_info,
+RegisterValue ®_value) override;
+
+  bool WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) override;
+};
+} // namespace lldb_private
+
+#endif // defined(__aarch64__) || defined(_M_ARM64)
+
+#endif // #ifndef liblldb_RegisterContextWindows_arm64_H_
Index: lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
===
--- /dev/null
+++ lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -0,0 +1,423 @@
+//===-- RegisterContextWindows_arm64.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+
+#include "lldb/Host/windows/HostThreadWindows.h"
+#include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private-types.h"
+
+#include "RegisterContextWindows_arm64.h"
+#include "TargetThreadWindows.h"
+
+#include "llvm/ADT/STLExtras.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+#define GPR_OFFSET(idx) 0
+#define GPR_OFFSET_NAME(reg) 0
+
+#define FPU_OFFSET(idx) 0
+#define FPU_OFFSET_NAME(reg) 0
+
+#define EXC_OFFSET_NAME(reg) 0
+#define DBG_OFFSET_NAME(reg) 0
+
+#define DEFINE_DBG(reg, i) \
+  #reg, NULL,  \
+  0, DBG_OFFSET_NAME(reg[i]), eEncodingUint, eFormatHex,   \
+  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,   \
+   LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,   \
+   LLDB_INVALID_REGNUM },  \
+   NULL, NULL, NULL, 0
+
+// Include RegisterInfos_arm64 to declare our g_register_infos_arm64 structure.
+#define DECLARE_REGISTER_INFOS_ARM64_STRUCT
+#include "Plugins/Process/Utility/RegisterInfos_arm64.h"
+#undef DECLARE_REGISTER_INFOS_ARM64_STRUCT
+
+static size_t k_num_register_infos =
+llvm::array_lengthof(g_register_info

[Lldb-commits] [lldb] r372716 - [lldb] Decouple importing the std C++ module from the way the program is compiled

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 03:08:18 2019
New Revision: 372716

URL: http://llvm.org/viewvc/llvm-project?rev=372716&view=rev
Log:
[lldb] Decouple importing the std C++ module from the way the program is 
compiled

Summary:
At the moment, when trying to import the `std` module in LLDB, we look at the 
imported modules used in the compiled program
and try to infer the Clang configuration we need from the DWARF module-import. 
That was the initial idea but turned out to
cause a few problems or inconveniences:

* It requires that users compile their programs with C++ modules. Given how 
experimental C++ modules are makes this feature inaccessible
for many users. Also it means that people can't just get the benefits of this 
feature for free when we activate it by default
(and we can't just close all the associated bug reports).
* Relying on DWARF's imported module tags (that are only emitted by default on 
macOS) means this can only be used when using DWARF (and with -glldb on Linux).
* We essentially hardcoded the C standard library paths on some platforms 
(Linux) or just couldn't support this feature on other platforms (macOS).

This patch drops the whole idea of looking at the imported module DWARF tags 
and instead just uses the support files of the compilation unit.
If we look at the support files and see file paths that indicate where the C 
standard library and libc++ are, we can just create the module
configuration this information. This fixes all the problems above which means 
we can enable all the tests now on Linux, macOS and with other debug information
than what we currently had. The only debug information specific code is now the 
iteration over external type module when -gmodules is used (as `std` and also 
the
`Darwin` module are their own external type module with their own files).

The meat of this patch is the CppModuleConfiguration which looks at the file 
paths from the compilation unit and then figures out the include paths
based on those paths. It's quite conservative in that it only enables modules 
if we find a single C library and single libc++ library. It's still missing some
test mode where we try to compile an expression before we actually activate the 
config for the user (which probably also needs some caching mechanism),
but for now it works and makes the feature usable.

Reviewers: aprantl, shafik, jdoerfert

Reviewed By: aprantl

Subscribers: mgorny, abidh, JDevlieghere, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

Added:
lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp
Modified:
lldb/trunk/include/lldb/Symbol/CompileUnit.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Target/Platform.h

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/basic/TestImportStdModule.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/conflicts/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/TestBasicDeque.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/TestBasicForwardList.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/TestBasicList.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentList.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/no-std-module/Makefile

lldb/trunk/packages/Python/lldbsuite/test/command

[Lldb-commits] [PATCH] D67760: [lldb] Decouple importing the std C++ module from the way the program is compiled

2019-09-24 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372716: [lldb] Decouple importing the std C++ module from 
the way the program is… (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67760?vs=221307&id=221496#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67760

Files:
  lldb/trunk/include/lldb/Symbol/CompileUnit.h
  lldb/trunk/include/lldb/Symbol/SymbolFile.h
  lldb/trunk/include/lldb/Target/Platform.h
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/basic/TestImportStdModule.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/conflicts/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/TestBasicDeque.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/TestBasicForwardList.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/TestBasicList.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentList.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/no-std-module/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/queue/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/queue/TestQueue.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContent.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr/TestSharedPtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/stack/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/stack/TestStack.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr/TestUniquePtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/TestBasicVector.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-bool/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-bool/TestBoolVector.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVector.py
  
lldb/trunk/p

[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

> This seems to be enough for getting a backtrace and variable values for 
> MinGW-built binaries for ARM64.

To clarify; this is binaries that use DWARF debug info.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [lldb] r372724 - [lldb][NFC] Use llvm::StringRef in formatters::NSStringSummaryProvider

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 04:00:37 2019
New Revision: 372724

URL: http://llvm.org/viewvc/llvm-project?rev=372724&view=rev
Log:
[lldb][NFC] Use llvm::StringRef in formatters::NSStringSummaryProvider

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

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp?rev=372724&r1=372723&r2=372724&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp Tue Sep 24 04:00:37 
2019
@@ -78,12 +78,12 @@ bool lldb_private::formatters::NSStringS
 return false;
 
   ConstString class_name_cs = descriptor->GetClassName();
-  const char *class_name = class_name_cs.GetCString();
+  llvm::StringRef class_name = class_name_cs.GetStringRef();
 
-  if (!class_name || !*class_name)
+  if (class_name.empty())
 return false;
 
-  bool is_tagged_ptr = (0 == strcmp(class_name, "NSTaggedPointerString")) &&
+  bool is_tagged_ptr = class_name == "NSTaggedPointerString" &&
descriptor->GetTaggedPointerInfo();
   // for a tagged pointer, the descriptor has everything we need
   if (is_tagged_ptr)
@@ -111,7 +111,7 @@ bool lldb_private::formatters::NSStringS
   bool is_inline = (info_bits & 0x60) == 0;
   bool has_explicit_length = (info_bits & (1 | 4)) != 4;
   bool is_unicode = (info_bits & 0x10) == 0x10;
-  bool is_path_store = strcmp(class_name, "NSPathStore2") == 0;
+  bool is_path_store = class_name == "NSPathStore2";
   bool has_null = (info_bits & 8) == 8;
 
   size_t explicit_length = 0;
@@ -135,14 +135,14 @@ bool lldb_private::formatters::NSStringS
 }
   }
 
-  if (strcmp(class_name, "NSString") && strcmp(class_name, "CFStringRef") &&
-  strcmp(class_name, "CFMutableStringRef") &&
-  strcmp(class_name, "__NSCFConstantString") &&
-  strcmp(class_name, "__NSCFString") &&
-  strcmp(class_name, "NSCFConstantString") &&
-  strcmp(class_name, "NSCFString") && strcmp(class_name, "NSPathStore2")) {
+  const llvm::StringSet<> supported_string_classes = {
+  "NSString", "CFMutableStringRef",
+  "CFStringRef",  "__NSCFConstantString",
+  "__NSCFString", "NSCFConstantString",
+  "NSCFString",   "NSPathStore2"};
+  if (supported_string_classes.count(class_name) == 0) {
 // not one of us - but tell me class name
-stream.Printf("class name = %s", class_name);
+stream.Printf("class name = %s", class_name_cs.GetCString());
 return true;
   }
 


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


[Lldb-commits] [lldb] r372729 - [lldb] Use convert_to_slash in CppModuleConfiguration

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 04:17:38 2019
New Revision: 372729

URL: http://llvm.org/viewvc/llvm-project?rev=372729&view=rev
Log:
[lldb] Use convert_to_slash in CppModuleConfiguration

That's what we actually want to do. Might fix the Windows bot.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp?rev=372729&r1=372728&r2=372729&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp 
Tue Sep 24 04:17:38 2019
@@ -31,9 +31,9 @@ bool CppModuleConfiguration::SetOncePath
 }
 
 bool CppModuleConfiguration::analyzeFile(const FileSpec &f) {
-  llvm::SmallString<256> dir_buffer = f.GetDirectory().GetStringRef();
-  // Convert to posix style so that we can use '/'.
-  llvm::sys::path::native(dir_buffer, llvm::sys::path::Style::posix);
+  using namespace llvm::sys::path;
+  // Convert to slashes to make following operations simpler.
+  std::string dir_buffer = convert_to_slash(f.GetDirectory().GetStringRef());
   llvm::StringRef posix_dir(dir_buffer);
 
   // Check for /c++/vX/ that is used by libc++.


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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: aleksandr.urakov.
labath added a comment.

Have you considered going the "native" route directly? My understanding is that 
this route is already functional on x86 (modulo watchpoints, which I need to 
get around to reviewing). It would be great to be able to delete the in-process 
route soon, as it's not good to have both for a long time, and for that we need 
to ensure that the lldb-server route does not lag behind in features. I'm not 
really sure what's needed to enable the lldb-server mechanism, but 
@aleksandr.urakov should.

One of the advantages of lldb-server is that is possible to test it by 
cross-debugging. The mechanism for doing that is a bit complicated, and I'm not 
entirely sure how that works after all the lit changes, but it goes 
approximately like this:

1. build lldb for the host
2. build lldb-server for the target (either on the target, or via cross-compile)
3. run `lldb-server platform --server *:1234` on the target
4. run the `dotest` test suite arguments suitable for cross-compilation. This 
means:
  - setting the test compiler to be a cross compiler (cmake 
-DLLDB_TEST_C(XX)_COMPILER)
  - choosing a suitable test architecture (-DLLDB_TEST_ARCH)
  - telling it how to connect to the target 
(-DLLDB_TEST_USER_ARGS=--platform-name remote-windows --platform-url 
connect://remote:1234 --platform-working-dir=c:\tmp)
  - crossing your fingers :)

But, of course the easiest way to test this would be to build and test 
natively. The usual obstacle for that is that the arm device is too small to 
comfortably work on it, but you say you don't have the full build environment 
*yet*, so it's not clear to me whether that is the problem you're running 
into...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D67954#1680536 , @labath wrote:

> Have you considered going the "native" route directly? My understanding is 
> that this route is already functional on x86 (modulo watchpoints, which I 
> need to get around to reviewing). It would be great to be able to delete the 
> in-process route soon, as it's not good to have both for a long time, and for 
> that we need to ensure that the lldb-server route does not lag behind in 
> features. I'm not really sure what's needed to enable the lldb-server 
> mechanism, but @aleksandr.urakov should.


I haven't dug in to see what's needed to enable it (if it maybe is enabled 
separately per arch somewhere?) - I just built lldb for arm64, tested using it 
and noting that it crashed due to `m_thread_reg_ctx` being unset, made a first 
proof of concept implementation of the missing class, and noted that it 
actually worked for getting usable debug info from my testcase.

> One of the advantages of lldb-server is that is possible to test it by 
> cross-debugging. The mechanism for doing that is a bit complicated, and I'm 
> not entirely sure how that works after all the lit changes, but it goes 
> approximately like this:
> 
> 1. build lldb for the host
> 2. build lldb-server for the target (either on the target, or via 
> cross-compile)
> 3. run `lldb-server platform --server *:1234` on the target
> 4. run the `dotest` test suite arguments suitable for cross-compilation. This 
> means:
>   - setting the test compiler to be a cross compiler (cmake 
> -DLLDB_TEST_C(XX)_COMPILER)
>   - choosing a suitable test architecture (-DLLDB_TEST_ARCH)
>   - telling it how to connect to the target 
> (-DLLDB_TEST_USER_ARGS=--platform-name remote-windows --platform-url 
> connect://remote:1234 --platform-working-dir=c:\tmp)
>   - crossing your fingers :)

Interesting - sounds sensible but also sounds like a bit more effort to get 
going than just running the usual lit tests. Will look into that at some point.

> But, of course the easiest way to test this would be to build and test 
> natively. The usual obstacle for that is that the arm device is too small to 
> comfortably work on it, but you say you don't have the full build environment 
> *yet*, so it's not clear to me whether that is the problem you're running 
> into...

Well, I cross build as the environment on the target device is a bit bare, and 
as it's a new architecture and all, there's not much available when it comes to 
prebuilt packages (for everything you need for building) - I do have a working 
compiler on that device, but nothing else. The devices do support running i386 
binaries emulated, so I could install such a version of msys2 and do building 
there, but even more slowly... In general as well, I think building llvm/lldb 
on such a device requires quite a bit of patience, and rebuilding after 
fetching newer upstream commits would be pretty painful as well.

I think the most practical setup, at least for lit-style tests that don't 
require any compilation in themselves, is cross-building all the binaries 
needed, moving them over to the target device, and running them with llvm-lit 
there. But that still requires having python available for running llvm-lit.

The alternative is probably to leverage WSL for a mess-free environment with 
python, shells and everything available, but I'm not sure if that messes things 
up (like llvm-lit thinks it runs on linux even though the binaries it should 
execute will run are windows ones).


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [lldb] r372736 - [lldb][NFC] Use default member initializers in ReadStringAndDumpToStreamOptions

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 05:01:15 2019
New Revision: 372736

URL: http://llvm.org/viewvc/llvm-project?rev=372736&view=rev
Log:
[lldb][NFC] Use default member initializers in ReadStringAndDumpToStreamOptions

Modified:
lldb/trunk/include/lldb/DataFormatters/StringPrinter.h

Modified: lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/StringPrinter.h?rev=372736&r1=372735&r2=372736&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/StringPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/StringPrinter.h Tue Sep 24 05:01:15 
2019
@@ -26,12 +26,7 @@ public:
 
   class ReadStringAndDumpToStreamOptions {
   public:
-ReadStringAndDumpToStreamOptions()
-: m_location(0), m_process_sp(), m_stream(nullptr), m_prefix_token(),
-  m_suffix_token(), m_quote('"'), m_source_size(0),
-  m_needs_zero_termination(true), m_escape_non_printables(true),
-  m_ignore_max_length(false), m_zero_is_terminator(true),
-  m_language_type(lldb::eLanguageTypeUnknown) {}
+ReadStringAndDumpToStreamOptions() = default;
 
 ReadStringAndDumpToStreamOptions(ValueObject &valobj);
 
@@ -128,24 +123,23 @@ public:
 }
 
 lldb::LanguageType GetLanguage() const
-
 {
   return m_language_type;
 }
 
   private:
-uint64_t m_location;
+uint64_t m_location = 0;
 lldb::ProcessSP m_process_sp;
-Stream *m_stream;
+Stream *m_stream = nullptr;
 std::string m_prefix_token;
 std::string m_suffix_token;
-char m_quote;
-uint32_t m_source_size;
-bool m_needs_zero_termination;
-bool m_escape_non_printables;
-bool m_ignore_max_length;
-bool m_zero_is_terminator;
-lldb::LanguageType m_language_type;
+char m_quote = '"';
+uint32_t m_source_size = 0;
+bool m_needs_zero_termination = true;
+bool m_escape_non_printables = true;
+bool m_ignore_max_length = false;
+bool m_zero_is_terminator = true;
+lldb::LanguageType m_language_type = lldb::eLanguageTypeUnknown;
   };
 
   class ReadBufferAndDumpToStreamOptions {


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


[Lldb-commits] [PATCH] D67222: [Windows] Added support of watchpoints to `NativeProcessWindows`

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks mostly fine to me. There's still a lot more copy-pasta between the 
three kinds of register contexts than I'd like (e.g. on linux, all of these 
three cases are handled by a single class), but I don't have a clear idea what 
to do about that at this point.




Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp:447-449
+std::ostringstream ostr;
+ostr << reg_ctx.GetWatchpointAddress(wp_id) << " " << wp_id << " "
+ << reg_ctx.GetWatchpointHitAddress(wp_id);

Though the std::stringstream classes are used in a couple of places, we usually 
try to stay away from all std::stream classes. In this case, I'd just do a 
`llvm::formatv(...).str()`


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67222



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


[Lldb-commits] [lldb] r372737 - [lldb] Also force posix paths in CppModuleConfigurationTest

2019-09-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep 24 05:13:35 2019
New Revision: 372737

URL: http://llvm.org/viewvc/llvm-project?rev=372737&view=rev
Log:
[lldb] Also force posix paths in CppModuleConfigurationTest

Modified:
lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp

Modified: lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp?rev=372737&r1=372736&r2=372737&view=diff
==
--- lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp (original)
+++ lldb/trunk/unittests/Expression/CppModuleConfigurationTest.cpp Tue Sep 24 
05:13:35 2019
@@ -43,7 +43,7 @@ static std::string ResourceInc() {
 static FileSpecList makeFiles(llvm::ArrayRef paths) {
   FileSpecList result;
   for (const std::string &path : paths)
-result.Append(FileSpec(path));
+result.Append(FileSpec(path, FileSpec::Style::posix));
   return result;
 }
 


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


[Lldb-commits] [lldb] r372739 - [LLDB] [test] Add a few missing cases of REQUIRES: python

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 05:20:33 2019
New Revision: 372739

URL: http://llvm.org/viewvc/llvm-project?rev=372739&view=rev
Log:
[LLDB] [test] Add a few missing cases of REQUIRES: python

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

Modified:
lldb/trunk/lit/Commands/command-script-import.test
lldb/trunk/lit/Reproducer/TestSynchronous.test

Modified: lldb/trunk/lit/Commands/command-script-import.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/command-script-import.test?rev=372739&r1=372738&r2=372739&view=diff
==
--- lldb/trunk/lit/Commands/command-script-import.test (original)
+++ lldb/trunk/lit/Commands/command-script-import.test Tue Sep 24 05:20:33 2019
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # RUN: echo 'b main' > %t.in
 # RUN: echo 'run' >> %t.in
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in

Modified: lldb/trunk/lit/Reproducer/TestSynchronous.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestSynchronous.test?rev=372739&r1=372738&r2=372739&view=diff
==
--- lldb/trunk/lit/Reproducer/TestSynchronous.test (original)
+++ lldb/trunk/lit/Reproducer/TestSynchronous.test Tue Sep 24 05:20:33 2019
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # Ensure that replay happens in synchronous mode.
 
 # RUN: rm -rf %t.repro


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


[Lldb-commits] [lldb] r372741 - [LLDB] Add tests for PECOFF arm architecture identification

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 05:20:52 2019
New Revision: 372741

URL: http://llvm.org/viewvc/llvm-project?rev=372741&view=rev
Log:
[LLDB] Add tests for PECOFF arm architecture identification

Add a test case for the change from SVN r372657, and for the
preexisting ARM identification.

Add a missing ArchDefinitionEntry for PECOFF/arm64, and tweak
the ArmNt case to set the architecture to armv7 (ArmNt never ran
on anything lower than that). (This avoids a case where
ArchSpec::MergeFrom would override the arch from arm to armv7 and
ArchSpec::CoreUpdated would reset the OS to unknown at the same time.)

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

Added:
lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Utility/ArchSpec.cpp

Added: lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml?rev=372741&view=auto
==
--- lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml (added)
+++ lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml Tue Sep 24 05:20:52 2019
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: armv7-pc-windows-msvc
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: false
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x4
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4097
+  ImageBase:   4194304
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, 
IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, 
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_ARMNT
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, 
IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 2
+SectionData: '7047'
+symbols: []
+...

Added: lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml?rev=372741&view=auto
==
--- lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml (added)
+++ lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml Tue Sep 24 05:20:52 2019
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: aarch64-unknown-windows-msvc
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: false
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x4000
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, 
IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, 
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfSta

[Lldb-commits] [lldb] r372738 - [LLDB] Fix typo in RegisterContextDarwin_arm64

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 05:20:21 2019
New Revision: 372738

URL: http://llvm.org/viewvc/llvm-project?rev=372738&view=rev
Log:
[LLDB] Fix typo in RegisterContextDarwin_arm64

In these cases, the register number should be calculated from
fpu_d0, not fpu_s0.

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

Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp?rev=372738&r1=372737&r2=372738&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp 
Tue Sep 24 05:20:21 2019
@@ -503,7 +503,7 @@ bool RegisterContextDarwin_arm64::ReadRe
   case fpu_d31: {
 ProcessSP process_sp(m_thread.GetProcess());
 if (process_sp.get()) {
-  DataExtractor regdata(&fpu.v[reg - fpu_s0], 8, 
process_sp->GetByteOrder(),
+  DataExtractor regdata(&fpu.v[reg - fpu_d0], 8, 
process_sp->GetByteOrder(),
 process_sp->GetAddressByteSize());
   offset_t offset = 0;
   value.SetDouble(regdata.GetDouble(&offset));


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


[Lldb-commits] [lldb] r372740 - [LLDB] [test] Allow differing order of some matches

2019-09-24 Thread Martin Storsjo via lldb-commits
Author: mstorsjo
Date: Tue Sep 24 05:20:38 2019
New Revision: 372740

URL: http://llvm.org/viewvc/llvm-project?rev=372740&view=rev
Log:
[LLDB] [test] Allow differing order of some matches

These can appear in a different order depending on the relative
layout of the source and build trees.

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

Modified:
lldb/trunk/lit/Reproducer/TestDump.test

Modified: lldb/trunk/lit/Reproducer/TestDump.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestDump.test?rev=372740&r1=372739&r2=372740&view=diff
==
--- lldb/trunk/lit/Reproducer/TestDump.test (original)
+++ lldb/trunk/lit/Reproducer/TestDump.test Tue Sep 24 05:20:38 2019
@@ -8,8 +8,8 @@
 # RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' 
--capture --capture-path %t.repro %t/reproducer.out
 
 # RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s 
--check-prefix FILES
-# FILES: 'reproducer.out'
-# FILES: 'FileCapture.in'
+# FILES-DAG: 'reproducer.out'
+# FILES-DAG: 'FileCapture.in'
 
 # RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s 
--check-prefix VERSION
 # VERSION: lldb version


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


[Lldb-commits] [PATCH] D67892: [LLDB] Fix typo in RegisterContextDarwin_arm64

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372738: [LLDB] Fix typo in RegisterContextDarwin_arm64 
(authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67892?vs=221223&id=221516#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67892

Files:
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp


Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -503,7 +503,7 @@
   case fpu_d31: {
 ProcessSP process_sp(m_thread.GetProcess());
 if (process_sp.get()) {
-  DataExtractor regdata(&fpu.v[reg - fpu_s0], 8, 
process_sp->GetByteOrder(),
+  DataExtractor regdata(&fpu.v[reg - fpu_d0], 8, 
process_sp->GetByteOrder(),
 process_sp->GetAddressByteSize());
   offset_t offset = 0;
   value.SetDouble(regdata.GetDouble(&offset));


Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -503,7 +503,7 @@
   case fpu_d31: {
 ProcessSP process_sp(m_thread.GetProcess());
 if (process_sp.get()) {
-  DataExtractor regdata(&fpu.v[reg - fpu_s0], 8, process_sp->GetByteOrder(),
+  DataExtractor regdata(&fpu.v[reg - fpu_d0], 8, process_sp->GetByteOrder(),
 process_sp->GetAddressByteSize());
   offset_t offset = 0;
   value.SetDouble(regdata.GetDouble(&offset));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67953: [LLDB] [test] Allow differing order of some matches

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372740: [LLDB] [test] Allow differing order of some matches 
(authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67953?vs=221489&id=221518#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67953

Files:
  lldb/trunk/lit/Reproducer/TestDump.test


Index: lldb/trunk/lit/Reproducer/TestDump.test
===
--- lldb/trunk/lit/Reproducer/TestDump.test
+++ lldb/trunk/lit/Reproducer/TestDump.test
@@ -8,8 +8,8 @@
 # RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' 
--capture --capture-path %t.repro %t/reproducer.out
 
 # RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s 
--check-prefix FILES
-# FILES: 'reproducer.out'
-# FILES: 'FileCapture.in'
+# FILES-DAG: 'reproducer.out'
+# FILES-DAG: 'FileCapture.in'
 
 # RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s 
--check-prefix VERSION
 # VERSION: lldb version


Index: lldb/trunk/lit/Reproducer/TestDump.test
===
--- lldb/trunk/lit/Reproducer/TestDump.test
+++ lldb/trunk/lit/Reproducer/TestDump.test
@@ -8,8 +8,8 @@
 # RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' --capture --capture-path %t.repro %t/reproducer.out
 
 # RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s --check-prefix FILES
-# FILES: 'reproducer.out'
-# FILES: 'FileCapture.in'
+# FILES-DAG: 'reproducer.out'
+# FILES-DAG: 'FileCapture.in'
 
 # RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s --check-prefix VERSION
 # VERSION: lldb version
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67952: [LLDB] [test] Add a few missing cases of REQUIRES: python

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372739: [LLDB] [test] Add a few missing cases of REQUIRES: 
python (authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67952?vs=221488&id=221517#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67952

Files:
  lldb/trunk/lit/Commands/command-script-import.test
  lldb/trunk/lit/Reproducer/TestSynchronous.test


Index: lldb/trunk/lit/Reproducer/TestSynchronous.test
===
--- lldb/trunk/lit/Reproducer/TestSynchronous.test
+++ lldb/trunk/lit/Reproducer/TestSynchronous.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # Ensure that replay happens in synchronous mode.
 
 # RUN: rm -rf %t.repro
Index: lldb/trunk/lit/Commands/command-script-import.test
===
--- lldb/trunk/lit/Commands/command-script-import.test
+++ lldb/trunk/lit/Commands/command-script-import.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # RUN: echo 'b main' > %t.in
 # RUN: echo 'run' >> %t.in
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in


Index: lldb/trunk/lit/Reproducer/TestSynchronous.test
===
--- lldb/trunk/lit/Reproducer/TestSynchronous.test
+++ lldb/trunk/lit/Reproducer/TestSynchronous.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # Ensure that replay happens in synchronous mode.
 
 # RUN: rm -rf %t.repro
Index: lldb/trunk/lit/Commands/command-script-import.test
===
--- lldb/trunk/lit/Commands/command-script-import.test
+++ lldb/trunk/lit/Commands/command-script-import.test
@@ -1,3 +1,4 @@
+# REQUIRES: python
 # RUN: echo 'b main' > %t.in
 # RUN: echo 'run' >> %t.in
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67951: [LLDB] Add tests for PECOFF arm architecture identification

2019-09-24 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372741: [LLDB] Add tests for PECOFF arm architecture 
identification (authored by mstorsjo, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67951?vs=221487&id=221519#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67951

Files:
  lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
  lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/trunk/source/Utility/ArchSpec.cpp

Index: lldb/trunk/source/Utility/ArchSpec.cpp
===
--- lldb/trunk/source/Utility/ArchSpec.cpp
+++ lldb/trunk/source/Utility/ArchSpec.cpp
@@ -459,7 +459,9 @@
 {ArchSpec::eCore_thumb, llvm::COFF::IMAGE_FILE_MACHINE_THUMB,
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // ARMv7
 {ArchSpec::eCore_x86_64_x86_64, llvm::COFF::IMAGE_FILE_MACHINE_AMD64,
- LLDB_INVALID_CPUTYPE, 0xu, 0xu} // AMD64
+ LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // AMD64
+{ArchSpec::eCore_arm_arm64, llvm::COFF::IMAGE_FILE_MACHINE_ARM64,
+ LLDB_INVALID_CPUTYPE, 0xu, 0xu} // ARM64
 };
 
 static const ArchDefinition g_coff_arch_def = {
Index: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -195,7 +195,7 @@
 specs.Append(module_spec);
 break;
   case MachineArmNt:
-spec.SetTriple("arm-pc-windows");
+spec.SetTriple("armv7-pc-windows");
 specs.Append(module_spec);
 break;
   case MachineArm64:
Index: lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
===
--- lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
+++ lldb/trunk/lit/Modules/PECOFF/basic-info-arm.yaml
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: armv7-pc-windows-msvc
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: false
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x4
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4097
+  ImageBase:   4194304
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_ARMNT
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 2
+SectionData: '7047'
+symbols: []
+...
Index: lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
===
--- lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
+++ lldb/trunk/lit/Modules/PECOFF/basic-info-arm64.yaml
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: aarch64-unknown-windows-msvc
+#

[Lldb-commits] [PATCH] D67222: [Windows] Added support of watchpoints to `NativeProcessWindows`

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Btw, in the context of D67954 , I realized 
that I don't know how to actually enable the usage of lldb-server in lldb on 
windows. Can you share how you did that ?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67222



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


[Lldb-commits] [lldb] r372744 - Enhance SymbolFileDWARF::ParseDeclsForContext performance

2019-09-24 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Sep 24 05:36:54 2019
New Revision: 372744

URL: http://llvm.org/viewvc/llvm-project?rev=372744&view=rev
Log:
Enhance SymbolFileDWARF::ParseDeclsForContext performance

This implements
DWARFASTParserClang::EnsureAllDIEsInDeclContextHaveBeenParsed so as to
provide a faster way to ensure all DIEs linked to a certain declaration
context have been parsed.

Currently, we rely on SymbolFileDWARF::ParseDeclsForContext calling
DWARFASTParserClang::GetDIEForDeclContext, and only then
DWARFASTParserClang::GetDeclForUIDFromDWARF. This change shortcuts that
logic and removes redundant calls to DWARFASTParserClang::
GetClangDeclForDIE by deleting DIEs from the m_decl_ctx_to_die map once
they have been parsed.

Differential Revision: https://reviews.llvm.org/D67760
Patch by Guilherme Andrade .

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h?rev=372744&r1=372743&r2=372744&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h Tue Sep 24 
05:36:54 2019
@@ -48,8 +48,8 @@ public:
   virtual lldb_private::CompilerDeclContext
   GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) = 0;
 
-  virtual std::vector
-  GetDIEForDeclContext(lldb_private::CompilerDeclContext decl_context) = 0;
+  virtual void EnsureAllDIEsInDeclContextHaveBeenParsed(
+  lldb_private::CompilerDeclContext decl_context) = 0;
 
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE &parent_die,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=372744&r1=372743&r2=372744&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Sep 
24 05:36:54 2019
@@ -2183,15 +2183,16 @@ bool DWARFASTParserClang::CompleteTypeFr
   return false;
 }
 
-std::vector DWARFASTParserClang::GetDIEForDeclContext(
+void DWARFASTParserClang::EnsureAllDIEsInDeclContextHaveBeenParsed(
 lldb_private::CompilerDeclContext decl_context) {
-  std::vector result;
   auto opaque_decl_ctx =
   (clang::DeclContext *)decl_context.GetOpaqueDeclContext();
   for (auto it = m_decl_ctx_to_die.find(opaque_decl_ctx);
-   it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx; it++)
-result.push_back(it->second);
-  return result;
+   it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx;
+   it = m_decl_ctx_to_die.erase(it))
+for (DWARFDIE decl = it->second.GetFirstChild(); decl;
+ decl = decl.GetSibling())
+  GetClangDeclForDIE(decl);
 }
 
 CompilerDecl DWARFASTParserClang::GetDeclForUIDFromDWARF(const DWARFDIE &die) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h?rev=372744&r1=372743&r2=372744&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h Tue Sep 24 
05:36:54 2019
@@ -51,8 +51,8 @@ public:
   lldb_private::CompilerDecl
   GetDeclForUIDFromDWARF(const DWARFDIE &die) override;
 
-  std::vector
-  GetDIEForDeclContext(lldb_private::CompilerDeclContext decl_context) 
override;
+  void EnsureAllDIEsInDeclContextHaveBeenParsed(
+  lldb_private::CompilerDeclContext decl_context) override;
 
   lldb_private::CompilerDeclContext
   GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=372744&r1=372743&r2=372744&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Sep 24 
05:36:54 2019
@@ -1217,16 +1217,9 @@ bool SymbolFileDWARF::ClassOrStructIsVir
 
 void SymbolFileDWARF::ParseDeclsForContext(CompilerDeclContext decl_ctx) {
   auto *type_system = decl_ctx

[Lldb-commits] [PATCH] D67022: Enhance SymbolFileDWARF::ParseDeclsForContext performance

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath closed this revision.
labath added a comment.
Herald added a subscriber: usaxena95.

In D67022#1669298 , @guiandrade wrote:

> Thank you, guys! Could you please submit it for me?


Landed as r370374. Sorry about the delay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67022



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


[Lldb-commits] [lldb] r372755 - [lldb] [Process/NetBSD] Fix handling LLDB_INVALID_SIGNAL_NUMBER

2019-09-24 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Sep 24 06:41:54 2019
New Revision: 372755

URL: http://llvm.org/viewvc/llvm-project?rev=372755&view=rev
Log:
[lldb] [Process/NetBSD] Fix handling LLDB_INVALID_SIGNAL_NUMBER

Fix NativeProcessNetBSD::Resume() to handle LLDB_INVALID_SIGNAL_NUMBER
correctly.  Fixes breakage caused by r372090 and r372300.  I have major
rewrite of that function pending; however, the fixes to gdb-remote
were committed prior to that.

Modified:
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=372755&r1=372754&r2=372755&view=diff
==
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Tue Sep 24 
06:41:54 2019
@@ -340,12 +340,14 @@ Status NativeProcessNetBSD::Resume(const
   }
 
   Status error;
+  int signal =
+  action->signal != LLDB_INVALID_SIGNAL_NUMBER ? action->signal : 0;
 
   switch (action->state) {
   case eStateRunning: {
 // Run the thread, possibly feeding it the signal.
 error = NativeProcessNetBSD::PtraceWrapper(PT_CONTINUE, GetID(), (void *)1,
-   action->signal);
+   signal);
 if (!error.Success())
   return error;
 for (const auto &thread : m_threads)
@@ -356,7 +358,7 @@ Status NativeProcessNetBSD::Resume(const
   case eStateStepping:
 // Run the thread, possibly feeding it the signal.
 error = NativeProcessNetBSD::PtraceWrapper(PT_STEP, GetID(), (void *)1,
-   action->signal);
+   signal);
 if (!error.Success())
   return error;
 for (const auto &thread : m_threads)


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


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: jasonmolenda, aprantl, JDevlieghere, tatyana-krasnukha.
Herald added subscribers: atanasyan, kbarton, mgorny, nemanjai.

I was recently surprised to learn that there is a total of 2 (two) users
of the register info definitions contained in the ABI plugins. Yet, the
defitions themselves span nearly 10kLOC.
The two users are:

- dwarf expression pretty printer
- the mechanism for augmenting the register info definitions obtained over 
gdb-remote protocol (AugmentRegisterInfoViaABI)

Both of these uses need the DWARF an EH register numbers, which is
information that is already available in LLVM. This patch makes it
possible to do so.

It adds a GetMCRegisterInfo method to the ABI class, which every class
is expected to implement. Normally, it should be sufficient to obtain
the definitions from the appropriate llvm::Target object (for which I
provide a utility function), but the subclasses are free to construct it
in any way they deem fit.

We should be able to always get the MCRegisterInfo object from llvm,
with one important exception: if the relevant llvm target was disabled
at compile time. To handle this, I add a mechanism to disable the
compilation of ABI plugins based on the value of LLVM_TARGETS_TO_BUILD
cmake setting. This ensures all our existing are able to create their
MCRegisterInfo objects.

The new MCRegisterInfo api is not used yet, but the intention is to make
use of it in follow-up patches.


https://reviews.llvm.org/D67965

Files:
  include/lldb/Target/ABI.h
  source/API/CMakeLists.txt
  source/API/SystemInitializerFull.cpp
  source/Plugins/ABI/CMakeLists.txt
  source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
  source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
  source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
  source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
  source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
  source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
  source/Plugins/ABI/SysV-arm/ABISysV_arm.h
  source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
  source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
  source/Plugins/ABI/SysV-i386/ABISysV_i386.h
  source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  source/Plugins/ABI/SysV-mips/ABISysV_mips.h
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
  source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
  source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
  source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
  source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
  source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
  source/Target/ABI.cpp
  tools/lldb-test/CMakeLists.txt
  tools/lldb-test/SystemInitializerTest.cpp

Index: tools/lldb-test/SystemInitializerTest.cpp
===
--- tools/lldb-test/SystemInitializerTest.cpp
+++ tools/lldb-test/SystemInitializerTest.cpp
@@ -28,6 +28,7 @@
 #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
 #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
+#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
 #include "Plugins/Architecture/Arm/ArchitectureArm.h"
 #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
 #include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
@@ -144,19 +145,34 @@
 
   ClangASTContext::Initialize();
 
-  ABIMacOSX_i386::Initialize();
-  ABIMacOSX_arm::Initialize();
+#ifdef LLVM_TARGET_AArch64_BUILT
   ABIMacOSX_arm64::Initialize();
-  ABISysV_arm::Initialize();
   ABISysV_arm64::Initialize();
+#endif
+#ifdef LLVM_TARGET_ARM_BUILT
+  ABIMacOSX_arm::Initialize();
+  ABISysV_arm::Initialize();
+#endif
+#ifdef LLVM_TARGET_Hexagon_BUILT
   ABISysV_hexagon::Initialize();
-  ABISysV_i386::Initialize();
-  ABISysV_x86_64::Initialize();
-  ABISysV_ppc::Initialize();
-  ABISysV_ppc64::Initialize();
+#endif
+#ifdef LLVM_TARGET_Mips_BUILT
   ABISysV_mips::Initialize();
   ABISysV_mips64::Initialize();
+#endif
+#ifdef LLVM_TARGET_PowerPC_BUILT
+  ABISysV_ppc::Initialize();
+  ABISysV_ppc64::Initialize();
+#endif
+#ifdef LLVM_TARGET_SystemZ_BUILT
   ABISysV_s390x::Initialize();
+#endif
+#ifdef LLVM_TARGET_X86_BUILT
+  ABIMacOSX_i386::Initialize();
+  ABISysV_i386::Initialize();
+  ABISysV_x86_64::Initialize();
+  ABIWindows_x86_64::Initialize();
+#endif
 
   ArchitectureArm::Initialize();
   ArchitecturePPC64::Initialize();
@@ -246,19 +262,35 @@
 
   ClangASTContext::Terminate();
 
-  ABIMacOSX_i386::Terminate();
-  ABIMacOSX_arm::Terminate();
+#ifdef LLVM_TARGET_AArch6

[Lldb-commits] [lldb] r372763 - [NFC] Fix typo in the "kind" description for the software single-step breakpoint

2019-09-24 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Sep 24 07:24:52 2019
New Revision: 372763

URL: http://llvm.org/viewvc/llvm-project?rev=372763&view=rev
Log:
[NFC] Fix typo in the "kind" description for the software single-step breakpoint

Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=372763&r1=372762&r2=372763&view=diff
==
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Tue Sep 24 
07:24:52 2019
@@ -977,7 +977,7 @@ Status ProcessFreeBSD::SetSoftwareSingle
   Breakpoint *const sw_step_break =
   m_process->GetTarget().CreateBreakpoint(addr, true, false).get();
   sw_step_break->SetCallback(SingleStepBreakpointHit, this, true);
-  sw_step_break->SetBreakpointKind("software-signle-step");
+  sw_step_break->SetBreakpointKind("software-single-step");
 
   LLDB_LOGF(log, "ProcessFreeBSD::%s addr = 0x%" PRIx64 " -- SUCCESS",
 __FUNCTION__, addr);


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


[Lldb-commits] [PATCH] D67966: Use llvm for dumping DWARF expressions

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, aprantl, jasonmolenda.

It uses the new ability of ABI plugins to vend llvm::MCRegisterInfo
structs (which is what is needed to turn dwarf register numbers into
strings).


https://reviews.llvm.org/D67966

Files:
  include/lldb/Utility/DataExtractor.h
  lit/SymbolFile/DWARF/debug_loc.s
  lit/SymbolFile/DWARF/dwarf5_locations.s
  source/Expression/DWARFExpression.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Symbol/ClangASTContext.cpp
  unittests/Utility/ScalarTest.cpp

Index: unittests/Utility/ScalarTest.cpp
===
--- unittests/Utility/ScalarTest.cpp
+++ unittests/Utility/ScalarTest.cpp
@@ -16,7 +16,9 @@
 #include "llvm/Testing/Support/Error.h"
 
 using namespace lldb_private;
-using namespace llvm;
+using llvm::APInt;
+using llvm::Failed;
+using llvm::Succeeded;
 
 template 
 bool checkInequality(T c1, T c2) {
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -103,8 +103,8 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace llvm;
 using namespace clang;
+using llvm::StringSwitch;
 
 namespace {
 #ifdef LLDB_CONFIGURATION_DEBUG
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -86,7 +86,6 @@
 #include "llvm/Support/raw_ostream.h"
 
 #define DEBUGSERVER_BASENAME "debugserver"
-using namespace llvm;
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_gdb_remote;
Index: source/Expression/DWARFExpression.cpp
===
--- source/Expression/DWARFExpression.cpp
+++ source/Expression/DWARFExpression.cpp
@@ -88,413 +88,10 @@
lldb::offset_t length,
lldb::DescriptionLevel level,
ABI *abi) const {
-  if (!m_data.ValidOffsetForDataOfSize(offset, length))
-return;
-  const lldb::offset_t start_offset = offset;
-  const lldb::offset_t end_offset = offset + length;
-
-  // An operation within a DWARF expression may contain a sub-expression. The
-  // motivating example for this is DW_OP_entry_value. Keep track of where each
-  // each sub-expression ends.
-  std::vector ends_of_subexprs;
-
-  // "Finish" (i.e. print the closing right-parens) for sub-expressions up to
-  // the specified \p op_offset.
-  auto finish_subexpressions_to = [&](const lldb::offset_t op_offset) {
-while (!ends_of_subexprs.empty() && op_offset >= ends_of_subexprs.back()) {
-  ends_of_subexprs.pop_back();
-  s->Printf(")");
-  if (!ends_of_subexprs.empty())
-s->Printf(" ");
-}
-  };
-
-  while (m_data.ValidOffset(offset) && offset < end_offset) {
-const lldb::offset_t op_offset = offset;
-const uint8_t op = m_data.GetU8(&offset);
-finish_subexpressions_to(op_offset);
-
-switch (level) {
-default:
-  break;
-
-case lldb::eDescriptionLevelBrief:
-  if (op_offset > start_offset)
-s->PutChar(' ');
-  break;
-
-case lldb::eDescriptionLevelFull:
-case lldb::eDescriptionLevelVerbose:
-  if (op_offset > start_offset)
-s->EOL();
-  s->Indent();
-  if (level == lldb::eDescriptionLevelFull)
-break;
-  // Fall through for verbose and print offset and DW_OP prefix..
-  s->Printf("0x%8.8" PRIx64 ": %s", op_offset,
-op >= DW_OP_APPLE_uninit ? "DW_OP_APPLE_" : "DW_OP_");
-  break;
-}
-
-switch (op) {
-case DW_OP_addr:
-  *s << "DW_OP_addr(" << m_data.GetAddress(&offset) << ") ";
-  break; // 0x03 1 address
-case DW_OP_deref:
-  *s << "DW_OP_deref";
-  break; // 0x06
-case DW_OP_const1u:
-  s->Printf("DW_OP_const1u(0x%2.2x)", m_data.GetU8(&offset));
-  break; // 0x08 1 1-byte constant
-case DW_OP_const1s:
-  s->Printf("DW_OP_const1s(0x%2.2x)", m_data.GetU8(&offset));
-  break; // 0x09 1 1-byte constant
-case DW_OP_const2u:
-  s->Printf("DW_OP_const2u(0x%4.4x)", m_data.GetU16(&offset));
-  break; // 0x0a 1 2-byte constant
-case DW_OP_const2s:
-  s->Printf("DW_OP_const2s(0x%4.4x)", m_data.GetU16(&offset));
-  break; // 0x0b 1 2-byte constant
-case DW_OP_const4u:
-  s->Printf("DW_OP_const4u(0x%8.8x)", m_data.GetU32(&offset));
-  break; // 0x0c 1 4-byte constant
-case DW_OP_const4s:
-  s->Printf("DW_OP_const4s(0x%8.8x)", m_data.GetU32(&offset));
-  break; // 0x0d 1 4-byte constant
-case DW_OP_const8u:
-  s->Printf("DW_OP_const8u(0x%16.16" PRIx64 ")", m_data.GetU64(&offset));
-  break; // 0x0e 1 8-byte const

[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

Honestly, this is just setting up the register context for ARM64.  I dont think 
that there is much of a test for this.  I mean, I suppose you could test this 
by instantiating the context and trying to read it through the interface.  But, 
I question the value of such a test.  Whether you go with the in-process or 
out-of-process approach and whether you are doing DWARF of CodeView debugging 
this is going to be needed.  As to running the test suite - you can 
cross-compile and run the tests remotely.




Comment at: 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp:57
+gpr_x21, gpr_x22, gpr_x23, gpr_x24, gpr_x25, gpr_x26, gpr_x27,
+gpr_x28, gpr_fp,  gpr_lr,  gpr_sp,  gpr_pc,  gpr_cpsr};
+

It formats better if you add a trailing comma to the list (`gpr_cpsr,`)



Comment at: 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp:64
+fpu_v21, fpu_v22, fpu_v23, fpu_v24, fpu_v25,  fpu_v26, fpu_v27,
+fpu_v28, fpu_v29, fpu_v30, fpu_v31, fpu_fpsr, fpu_fpcr};
+

Similar



Comment at: 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp:70
+{"Floating Point Registers", "fpu",
+ llvm::array_lengthof(g_fpu_reg_indices), g_fpu_reg_indices}};
+

Similar


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67966: Use llvm for dumping DWARF expressions

2019-09-24 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.

This is great!


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

https://reviews.llvm.org/D67966



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


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Target/ABI.cpp:216
+
+std::unique_ptr ABI::MakeMCRegisterInfo(const ArchSpec 
&arch) {
+  std::string triple = arch.GetTriple().getTriple();

Should this return an llvm::Expected instead? I understand it will cause a lot 
of churn around the call sites, but now if this fails it will trigger an assert 
in the ABI constructor?


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

https://reviews.llvm.org/D67965



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 debugging

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D67954#1680893 , @compnerd wrote:

> Honestly, this is just setting up the register context for ARM64.  I dont 
> think that there is much of a test for this.  I mean, I suppose you could 
> test this by instantiating the context and trying to read it through the 
> interface.  But, I question the value of such a test.  Whether you go with 
> the in-process or out-of-process approach and whether you are doing DWARF of 
> CodeView debugging this is going to be needed.  As to running the test suite 
> - you can cross-compile and run the tests remotely.


I disagree. As D67892  shows, it quite 
possible to mess up even with a "trivial" class as this one. Ideally I'd like 
to see here tests similar to what @mgorny added for x86 (see 
`lldb/lit/Register`). However, the problem is that we don't have a way to run 
those tests at the moment. Since this is a problem that's going to show up 
sooner or later, perhaps with more "nontrivial" patches, I think it's good to 
figure out what to do early.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67390: [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-24 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk added a comment.

@clayborg @labath I'm still trying to only add symbols when they are unique.

Take this already existing test:

  ./bin/llvm-lit -avv 
~/llvm-project/lldb/lit/SymbolFile/DWARF/debug-types-line-tables.s

The symbols that are being added at the end of `ObjectFileELF::ParseSymbols` 
are  these:

  Symbol:
i: 1
start_id: 0
symbol_bare: ""
is_mangled: 0
symbol_type: 0
is_global: 0
symbol_section_sp: 0x1915710 (.debug_str)
symbol_value: 0
symbol.st_size: 0
symbol_size_valid: 1
has_suffix: 0
flags: 3
  
  Symbol:
i: 2
start_id: 0
symbol_bare: ""
is_mangled: 0
symbol_type: 0
is_global: 0
symbol_section_sp: 0x19157e0 (.debug_abbrev)
symbol_value: 0
symbol.st_size: 0
symbol_size_valid: 1
has_suffix: 0
flags: 3
  
  Symbol:
i: 3
start_id: 0
symbol_bare: ""
is_mangled: 0
symbol_type: 0
is_global: 0
symbol_section_sp: 0x1915a50 (.debug_line)
symbol_value: 0
symbol.st_size: 0
symbol_size_valid: 1
has_suffix: 0
flags: 3

I wonder how to define uniqueness for them. As you can see, the only difference 
is the symbol section which wasn't part of your definition of uniqueness (yet).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



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


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: include/lldb/Target/ABI.h:141
 protected:
-  // Classes that inherit from ABI can see and modify these
-  ABI(lldb::ProcessSP process_sp) {
-if (process_sp.get())
-m_process_wp = process_sp;
+  ABI(lldb::ProcessSP process_sp, std::unique_ptr 
info_up)
+  : m_process_wp(process_sp), m_mc_register_info_up(std::move(info_up)) {

Since this and derived class's constructors are protected/private it can make 
sense to make their parameters r-value and not rely on copy elision.


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

https://reviews.llvm.org/D67965



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


[Lldb-commits] [PATCH] D67390: [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-24 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D67390#1681034 , @kwk wrote:

>   I wonder how to define uniqueness for them. As you can see, the only 
> difference is the symbol section which wasn't part of your definition of 
> uniqueness (yet).


These symbols should be obviously all kept distinct.  Yes, you should add to 
the tuple also `ELFSymbol::st_shndx` as I have seen in your code: 
https://people.redhat.com/jkratoch/kwk-branch.diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



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


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: source/Target/ABI.cpp:216
+
+std::unique_ptr ABI::MakeMCRegisterInfo(const ArchSpec 
&arch) {
+  std::string triple = arch.GetTriple().getTriple();

JDevlieghere wrote:
> Should this return an llvm::Expected instead? I understand it will cause a 
> lot of churn around the call sites, but now if this fails it will trigger an 
> assert in the ABI constructor?
Yes, it will, but the idea is that one should call this function only if one is 
certain that it will succeed (or if he's uncertain, he should at least check 
the result before passing it to the ABI constructor). As far as I am aware of, 
there are only two ways that this can fail:
1. we pass it some completely bogus triple
2. llvm was compiled without support for the given triple (this is kind of 
already covered by the first item, but anyway...)

All ABI plugins check that the archspec is "reasonable" (they at least check 
the architecture, some also check other fields), so the first case should not 
occur. And I am excluding the second case here, by making sure the ABI plugin 
is initialized only if the relevant llvm target is built.

I actually first coded an implementation which did something like `if 
(is_supported(arch_spec)) { if (auto info = MakeMCRegisterInfo(arch_spec)) 
return ABI(process, info)`, but then I ditched it in favor of this. I can go 
back to that if you want (because the current version is not completely ideal 
either), but I kind of like this one more, because if anything goes wrong, it 
will be easier to track down the failure. (and it's pretty unlikely that this 
will only fail in some corner cases, as the only variable here is the ArchSpec, 
so even the most superficial testing of a given target should uncover any 
problems here.)


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

https://reviews.llvm.org/D67965



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


[Lldb-commits] [PATCH] D67972: [unittest] Skip the socket tests if we $TMPDIR is too long.

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: aprantl.
Herald added a subscriber: abidh.
Herald added a project: LLDB.

Adrian added a sanity check to the socket tests to ensure the $TMPDIR is not to 
long for a socket. While this is great for diagnosing the problem it doesn't 
really solve the problem for environment where you have no control over that 
variable such as in CI. I propose to just skip the test in that case similar to 
what we do for tests that rely on targets that are not currently build, etc.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67972

Files:
  unittests/Host/SocketTest.cpp


Index: unittests/Host/SocketTest.cpp
===
--- unittests/Host/SocketTest.cpp
+++ unittests/Host/SocketTest.cpp
@@ -93,8 +93,10 @@
   std::error_code EC = 
llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(Path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(Path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
@@ -196,8 +198,10 @@
   llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", 
domain_path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(domain_path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(domain_path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (domain_path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;


Index: unittests/Host/SocketTest.cpp
===
--- unittests/Host/SocketTest.cpp
+++ unittests/Host/SocketTest.cpp
@@ -93,8 +93,10 @@
   std::error_code EC = llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(Path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(Path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
@@ -196,8 +198,10 @@
   llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", domain_path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(domain_path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(domain_path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (domain_path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67890: [lldb] [cmake] Fix installing Python modules on systems using /usr/lib

2019-09-24 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 221555.
mgorny marked 8 inline comments as done.
mgorny retitled this revision from "[lldb] [cmake] Unify and correct Python 
module installation paths" to "[lldb] [cmake] Fix installing Python modules on 
systems using /usr/lib".
mgorny edited the summary of this revision.
mgorny added a comment.

This turned out much harder than expected. Let's go with my original patch 
instead, and in the meantime I'll try to figure out how to properly use 
relative libdir everywhere.


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

https://reviews.llvm.org/D67890

Files:
  lldb/scripts/CMakeLists.txt
  lldb/scripts/get_relative_lib_dir.py


Index: lldb/scripts/get_relative_lib_dir.py
===
--- lldb/scripts/get_relative_lib_dir.py
+++ lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@
 # right answer always.
 arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
 split_libdir = arch_specific_libdir.split(os.sep)
-lib_re = re.compile(r"^lib.+$")
+lib_re = re.compile(r"^lib.*$")
 
 for i in range(len(split_libdir)):
 match = lib_re.match(split_libdir[i])
Index: lldb/scripts/CMakeLists.txt
===
--- lldb/scripts/CMakeLists.txt
+++ lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@
 )
 
 if(NOT LLDB_BUILD_FRAMEWORK)
-  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-set(swig_python_subdir site-packages)
-  else()
-set(swig_python_subdir 
python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-  endif()
-
-  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig, sys; 
print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+${CMAKE_BINARY_DIR}
+OUTPUT_VARIABLE SWIG_PYTHON_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(True, False, ''))"
+OUTPUT_VARIABLE SWIG_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
 
   # Install the LLDB python module
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
 endif()


Index: lldb/scripts/get_relative_lib_dir.py
===
--- lldb/scripts/get_relative_lib_dir.py
+++ lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@
 # right answer always.
 arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
 split_libdir = arch_specific_libdir.split(os.sep)
-lib_re = re.compile(r"^lib.+$")
+lib_re = re.compile(r"^lib.*$")
 
 for i in range(len(split_libdir)):
 match = lib_re.match(split_libdir[i])
Index: lldb/scripts/CMakeLists.txt
===
--- lldb/scripts/CMakeLists.txt
+++ lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@
 )
 
 if(NOT LLDB_BUILD_FRAMEWORK)
-  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-set(swig_python_subdir site-packages)
-  else()
-set(swig_python_subdir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-  endif()
-
-  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+${CMAKE_BINARY_DIR}
+OUTPUT_VARIABLE SWIG_PYTHON_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+OUTPUT_VARIABLE SWIG_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
 
   # Install the LLDB python module
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67966: Use llvm for dumping DWARF expressions

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Awesome!


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

https://reviews.llvm.org/D67966



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


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/ABI/CMakeLists.txt:1
-add_subdirectory(SysV-arm)
-add_subdirectory(SysV-arm64)
-add_subdirectory(SysV-hexagon)
-add_subdirectory(SysV-ppc)
-add_subdirectory(SysV-ppc64)
-add_subdirectory(SysV-mips)
-add_subdirectory(SysV-mips64)
-add_subdirectory(SysV-s390x)
-add_subdirectory(SysV-i386)
-add_subdirectory(SysV-x86_64)
-add_subdirectory(MacOSX-i386)
-add_subdirectory(MacOSX-arm)
-add_subdirectory(MacOSX-arm64)
-add_subdirectory(Windows-x86_64)
+if ("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD)
+  add_subdirectory(MacOSX-arm64)

This looks like a good idea regardless.


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

https://reviews.llvm.org/D67965



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


[Lldb-commits] [lldb] r372774 - [unittest] Skip the socket tests if we $TMPDIR is too long.

2019-09-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep 24 12:34:50 2019
New Revision: 372774

URL: http://llvm.org/viewvc/llvm-project?rev=372774&view=rev
Log:
[unittest] Skip the socket tests if we $TMPDIR is too long.

Adrian added a sanity check to the socket tests to ensure the $TMPDIR is
not too long for a socket. While this is great for diagnosing the
problem it doesn't really solve the problem for environment where you
have no control over that variable such as in CI. I propose to just skip
the test in that case similar to what we do for tests that rely on
targets that are not currently build, etc.

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

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

Modified: lldb/trunk/unittests/Host/SocketTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTest.cpp?rev=372774&r1=372773&r2=372774&view=diff
==
--- lldb/trunk/unittests/Host/SocketTest.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTest.cpp Tue Sep 24 12:34:50 2019
@@ -93,8 +93,10 @@ TEST_F(SocketTest, DomainListenConnectAc
   std::error_code EC = 
llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(Path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(Path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
@@ -196,8 +198,10 @@ TEST_F(SocketTest, DomainGetConnectURI)
   llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", 
domain_path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(domain_path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(domain_path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (domain_path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;


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


[Lldb-commits] [PATCH] D67972: [unittest] Skip the socket tests if we $TMPDIR is too long.

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372774: [unittest] Skip the socket tests if we $TMPDIR is 
too long. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67972?vs=221560&id=221576#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67972

Files:
  lldb/trunk/unittests/Host/SocketTest.cpp


Index: lldb/trunk/unittests/Host/SocketTest.cpp
===
--- lldb/trunk/unittests/Host/SocketTest.cpp
+++ lldb/trunk/unittests/Host/SocketTest.cpp
@@ -93,8 +93,10 @@
   std::error_code EC = 
llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(Path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(Path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
@@ -196,8 +198,10 @@
   llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", 
domain_path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(domain_path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(domain_path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (domain_path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;


Index: lldb/trunk/unittests/Host/SocketTest.cpp
===
--- lldb/trunk/unittests/Host/SocketTest.cpp
+++ lldb/trunk/unittests/Host/SocketTest.cpp
@@ -93,8 +93,10 @@
   std::error_code EC = llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(Path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(Path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
@@ -196,8 +198,10 @@
   llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", domain_path);
   ASSERT_FALSE(EC);
   llvm::sys::path::append(domain_path, "test");
-  // If this fails, $TMPDIR is too long to hold a domain socket.
-  EXPECT_LE(domain_path.size(), 107u);
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (domain_path.size() > 107u)
+return;
 
   std::unique_ptr socket_a_up;
   std::unique_ptr socket_b_up;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67965: Have ABI plugins vend llvm MCRegisterInfo data

2019-09-24 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.


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

https://reviews.llvm.org/D67965



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


[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jasonmolenda, JDevlieghere, labath.
Herald added subscribers: arphaman, christof.

This test streamlines our use of variables that are expected by Makefile.rules 
throughout the test suite. Mostly it replaced potentially dangerous overrides 
and updates of variables like CFLAGS with safe assignments to variables 
reserved for this purpose like CFLAGS_EXTRAS.


https://reviews.llvm.org/D67984

Files:
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/context-object-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/dont_allow_jit/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import_builtin_fileid/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_obj_c/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/persist_objc_pointeetype/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/po_verbosity/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/scoped_enums/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/two-files/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/var/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/mpx_bound_violation/Makefile
  lldb/packages/Python/lldbsuite/test/commands/target/stop-hooks/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-f

[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 221592.

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

https://reviews.llvm.org/D67984

Files:
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/context-object-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/dont_allow_jit/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import_builtin_fileid/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_obj_c/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/persist_objc_pointeetype/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/po_verbosity/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/scoped_enums/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/two-files/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/var/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/mpx_bound_violation/Makefile
  lldb/packages/Python/lldbsuite/test/commands/target/stop-hooks/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
  
lldb/packages/Python/lldbsuit

[Lldb-commits] [PATCH] D67988: [lldb] clean up lldb/scripts a little bit

2019-09-24 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
hhb added reviewers: labath, mgorny.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

No functional change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67988

Files:
  lldb/scripts/Python/finishSwigPythonLLDB.py
  lldb/scripts/finishSwigWrapperClasses.py

Index: lldb/scripts/finishSwigWrapperClasses.py
===
--- lldb/scripts/finishSwigWrapperClasses.py
+++ lldb/scripts/finishSwigWrapperClasses.py
@@ -5,8 +5,6 @@
 
 Overview:   Python script(s) to finish off the SWIG Python C++ Script
 Bridge wrapper code on the Windows/LINUX/OSX platform.
-The Python scripts are equivalent to the shell script (.sh)
-files.
 We use SWIG to create a C++ file containing the appropriate
 wrapper classes and functions for each scripting language,
 before liblldb is built (thus the C++ file can be compiled
@@ -293,11 +291,9 @@
 
 # Iterate script directory find any script language directories
 for scriptLang in listDirs:
-# __pycache__ is a magic directory in Python 3 that holds .pyc files
-if scriptLang != "__pycache__" and scriptLang != "swig_bot_lib":
-dbg.dump_text("Executing language script for \'%s\'" % scriptLang)
-nResult, strStatusMsg = run_post_process(
-scriptLang, strFinishFileName, vDictArgs)
+dbg.dump_text("Executing language script for \'%s\'" % scriptLang)
+nResult, strStatusMsg = run_post_process(
+scriptLang, strFinishFileName, vDictArgs)
 if nResult < 0:
 break
 
Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -5,8 +5,6 @@
 
 Overview:   Python script(s) to post process SWIG Python C++ Script
 Bridge wrapper code on the Windows/LINUX/OSX platform.
-The Python scripts are equivalent to the shell script (.sh)
-files.
 For the Python script interpreter (external to liblldb) to
 be able to import and use the lldb module, there must be
 two files, lldb.py and _lldb.so, that it can find. lldb.py
@@ -617,7 +615,8 @@
 
 #++---
 # Details:  Determine where to put the files. Retrieve the directory path for
-#   Python's dist_packages/ site_package folder on a Windows platform.
+#   Python's dist_packages / site_package folder when build with LLVM
+#   build system.
 # Args: vDictArgs   - (R) Program input parameters.
 # Returns:  Bool - True = function success, False = failure.
 #   Str - Python Framework directory path.
@@ -626,13 +625,14 @@
 #--
 
 
-def get_framework_python_dir_windows(vDictArgs):
+def get_framework_python_dir_llvm(vDictArgs):
 dbg = utilsDebug.CDebugFnVerbose(
-"Python script get_framework_python_dir_windows()")
+"Python script get_framework_python_dir_llvm()")
 bOk = True
 strWkDir = ""
 strErrMsg = ""
 
+dbg.dump_text("Built by LLVM")
 # We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument,
 # and append the python version directory to the end of it.  Depending
 # on the system other stuff may need to be put here as well.
@@ -658,7 +658,7 @@
 
 #++---
 # Details:  Retrieve the directory path for Python's dist_packages/
-#   site_package folder on a UNIX style platform.
+#   site_package folder for xcode.
 # Args: vDictArgs   - (R) Program input parameters.
 # Returns:  Bool - True = function success, False = failure.
 #   Str - Python Framework directory path.
@@ -667,32 +667,27 @@
 #--
 
 
-def get_framework_python_dir_other_platforms(vDictArgs):
+def get_framework_python_dir_xcode(vDictArgs):
 dbg = utilsDebug.CDebugFnVerbose(
-"Python script get_framework_python_dir_other_platform()")
+"Python script get_framework_python_dir_xcode()")
 bOk = True
 strWkDir = ""
 strErrMsg = ""
 bDbg = "-d" in vDictArgs
 
-bMakeFileCalled = "-m" in vDictArgs
-if bMakeFileCalled:
-dbg.dump_text("Built by LLVM")
-return get_framework_python_dir_windows(vDictArgs)
+dbg.dump_text("Built by XCode")
+# We are being built by XCode, so all the lldb Python files can go
+# into the LLDB.framework/Resources/Python subdirectory.
+strWkDir = vDictArgs["--targetDir"]
+strWkDir = os.path.join(strWkDir, "LLDB.framework")
+if os.path.exists(strWkDir):
+if bDbg:
+print((strMsgFoundLldbFrameWkDir % strWk

[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

A few things that need checking/reordering, but otherwise great cleanup!




Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile:4
 include Makefile.rules
-CXXFLAGS += -O0
+CXXFLAGS_EXTRAS := -O0
 

This is wrong ;-) This should probably just go away.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile:4
 USE_LIBCPP := 1
 include Makefile.rules
+CXXFLAGS_EXTRAS := -O0

Same here



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile:3
 CXX_SOURCES := main.cpp
 include $(LEVEL)/Makefile.rules
+CXXFLAGS_EXTRAS := -O1 -glldb -Xclang -femit-debug-entry-values

Another one



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile:3
 include Makefile.rules
-CXXFLAGS += -g -O1 -glldb
+CXXFLAGS_EXTRAS := -g -O1 -glldb

These one too?


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

https://reviews.llvm.org/D67984



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


[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: friss, xiaobai, aprantl.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

r366433 broke support for the system debugserver. Although the change was 
well-intended, it (presumably) unintentionally removed the logic to copy over 
the debugserver. As a result, even with LLDB_USE_SYSTEM_DEBUGSERVER enabled, we 
ended up building, signing and using the just-built debugserver. This patch 
partially recovers the old behavior: when LLDB_USE_SYSTEM_DEBUGSERVER is set we 
don't build debugserver and just copy over the system one.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67991

Files:
  lldb/test/CMakeLists.txt
  lldb/tools/CMakeLists.txt
  lldb/tools/debugserver/source/CMakeLists.txt


Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
 set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
 check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+if(NOT available)
   message(WARNING "LLDB_CODESIGN_IDENTITY not found: 
'${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
 endif()
 return()
@@ -41,9 +41,7 @@
 return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-message(WARNING "Development code sign identiy not found: 'lldb_codesign' 
${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' 
${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/tools/CMakeLists.txt
===
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
 lldb_find_system_debugserver(system_debugserver_path)
+add_custom_target(debugserver
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)


Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
 set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
 check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+if(NOT available)
   message(WARNING "LLDB_CODESIGN_IDENTITY not found: '${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
 endif()
 return()
@@ -41,9 +41,7 @@
 return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/tools/CMakeLists.txt
===
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
 lldb_find_system_debugserver(system_debugserver_path)
+add_custom_target(debugserver
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(T

[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 221611.
JDevlieghere added a comment.
Herald added a reviewer: jfb.

Add decorator to tests that require a more recent debugserver.


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

https://reviews.llvm.org/D67991

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
  lldb/test/CMakeLists.txt
  lldb/tools/CMakeLists.txt
  lldb/tools/debugserver/source/CMakeLists.txt

Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
 set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
 check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+if(NOT available)
   message(WARNING "LLDB_CODESIGN_IDENTITY not found: '${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
 endif()
 return()
@@ -41,9 +41,7 @@
 return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/tools/CMakeLists.txt
===
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
 lldb_find_system_debugserver(system_debugserver_path)
+add_custom_target(debugserver
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)
Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
@@ -16,6 +16,7 @@
 @skipIf(triple='^mips')
 @expectedFailureNetBSD
 @add_test_categories(["watchpoint"])
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 watchpoints from 100 threads."""
 self.build(dictionary=self.getBuildFlags())
Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
@@ -17,6 +17,7 @@
 # This test is flaky on Darwin.
 @skipIfDarwin
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 signals from 100 threads."""
 self.build(dictionary=self.getBuildFlags())
Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
@@ -15,6 +15,7 @@
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 threads that cause a segfault."""
 self.build(dictionary=self.getBuildFlags())
Index: ll

[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I checked, and Makefile.rules does initialize CXXFLAGS lazily, but it's still 
better to not depend on that implementation detail.


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

https://reviews.llvm.org/D67984



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


[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

2019-09-24 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
hhb added reviewers: labath, mgorny.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This replaces the hard coded path.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67993

Files:
  lldb/scripts/Python/finishSwigPythonLLDB.py


Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in


Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.
Herald added a subscriber: dexonsmith.



Comment at: lldb/test/CMakeLists.txt:103
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")

Doesn't this now conflict with the use of `--out-of-tree-debugserver` added to 
the args below?


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

https://reviews.llvm.org/D67991



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


[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 221613.
aprantl added a comment.

Address feedback from Jonas.


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

https://reviews.llvm.org/D67984

Files:
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/context-object-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/dont_allow_jit/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/import_builtin_fileid/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_obj_c/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/persist_objc_pointeetype/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/po_verbosity/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/scoped_enums/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/two-files/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
  lldb/packages/Python/lldbsuite/test/commands/frame/var/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/mpx_bound_violation/Makefile
  lldb/packages/Python/lldbsuite/test/commands/target/stop-hooks/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl

[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: lldb/test/CMakeLists.txt:103
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")

xiaobai wrote:
> Doesn't this now conflict with the use of `--out-of-tree-debugserver` added 
> to the args below?
`--out-of-tree-debugserver` tells dotest that test decorated with 
`skipIfOutOfTreeDebugserver` should be skipped during this run.


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

https://reviews.llvm.org/D67991



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


[Lldb-commits] [lldb] r372786 - [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep 24 15:39:04 2019
New Revision: 372786

URL: http://llvm.org/viewvc/llvm-project?rev=372786&view=rev
Log:
[CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

r366433 broke support for the system debugserver. Although the change
was well-intended, it (presumably) unintentionally removed the logic to
copy over the debugserver. As a result, even with
LLDB_USE_SYSTEM_DEBUGSERVER enabled, we ended up building, signing and
using the just-built debugserver.

This patch partially recovers the old behavior: when
LLDB_USE_SYSTEM_DEBUGSERVER is set we don't build debugserver and just
copy over the system one.

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
lldb/trunk/test/CMakeLists.txt
lldb/trunk/tools/CMakeLists.txt
lldb/trunk/tools/debugserver/source/CMakeLists.txt

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py?rev=372786&r1=372785&r2=372786&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
 Tue Sep 24 15:39:04 2019
@@ -15,6 +15,7 @@ class ConcurrentManyBreakpoints(Concurre
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 breakpoints from 100 threads."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py?rev=372786&r1=372785&r2=372786&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
 Tue Sep 24 15:39:04 2019
@@ -15,6 +15,7 @@ class ConcurrentManyCrash(ConcurrentEven
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 threads that cause a segfault."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py?rev=372786&r1=372785&r2=372786&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
 Tue Sep 24 15:39:04 2019
@@ -17,6 +17,7 @@ class ConcurrentManySignals(ConcurrentEv
 # This test is flaky on Darwin.
 @skipIfDarwin
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 signals from 100 threads."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py?rev=372786&r1=372785&r2=372786&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
 T

[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

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

No objections from me.


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

https://reviews.llvm.org/D67991



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


[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372786: [CMake] Copy over the system debugserver when using 
LLDB_USE_SYSTEM_DEBUGSERVER (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67991?vs=221611&id=221615#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67991

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
  lldb/trunk/test/CMakeLists.txt
  lldb/trunk/tools/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/CMakeLists.txt

Index: lldb/trunk/tools/debugserver/source/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
 set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
 check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+if(NOT available)
   message(WARNING "LLDB_CODESIGN_IDENTITY not found: '${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
 endif()
 return()
@@ -41,9 +41,7 @@
 return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/trunk/tools/CMakeLists.txt
===
--- lldb/trunk/tools/CMakeLists.txt
+++ lldb/trunk/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
 lldb_find_system_debugserver(system_debugserver_path)
+add_custom_target(debugserver
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different
+  ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+  COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
 message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
@@ -15,6 +15,7 @@
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 threads that cause a segfault."""
 self.build(dictionary=self.getBuildFlags())
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
@@ -17,6 +17,7 @@
 # This test is flaky on Darwin.
 @skipIfDarwin
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):
 """Test 100 signals from 100 threads."""
 self.build(dictionary=self.getBuildFlags())
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
+++ lldb/trunk/packages/Python

[Lldb-commits] [lldb] r372788 - Host: use the platform identifiers from LLVM (NFC)

2019-09-24 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue Sep 24 15:55:44 2019
New Revision: 372788

URL: http://llvm.org/viewvc/llvm-project?rev=372788&view=rev
Log:
Host: use the platform identifiers from LLVM (NFC)

Use symbolic constants for the platform identifiers rather than replicating them
locally.

Modified:
lldb/trunk/source/Host/windows/Host.cpp

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=372788&r1=372787&r2=372788&view=diff
==
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Tue Sep 24 15:55:44 2019
@@ -22,6 +22,7 @@
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StructuredData.h"
 
+#include "llvm/BinaryFormat/COFF.h"
 #include "llvm/Support/ConvertUTF.h"
 
 // Windows includes
@@ -52,13 +53,13 @@ bool GetTripleForProcess(const FileSpec
   triple.setVendor(llvm::Triple::PC);
   triple.setOS(llvm::Triple::Win32);
   triple.setArch(llvm::Triple::UnknownArch);
-  if (machineType == 0x8664)
+  if (machineType == llvm::COFF::IMAGE_FILE_MACHINE_AMD64)
 triple.setArch(llvm::Triple::x86_64);
-  else if (machineType == 0x14c)
+  else if (machineType == llvm::COFF::IMAGE_FILE_MACHINE_I386)
 triple.setArch(llvm::Triple::x86);
-  else if (machineType == 0x1c4)
+  else if (machineType == llvm::COFF::IMAGE_FILE_MACHINE_ARMNT)
 triple.setArch(llvm::Triple::arm);
-  else if (machineType == 0xaa64)
+  else if (machineType == llvm::COFF::IMAGE_FILE_MACHINE_ARM64)
 triple.setArch(llvm::Triple::aarch64);
 
   return true;


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


[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik created this revision.
shafik added reviewers: labath, JDevlieghere, xiaobai, aam, amccarth.
Herald added a subscriber: aprantl.
shafik marked an inline comment as done.
shafik added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3060
+
+switch (tag) {
+  case DW_TAG_array_type:

I added this change because currently when end up trying to parse non-types 
which generates diagnostic like the following:

```
error: anon.o {0x001e}: unhandled type tag 0x0034 (DW_TAG_variable), please 
file a bug and attach the file at the start of this error message
```


Currently when invoking `lldb-test symbols -dump-ast` it parses all the debug 
symbols and calls `print(...)` on the `TranslationUnitDecl`.

While useful the `TranslationUnitDecl::print(...)` method gives us a higher 
level view then the dump from `ASTDumper` which is what we get when we invoke 
`dump()` on a  specific AST node.

The main motivation for this change is allow us to verify that the AST nodes we 
create when we parse DWARF. For example in order to verify we are correctly 
using `DIFlagExportSymbols` added by D7  
we would want to dump a `CXXRecordDecl`:

  CXXRecordDecl 0x7fdc578295f8 <>  struct definition
  |-DefinitionData is_anonymous pass_in_registers aggregate standard_layout 
trivially_copyable pod trivial literal
  ...

and check for the `is_anonymous` flag or the lack thereof.

My current approach is to enumerate the symbols and to obtain specific AST 
nodes if possible and dump them. It looks in some cases such as `FunctionDecl`s 
we don't have direct access to it but I don't think that is an major problem at 
this point.

I did not implement it but we should probably have a way of request a specific 
type instead of indiscriminately dumping all of them.

This is a work in progress and I am not sure if the following is the best 
approach and I am open to alternative approaches or modification to the current 
one.


https://reviews.llvm.org/D67994

Files:
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -42,6 +42,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
+
 #include 
 #include 
 
@@ -547,6 +548,35 @@
 return make_string_error("Can't retrieve translation unit declaration.");
 
   tu->print(outs());
+
+
+lldb_private::TypeList type_list;
+size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+printf( "Type list size: %zu\n", ntypes);
+
+for( size_t i = 0; i < ntypes; ++i) {
+auto type = type_list.GetTypeAtIndex(i);
+printf( "%s\n", type->GetName().AsCString() );
+
+if (clang::CXXRecordDecl *record_decl =
+  clang_ast_ctx->GetAsCXXRecordDecl(type->GetFullCompilerType().GetOpaqueQualType()) )
+record_decl->dump();
+else if( clang::TagDecl *tag_decl =
+clang_ast_ctx->GetAsTagDecl(type->GetFullCompilerType()) )
+tag_decl->dump();
+else if( clang::TypedefNameDecl *typedef_decl =
+clang_ast_ctx->GetAsTypedefDecl(type->GetFullCompilerType()) )
+typedef_decl->dump();
+else if( clang::EnumDecl *enum_decl = clang_ast_ctx->GetAsEnumDecl(type->GetFullCompilerType()) )
+enum_decl->dump();
+else if ( const clang::FunctionDecl* func_decl = llvm::dyn_cast(
+ (clang::Decl*)
+clang_ast_ctx->GetCanonicalQualType(type->GetFullCompilerType().GetOpaqueQualType()).getAsOpaquePtr()) )
+func_decl->dump();
+else {
+clang_ast_ctx->GetCanonicalQualType(type->GetFullCompilerType().GetOpaqueQualType()).dump();
+}
+}
 
   return Error::success();
 }
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3026,7 +3026,10 @@
 return {};
 
   Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
-  TypeSP type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, type_is_new_ptr);
+
+  TypeSP type_sp;
+
+ type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, type_is_new_ptr);
   if (type_sp) {
 GetTypeList().Insert(type_sp);
 
@@ -3049,12 +3052,37 @@
bool parse_siblings, bool parse_children) {
   size_t types_added = 0;
   DWARFDIE die = orig_die;
+  
   while (die) {
+const dw_tag_t tag = die.Tag();
 bool type_is_new = false;
-if (ParseType(sc, die, &type_is_new)

[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik marked an inline comment as done.
shafik added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3060
+
+switch (tag) {
+  case DW_TAG_array_type:

I added this change because currently when end up trying to parse non-types 
which generates diagnostic like the following:

```
error: anon.o {0x001e}: unhandled type tag 0x0034 (DW_TAG_variable), please 
file a bug and attach the file at the start of this error message
```


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

https://reviews.llvm.org/D67994



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


[Lldb-commits] [PATCH] D67774: [Mangle] Add flag to asm labels to disable global prefixing

2019-09-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: clang/lib/AST/Mangle.cpp:130
+  return;
+}
+

rjmccall wrote:
> This is actually backwards, right?  A literal label is one that doesn't get 
> the global prefix and therefore potentially needs the `\01` prefix to 
> suppress it.
Thank you for the careful and helpful review! Before updating this patch, I'd 
like to make sure we're on the same page on this point.

What I'm searching for is a way to prevent `mangleName` from adding either a 
`\01` prefix or the global prefix to the label contained within an 
AsmLabelAttr. As the result from `mangleName` is passed to a hash function, 
omitting both prefixes is necessary to fix the lldb expression evaluation 
failure mentioned in the summary. Based on (probably a bad reading of) earlier 
feedback, I thought that marking an attr as "Literal" would be the preferred 
method to suppress all prefixes.

However, it sounds like you believe:
1) An attr marked as "Literal" should have a `\01` prefix applied, but no 
global prefix.
2) An attr *not* marked as "Literal" should have a global prefix applied (if 
one is available).

If I've characterized your view correctly, then we really need something else 
to denote "do not add any kind of prefix". One option is to use 
`BoolArgument<"IsUnprefixed", /*optional=*/0, /*fake=*/1>`, and set the 
literal/non-literal distinction aside.

OTOH, if what you really meant was that `mangleName` should omit all prefixes 
for non-"Literal" labels (and that "Literal" is the right name/distinction for 
this idea), I can simply invert the condition I've been using.


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

https://reviews.llvm.org/D67774



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


[Lldb-commits] [PATCH] D67991: [CMake] Copy over the system debugserver when using LLDB_USE_SYSTEM_DEBUGSERVER

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py:18
 @expectedFailureNetBSD
+@skipIfOutOfTreeDebugserver
 def test(self):

It may be more forward-looking to check for an actual version here like we do 
for the compiler.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67991



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


[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3029
   Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
-  TypeSP type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, 
type_is_new_ptr);
+
+  TypeSP type_sp;

nit: stray whitespace



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3032
+
+ type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, type_is_new_ptr);
   if (type_sp) {

Why is this now two lines?



Comment at: tools/lldb-test/lldb-test.cpp:580
+}
 
   return Error::success();

nit: clang-format this block, some of the lines are long and somewhat difficult 
to read on phabricator.


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

https://reviews.llvm.org/D67994



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


[Lldb-commits] [PATCH] D67996: Convert FileSystem::Open() to return Expected

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, labath.
lawrence_danna added a project: LLDB.

This patch converts FileSystem::Open from this prototype:

Status
Open(File &File, const FileSpec &file_spec, ...);

to this one:

llvm::Expected>
Open(const FileSpec &file_spec, ...);

This is beneficial on its own, as llvm::Expected is a more modern
and recommended error type than Status.  It is also a necessary step
towards https://reviews.llvm.org/D67891, and further developments
for lldb_private::File.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67996

Files:
  lldb/include/lldb/Core/StreamFile.h
  lldb/include/lldb/Host/FileCache.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/include/lldb/lldb-forward.h
  lldb/scripts/Python/python-typemaps.swig
  lldb/source/API/SBStream.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Core/StreamFile.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/FileCache.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Host/windows/Host.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/unittests/Host/FileSystemTest.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -581,10 +581,10 @@
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonFile) {
-  File file;
-  FileSystem::Instance().Open(file, FileSpec(FileSystem::DEV_NULL),
-  File::eOpenOptionRead);
-  PythonFile py_file(file, "r");
+  auto file = FileSystem::Instance().Open(FileSpec(FileSystem::DEV_NULL),
+  File::eOpenOptionRead);
+  ASSERT_TRUE(!!file);
+  PythonFile py_file(*file.get(), "r");
   EXPECT_TRUE(PythonFile::Check(py_file.get()));
 }
 
Index: lldb/unittests/Host/FileSystemTest.cpp
===
--- lldb/unittests/Host/FileSystemTest.cpp
+++ lldb/unittests/Host/FileSystemTest.cpp
@@ -288,3 +288,35 @@
   EXPECT_THAT(visited,
   testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux"));
 }
+
+TEST(FileSystemTest, OpenErrno) {
+#ifdef _WIN32
+  FileSpec spec("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT");
+#else
+  FileSpec spec("/file/that/does/not/exist.txt");
+#endif
+  FileSystem fs;
+  auto file = fs.Open(spec, File::eOpenOptionRead, 0, true);
+  ASSERT_FALSE(file);
+  std::error_code code = errorToErrorCode(file.takeError());
+  EXPECT_EQ(code.category(), std::system_category());
+  EXPECT_EQ(code.value(), ENOENT);
+}
+
+TEST(FileSystemTest, OpenErrnoHandler) {
+#ifdef _WIN32
+  FileSpec spec("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT");
+#else
+  FileSpec spec("/file/that/does/not/exist.txt");
+#endif
+  FileSystem fs;
+  auto file = fs.Open(spec, File::eOpenOptionRead, 0, true);
+  ASSERT_FALSE(file);
+  std::error_code code;
+  Error error = handleErrors(file.takeError(), [&](const ECError &E) {
+code = E.convertToErrorCode();
+  });
+  ASSERT_FALSE(error);
+  EXPECT_EQ(code.category(), std::system_category());
+  EXPECT_EQ(code.value(), ENOENT);
+}
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1226,15 +1226,15 @@
   if (fs::is_symlink_file(source.GetPath()))
 source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
-  File source_file;
-  Status error = FileSystem::Instance().Open(
-  source_file, source, source_open_options, lldb::eFilePermissionsUserRW);
-  uint32_t permissions = source_file.GetPermissions(error);
+  auto source_file = FileSystem::Instance().Open(
+  source, source_open_options, lldb::eFilePermissionsUserRW);
+  if (!source_file)
+return Status("PutFile: unable to open source file");
+  Status error;
+  uint32_t permissions = source_file.get()->GetPermissions(error);
   if (permissions == 0)
 permissions = lldb::eFilePermissionsFileDefault;
 
-  if (!source_file.IsValid())
-return Status("PutFile: unable to open source file");

[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 221622.
shafik added a comment.

- Formatting code
- Removing FunctionDecl case since it was not correct


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

https://reviews.llvm.org/D67994

Files:
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  tools/lldb-test/lldb-test.cpp


Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -42,6 +42,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
+
 #include 
 #include 
 
@@ -548,6 +549,34 @@
 
   tu->print(outs());
 
+  lldb_private::TypeList type_list;
+  size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+  printf("Type list size: %zu\n", ntypes);
+
+  for (size_t i = 0; i < ntypes; ++i) {
+auto type = type_list.GetTypeAtIndex(i);
+printf("%s\n", type->GetName().AsCString());
+
+if (clang::CXXRecordDecl *record_decl = clang_ast_ctx->GetAsCXXRecordDecl(
+type->GetFullCompilerType().GetOpaqueQualType()))
+  record_decl->dump();
+else if (clang::TagDecl *tag_decl =
+ clang_ast_ctx->GetAsTagDecl(type->GetFullCompilerType()))
+  tag_decl->dump();
+else if (clang::TypedefNameDecl *typedef_decl =
+ clang_ast_ctx->GetAsTypedefDecl(type->GetFullCompilerType()))
+  typedef_decl->dump();
+else if (clang::EnumDecl *enum_decl =
+ clang_ast_ctx->GetAsEnumDecl(type->GetFullCompilerType()))
+  enum_decl->dump();
+else {
+  clang_ast_ctx
+  ->GetCanonicalQualType(
+  type->GetFullCompilerType().GetOpaqueQualType())
+  .dump();
+}
+  }
+
   return Error::success();
 }
 
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3049,13 +3049,38 @@
bool parse_siblings, bool parse_children) {
   size_t types_added = 0;
   DWARFDIE die = orig_die;
+
   while (die) {
+const dw_tag_t tag = die.Tag();
 bool type_is_new = false;
-if (ParseType(sc, die, &type_is_new).get()) {
-  if (type_is_new)
-++types_added;
+
+switch (tag) {
+case DW_TAG_array_type:
+case DW_TAG_unspecified_type:
+case DW_TAG_base_type:
+case DW_TAG_class_type:
+case DW_TAG_structure_type:
+case DW_TAG_union_type:
+case DW_TAG_enumeration_type:
+case DW_TAG_subroutine_type:
+case DW_TAG_subprogram:
+case DW_TAG_inlined_subroutine:
+case DW_TAG_pointer_type:
+case DW_TAG_rvalue_reference_type:
+case DW_TAG_reference_type:
+case DW_TAG_typedef:
+case DW_TAG_ptr_to_member_type:
+  ParseType(sc, die, &type_is_new).get();
+  printf("pubname: %s is_type = %d\n", die.GetPubname(), true);
+  break;
+default:
+  printf("pubname: %s is_type = %d\n", die.GetPubname(), false);
+  break;
 }
 
+if (type_is_new)
+  ++types_added;
+
 if (parse_children && die.HasChildren()) {
   if (die.Tag() == DW_TAG_subprogram) {
 SymbolContext child_sc(sc);


Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -42,6 +42,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
+
 #include 
 #include 
 
@@ -548,6 +549,34 @@
 
   tu->print(outs());
 
+  lldb_private::TypeList type_list;
+  size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+  printf("Type list size: %zu\n", ntypes);
+
+  for (size_t i = 0; i < ntypes; ++i) {
+auto type = type_list.GetTypeAtIndex(i);
+printf("%s\n", type->GetName().AsCString());
+
+if (clang::CXXRecordDecl *record_decl = clang_ast_ctx->GetAsCXXRecordDecl(
+type->GetFullCompilerType().GetOpaqueQualType()))
+  record_decl->dump();
+else if (clang::TagDecl *tag_decl =
+ clang_ast_ctx->GetAsTagDecl(type->GetFullCompilerType()))
+  tag_decl->dump();
+else if (clang::TypedefNameDecl *typedef_decl =
+ clang_ast_ctx->GetAsTypedefDecl(type->GetFullCompilerType()))
+  typedef_decl->dump();
+else if (clang::EnumDecl *enum_decl =
+ clang_ast_ctx->GetAsEnumDecl(type->GetFullCompilerType()))
+  enum_decl->dump();
+else {
+  clang_ast_ctx
+  ->GetCanonicalQualType(
+  type->GetFullCompilerType().GetOpaqueQualType())
+  .dump();
+}
+  }
+
   return Error::success();
 }
 
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/Sy

[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3029
   Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
-  TypeSP type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, 
type_is_new_ptr);
+
+  TypeSP type_sp;

xiaobai wrote:
> nit: stray whitespace
Trailing whitespace. 



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3030
+
+  TypeSP type_sp;
+

I assume this is unintentional? 



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3060
+
+switch (tag) {
+  case DW_TAG_array_type:

shafik wrote:
> I added this change because currently when end up trying to parse non-types 
> which generates diagnostic like the following:
> 
> ```
> error: anon.o {0x001e}: unhandled type tag 0x0034 (DW_TAG_variable), 
> please file a bug and attach the file at the start of this error message
> ```
Assuming these are LLVM enum values, there's a method in `Dwarf.h` named 
`isType` which tells you if a given tag is a type. This list is missing at 
least some DWARF5 types (DW_TAG_dynamic_type, DW_TAG_atomic_type...). 



Comment at: tools/lldb-test/lldb-test.cpp:553
+
+lldb_private::TypeList type_list;
+size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);

The formatting seems off. Did you run this through clang-format?



Comment at: tools/lldb-test/lldb-test.cpp:561
+
+if (clang::CXXRecordDecl *record_decl =
+  
clang_ast_ctx->GetAsCXXRecordDecl(type->GetFullCompilerType().GetOpaqueQualType())
 )

Personally I think this would be a lot more readable with braces.  


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

https://reviews.llvm.org/D67994



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


[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3032
+
+ type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, type_is_new_ptr);
   if (type_sp) {

indent is wrong



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3061-3075
+  case DW_TAG_array_type:
+  case DW_TAG_unspecified_type:
+  case DW_TAG_base_type:
+  case DW_TAG_class_type:
+  case DW_TAG_structure_type:
+  case DW_TAG_union_type:
+  case DW_TAG_enumeration_type:

We should add a "IsType()" to DWARFDie here. This list can get out of date as 
new type tags are added. There are a few other places that could use the "bool 
DWARFDie::ItType() const" function too. Or we should just fix ParseType by 
adding an option to it like an extra bool like "bool warnIfNotType" so you 
don't get the "error:" message.



Comment at: tools/lldb-test/lldb-test.cpp:552-579
+
+lldb_private::TypeList type_list;
+size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+printf( "Type list size: %zu\n", ntypes);
+
+for( size_t i = 0; i < ntypes; ++i) {
+auto type = type_list.GetTypeAtIndex(i);

I know that there is already clang AST stuff in this file, but it seems like 
anything in this file should be just passed to the type system for dumping? 
This code could be:

```
lldb_private::TypeList type_list;
size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
printf( "Type list size: %zu\n", ntypes);
for( size_t i = 0; i < ntypes; ++i)
  type_list.GetTypeAtIndex(i)->DumpTypeValue(...);
```

Better yet this entire function could just become:

```
Error opts::symbols::dumpAST(lldb_private::Module &Module) {
  Module.ParseAllDebugSymbols();

  auto symfile = Module.GetSymbolFile();
  if (!symfile)
return make_string_error("Module has no symbol file.");

  auto type_system_or_err =
  symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus);
  if (type_system_or_err)
type_system_or_err->DumpAST(...);
  else
return make_string_error("Can't retrieve TypeSystem");
}
```
And all clang AST specific stuff can be removed from this binary? Tests would 
need to be updated.



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

https://reviews.llvm.org/D67994



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


[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 221621.
lawrence_danna edited the summary of this revision.
lawrence_danna added a comment.

converted to Expected, and split into two separate patches


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Host/File.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp

Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nullptr;
 }
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1358,15 +1358,15 @@
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(
target, error, &feedback_stream)) {
 if (error.AsCString())
-  target->GetDebugger().GetErrorFile()->Printf(
+  target->GetDebugger().GetErrorStream().Printf(
   "unable to load scripting data for module %s - error reported was "
   "%s\n",
   module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
   error.AsCString());
   }
   if (feedback_stream.GetSize())
-target->GetDebugger().GetErrorFile()->Printf("%s\n",
- feedback_stream.GetData());
+target->GetDebugger().GetErrorStream().Printf("%s\n",
+  feedback_stream.GetData());
 }
 
 void Target::ClearModules(bool delete_locations) {
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1649,7 +1649,7 @@
   Address symbol_address = symbol->GetAddress();
   load_addr = ResolveIndirectFunction(&symbol_address, error);
   if (!error.Success() && show_error) {
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to resolve indirect function at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 symbol->GetLoadAddress(&GetTarget()),
@@ -1688,7 +1688,7 @@
 } else {
   if (show_error || use_hardware) {
 // Report error for setting breakpoint...
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to set breakpoint site at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 load_addr, owner->GetBreakpoint().GetID(), owner->GetID(),
@@ -4300,9 +4300,9 @@
   : IOHandler(process->GetTarget().GetDebugger(),
   IOHandler::Type::ProcessIO),
 m_process(process),
+m_read_file(GetInputFD(), File::eOpenOptionRead, false),
 m_write_file(write_fd, File::eOpenOptionWrite, false) {
 m_pipe.CreateNew(false);
-m_read_file.SetDescriptor(GetInputFD(), File::eOpenOptionRead, false);
   }
 
   ~IOHandlerProcessSTDIO() override = default;
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1226,8 +1226,8 @

[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

2019-09-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3077
+  ParseType(sc, die, &type_is_new).get();
+  printf( "pubname: %s is_type = %d\n", die.GetPubname(), true);
+  break;

You also probably don't want to actually print anything here?



Comment at: tools/lldb-test/lldb-test.cpp:555
+size_t ntypes = symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+printf( "Type list size: %zu\n", ntypes);
+

The rest of the file seems to use `llvm::outs()` instead of printf.



Comment at: tools/lldb-test/lldb-test.cpp:564
+record_decl->dump();
+else if( clang::TagDecl *tag_decl =
+clang_ast_ctx->GetAsTagDecl(type->GetFullCompilerType()) )

clang-format



Comment at: tools/lldb-test/lldb-test.cpp:570
+typedef_decl->dump();
+else if( clang::EnumDecl *enum_decl = 
clang_ast_ctx->GetAsEnumDecl(type->GetFullCompilerType()) )
+enum_decl->dump();

switch over CompilerType->getAsClangType() ->getKind()?


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

https://reviews.llvm.org/D67994



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


[Lldb-commits] [PATCH] D67943: documentation: update test.rst

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 221625.
lawrence_danna added a comment.

added note about passing --filter to lit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67943

Files:
  lldb/docs/resources/test.rst


Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -1,11 +1,20 @@
 Testing
 ===
 
-The LLDB test suite consists of Python scripts located under the test
-directory. Each script contains a number of test cases and is usually
-accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
-source file and then uses LLDB to debug the resulting executable. The tests
-verify both the LLDB command line interface and the scripting API.
+The LLDB test suite consists of three different kinds of test:
+
+* Python scripts located under ``lldb/packages/Python/lldbsuite``.
+  These are written using python's unittest2 testing framework.
+
+* Unit tests, located under ``lldb/unittests``.   These are written in C++,
+  using googletest.
+
+* LIT tests, located under ``lldb/lit``.  These use the LLVM Integrated Tester.
+
+Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each 
test
+first compiles the source file and then uses LLDB to debug the resulting 
executable.
+
+The tests verify both the LLDB command line interface and the scripting API.
 
 .. contents::
:local:
@@ -46,8 +55,8 @@
 ``LLDB_TEST_USER_ARGS``.
 
 
-Running a Specific Test or Set of Tests

+Running a Specific Test or Set of Tests: Python
+---
 
 In addition to running all the LLDB test suites with the ``check-lldb`` CMake
 target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@
 
> python dotest.py -h
 
+
+Running a Specific Test or Set of Tests: Unit Tests
+---
+
+The unit tests are simple executables, located in the build directory under 
``tools/lldb/unittests``.
+
+To run them, just run the test binary, for example, to run all the Host tests:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests
+
+
+To run a specific test, pass a filter, for example:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests 
--gtest_filter=SocketTest.DomainListenConnectAccept
+
+
+Running a Specific Test or Set of Tests: LIT
+
+
+LIT automatically scans a directory for tests.   To run a subset of the LIT 
tests, pass it a
+subdirectory, for example:
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit/Commands/CommandScriptImmediateOutput
+
+
+LIT can also filter based on test name.
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit --filter CommandScriptImmediateOutput
+
+
 Running the Test Suite Remotely
 ---
 


Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -1,11 +1,20 @@
 Testing
 ===
 
-The LLDB test suite consists of Python scripts located under the test
-directory. Each script contains a number of test cases and is usually
-accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
-source file and then uses LLDB to debug the resulting executable. The tests
-verify both the LLDB command line interface and the scripting API.
+The LLDB test suite consists of three different kinds of test:
+
+* Python scripts located under ``lldb/packages/Python/lldbsuite``.
+  These are written using python's unittest2 testing framework.
+
+* Unit tests, located under ``lldb/unittests``.   These are written in C++,
+  using googletest.
+
+* LIT tests, located under ``lldb/lit``.  These use the LLVM Integrated Tester.
+
+Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each test
+first compiles the source file and then uses LLDB to debug the resulting executable.
+
+The tests verify both the LLDB command line interface and the scripting API.
 
 .. contents::
:local:
@@ -46,8 +55,8 @@
 ``LLDB_TEST_USER_ARGS``.
 
 
-Running a Specific Test or Set of Tests

+Running a Specific Test or Set of Tests: Python
+---
 
 In addition to running all the LLDB test suites with the ``check-lldb`` CMake
 target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@
 
> python dotest.py -h
 
+
+Running a Specific Test or Set of Tests: Unit Tests
+---
+
+The unit tests are simple executables, located in the build directory under ``tools/lldb/unittests``.
+
+To run them, just run the test binary, for example, to run all the Host tests:
+
+::
+
+   > ./tools/l

[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 221627.
lawrence_danna added a comment.

changed unique_ptr to shared_ptr


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793

Files:
  lldb/include/lldb/API/LLDB.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBFile.h
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/lldb-forward.h
  lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
  lldb/scripts/interface/SBFile.i
  lldb/scripts/lldb.swig
  lldb/source/API/CMakeLists.txt
  lldb/source/API/SBFile.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -467,8 +467,6 @@
   void Reset(PyRefType type, PyObject *py_obj) override;
   void Reset(File &file, const char *mode);
 
-  static uint32_t GetOptionsFromMode(llvm::StringRef mode);
-
   bool GetUnderlyingFile(lldb::FileSP &file) const;
 };
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -951,7 +951,7 @@
 
 PythonFile::PythonFile(const char *path, const char *mode) {
   auto file =
-  FileSystem::Instance().Open(FileSpec(path), GetOptionsFromMode(mode));
+  FileSystem::Instance().Open(FileSpec(path), File::GetOptionsFromMode(mode));
   if (file)
 Reset(*file.get(), mode);
   else
@@ -1022,23 +1022,6 @@
 #endif
 }
 
-uint32_t PythonFile::GetOptionsFromMode(llvm::StringRef mode) {
-  if (mode.empty())
-return 0;
-
-  return llvm::StringSwitch(mode.str())
-  .Case("r", File::eOpenOptionRead)
-  .Case("w", File::eOpenOptionWrite)
-  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
- File::eOpenOptionCanCreate)
-  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
-  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
-  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
-  .Default(0);
-}
-
 bool PythonFile::GetUnderlyingFile(FileSP &file) const {
   if (!IsValid())
 return false;
@@ -1049,7 +1032,8 @@
   // We don't own the file descriptor returned by this function, make sure the
   // File object knows about that.
   PythonString py_mode = GetAttributeValue("mode").AsType();
-  auto options = PythonFile::GetOptionsFromMode(py_mode.GetString());
+  auto options = File::GetOptionsFromMode(py_mode.GetString());
+
   file = std::make_shared(PyObject_AsFileDescriptor(m_py_obj), options,
 false);
   return file->IsValid();
Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -68,6 +68,22 @@
   return nullptr;
 }
 
+uint32_t File::GetOptionsFromMode(llvm::StringRef mode) {
+  if (mode.empty())
+return 0;
+  return llvm::StringSwitch(mode.str())
+  .Case("r", File::eOpenOptionRead)
+  .Case("w", File::eOpenOptionWrite)
+  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
+ File::eOpenOptionCanCreate)
+  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
+  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
+  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
+  .Default(0);
+}
+
 int File::kInvalidDescriptor = -1;
 FILE *File::kInvalidStream = nullptr;
 
@@ -143,9 +159,14 @@
 
 Status File::Close() {
   Status error;
-  if (StreamIsValid() && m_own_stream) {
-if (::fclose(m_stream) == EOF)
-  error.SetErrorToErrno();
+  if (StreamIsValid()) {
+if (m_own_stream) {
+  if (::fclose(m_stream) == EOF)
+error.SetErrorToErrno();
+} else {
+  if (::fflush(m_stream) == EOF)
+error.SetErrorToErrno();
+}
   }
 
   if (DescriptorIsValid() && m_should_close_fd) {
Index: lldb/source/API/SBFile.cpp
===
--- /dev/null
+++ lldb/source/API/SBFile.cpp
@@ -0,0 +1,76 @@
+//===-- SBFile.cpp -

[Lldb-commits] [PATCH] D67774: [Mangle] Add flag to asm labels to disable global prefixing

2019-09-24 Thread John McCall via Phabricator via lldb-commits
rjmccall added inline comments.



Comment at: clang/lib/AST/Mangle.cpp:130
+  return;
+}
+

vsk wrote:
> rjmccall wrote:
> > This is actually backwards, right?  A literal label is one that doesn't get 
> > the global prefix and therefore potentially needs the `\01` prefix to 
> > suppress it.
> Thank you for the careful and helpful review! Before updating this patch, I'd 
> like to make sure we're on the same page on this point.
> 
> What I'm searching for is a way to prevent `mangleName` from adding either a 
> `\01` prefix or the global prefix to the label contained within an 
> AsmLabelAttr. As the result from `mangleName` is passed to a hash function, 
> omitting both prefixes is necessary to fix the lldb expression evaluation 
> failure mentioned in the summary. Based on (probably a bad reading of) 
> earlier feedback, I thought that marking an attr as "Literal" would be the 
> preferred method to suppress all prefixes.
> 
> However, it sounds like you believe:
> 1) An attr marked as "Literal" should have a `\01` prefix applied, but no 
> global prefix.
> 2) An attr *not* marked as "Literal" should have a global prefix applied (if 
> one is available).
> 
> If I've characterized your view correctly, then we really need something else 
> to denote "do not add any kind of prefix". One option is to use 
> `BoolArgument<"IsUnprefixed", /*optional=*/0, /*fake=*/1>`, and set the 
> literal/non-literal distinction aside.
> 
> OTOH, if what you really meant was that `mangleName` should omit all prefixes 
> for non-"Literal" labels (and that "Literal" is the right name/distinction 
> for this idea), I can simply invert the condition I've been using.
I'm just asking you to invert the condition.  At the user level, a "literal" 
label is one that should be taken "literally", as in, it shouldn't have the 
global prefix.  The `\01` prefix is not part of the user-level semantics of asm 
labels; it's just part of the representation of symbols in LLVM IR, and 
`mangleName` should add it or not depending on what gets the right behavior 
from LLVM.  Ultimately, that will include canonicalizing labels so that an asm 
label that starts with the global prefix (e.g. `asm("_foo")`) will just be 
translated appropriately (to `@foo` rather than `@\01_foo`), but you've 
reasonably asked not to take that on in this patch, so all you need to do is 
make sure that we're only adding `\01` when the label is literal and there 
actually is a global prefix.


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

https://reviews.llvm.org/D67774



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


[Lldb-commits] [lldb] r372793 - [CMake] Don't try to install the system debugserver.

2019-09-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep 24 17:21:31 2019
New Revision: 372793

URL: http://llvm.org/viewvc/llvm-project?rev=372793&view=rev
Log:
[CMake] Don't try to install the system debugserver.

The custom target for the system debugserver has no install target, so
we need to remove it from the LLVM_DISTRIBUTION_COMPONENTS list.

Modified:
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=372793&r1=372792&r2=372793&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue Sep 24 17:21:31 2019
@@ -101,6 +101,10 @@ if(CMAKE_HOST_APPLE)
   COMMAND ${CMAKE_COMMAND} -E copy_if_different
   ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
   COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
+# The custom target for the system debugserver has no install target, so we
+# need to remove it from the LLVM_DISTRIBUTION_COMPONENTS list.
+list(REMOVE_ITEM LLVM_DISTRIBUTION_COMPONENTS debugserver)
+set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} 
PARENT_SCOPE)
 message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)


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


[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 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.

LGTM!


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

https://reviews.llvm.org/D67984



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


[Lldb-commits] [PATCH] D67984: Canonicalize variable usage in testsuite Makefiles

2019-09-24 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372795: Canonicalize variable usage in testsuite Makefiles 
(authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67984?vs=221613&id=221641#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67984

Files:
  lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/context-object-objc/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/dont_allow_jit/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import_builtin_fileid/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_obj_c/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/persist_objc_pointeetype/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/po_verbosity/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/scoped_enums/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/two-files/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/weak_symbols/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/commands/frame/var/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/intel_xtended_registers/mpx_bound_violation/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/commands/target/stop-hooks/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Make

[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna marked 2 inline comments as done.
lawrence_danna added inline comments.



Comment at: lldb/source/API/SBFile.cpp:20-26
+void SBFile::SetStream(FILE *file, bool transfer_ownership) {
+m_opaque_up = std::make_unique(file, transfer_ownership);
+}
+
+void SBFile::SetDescriptor(int fd, bool transfer_owndership) {
+m_opaque_up = std::make_unique(fd, transfer_owndership);
+}

labath wrote:
> I think it would be better if these were constructors instead of member 
> functions. That way you might be able to get rid of the all the `if 
> (!m_opaque_up) {` checks as the File member will always be initialized.
Unfortunately, SWIG does not allow return types that don't have default 
constructors.

https://github.com/swig/swig/issues/1062


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793



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


[Lldb-commits] [lldb] r372797 - [Documentation] Expand on testing variants.

2019-09-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep 24 17:58:39 2019
New Revision: 372797

URL: http://llvm.org/viewvc/llvm-project?rev=372797&view=rev
Log:
[Documentation] Expand on testing variants.

The testing documentation appears to be from an era when the only kind
of tests were the lldbsuite python tests. This patch adds a short
description of the unittests and LIT tests and how to run them.

Patch by: Lawrence D'Anna

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

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

Modified: lldb/trunk/docs/resources/test.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/test.rst?rev=372797&r1=372796&r2=372797&view=diff
==
--- lldb/trunk/docs/resources/test.rst (original)
+++ lldb/trunk/docs/resources/test.rst Tue Sep 24 17:58:39 2019
@@ -1,11 +1,20 @@
 Testing
 ===
 
-The LLDB test suite consists of Python scripts located under the test
-directory. Each script contains a number of test cases and is usually
-accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
-source file and then uses LLDB to debug the resulting executable. The tests
-verify both the LLDB command line interface and the scripting API.
+The LLDB test suite consists of three different kinds of test:
+
+* Python scripts located under ``lldb/packages/Python/lldbsuite``.
+  These are written using python's unittest2 testing framework.
+
+* Unit tests, located under ``lldb/unittests``.   These are written in C++,
+  using googletest.
+
+* LIT tests, located under ``lldb/lit``.  These use the LLVM Integrated Tester.
+
+Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each 
test
+first compiles the source file and then uses LLDB to debug the resulting 
executable.
+
+The tests verify both the LLDB command line interface and the scripting API.
 
 .. contents::
:local:
@@ -46,8 +55,8 @@ Note that multiple ``-A`` and ``-C`` fla
 ``LLDB_TEST_USER_ARGS``.
 
 
-Running a Specific Test or Set of Tests

+Running a Specific Test or Set of Tests: Python
+---
 
 In addition to running all the LLDB test suites with the ``check-lldb`` CMake
 target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@ Many more options that are available. To
 
> python dotest.py -h
 
+
+Running a Specific Test or Set of Tests: Unit Tests
+---
+
+The unit tests are simple executables, located in the build directory under 
``tools/lldb/unittests``.
+
+To run them, just run the test binary, for example, to run all the Host tests:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests
+
+
+To run a specific test, pass a filter, for example:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests 
--gtest_filter=SocketTest.DomainListenConnectAccept
+
+
+Running a Specific Test or Set of Tests: LIT
+
+
+LIT automatically scans a directory for tests.   To run a subset of the LIT 
tests, pass it a
+subdirectory, for example:
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit/Commands/CommandScriptImmediateOutput
+
+
+LIT can also filter based on test name.
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit --filter CommandScriptImmediateOutput
+
+
 Running the Test Suite Remotely
 ---
 


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


[Lldb-commits] [PATCH] D67943: documentation: update test.rst

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372797: [Documentation] Expand on testing variants. 
(authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67943?vs=221625&id=221644#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67943

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


Index: lldb/trunk/docs/resources/test.rst
===
--- lldb/trunk/docs/resources/test.rst
+++ lldb/trunk/docs/resources/test.rst
@@ -1,11 +1,20 @@
 Testing
 ===
 
-The LLDB test suite consists of Python scripts located under the test
-directory. Each script contains a number of test cases and is usually
-accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
-source file and then uses LLDB to debug the resulting executable. The tests
-verify both the LLDB command line interface and the scripting API.
+The LLDB test suite consists of three different kinds of test:
+
+* Python scripts located under ``lldb/packages/Python/lldbsuite``.
+  These are written using python's unittest2 testing framework.
+
+* Unit tests, located under ``lldb/unittests``.   These are written in C++,
+  using googletest.
+
+* LIT tests, located under ``lldb/lit``.  These use the LLVM Integrated Tester.
+
+Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each 
test
+first compiles the source file and then uses LLDB to debug the resulting 
executable.
+
+The tests verify both the LLDB command line interface and the scripting API.
 
 .. contents::
:local:
@@ -46,8 +55,8 @@
 ``LLDB_TEST_USER_ARGS``.
 
 
-Running a Specific Test or Set of Tests

+Running a Specific Test or Set of Tests: Python
+---
 
 In addition to running all the LLDB test suites with the ``check-lldb`` CMake
 target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@
 
> python dotest.py -h
 
+
+Running a Specific Test or Set of Tests: Unit Tests
+---
+
+The unit tests are simple executables, located in the build directory under 
``tools/lldb/unittests``.
+
+To run them, just run the test binary, for example, to run all the Host tests:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests
+
+
+To run a specific test, pass a filter, for example:
+
+::
+
+   > ./tools/lldb/unittests/Host/HostTests 
--gtest_filter=SocketTest.DomainListenConnectAccept
+
+
+Running a Specific Test or Set of Tests: LIT
+
+
+LIT automatically scans a directory for tests.   To run a subset of the LIT 
tests, pass it a
+subdirectory, for example:
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit/Commands/CommandScriptImmediateOutput
+
+
+LIT can also filter based on test name.
+
+::
+
+   > ./bin/llvm-lit -sv tools/lldb/lit --filter CommandScriptImmediateOutput
+
+
 Running the Test Suite Remotely
 ---
 


Index: lldb/trunk/docs/resources/test.rst
===
--- lldb/trunk/docs/resources/test.rst
+++ lldb/trunk/docs/resources/test.rst
@@ -1,11 +1,20 @@
 Testing
 ===
 
-The LLDB test suite consists of Python scripts located under the test
-directory. Each script contains a number of test cases and is usually
-accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
-source file and then uses LLDB to debug the resulting executable. The tests
-verify both the LLDB command line interface and the scripting API.
+The LLDB test suite consists of three different kinds of test:
+
+* Python scripts located under ``lldb/packages/Python/lldbsuite``.
+  These are written using python's unittest2 testing framework.
+
+* Unit tests, located under ``lldb/unittests``.   These are written in C++,
+  using googletest.
+
+* LIT tests, located under ``lldb/lit``.  These use the LLVM Integrated Tester.
+
+Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each test
+first compiles the source file and then uses LLDB to debug the resulting executable.
+
+The tests verify both the LLDB command line interface and the scripting API.
 
 .. contents::
:local:
@@ -46,8 +55,8 @@
 ``LLDB_TEST_USER_ARGS``.
 
 
-Running a Specific Test or Set of Tests

+Running a Specific Test or Set of Tests: Python
+---
 
 In addition to running all the LLDB test suites with the ``check-lldb`` CMake
 target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@
 
> python dotest.py -h
 
+
+Running a Specific Test or Set of Tests: Unit Tests
+

[Lldb-commits] [PATCH] D68001: remove unused method ResetOutputFileHandle()

2019-09-24 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, labath.
Herald added a project: LLDB.

ResetOutputFileHandle() isn't being used by anything. Also it's using 
FILE*, which is something we should be doing less of.   Remove it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68001

Files:
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/source/Core/Debugger.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h


Index: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -254,8 +254,6 @@
   void SetWatchpointCommandCallback(WatchpointOptions *wp_options,
 const char *oneliner) override;
 
-  void ResetOutputFileHandle(FILE *new_fh) override;
-
   const char *GetDictionaryName() { return m_dictionary_name.c_str(); }
 
   PyThreadState *GetThreadState() { return m_command_thread_state; }
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -609,8 +609,6 @@
   return std::make_shared(debugger);
 }
 
-void ScriptInterpreterPythonImpl::ResetOutputFileHandle(FILE *fh) {}
-
 void ScriptInterpreterPythonImpl::LeaveSession() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   if (log)
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -851,11 +851,6 @@
   if (!out_file.IsValid())
 out_file.SetStream(stdout, false);
 
-  // Do not create the ScriptInterpreter just for setting the output file
-  // handle as the constructor will know how to do the right thing on its own.
-  if (ScriptInterpreter *script_interpreter =
-  GetScriptInterpreter(/*can_create=*/false))
-script_interpreter->ResetOutputFileHandle(fh);
 }
 
 void Debugger::SetErrorFileHandle(FILE *fh, bool tranfer_ownership) {
Index: lldb/include/lldb/Interpreter/ScriptInterpreter.h
===
--- lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -463,8 +463,6 @@
 
   static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
 
-  virtual void ResetOutputFileHandle(FILE *new_fh) {} // By default, do 
nothing.
-
   lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
 
 protected:


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -254,8 +254,6 @@
   void SetWatchpointCommandCallback(WatchpointOptions *wp_options,
 const char *oneliner) override;
 
-  void ResetOutputFileHandle(FILE *new_fh) override;
-
   const char *GetDictionaryName() { return m_dictionary_name.c_str(); }
 
   PyThreadState *GetThreadState() { return m_command_thread_state; }
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -609,8 +609,6 @@
   return std::make_shared(debugger);
 }
 
-void ScriptInterpreterPythonImpl::ResetOutputFileHandle(FILE *fh) {}
-
 void ScriptInterpreterPythonImpl::LeaveSession() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   if (log)
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -851,11 +851,6 @@
   if (!out_file.IsValid())
 out_file.SetStream(stdout, false);
 
-  // Do not create the ScriptInterpreter just for setting the output file
-  // handle as the constructor will know how to do the right thing on its own.
-  if (ScriptInterpreter *script_interpreter =
-  GetScriptInterpreter(/*can_create=*/false))
-script_interpreter->ResetOutputFileHandle(fh);
 }
 
 void Debugger::SetErrorFileHandle(FILE *fh, bool tranfer_ownership) {
Index: lldb/include/lldb/Interpreter/ScriptInterpreter.h
===

[Lldb-commits] [PATCH] D67774: [Mangle] Add flag to asm labels to disable '\01' prefixing

2019-09-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 221645.
vsk retitled this revision from "[Mangle] Add flag to asm labels to disable 
global prefixing" to "[Mangle] Add flag to asm labels to disable '\01' 
prefixing".
vsk edited the summary of this revision.
vsk added a comment.

- Address latest round of comments.


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

https://reviews.llvm.org/D67774

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/AST/Mangle.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/unittests/AST/DeclTest.cpp
  lldb/source/Symbol/ClangASTContext.cpp

Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -8300,8 +8300,8 @@
 cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(*getASTContext()));
 
   if (mangled_name != nullptr) {
-cxx_method_decl->addAttr(
-clang::AsmLabelAttr::CreateImplicit(*getASTContext(), mangled_name));
+cxx_method_decl->addAttr(clang::AsmLabelAttr::CreateImplicit(
+*getASTContext(), mangled_name, /*literal=*/false));
   }
 
   // Populate the method decl with parameter decls
Index: clang/unittests/AST/DeclTest.cpp
===
--- clang/unittests/AST/DeclTest.cpp
+++ clang/unittests/AST/DeclTest.cpp
@@ -10,12 +10,16 @@
 //
 //===--===//
 
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Mangle.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/LLVM.h"
 #include "clang/Tooling/Tooling.h"
 #include "gtest/gtest.h"
 
 using namespace clang::ast_matchers;
 using namespace clang::tooling;
+using namespace clang;
 
 TEST(Decl, CleansUpAPValues) {
   MatchFinder Finder;
@@ -56,3 +60,48 @@
   "constexpr _Complex __uint128_t c = 0x;",
   Args));
 }
+
+TEST(Decl, AsmLabelAttr) {
+  // Create two method decls: `f` and `g`.
+  StringRef Code = R"(
+struct S {
+  void f() {}
+  void g() {}
+};
+  )";
+  auto AST =
+  tooling::buildASTFromCodeWithArgs(Code, {"-target", "i386-apple-darwin"});
+  ASTContext &Ctx = AST->getASTContext();
+  assert(Ctx.getTargetInfo().getDataLayout().getGlobalPrefix() &&
+ "Expected target to have a global prefix");
+  DiagnosticsEngine &Diags = AST->getDiagnostics();
+  SourceManager &SM = AST->getSourceManager();
+  FileID MainFileID = SM.getMainFileID();
+
+  // Find the method decls within the AST.
+  SmallVector Decls;
+  AST->findFileRegionDecls(MainFileID, Code.find('{'), 0, Decls);
+  ASSERT_TRUE(Decls.size() == 1);
+  CXXRecordDecl *DeclS = cast(Decls[0]);
+  NamedDecl *DeclF = *DeclS->method_begin();
+  NamedDecl *DeclG = *(++DeclS->method_begin());
+
+  // Attach asm labels to the decls: one literal, and one not.
+  DeclF->addAttr(::new (Ctx) AsmLabelAttr(Ctx, SourceLocation(), "foo",
+  /*LiteralLabel=*/true));
+  DeclG->addAttr(::new (Ctx) AsmLabelAttr(Ctx, SourceLocation(), "goo",
+  /*LiteralLabel=*/false));
+
+  // Mangle the decl names.
+  std::string MangleF, MangleG;
+  MangleContext *MC = ItaniumMangleContext::create(Ctx, Diags);
+  {
+llvm::raw_string_ostream OS_F(MangleF);
+llvm::raw_string_ostream OS_G(MangleG);
+MC->mangleName(DeclF, OS_F);
+MC->mangleName(DeclG, OS_G);
+  }
+
+  ASSERT_TRUE(0 == MangleF.compare("\x01" "foo"));
+  ASSERT_TRUE(0 == MangleG.compare("goo"));
+}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -2766,7 +2766,7 @@
 
   if (AsmLabelAttr *NewA = New->getAttr()) {
 if (AsmLabelAttr *OldA = Old->getAttr()) {
-  if (OldA->getLabel() != NewA->getLabel()) {
+  if (!OldA->isEquivalent(NewA)) {
 // This redeclaration changes __asm__ label.
 Diag(New->getLocation(), diag::err_different_asm_label);
 Diag(OldA->getLocation(), diag::note_previous_declaration);
@@ -6983,8 +6983,8 @@
   }
 }
 
-NewVD->addAttr(::new (Context)
-   AsmLabelAttr(Context, SE->getStrTokenLoc(0), Label));
+NewVD->addAttr(::new (Context) AsmLabelAttr(
+Context, SE->getStrTokenLoc(0), Label, /*IsLiteralLabel=*/true));
   } else if (!ExtnameUndeclaredIdentifiers.empty()) {
 llvm::DenseMap::iterator I =
   ExtnameUndeclaredIdentifiers.find(NewVD->getIdentifier());
@@ -8882,8 +8882,9 @@
   if (Expr *E = (Expr*) D.getAsmLabel()) {
 // The parser guarantees this is a string.
 StringLiteral *SE = cast(E);
-NewFD->addAttr(::new (Context) AsmLabelAttr(Context, SE->getStrTokenLoc(0),
-SE->getString()));
+NewFD->addAttr(::new (Context)
+   AsmLab

[Lldb-commits] [PATCH] D68003: [dotest] Support specifying a version for skipIfOutOfTreeDebugserver

2019-09-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, labath.
Herald added a subscriber: mgorny.
Herald added a reviewer: jfb.
Herald added a project: LLDB.

The `skipIfOutOfTreeDebugserver` decorator is meant to skip tests that exercise 
functionalities that may not be present yet in a debugserver that ships with 
Xcode. This is inherently tied to a version of debugserver and therefore a 
version should be part of the decorator. This patch extends the decorator to 
take an operator and a debugserver version.

This patch also removes the `--out-of-tree-debugserver` dotest flag. Instead we 
expect `--server` to be passed even when using a system debugserver, which is 
used to deduct the current version.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68003

Files:
  
lldb/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
  lldb/test/CMakeLists.txt

Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -106,7 +106,7 @@
 list(REMOVE_ITEM LLVM_DISTRIBUTION_COMPONENTS debugserver)
 set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} PARENT_SCOPE)
 message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
-list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
+list(APPEND LLDB_TEST_COMMON_ARGS --server ${system_debugserver_path})
   elseif(TARGET debugserver)
 set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver)
 message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}")
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -51,7 +51,7 @@
 context = self.expect_gdbremote_sequence()
 self.assertTrue(context.get("G_reply")[0] != 'E')
 
-@skipIfOutOfTreeDebugserver
+@skipIfOutOfTreeDebugserver(['<', '1100'])
 @debugserver_test
 @skipIfDarwinEmbedded
 def test_g_packet_debugserver(self):
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1293,6 +1293,20 @@
 version = m.group(1)
 return version
 
+def getDebugserverVersion(self):
+""" Returns a string that represents the debugserver version. """
+if not configuration.debugserver:
+return '0'
+try:
+version_output = check_output([configuration.debugserver, "-v"], stderr=STDOUT)
+except CalledProcessError as e:
+version_output = e.output
+for line in version_output.split(os.linesep):
+m = re.search('PROJECT:lldb-([0-9\.]+)', line)
+if m:
+return m.group(1)
+return '0'
+
 def getDwarfVersion(self):
 """ Returns the dwarf version generated by clang or '0'. """
 if configuration.dwarf_version:
@@ -1350,6 +1364,13 @@
 return str(version) not in str(self.getCompilerVersion())
 return str(version) in str(self.getCompilerVersion())
 
+def expectedDebugserverVersion(self, debugserver_version):
+if (debugserver_version is None):
+return True
+operator = str(debugserver_version[0])
+version = str(compiler_version[1])
+
+
 def expectedCompiler(self, compilers):
 """Returns True iff any element of compilers is a sub-string of the current compiler."""
 if (compilers is None):
Index: lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentMany

  1   2   >