[Lldb-commits] [lldb] r355766 - Actually implement the TestQueues.py workaround

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 17:34:44 2019
New Revision: 355766

URL: http://llvm.org/viewvc/llvm-project?rev=355766&view=rev
Log:
Actually implement the TestQueues.py workaround

The code commited in r355764 didn't do what I want as I typed GetThreadID
instead of GetQueueID. This commit contains a (hopefully) better version
of the workaround.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355766&r1=355765&r2=355766&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 17:34:44 2019
@@ -337,6 +337,10 @@ class TestQueues(TestBase):
 queue_performer_2 = q
 if q.GetName() == "com.apple.work_performer_3":
 queue_performer_3 = q
+if q.GetName() == "com.apple.main-thread":
+if q.GetNumThreads() == 0:
+print("Cannot get thread <=> queue associations")
+return
 
 self.assertTrue(
 queue_submittor_1.IsValid() and queue_performer_1.IsValid() and 
queue_performer_2.IsValid() and queue_performer_3.IsValid(),
@@ -357,11 +361,6 @@ class TestQueues(TestBase):
 queue_performer_2, 1, )
 self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
 
-for th in process.threads:
-if th.GetThreadID() == lldb.LLDB_INVALID_QUEUE_ID:
-print("Cannot get thread <=> queue associations")
-return
-
 self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)


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


[Lldb-commits] [lldb] r355764 - Try to workaround the TestQueues.py flakyness

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 17:23:47 2019
New Revision: 355764

URL: http://llvm.org/viewvc/llvm-project?rev=355764&view=rev
Log:
Try to workaround the TestQueues.py flakyness

This is not a fix, but if I understand enough of the issue, it should
bail out early of the test when in a situation that would result in
a failure down the road.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355764&r1=355763&r2=355764&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 17:23:47 2019
@@ -357,6 +357,11 @@ class TestQueues(TestBase):
 queue_performer_2, 1, )
 self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
 
+for th in process.threads:
+if th.GetThreadID() == lldb.LLDB_INVALID_QUEUE_ID:
+print("Cannot get thread <=> queue associations")
+return
+
 self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)


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


Re: [Lldb-commits] [PATCH] D59165: Remove DWARFDIECollection

2019-03-08 Thread Zachary Turner via lldb-commits
Yes, it’s not the case here but even it were, just because the Python
interface exposes this api doesn’t mean we have to use it internally.

Regardless, this particular class is completely private and has no analogue
in the SB API
On Fri, Mar 8, 2019 at 4:53 PM Adrian Prantl via Phabricator <
revi...@reviews.llvm.org> wrote:

> aprantl added a comment.
>
> Whenever I see a GetFooAtIndex() method I expect this to be exposed via
> the SBAPI, but I assume this isn't the case here?
>
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D59165/new/
>
> https://reviews.llvm.org/D59165
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59165: Remove DWARFDIECollection

2019-03-08 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Whenever I see a GetFooAtIndex() method I expect this to be exposed via the 
SBAPI, but I assume this isn't the case here?


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

https://reviews.llvm.org/D59165



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


[Lldb-commits] [PATCH] D59165: Remove DWARFDIECollection

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added reviewers: clayborg, aprantl.
Herald added subscribers: jdoerfert, mgorny.

  This is a very thin wrapper over a std::vector and does
  not seem to provide any real value over just using a container
  directly.


https://reviews.llvm.org/D59165

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -49,7 +49,6 @@
 class DWARFDebugLine;
 class DWARFDebugRangesBase;
 class DWARFDeclContext;
-class DWARFDIECollection;
 class DWARFFormValue;
 class SymbolFileDWARFDebugMap;
 class SymbolFileDWARFDwo;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -54,7 +54,6 @@
 #include "AppleDWARFIndex.h"
 #include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
-#include "DWARFDIECollection.h"
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
@@ -861,22 +860,20 @@
 
 size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) {
   ASSERT_MODULE_LOCK(this);
-  size_t functions_added = 0;
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
-  if (dwarf_cu) {
-DWARFDIECollection function_dies;
-const size_t num_functions =
-dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies);
-size_t func_idx;
-for (func_idx = 0; func_idx < num_functions; ++func_idx) {
-  DWARFDIE die = function_dies.GetDIEAtIndex(func_idx);
-  if (comp_unit.FindFunctionByUID(die.GetID()).get() == NULL) {
-if (ParseFunction(comp_unit, die))
-  ++functions_added;
-  }
-}
-// FixupTypes();
+  if (!dwarf_cu)
+return 0;
+
+  size_t functions_added = 0;
+  std::vector function_dies;
+  dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies);
+  for (const DWARFDIE &die : function_dies) {
+if (comp_unit.FindFunctionByUID(die.GetID()))
+  continue;
+if (ParseFunction(comp_unit, die))
+  ++functions_added;
   }
+  // FixupTypes();
   return functions_added;
 }
 
@@ -2807,8 +2804,8 @@
   if (die1 == die2)
 return true;
 
-  DWARFDIECollection decl_ctx_1;
-  DWARFDIECollection decl_ctx_2;
+  std::vector decl_ctx_1;
+  std::vector decl_ctx_2;
   // The declaration DIE stack is a stack of the declaration context DIEs all
   // the way back to the compile unit. If a type "T" is declared inside a class
   // "B", and class "B" is declared inside a class "A" and class "A" is in a
@@ -2824,11 +2821,11 @@
   // back to the compiler unit.
 
   // First lets grab the decl contexts for both DIEs
-  die1.GetDeclContextDIEs(decl_ctx_1);
-  die2.GetDeclContextDIEs(decl_ctx_2);
+  decl_ctx_1 = die1.GetDeclContextDIEs();
+  decl_ctx_2 = die2.GetDeclContextDIEs();
   // Make sure the context arrays have the same size, otherwise we are done
-  const size_t count1 = decl_ctx_1.Size();
-  const size_t count2 = decl_ctx_2.Size();
+  const size_t count1 = decl_ctx_1.size();
+  const size_t count2 = decl_ctx_2.size();
   if (count1 != count2)
 return false;
 
@@ -2838,8 +2835,8 @@
   DWARFDIE decl_ctx_die2;
   size_t i;
   for (i = 0; i < count1; i++) {
-decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i);
-decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i);
+decl_ctx_die1 = decl_ctx_1[i];
+decl_ctx_die2 = decl_ctx_2[i];
 if (decl_ctx_die1.Tag() != decl_ctx_die2.Tag())
   return false;
   }
@@ -2849,7 +2846,7 @@
   // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then
   // something went wrong in the DWARFDIE::GetDeclContextDIEs()
   // function.
-  dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag();
+  dw_tag_t cu_tag = decl_ctx_1[count1 - 1].Tag();
   UNUSED_IF_ASSERT_DISABLED(cu_tag);
   assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit);
 
@@ -2857,8 +2854,8 @@
   // Always skip the compile unit when comparing by only iterating up to "count
   // 

[Lldb-commits] [PATCH] D59164: [SymbolFileDWARF] Move ElaboratingDIEIterator into implementation file

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added a reviewer: clayborg.

  This is not used outside of the private implementation of the class,
  so hiding in the implementation file is a nice way of simplifying
  the external interface.


https://reviews.llvm.org/D59164

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

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
@@ -14,8 +14,6 @@
 
 class DWARFDIE : public DWARFBaseDIE {
 public:
-  class ElaboratingDIEIterator;
-
   using DWARFBaseDIE::DWARFBaseDIE;
 
   //--
@@ -33,8 +31,6 @@
   DWARFDIE
   GetContainingDWOModuleDIE() const;
 
-  inline llvm::iterator_range elaborating_dies() const;
-
   //--
   // Accessing information about a DIE
   //--
@@ -121,58 +117,4 @@
   lldb_private::CompilerDeclContext GetContainingDeclContext() const;
 };
 
-/// Iterate through all DIEs elaborating (i.e. reachable by a chain of
-/// DW_AT_specification and DW_AT_abstract_origin attributes) a given DIE. For
-/// convenience, the starting die is included in the sequence as the first
-/// item.
-class DWARFDIE::ElaboratingDIEIterator
-: public std::iterator {
-
-  // The operating invariant is: top of m_worklist contains the "current" item
-  // and the rest of the list are items yet to be visited. An empty worklist
-  // means we've reached the end.
-  // Infinite recursion is prevented by maintaining a list of seen DIEs.
-  // Container sizes are optimized for the case of following DW_AT_specification
-  // and DW_AT_abstract_origin just once.
-  llvm::SmallVector m_worklist;
-  llvm::SmallSet m_seen;
-
-  void Next();
-
-public:
-  /// An iterator starting at die d.
-  explicit ElaboratingDIEIterator(DWARFDIE d) : m_worklist(1, d) {}
-
-  /// End marker
-  ElaboratingDIEIterator() {}
-
-  const DWARFDIE &operator*() const { return m_worklist.back(); }
-  ElaboratingDIEIterator &operator++() {
-Next();
-return *this;
-  }
-  ElaboratingDIEIterator operator++(int) {
-ElaboratingDIEIterator I = *this;
-Next();
-return I;
-  }
-
-  friend bool operator==(const ElaboratingDIEIterator &a,
- const ElaboratingDIEIterator &b) {
-if (a.m_worklist.empty() || b.m_worklist.empty())
-  return a.m_worklist.empty() == b.m_worklist.empty();
-return a.m_worklist.back() == b.m_worklist.back();
-  }
-  friend bool operator!=(const ElaboratingDIEIterator &a,
- const ElaboratingDIEIterator &b) {
-return !(a == b);
-  }
-};
-
-llvm::iterator_range
-DWARFDIE::elaborating_dies() const {
-  return llvm::make_range(ElaboratingDIEIterator(*this),
-  ElaboratingDIEIterator());
-}
-
 #endif // SymbolFileDWARF_DWARFDIE_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -17,20 +17,75 @@
 
 using namespace lldb_private;
 
-void DWARFDIE::ElaboratingDIEIterator::Next() {
-  assert(!m_worklist.empty() && "Incrementing end iterator?");
-
-  // Pop the current item from the list.
-  DWARFDIE die = m_worklist.back();
-  m_worklist.pop_back();
-
-  // And add back any items that elaborate it.
-  for (dw_attr_t attr : {DW_AT_specification, DW_AT_abstract_origin}) {
-if (DWARFDIE d = die.GetReferencedDIE(attr))
-  if (m_seen.insert(die.GetID()).second)
-m_worklist.push_back(d);
+namespace {
+
+/// Iterate through all DIEs elaborating (i.e. reachable by a chain of
+/// DW_AT_specification and DW_AT_abstract_origin attributes) a given DIE. For
+/// convenience, the starting die is included in the sequence as the first
+/// item.
+class ElaboratingDIEIterator
+: public std::iterator {
+
+  // The operating invariant is: top of m_worklist contains the "current" item
+  // and the rest of the list are items yet to be visited. An empty worklist
+  // means we've reached the end.
+  // Infinite recursion is prevented by maintaining a list of seen DIEs.
+  // Container sizes are optimized for the case of following DW_AT_specification
+  // and DW_AT_abstract_origin just once.
+  llvm::SmallVector m_worklist;
+  llvm::SmallSet m_seen;
+
+  void Next() {
+assert(!m_worklist.empty() && "Incrementing end iterator?");
+
+// Pop the current item from the list.
+DWARFDIE die = m_worklist.back();
+m_worklist.pop_back();
+
+// And add back any items that elaborate it.
+for (dw_attr_t attr : {DW_AT_specification, DW_AT_abstract_origin}) {
+  if (DWARFDIE d 

[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355762: Break cycle lldb/Commands [3->] lldb/Expression 
[1->] lldb/Commands (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59158?vs=189957&id=189958#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59158

Files:
  lldb/trunk/include/lldb/Expression/REPL.h
  lldb/trunk/source/Commands/CommandObjectExpression.cpp
  lldb/trunk/source/Expression/REPL.cpp

Index: lldb/trunk/include/lldb/Expression/REPL.h
===
--- lldb/trunk/include/lldb/Expression/REPL.h
+++ lldb/trunk/include/lldb/Expression/REPL.h
@@ -11,9 +11,10 @@
 
 #include 
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
+#include "lldb/Core/IOHandler.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/Target/Target.h"
 
 namespace lldb_private {
 
@@ -68,9 +69,8 @@
 m_varobj_options = options;
   }
 
-  void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-m_command_options = options;
+  void SetEvaluateOptions(const EvaluateExpressionOptions &options) {
+m_expr_options = options;
   }
 
   void SetCompilerOptions(const char *options) {
@@ -145,7 +145,7 @@
 
   OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
   OptionGroupValueObjectDisplay m_varobj_options;
-  CommandObjectExpression::CommandOptions m_command_options;
+  EvaluateExpressionOptions m_expr_options;
   std::string m_compiler_options;
 
   bool m_enable_auto_indent = true;
Index: lldb/trunk/source/Commands/CommandObjectExpression.cpp
===
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp
@@ -571,6 +571,29 @@
   debugger.PushIOHandler(io_handler_sp);
 }
 
+static EvaluateExpressionOptions
+GetExprOptions(ExecutionContext &ctx,
+   CommandObjectExpression::CommandOptions command_options) {
+  command_options.OptionParsingStarting(&ctx);
+
+  // Default certain settings for REPL regardless of the global settings.
+  command_options.unwind_on_error = false;
+  command_options.ignore_breakpoints = false;
+  command_options.debug = false;
+
+  EvaluateExpressionOptions expr_options;
+  expr_options.SetUnwindOnError(command_options.unwind_on_error);
+  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
+  expr_options.SetTryAllThreads(command_options.try_all_threads);
+
+  if (command_options.timeout > 0)
+expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
+  else
+expr_options.SetTimeout(llvm::None);
+
+  return expr_options;
+}
+
 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
 CommandReturnObject &result) {
   m_fixed_expression.clear();
@@ -626,7 +649,8 @@
 
   if (repl_sp) {
 if (initialize) {
-  repl_sp->SetCommandOptions(m_command_options);
+  repl_sp->SetEvaluateOptions(
+  GetExprOptions(exe_ctx, m_command_options));
   repl_sp->SetFormatOptions(m_format_options);
   repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
 }
Index: lldb/trunk/source/Expression/REPL.cpp
===
--- lldb/trunk/source/Expression/REPL.cpp
+++ lldb/trunk/source/Expression/REPL.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/AnsiTerminal.h"
 
@@ -29,12 +28,6 @@
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
-
-  // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error = false;
-  m_command_options.ignore_breakpoints = false;
-  m_command_options.debug = false;
 }
 
 REPL::~REPL() = default;
@@ -276,22 +269,15 @@
 
   const bool colorize_err = error_sp->GetFile().GetIsTerminalWithColors();
 
-  EvaluateExpressionOptions expr_options;
+  EvaluateExpressionOptions expr_options = m_expr_options;
   expr_options.SetCoerceToId(m_varobj_options.use_objc);
-  expr_options.SetUnwindOnError(m_command_options.unwind_on_error);
-  expr_options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
   expr_options.SetKeepInMemory(true);
   expr_op

[Lldb-commits] [lldb] r355762 - Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Mar  8 16:10:52 2019
New Revision: 355762

URL: http://llvm.org/viewvc/llvm-project?rev=355762&view=rev
Log:
Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

Inspired by Zachary's mail on lldb-dev, this seemed like low hanging
fruit. This patch breaks the circular dependency between commands and
expression.

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

Modified:
lldb/trunk/include/lldb/Expression/REPL.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Expression/REPL.cpp

Modified: lldb/trunk/include/lldb/Expression/REPL.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/REPL.h?rev=355762&r1=355761&r2=355762&view=diff
==
--- lldb/trunk/include/lldb/Expression/REPL.h (original)
+++ lldb/trunk/include/lldb/Expression/REPL.h Fri Mar  8 16:10:52 2019
@@ -11,9 +11,10 @@
 
 #include 
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
+#include "lldb/Core/IOHandler.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/Target/Target.h"
 
 namespace lldb_private {
 
@@ -68,9 +69,8 @@ public:
 m_varobj_options = options;
   }
 
-  void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-m_command_options = options;
+  void SetEvaluateOptions(const EvaluateExpressionOptions &options) {
+m_expr_options = options;
   }
 
   void SetCompilerOptions(const char *options) {
@@ -145,7 +145,7 @@ protected:
 
   OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
   OptionGroupValueObjectDisplay m_varobj_options;
-  CommandObjectExpression::CommandOptions m_command_options;
+  EvaluateExpressionOptions m_expr_options;
   std::string m_compiler_options;
 
   bool m_enable_auto_indent = true;

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=355762&r1=355761&r2=355762&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Mar  8 16:10:52 
2019
@@ -571,6 +571,29 @@ void CommandObjectExpression::GetMultili
   debugger.PushIOHandler(io_handler_sp);
 }
 
+static EvaluateExpressionOptions
+GetExprOptions(ExecutionContext &ctx,
+   CommandObjectExpression::CommandOptions command_options) {
+  command_options.OptionParsingStarting(&ctx);
+
+  // Default certain settings for REPL regardless of the global settings.
+  command_options.unwind_on_error = false;
+  command_options.ignore_breakpoints = false;
+  command_options.debug = false;
+
+  EvaluateExpressionOptions expr_options;
+  expr_options.SetUnwindOnError(command_options.unwind_on_error);
+  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
+  expr_options.SetTryAllThreads(command_options.try_all_threads);
+
+  if (command_options.timeout > 0)
+
expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
+  else
+expr_options.SetTimeout(llvm::None);
+
+  return expr_options;
+}
+
 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
 CommandReturnObject &result) {
   m_fixed_expression.clear();
@@ -626,7 +649,8 @@ bool CommandObjectExpression::DoExecute(
 
   if (repl_sp) {
 if (initialize) {
-  repl_sp->SetCommandOptions(m_command_options);
+  repl_sp->SetEvaluateOptions(
+  GetExprOptions(exe_ctx, m_command_options));
   repl_sp->SetFormatOptions(m_format_options);
   repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
 }

Modified: lldb/trunk/source/Expression/REPL.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/REPL.cpp?rev=355762&r1=355761&r2=355762&view=diff
==
--- lldb/trunk/source/Expression/REPL.cpp (original)
+++ lldb/trunk/source/Expression/REPL.cpp Fri Mar  8 16:10:52 2019
@@ -15,7 +15,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/AnsiTerminal.h"
 
@@ -29,12 +28,6 @@ REPL::REPL(LLVMCastKind kind, Target &ta
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
-
-  // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error

[Lldb-commits] [lldb] r355761 - Add parens to force the order of operations in an expression trying

2019-03-08 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Mar  8 16:04:24 2019
New Revision: 355761

URL: http://llvm.org/viewvc/llvm-project?rev=355761&view=rev
Log:
Add parens to force the order of operations in an expression trying
to do "databuffer + offset" so that we don't overflow the uint64_t's 
we're using for addresses when working with high addresses.

Found with clang's ubsan while doing darwin kernel debugging.

 


Modified:
lldb/trunk/source/Target/Memory.cpp

Modified: lldb/trunk/source/Target/Memory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=355761&r1=355760&r2=355761&view=diff
==
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Fri Mar  8 16:04:24 2019
@@ -146,7 +146,7 @@ size_t MemoryCache::Read(addr_t addr, vo
 }
 AddrRange chunk_range(pos->first, pos->second->GetByteSize());
 if (chunk_range.Contains(read_range)) {
-  memcpy(dst, pos->second->GetBytes() + addr - chunk_range.GetRangeBase(),
+  memcpy(dst, pos->second->GetBytes() + (addr - 
chunk_range.GetRangeBase()),
  dst_len);
   return dst_len;
 }


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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

Ahh yea, sorry.  Got confused for a second :)


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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D59158#1423483 , @zturner wrote:

> Interesting, I had looked at fixing this one once before but I didn't realize 
> we had a class named `EvaluateExpressionOptions` that contained just the 
> right set of information, and it felt gross to invent a new one just for this 
> purpose (It's a good thing I didn't too, since we already had another one).
>
> Can you also update the CMake files?  You'll need to update 
> `Expression/CMakeLists.txt` to not pull in `lldbTarget`.  I was going to say 
> that you would also need to update `unittests/Expression/CMakeLists.txt`, but 
> it's already not listed, so I guess it's just been relying on linking it 
> transitively.


You mean `lldbCommand`, right? It's already not listed there, and neither in 
the unittest.

> Do you have the ability to test the build with CMake?  If so, could you try 
> `ninja ExpressionTests` and make sure everything still works after removing 
> the link dependcy in `Expression/CMakeLists.txt`?




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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 189957.

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

https://reviews.llvm.org/D59158

Files:
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Expression/REPL.cpp

Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/AnsiTerminal.h"
 
@@ -29,12 +28,6 @@
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
-
-  // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error = false;
-  m_command_options.ignore_breakpoints = false;
-  m_command_options.debug = false;
 }
 
 REPL::~REPL() = default;
@@ -276,22 +269,15 @@
 
   const bool colorize_err = error_sp->GetFile().GetIsTerminalWithColors();
 
-  EvaluateExpressionOptions expr_options;
+  EvaluateExpressionOptions expr_options = m_expr_options;
   expr_options.SetCoerceToId(m_varobj_options.use_objc);
-  expr_options.SetUnwindOnError(m_command_options.unwind_on_error);
-  expr_options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
   expr_options.SetKeepInMemory(true);
   expr_options.SetUseDynamic(m_varobj_options.use_dynamic);
-  expr_options.SetTryAllThreads(m_command_options.try_all_threads);
   expr_options.SetGenerateDebugInfo(true);
   expr_options.SetREPLEnabled(true);
   expr_options.SetColorizeErrors(colorize_err);
   expr_options.SetPoundLine(m_repl_source_path.c_str(),
 m_code.GetSize() + 1);
-  if (m_command_options.timeout > 0)
-expr_options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
-  else
-expr_options.SetTimeout(llvm::None);
 
   expr_options.SetLanguage(GetLanguage());
 
Index: lldb/source/Commands/CommandObjectExpression.cpp
===
--- lldb/source/Commands/CommandObjectExpression.cpp
+++ lldb/source/Commands/CommandObjectExpression.cpp
@@ -571,6 +571,29 @@
   debugger.PushIOHandler(io_handler_sp);
 }
 
+static EvaluateExpressionOptions
+GetExprOptions(ExecutionContext &ctx,
+   CommandObjectExpression::CommandOptions command_options) {
+  command_options.OptionParsingStarting(&ctx);
+
+  // Default certain settings for REPL regardless of the global settings.
+  command_options.unwind_on_error = false;
+  command_options.ignore_breakpoints = false;
+  command_options.debug = false;
+
+  EvaluateExpressionOptions expr_options;
+  expr_options.SetUnwindOnError(command_options.unwind_on_error);
+  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
+  expr_options.SetTryAllThreads(command_options.try_all_threads);
+
+  if (command_options.timeout > 0)
+expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
+  else
+expr_options.SetTimeout(llvm::None);
+
+  return expr_options;
+}
+
 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
 CommandReturnObject &result) {
   m_fixed_expression.clear();
@@ -626,7 +649,8 @@
 
   if (repl_sp) {
 if (initialize) {
-  repl_sp->SetCommandOptions(m_command_options);
+  repl_sp->SetEvaluateOptions(
+  GetExprOptions(exe_ctx, m_command_options));
   repl_sp->SetFormatOptions(m_format_options);
   repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
 }
Index: lldb/include/lldb/Expression/REPL.h
===
--- lldb/include/lldb/Expression/REPL.h
+++ lldb/include/lldb/Expression/REPL.h
@@ -11,9 +11,10 @@
 
 #include 
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
+#include "lldb/Core/IOHandler.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/Target/Target.h"
 
 namespace lldb_private {
 
@@ -68,9 +69,8 @@
 m_varobj_options = options;
   }
 
-  void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-m_command_options = options;
+  void SetEvaluateOptions(const EvaluateExpressionOptions &options) {
+m_expr_options = options;
   }
 
   void SetCompilerOptions(const char *options) {
@@ -145,7 +145,7 @@
 
   OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
   OptionGroupValueO

[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

Interesting, I had looked at fixing this one once before but I didn't realize 
we had a class named `EvaluateExpressionOptions` that contained just the right 
set of information, and it felt gross to invent a new one just for this purpose 
(It's a good thing I didn't too, since we already had another one).

Can you also update the CMake files?  You'll need to update 
`Expression/CMakeLists.txt` to not pull in `lldbTarget`.  I was going to say 
that you would also need to update `unittests/Expression/CMakeLists.txt`, but 
it's already not listed, so I guess it's just been relying on linking it 
transitively.

Do you have the ability to test the build with CMake?  If so, could you try 
`ninja ExpressionTests` and make sure everything still works after removing the 
link dependcy in `Expression/CMakeLists.txt`?


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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 189955.
JDevlieghere added a comment.

format


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

https://reviews.llvm.org/D59158

Files:
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Expression/REPL.cpp

Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Expression/REPL.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/IOHandler.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Expression/ExpressionVariable.h"
@@ -15,7 +16,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/AnsiTerminal.h"
 
@@ -29,12 +29,6 @@
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
-
-  // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error = false;
-  m_command_options.ignore_breakpoints = false;
-  m_command_options.debug = false;
 }
 
 REPL::~REPL() = default;
@@ -276,22 +270,15 @@
 
   const bool colorize_err = error_sp->GetFile().GetIsTerminalWithColors();
 
-  EvaluateExpressionOptions expr_options;
+  EvaluateExpressionOptions expr_options = m_expr_options;
   expr_options.SetCoerceToId(m_varobj_options.use_objc);
-  expr_options.SetUnwindOnError(m_command_options.unwind_on_error);
-  expr_options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
   expr_options.SetKeepInMemory(true);
   expr_options.SetUseDynamic(m_varobj_options.use_dynamic);
-  expr_options.SetTryAllThreads(m_command_options.try_all_threads);
   expr_options.SetGenerateDebugInfo(true);
   expr_options.SetREPLEnabled(true);
   expr_options.SetColorizeErrors(colorize_err);
   expr_options.SetPoundLine(m_repl_source_path.c_str(),
 m_code.GetSize() + 1);
-  if (m_command_options.timeout > 0)
-expr_options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
-  else
-expr_options.SetTimeout(llvm::None);
 
   expr_options.SetLanguage(GetLanguage());
 
Index: lldb/source/Commands/CommandObjectExpression.cpp
===
--- lldb/source/Commands/CommandObjectExpression.cpp
+++ lldb/source/Commands/CommandObjectExpression.cpp
@@ -571,6 +571,29 @@
   debugger.PushIOHandler(io_handler_sp);
 }
 
+static EvaluateExpressionOptions
+GetExprOptions(ExecutionContext &ctx,
+   CommandObjectExpression::CommandOptions command_options) {
+  command_options.OptionParsingStarting(&ctx);
+
+  // Default certain settings for REPL regardless of the global settings.
+  command_options.unwind_on_error = false;
+  command_options.ignore_breakpoints = false;
+  command_options.debug = false;
+
+  EvaluateExpressionOptions expr_options;
+  expr_options.SetUnwindOnError(command_options.unwind_on_error);
+  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
+  expr_options.SetTryAllThreads(command_options.try_all_threads);
+
+  if (command_options.timeout > 0)
+expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
+  else
+expr_options.SetTimeout(llvm::None);
+
+  return expr_options;
+}
+
 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
 CommandReturnObject &result) {
   m_fixed_expression.clear();
@@ -626,7 +649,8 @@
 
   if (repl_sp) {
 if (initialize) {
-  repl_sp->SetCommandOptions(m_command_options);
+  repl_sp->SetEvaluateOptions(
+  GetExprOptions(exe_ctx, m_command_options));
   repl_sp->SetFormatOptions(m_format_options);
   repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
 }
Index: lldb/include/lldb/Expression/REPL.h
===
--- lldb/include/lldb/Expression/REPL.h
+++ lldb/include/lldb/Expression/REPL.h
@@ -11,9 +11,9 @@
 
 #include 
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/Target/Target.h"
 
 namespace lldb_private {
 
@@ -68,9 +68,8 @@
 m_varobj_options = options;
   }
 
-  void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-m_command_options = options;
+  void SetEvaluateOptions(const Eva

[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Expression/REPL.cpp:10
 #include "lldb/Expression/REPL.h"
+#include "lldb/Commands/CommandObjectExpression.h"
 #include "lldb/Core/Debugger.h"

zturner wrote:
> AFAICT, this doesn't really appear to break the dependency does it?  Because 
> right here, Expression will still cause a link dependency against Commands.  
Yeah you're totally right, I'm doing too many things at the same time. 


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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 189953.
JDevlieghere marked 2 inline comments as done.

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

https://reviews.llvm.org/D59158

Files:
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Expression/REPL.cpp

Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -6,6 +6,7 @@
 //
 //===--===//
 
+#include "lldb/Core/IOHandler.h"
 #include "lldb/Expression/REPL.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/PluginManager.h"
@@ -15,7 +16,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/AnsiTerminal.h"
 
@@ -29,12 +29,6 @@
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
-
-  // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error = false;
-  m_command_options.ignore_breakpoints = false;
-  m_command_options.debug = false;
 }
 
 REPL::~REPL() = default;
@@ -276,22 +270,15 @@
 
   const bool colorize_err = error_sp->GetFile().GetIsTerminalWithColors();
 
-  EvaluateExpressionOptions expr_options;
+  EvaluateExpressionOptions expr_options = m_expr_options;
   expr_options.SetCoerceToId(m_varobj_options.use_objc);
-  expr_options.SetUnwindOnError(m_command_options.unwind_on_error);
-  expr_options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
   expr_options.SetKeepInMemory(true);
   expr_options.SetUseDynamic(m_varobj_options.use_dynamic);
-  expr_options.SetTryAllThreads(m_command_options.try_all_threads);
   expr_options.SetGenerateDebugInfo(true);
   expr_options.SetREPLEnabled(true);
   expr_options.SetColorizeErrors(colorize_err);
   expr_options.SetPoundLine(m_repl_source_path.c_str(),
 m_code.GetSize() + 1);
-  if (m_command_options.timeout > 0)
-expr_options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
-  else
-expr_options.SetTimeout(llvm::None);
 
   expr_options.SetLanguage(GetLanguage());
 
Index: lldb/source/Commands/CommandObjectExpression.cpp
===
--- lldb/source/Commands/CommandObjectExpression.cpp
+++ lldb/source/Commands/CommandObjectExpression.cpp
@@ -571,6 +571,27 @@
   debugger.PushIOHandler(io_handler_sp);
 }
 
+static EvaluateExpressionOptions GetExprOptions(ExecutionContext& ctx, CommandObjectExpression::CommandOptions command_options) {
+  command_options.OptionParsingStarting(&ctx);
+
+  // Default certain settings for REPL regardless of the global settings.
+  command_options.unwind_on_error = false;
+  command_options.ignore_breakpoints = false;
+  command_options.debug = false;
+
+  EvaluateExpressionOptions expr_options;
+  expr_options.SetUnwindOnError(command_options.unwind_on_error);
+  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
+  expr_options.SetTryAllThreads(command_options.try_all_threads);
+
+  if (command_options.timeout > 0)
+expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
+  else
+expr_options.SetTimeout(llvm::None);
+
+  return expr_options;
+}
+
 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
 CommandReturnObject &result) {
   m_fixed_expression.clear();
@@ -626,7 +647,7 @@
 
   if (repl_sp) {
 if (initialize) {
-  repl_sp->SetCommandOptions(m_command_options);
+  repl_sp->SetEvaluateOptions(GetExprOptions(exe_ctx, m_command_options));
   repl_sp->SetFormatOptions(m_format_options);
   repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
 }
Index: lldb/include/lldb/Expression/REPL.h
===
--- lldb/include/lldb/Expression/REPL.h
+++ lldb/include/lldb/Expression/REPL.h
@@ -11,7 +11,7 @@
 
 #include 
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 
@@ -69,8 +69,8 @@
   }
 
   void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-m_command_options = options;
+  SetEvaluateOptions(const EvaluateExpressionOptions &options) {
+m_expr_options = options;
   }
 
   void SetCompilerO

[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

I think maybe part of the problem is that this patch looks like actually 2 
things.  1) A move of the include files from `lldb/source/Commands` to 
`lldb/Include/lldb/Commands`, and 2) The dependency changes.  So it makes it 
hard to see what changes are actually needed for breaking the dependency.

Would it be possible to first move the header files as an independent change 
(which probably doesn't even need to be clang-formatted), and then after that 
fix the dependency issues?




Comment at: lldb/source/Expression/REPL.cpp:10
 #include "lldb/Expression/REPL.h"
+#include "lldb/Commands/CommandObjectExpression.h"
 #include "lldb/Core/Debugger.h"

AFAICT, this doesn't really appear to break the dependency does it?  Because 
right here, Expression will still cause a link dependency against Commands.  


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [lldb] r355750 - [lldb] [test] Skip broken NetBSD core test

2019-03-08 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Mar  8 14:41:14 2019
New Revision: 355750

URL: http://llvm.org/viewvc/llvm-project?rev=355750&view=rev
Log:
[lldb] [test] Skip broken NetBSD core test

Apparently the problem is harder than anticipated.  Skip the test for
now to fix buildbots.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py?rev=355750&r1=355749&r2=355750&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
 Fri Mar  8 14:41:14 2019
@@ -219,6 +219,7 @@ class NetBSD2LWPProcessSigCoreTestCase(N
 self.assertEqual(thread.GetStopReasonDataCount(), 1)
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
 
+@skipIf  # TODO: fails with non-netbsd libc
 @skipIfLLVMTargetMissing("X86")
 def test_amd64(self):
 """Test double-threaded amd64 core dump where process is signalled."""


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


[Lldb-commits] [PATCH] D59159: [third-party] Update pexpect to 4.6.

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

I don't think we should check in the 'test' or 'example' subdirectories.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59159



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked 2 inline comments as done.
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Commands/CommandObjectBreakpoint.h:36
 
-  static void VerifyBreakpointOrLocationIDs(Args &args, Target *target,
-CommandReturnObject &result,

zturner wrote:
> I think the clang-format got messed up.  It appears to be formatting your 
> entire tree instead of only the files that were changed in this patch.  Can 
> you try to re-run clang-format only on the changed files?
I did. I use `git clang-format`, which probably considers the whole file to be 
modified when you move it. It rings a bell but I don't remember the specifics. 

The other files look fine though, so I can just reset this one.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [lldb] r355747 - [lldb] [test] Do not check libc function names in NetBSD core test

2019-03-08 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Mar  8 14:32:35 2019
New Revision: 355747

URL: http://llvm.org/viewvc/llvm-project?rev=355747&view=rev
Log:
[lldb] [test] Do not check libc function names in NetBSD core test

Fix the NetBSD core test not to verify libc function names in backtrace.
This obviously requires the same libc.so as originally used to produce
the core file, and so it is going to fail everywhere except on my
system.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py?rev=355747&r1=355746&r2=355747&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
 Fri Mar  8 14:32:35 2019
@@ -130,8 +130,8 @@ class NetBSDCoreCommonTestCase(TestBase)
 for i in range(len(backtrace)):
 frame = thread.GetFrameAtIndex(i)
 self.assertTrue(frame)
-self.assertEqual(frame.GetFunctionName(), backtrace[i])
 if not backtrace[i].startswith('_'):
+self.assertEqual(frame.GetFunctionName(), backtrace[i])
 self.assertEqual(frame.GetLineEntry().GetLine(),
  line_number(src, "Frame " + backtrace[i]))
 self.assertEqual(


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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: lldb/include/lldb/Commands/CommandObjectBreakpoint.h:36
 
-  static void VerifyBreakpointOrLocationIDs(Args &args, Target *target,
-CommandReturnObject &result,

I think the clang-format got messed up.  It appears to be formatting your 
entire tree instead of only the files that were changed in this patch.  Can you 
try to re-run clang-format only on the changed files?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59158



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


[Lldb-commits] [PATCH] D59158: Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

2019-03-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: zturner, labath, davide.
Herald added a project: LLDB.

Inspired by Zachary's mail on lldb-dev, this seemed like low hanging fruit. 
This patch breaks the circular dependency between commands and expression.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59158

Files:
  lldb/include/lldb/Commands/CommandObjectApropos.h
  lldb/include/lldb/Commands/CommandObjectBreakpoint.h
  lldb/include/lldb/Commands/CommandObjectBreakpointCommand.h
  lldb/include/lldb/Commands/CommandObjectBugreport.h
  lldb/include/lldb/Commands/CommandObjectCommands.h
  lldb/include/lldb/Commands/CommandObjectDisassemble.h
  lldb/include/lldb/Commands/CommandObjectExpression.h
  lldb/include/lldb/Commands/CommandObjectFrame.h
  lldb/include/lldb/Commands/CommandObjectGUI.h
  lldb/include/lldb/Commands/CommandObjectHelp.h
  lldb/include/lldb/Commands/CommandObjectLanguage.h
  lldb/include/lldb/Commands/CommandObjectLog.h
  lldb/include/lldb/Commands/CommandObjectMemory.h
  lldb/include/lldb/Commands/CommandObjectPlatform.h
  lldb/include/lldb/Commands/CommandObjectPlugin.h
  lldb/include/lldb/Commands/CommandObjectProcess.h
  lldb/include/lldb/Commands/CommandObjectQuit.h
  lldb/include/lldb/Commands/CommandObjectRegister.h
  lldb/include/lldb/Commands/CommandObjectReproducer.h
  lldb/include/lldb/Commands/CommandObjectSettings.h
  lldb/include/lldb/Commands/CommandObjectSource.h
  lldb/include/lldb/Commands/CommandObjectStats.h
  lldb/include/lldb/Commands/CommandObjectTarget.h
  lldb/include/lldb/Commands/CommandObjectThread.h
  lldb/include/lldb/Commands/CommandObjectType.h
  lldb/include/lldb/Commands/CommandObjectVersion.h
  lldb/include/lldb/Commands/CommandObjectWatchpoint.h
  lldb/include/lldb/Commands/CommandObjectWatchpointCommand.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/API/SBTarget.cpp
  lldb/source/Commands/CommandObjectApropos.cpp
  lldb/source/Commands/CommandObjectApropos.h
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectBreakpoint.h
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.h
  lldb/source/Commands/CommandObjectBugreport.cpp
  lldb/source/Commands/CommandObjectBugreport.h
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectCommands.h
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectExpression.h
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectFrame.h
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectGUI.h
  lldb/source/Commands/CommandObjectHelp.cpp
  lldb/source/Commands/CommandObjectHelp.h
  lldb/source/Commands/CommandObjectLanguage.cpp
  lldb/source/Commands/CommandObjectLanguage.h
  lldb/source/Commands/CommandObjectLog.cpp
  lldb/source/Commands/CommandObjectLog.h
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectMemory.h
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Commands/CommandObjectPlatform.h
  lldb/source/Commands/CommandObjectPlugin.cpp
  lldb/source/Commands/CommandObjectPlugin.h
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectProcess.h
  lldb/source/Commands/CommandObjectQuit.cpp
  lldb/source/Commands/CommandObjectQuit.h
  lldb/source/Commands/CommandObjectRegister.cpp
  lldb/source/Commands/CommandObjectRegister.h
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.h
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Commands/CommandObjectSettings.h
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectSource.h
  lldb/source/Commands/CommandObjectStats.cpp
  lldb/source/Commands/CommandObjectStats.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectTarget.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectThread.h
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectType.h
  lldb/source/Commands/CommandObjectVersion.cpp
  lldb/source/Commands/CommandObjectVersion.h
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpoint.h
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.h
  lldb/source/Expression/REPL.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -14,32 +14,32 @@
 #include "CommandObjectScript.h"
 #include "lldb/Interpreter/CommandObjectRegexCommand.h"
 
-#include "Commands/CommandO

[Lldb-commits] [lldb] r355736 - [lldb] [Process] Add proper support for NetBSD core files with threads

2019-03-08 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Mar  8 13:10:43 2019
New Revision: 355736

URL: http://llvm.org/viewvc/llvm-project?rev=355736&view=rev
Log:
[lldb] [Process] Add proper support for NetBSD core files with threads

Improve the support for processing NetBSD cores.  Fix reading process
identifier, thread information and associating the terminating signal
with the correct thread.

Includes test cases for single-threaded program receiving SIGSEGV,
and two dual-threaded programs: one where thread receives the signal,
and the other one when the whole process is signalled.

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64.core
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64.core
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.c

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.amd64
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.amd64.core
   (with props)

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/GNUmakefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
Modified:
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64?rev=355736&view=auto
==
Binary file - no diff available.

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64
--
svn:executable = *

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64
--
svn:mime-type = application/x-executable

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64.core
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64.core?rev=355736&view=auto
==
Binary file - no diff available.

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64.core
--
svn:mime-type = application/x-coredump

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c?rev=355736&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c
 Fri Mar  8 13:10:43 2019
@@ -0,0 +1,14 @@
+static void bar(char *boom) {
+  char F = 'b';
+  *boom = 47; // Frame bar
+}
+
+static void foo(char *boom, void (*boomer)(char *)) {
+  char F = 'f';
+  boomer(boom); // Frame foo
+}
+
+void main(void) {
+  char F = 'm';
+  foo(0, bar); // Frame main
+}

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64?rev=355736&view=auto
==
Binary file - no diff available.

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64
-

[Lldb-commits] [PATCH] D32149: [lldb] [Process] Add proper support for NetBSD core files with threads

2019-03-08 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355736: [lldb] [Process] Add proper support for NetBSD core 
files with threads (authored by mgorny, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D32149?vs=189658&id=189911#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D32149

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.amd64.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/1lwp_SIGSEGV.c
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.amd64.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_process_SIGSEGV.c
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.amd64
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.amd64.core
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/GNUmakefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
  lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c
@@ -0,0 +1,30 @@
+#include 
+#include 
+#include 
+
+static void bar(char *boom) {
+  char F = 'b';
+  *boom = 47; // Frame bar
+}
+
+static void foo(char *boom, void (*boomer)(char *)) {
+  char F = 'f';
+  boomer(boom); // Frame foo
+}
+
+void lwp_main(void *unused) {
+  char F = 'l';
+  foo(0, bar); // Frame lwp_main
+}
+
+int main(int argc, char **argv) {
+  ucontext_t uc;
+  lwpid_t lid;
+  static const size_t ssize = 16 * 1024;
+  void *stack;
+
+  stack = malloc(ssize);
+  _lwp_makecontext(&uc, lwp_main, NULL, NULL, stack, ssize);
+  _lwp_create(&uc, 0, &lid);
+  _lwp_wait(lid, NULL);
+}
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
@@ -0,0 +1,225 @@
+"""
+Test NetBSD core file debugging.
+"""
+
+from __future__ import division, print_function
+
+import shutil
+import signal
+import struct
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class NetBSDCoreCommonTestCase(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+super(NetBSDCoreCommonTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(NetBSDCoreCommonTestCase, self).tearDown()
+
+def check_memory_regions(self, process, region_count):
+region_list = process.GetMemoryRegions()
+self.assertEqual(region_list.GetSize(), region_count)
+
+region = lldb.SBMemoryRegionInfo()
+
+# Check we have the right number of regions.
+self.assertEqual(region_list.GetSize(), region_count)
+
+# Check that getting a region beyond the last in the list fails.
+self.assertFalse(
+region_list.GetMemoryRegionAtIndex(
+region_count, region))
+
+# Check each region is valid.
+for i in range(region_list.GetSize()):
+# Check we can actually get this region.
+self.assertTrue(region_list.GetMemoryRegionAtIndex(i, region))
+
+# Every region in the list should be mapped.
+self.assertTrue(region.IsMapped())
+
+# Test the address at the start of a region returns it's enclosing
+# region.
+begin_address = region.GetRegionBase()
+region_at_begin = lldb.SBMemoryRegionInfo()
+error = process.GetMemoryRegionInfo(begin_address, region_at_begin)
+self.assertEqual(region, region

[Lldb-commits] [lldb] r355730 - Remove dependency edges from Host to Target/Core.

2019-03-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Mar  8 12:56:10 2019
New Revision: 355730

URL: http://llvm.org/viewvc/llvm-project?rev=355730&view=rev
Log:
Remove dependency edges from Host to Target/Core.

After recent changes, Host is now dependency-free.

Modified:
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/unittests/Host/CMakeLists.txt

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=355730&r1=355729&r2=355730&view=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Fri Mar  8 12:56:10 2019
@@ -162,7 +162,6 @@ add_lldb_library(lldbHost
   ${HOST_SOURCES}
 
   LINK_LIBS
-lldbTarget
 lldbUtility
 ${EXTRA_LIBS}
 ${LLDBObjCLibs}

Modified: lldb/trunk/unittests/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=355730&r1=355729&r2=355730&view=diff
==
--- lldb/trunk/unittests/Host/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Host/CMakeLists.txt Fri Mar  8 12:56:10 2019
@@ -21,7 +21,6 @@ endif()
 add_lldb_unittest(HostTests
   ${FILES}
   LINK_LIBS
-lldbCore
 lldbHost
 lldbUtilityHelpers
 LLVMTestingSupport


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


[Lldb-commits] [PATCH] D32149: [lldb] [Process] Add proper support for NetBSD core files with threads

2019-03-08 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.

The code looks good, though I think we should really start figuring out how to 
write elf core tests without checking in binaries.


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

https://reviews.llvm.org/D32149



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


[Lldb-commits] [PATCH] D58930: Add XCOFF triple object format type for AIX

2019-03-08 Thread Hubert Tong via Phabricator via lldb-commits
hubert.reinterpretcast added a comment.

@jasonliu, you have had a number of patches committed into the project already 
(D22698 , D22702 
, D34649 ). 
Please go ahead with requesting commit access, and commit this patch with the 
additional fix when you are ready.




Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:806
+Env = IsXCOFF;
+// TODO: Initialize MCObjectFileInfo for XCOFF format when MCSectionXCOFF 
is ready.
+break;

This line is over 80 characters.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58930



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


[Lldb-commits] [lldb] r355711 - [Reproducers] Add missing LLDB_RECORD_DUMMY macros

2019-03-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Mar  8 11:09:27 2019
New Revision: 355711

URL: http://llvm.org/viewvc/llvm-project?rev=355711&view=rev
Log:
[Reproducers] Add missing LLDB_RECORD_DUMMY macros

Re-ran lldb-inst on the API folder to insert missing LLDB_RECORD_DUMMY
macros.

Modified:
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointName.cpp
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/API/SBCommunication.cpp
lldb/trunk/source/API/SBData.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBExpressionOptions.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBTrace.cpp
lldb/trunk/source/API/SBTypeSummary.cpp

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=355711&r1=355710&r2=355711&view=diff
==
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Fri Mar  8 11:09:27 2019
@@ -21,12 +21,12 @@ public:
   SBInputReader() = default;
   ~SBInputReader() = default;
 
-  SBError Initialize(lldb::SBDebugger &,
- unsigned long (*)(void *, lldb::SBInputReader *,
-   lldb::InputReaderAction, char const *,
-   unsigned long),
- void *, lldb::InputReaderGranularity, char const *,
- char const *, bool);
+  SBError Initialize(lldb::SBDebugger &sb_debugger,
+ unsigned long (*callback)(void *, lldb::SBInputReader *,
+   lldb::InputReaderAction,
+   char const *, unsigned long),
+ void *a, lldb::InputReaderGranularity b, char const *c,
+ char const *d, bool e);
   void SetIsDone(bool);
   bool IsActive() const;
 };

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=355711&r1=355710&r2=355711&view=diff
==
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Fri Mar  8 11:09:27 2019
@@ -569,9 +569,10 @@ SBError SBBreakpoint::AddLocation(SBAddr
   return LLDB_RECORD_RESULT(error);
 }
 
-void SBBreakpoint
-  ::SetCallback(SBBreakpointHitCallback callback,
-  void *baton) {
+void SBBreakpoint ::SetCallback(SBBreakpointHitCallback callback, void *baton) 
{
+  LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback,
+(lldb::SBBreakpointHitCallback, void *), callback, baton);
+
   BreakpointSP bkpt_sp = GetSP();
 
   if (bkpt_sp) {

Modified: lldb/trunk/source/API/SBBreakpointName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointName.cpp?rev=355711&r1=355710&r2=355711&view=diff
==
--- lldb/trunk/source/API/SBBreakpointName.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointName.cpp Fri Mar  8 11:09:27 2019
@@ -543,6 +543,9 @@ bool SBBreakpointName::GetDescription(SB
 
 void SBBreakpointName::SetCallback(SBBreakpointHitCallback callback,
void *baton) {
+  LLDB_RECORD_DUMMY(void, SBBreakpointName, SetCallback,
+(lldb::SBBreakpointHitCallback, void *), callback, baton);
+
   BreakpointName *bp_name = GetBreakpointName();
   if (!bp_name)
 return;

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=355711&r1=355710&r2=355711&view=diff
==
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Mar  8 11:09:27 2019
@@ -611,6 +611,10 @@ bool SBCommandInterpreter::EventIsComman
 bool SBCommandInterpreter::SetCommandOverrideCallback(
 const char *command_name, lldb::CommandOverrideCallback callback,
 void *baton) {
+  LLDB_RECORD_DUMMY(bool, SBCommandInterpreter, SetCommandOverrideCallback,
+(const char *, lldb::CommandOverrideCallback, void *),
+command_name, callback, baton);
+
   if (command_name && command_name[0] && IsValid()) {
 llvm::StringRef command_name_str = command_name;
 CommandObject *cmd_obj =

Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=355711&r1=355710&r2=355711&view=diff
==
--- lldb/trunk/source/API/SBCommunication.cpp (

[Lldb-commits] [lldb] r355710 - [lldb-instr] Support LLDB_RECORD_DUMMY

2019-03-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Mar  8 10:33:40 2019
New Revision: 355710

URL: http://llvm.org/viewvc/llvm-project?rev=355710&view=rev
Log:
[lldb-instr] Support LLDB_RECORD_DUMMY

Extend lldb-instr to insert LLDB_RECORD_DUMMY macros for currently
unsupported signatures (void and function pointers).

Modified:
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
lldb/trunk/tools/lldb-instr/Instrument.cpp

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp?rev=355710&r1=355709&r2=355710&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp Fri Mar  8 10:33:40 2019
@@ -15,3 +15,4 @@ void Foo::G(const char *fmt...) {}
 Foo Foo::H() { return Foo(); }
 void Foo::I() const { MACRO_FOO; }
 Bar Foo::J() const { return MACRO_BAR(Bar()); }
+Bar Foo::K(void *v) const { return Bar(); }

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h?rev=355710&r1=355709&r2=355710&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h Fri Mar  8 10:33:40 2019
@@ -13,4 +13,5 @@ struct Foo {
   static Foo H();
   void I() const;
   Bar J() const;
+  Bar K(void *v) const;
 };

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test?rev=355710&r1=355709&r2=355710&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test Fri Mar  8 
10:33:40 2019
@@ -18,3 +18,5 @@
 # CHECK-NOT: LLDB_RECORD_METHOD_CONST_NO_ARGS(void, Foo, I);
 # CHECK: LLDB_RECORD_METHOD_CONST_NO_ARGS(Bar, Foo, J);
 # CHECK-NOT: LLDB_RECORD_RESULT(Bar());
+# CHECK: LLDB_RECORD_DUMMY(Bar, Foo, K, (void *), v);
+# CHECK-NOT: LLDB_RECORD_RESULT(Bar());

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test?rev=355710&r1=355709&r2=355710&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test Fri Mar  8 
10:33:40 2019
@@ -13,4 +13,5 @@
 # CHECK: LLDB_REGISTER_STATIC_METHOD(int, Foo, F, (int));
 # CHECK-NOT: LLDB_REGISTER_STATIC_METHOD(void, Foo, G
 # CHECK-NOT: LLDB_REGISTER_METHOD_CONST(void, Foo, I, ());
+# CHECK-NOT: LLDB_REGISTER_METHOD_CONST(Bar, Foo, K, (void*));
 # CHECK: }

Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=355710&r1=355709&r2=355710&view=diff
==
--- lldb/trunk/tools/lldb-instr/Instrument.cpp (original)
+++ lldb/trunk/tools/lldb-instr/Instrument.cpp Fri Mar  8 10:33:40 2019
@@ -100,6 +100,19 @@ static std::string GetRecordConstructorM
   return OS.str();
 }
 
+static std::string GetRecordDummyMacro(StringRef Result, StringRef Class,
+   StringRef Method, StringRef Signature,
+   StringRef Values) {
+  assert(!Values.empty());
+  std::string Macro;
+  llvm::raw_string_ostream OS(Macro);
+
+  OS << "LLDB_RECORD_DUMMY(" << Result << ", " << Class << ", " << Method;
+  OS << ", (" << Signature << "), " << Values << ");\n\n";
+
+  return OS.str();
+}
+
 static std::string GetRegisterConstructorMacro(StringRef Class,
StringRef Signature) {
   std::string Macro;
@@ -170,24 +183,21 @@ public:
 PrintingPolicy Policy(Context.getLangOpts());
 Policy.Bool = true;
 
+// Unsupported signatures get a dummy macro.
+bool ShouldInsertDummy = false;
+
 // Collect the functions parameter types and names.
 std::vector ParamTypes;
 std::vector ParamNames;
 for (auto *P : Decl->parameters()) {
   QualType T = P->getType();
-
-  // Currently we don't support functions that have function pointers as an
-  // argument.
-  if (T->isFunctionPointerType())
-return false;
-
-  // Currently we don't support functions that have void pointers as an
-  // argument.
-  if (T->isVoidPointerT

[Lldb-commits] [lldb] r355709 - [Reproducers] Add LLDB_RECORD_DUMMY

2019-03-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Mar  8 09:50:27 2019
New Revision: 355709

URL: http://llvm.org/viewvc/llvm-project?rev=355709&view=rev
Log:
[Reproducers] Add LLDB_RECORD_DUMMY

Add a macro that doesn't actually record anything but still toggles the
API boundary. Removing just the register macros for lldb::thread_t
wasn't sufficient on NetBSD because the serialization logic needed the
underlying type to be complete.

This macro should be used by functions that are currently unsupported,
as they might trip the API boundary logic. This should be easy using the
lldb-instr tool.

Modified:
lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
lldb/trunk/source/API/SBHostOS.cpp

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=355709&r1=355708&r2=355709&view=diff
==
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Fri Mar  8 
09:50:27 2019
@@ -185,6 +185,14 @@ template  inline std::st
 #define LLDB_RECORD_RESULT(Result) 
\
   sb_recorder ? sb_recorder->RecordResult(Result) : Result;
 
+/// The LLDB_RECORD_DUMMY macro is special because it doesn't actually record
+/// anything. It's used to track API boundaries when we cannot record for
+/// technical reasons.
+#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...)   
\
+  LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "{0} ({1})", 
\
+   LLVM_PRETTY_FUNCTION, log_args(__VA_ARGS__));   
\
+  llvm::Optional sb_recorder;
+
 namespace lldb_private {
 namespace repro {
 

Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=355709&r1=355708&r2=355709&view=diff
==
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Fri Mar  8 09:50:27 2019
@@ -108,6 +108,9 @@ SBFileSpec SBHostOS::GetUserHomeDirector
 lldb::thread_t SBHostOS::ThreadCreate(const char *name,
   lldb::thread_func_t thread_function,
   void *thread_arg, SBError *error_ptr) {
+  LLDB_RECORD_DUMMY(lldb::thread_t, SBHostOS, ThreadCreate,
+(lldb::thread_func_t, void *, SBError *), name,
+thread_function, thread_arg, error_ptr);
   HostThread thread(ThreadLauncher::LaunchThread(
   name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL));
   return thread.Release();
@@ -119,7 +122,7 @@ void SBHostOS::ThreadCreated(const char
 }
 
 bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(bool, SBHostOS, ThreadCancel,
+  LLDB_RECORD_DUMMY(bool, SBHostOS, ThreadCancel,
 (lldb::thread_t, lldb::SBError *), thread,
 error_ptr);
 
@@ -133,7 +136,7 @@ bool SBHostOS::ThreadCancel(lldb::thread
 }
 
 bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(bool, SBHostOS, ThreadDetach,
+  LLDB_RECORD_DUMMY(bool, SBHostOS, ThreadDetach,
 (lldb::thread_t, lldb::SBError *), thread,
 error_ptr);
 
@@ -153,7 +156,7 @@ bool SBHostOS::ThreadDetach(lldb::thread
 
 bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
   SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(
+  LLDB_RECORD_DUMMY(
   bool, SBHostOS, ThreadJoin,
   (lldb::thread_t, lldb::thread_result_t *, lldb::SBError *), thread,
   result, error_ptr);


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


[Lldb-commits] [lldb] r355708 - [lldb-vscode] Fix warning

2019-03-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Mar  8 09:36:54 2019
New Revision: 355708

URL: http://llvm.org/viewvc/llvm-project?rev=355708&view=rev
Log:
[lldb-vscode] Fix warning

I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.

Modified:
lldb/trunk/tools/lldb-vscode/IOStream.cpp

Modified: lldb/trunk/tools/lldb-vscode/IOStream.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/IOStream.cpp?rev=355708&r1=355707&r2=355708&view=diff
==
--- lldb/trunk/tools/lldb-vscode/IOStream.cpp (original)
+++ lldb/trunk/tools/lldb-vscode/IOStream.cpp Fri Mar  8 09:36:54 2019
@@ -95,7 +95,7 @@ bool InputStream::read_full(std::ofstrea
 
   char *ptr = &data[0];
   while (length != 0) {
-size_t bytes_read = 0;
+int bytes_read = 0;
 if (descriptor.m_is_socket)
   bytes_read = ::recv(descriptor.m_socket, ptr, length, 0);
 else
@@ -119,7 +119,7 @@ bool InputStream::read_full(std::ofstrea
   return false;
 }
 
-assert(bytes_read <= length);
+assert(bytes_read >= 0 && (size_t)bytes_read <= length);
 ptr += bytes_read;
 length -= bytes_read;
   }


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


[Lldb-commits] [lldb] r355706 - Add more logging to TestQueues.py

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 09:09:13 2019
New Revision: 355706

URL: http://llvm.org/viewvc/llvm-project?rev=355706&view=rev
Log:
Add more logging to TestQueues.py

The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355706&r1=355705&r2=355706&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 09:09:13 2019
@@ -65,8 +65,8 @@ class TestQueues(TestBase):
 location = "\t".join([lldbutil.get_description(
 x.GetFrameAtIndex(i)) for i in range(x.GetNumFrames())])
 desc.append(
-"thread %d: %s at\n\t%s" %
-(id, reason_str, location))
+"thread %d: %s (queue id: %s) at\n\t%s" %
+(id, reason_str, x.GetQueueID(), location))
 print('\n'.join(desc))
 
 def check_number_of_threads_owned_by_queue(self, queue, number_threads):
@@ -327,6 +327,8 @@ class TestQueues(TestBase):
 queue_performer_3 = lldb.SBQueue()
 for idx in range(0, process.GetNumQueues()):
 q = process.GetQueueAtIndex(idx)
+if "LLDB_COMMAND_TRACE" in os.environ:
+print("Queue  with id %s has name %s" % (q.GetQueueID(), 
q.GetName()))
 if q.GetName() == "com.apple.work_submittor_1":
 queue_submittor_1 = q
 if q.GetName() == "com.apple.work_performer_1":


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


[Lldb-commits] [PATCH] D58930: Add XCOFF triple object format type for AIX

2019-03-08 Thread Sean Fertile via Phabricator via lldb-commits
sfertile accepted this revision.
sfertile added a comment.

LGTM.




Comment at: llvm/lib/MC/MCContext.cpp:165
+case MCObjectFileInfo::IsXCOFF:
+  // TODO: Need to implement class MCSymbolXCOFF.
+  break;

jasonliu wrote:
> sfertile wrote:
> > jasonliu wrote:
> > > JDevlieghere wrote:
> > > > See previous comment.
> > > It is certain that we will need MCSymbolXCOFF. But before we run into 
> > > cases where we actually need a MCSymbolXCOFF, we could use the generic 
> > > MCSymbol first for XCOFF platform. So I don't want to put a 
> > > llvm_unreachable here. 
> > Would it make sense to add an llvm_unreachable now, and the first patch 
> > that actually uses an MCSymbol stubs out the class and removes the 
> > unreachable?
> The first patch that uses MCSymbol do not necessarily need to stub out 
> MCSymbolXCOFF, as MCSymbol seems to be generic and usable until we are doing 
> some XCOFF specific things that needs to be represented by MCSymbolXCOFF. If 
> the intention is MCSymbol should never get used, and different object file 
> should have their own MCSymbolXXX class from the start, then I could add in 
> the llvm_unreachable here, and I would also propose to replace the "return 
> new (Name, *this) MCSymbol(MCSymbol::SymbolKindUnset, Name, IsTemporary);" 
> with an llvm_unreachable as well. 
> 
Ok I think falling through to create the generic MCSymbol in this patch is 
reasonable. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58930



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


[Lldb-commits] [lldb] r355684 - Make function definition in header inline

2019-03-08 Thread Benjamin Kramer via lldb-commits
Author: d0k
Date: Fri Mar  8 02:43:56 2019
New Revision: 355684

URL: http://llvm.org/viewvc/llvm-project?rev=355684&view=rev
Log:
Make function definition in header inline

Otherwise including this header from more than one place will break
linking.

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

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=355684&r1=355683&r2=355684&view=diff
==
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Fri Mar  8 
02:43:56 2019
@@ -22,40 +22,40 @@
 
 template ::value, int>::type = 
0>
-void log_append(llvm::raw_string_ostream &ss, const T &t) {
+inline void log_append(llvm::raw_string_ostream &ss, const T &t) {
   ss << t;
 }
 
 template ::value,
   int>::type = 0>
-void log_append(llvm::raw_string_ostream &ss, const T &t) {
+inline void log_append(llvm::raw_string_ostream &ss, const T &t) {
   ss << &t;
 }
 
 template 
-void log_append(llvm::raw_string_ostream &ss, const T *t) {
+inline void log_append(llvm::raw_string_ostream &ss, const T *t) {
   ss << t;
 }
 
-inline template <>
-void log_append(llvm::raw_string_ostream &ss, const char *t) {
+template <>
+inline void log_append(llvm::raw_string_ostream &ss, const char *t) {
   ss << t;
 }
 
 template 
-void log_helper(llvm::raw_string_ostream &ss, const Head &head) {
+inline void log_helper(llvm::raw_string_ostream &ss, const Head &head) {
   log_append(ss, head);
 }
 
 template 
-void log_helper(llvm::raw_string_ostream &ss, const Head &head,
-const Tail &... tail) {
+inline void log_helper(llvm::raw_string_ostream &ss, const Head &head,
+   const Tail &... tail) {
   log_append(ss, head);
   ss << ", ";
   log_helper(ss, tail...);
 }
 
-template  std::string log_args(const Ts &... ts) {
+template  inline std::string log_args(const Ts &... ts) {
   std::string buffer;
   llvm::raw_string_ostream ss(buffer);
   log_helper(ss, ts...);


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


[Lldb-commits] [PATCH] D59114: [lldb-vscode] Don't hang indefinitely on invalid program

2019-03-08 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

A test case?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59114



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