[Lldb-commits] [PATCH] D87389: [flang][openacc] Lower clauses on loop construct to OpenACC dialect

2020-09-10 Thread Valentin Clement via Phabricator via lldb-commits
clementval updated this revision to Diff 290770.
clementval added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Remove unrelated changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87389

Files:
  flang/include/flang/Optimizer/Dialect/FIRDialect.h
  flang/lib/Lower/OpenACC.cpp

Index: flang/lib/Lower/OpenACC.cpp
===
--- flang/lib/Lower/OpenACC.cpp
+++ flang/lib/Lower/OpenACC.cpp
@@ -11,16 +11,202 @@
 //===--===//
 
 #include "flang/Lower/OpenACC.h"
+#include "flang/Common/idioms.h"
 #include "flang/Lower/Bridge.h"
 #include "flang/Lower/FIRBuilder.h"
 #include "flang/Lower/PFTBuilder.h"
 #include "flang/Parser/parse-tree.h"
+#include "flang/Semantics/tools.h"
+#include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "llvm/Frontend/OpenACC/ACC.h.inc"
 
 #define TODO() llvm_unreachable("not yet implemented")
 
+static const Fortran::parser::Name *
+GetDesignatorNameIfDataRef(const Fortran::parser::Designator &designator) {
+  const auto *dataRef{std::get_if(&designator.u)};
+  return dataRef ? std::get_if(&dataRef->u) : nullptr;
+}
+
+static void genObjectList(const Fortran::parser::AccObjectList &objectList,
+  Fortran::lower::AbstractConverter &converter,
+  std::int32_t &objectsCount,
+  SmallVector &operands) {
+  for (const auto &accObject : objectList.v) {
+std::visit(
+Fortran::common::visitors{
+[&](const Fortran::parser::Designator &designator) {
+  if (const auto *name = GetDesignatorNameIfDataRef(designator)) {
+++objectsCount;
+const auto variable = converter.getSymbolAddress(*name->symbol);
+operands.push_back(variable);
+  }
+},
+[&](const Fortran::parser::Name &name) {
+  ++objectsCount;
+  const auto variable = converter.getSymbolAddress(*name.symbol);
+  operands.push_back(variable);
+}},
+accObject.u);
+  }
+}
+
+static void genACC(Fortran::lower::AbstractConverter &converter,
+   Fortran::lower::pft::Evaluation &eval,
+   const Fortran::parser::OpenACCLoopConstruct &loopConstruct) {
+
+  const auto &beginLoopDirective =
+  std::get(loopConstruct.t);
+  const auto &loopDirective =
+  std::get(beginLoopDirective.t);
+
+  if (loopDirective.v == llvm::acc::ACCD_loop) {
+auto &firOpBuilder = converter.getFirOpBuilder();
+auto currentLocation = converter.getCurrentLocation();
+llvm::ArrayRef argTy;
+
+// Add attribute extracted from clauses.
+const auto &accClauseList =
+std::get(beginLoopDirective.t);
+
+mlir::Value workerNum;
+mlir::Value vectorLength;
+mlir::Value gangNum;
+mlir::Value gangStatic;
+std::int32_t tileOperands = 0;
+std::int32_t privateOperands = 0;
+std::int32_t reductionOperands = 0;
+std::int64_t executionMapping = mlir::acc::OpenACCExecMapping::NONE;
+SmallVector operands;
+
+// Lower clauses values mapped to operands.
+for (const auto &clause : accClauseList.v) {
+  if (const auto *gangClause =
+  std::get_if(&clause.u)) {
+if (gangClause->v) {
+  const Fortran::parser::AccGangArgument &x = *gangClause->v;
+  if (const auto &gangNumValue =
+  std::get>(
+  x.t)) {
+gangNum = converter.genExprValue(
+*Fortran::semantics::GetExpr(gangNumValue.value()));
+operands.push_back(gangNum);
+  }
+  if (const auto &gangStaticValue =
+  std::get>(x.t)) {
+const auto &expr =
+std::get>(
+gangStaticValue.value().t);
+if (expr) {
+  gangStatic =
+  converter.genExprValue(*Fortran::semantics::GetExpr(*expr));
+} else {
+  // * was passed as value and will be represented as a -1 constant
+  // integer.
+  gangStatic = firOpBuilder.createIntegerConstant(
+  currentLocation, firOpBuilder.getIntegerType(32),
+  /* STAR */ -1);
+}
+operands.push_back(gangStatic);
+  }
+}
+executionMapping |= mlir::acc::OpenACCExecMapping::GANG;
+  } else if (const auto *workerClause =
+ std::get_if(
+ &clause.u)) {
+if (workerClause->v) {
+  workerNum = converter.genExprValue(
+  *Fortran::semantics::GetExpr(*workerClause->v));
+  operands.push_back(workerNum);
+}
+executionMapping |= mlir::acc::OpenACCExecMapping::WORKER;
+  } else if (const auto *ve

[Lldb-commits] [PATCH] D87441: Speedup collecting DWARF attribute values

2020-09-10 Thread Dmitry Antipov via Phabricator via lldb-commits
dmantipov created this revision.
dmantipov added reviewers: labath, jankratochvil.
dmantipov added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, aprantl.
dmantipov requested review of this revision.

Try to speedup collecting DWARF attribute values by using emplace_back() to 
avoid extra calls to copy and/or move constructors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87441

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


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -53,7 +53,9 @@
   ~DWARFAttributes();
 
   void Append(const DWARFUnit *cu, dw_offset_t attr_die_offset,
-  dw_attr_t attr, dw_form_t form);
+  dw_attr_t attr, dw_form_t form) {
+m_infos.emplace_back(cu, attr_die_offset, attr, form);
+  }
   const DWARFUnit *CompileUnitAtIndex(uint32_t i) const {
 return m_infos[i].cu;
   }
@@ -77,6 +79,12 @@
 // case we have DW_FORM_ref_addr values
 dw_offset_t die_offset;
 DWARFAttribute attr;
+
+AttributeValue(const DWARFUnit *_cu, dw_offset_t _die_offset,
+   dw_attr_t _attr, dw_form_t _form)
+  : cu(_cu), die_offset(_die_offset),
+attr(_attr, _form, DWARFFormValue::ValueType()) {
+}
   };
   typedef llvm::SmallVector collection;
   collection m_infos;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -25,13 +25,6 @@
   return UINT32_MAX;
 }
 
-void DWARFAttributes::Append(const DWARFUnit *cu, dw_offset_t attr_die_offset,
- dw_attr_t attr, dw_form_t form) {
-  AttributeValue attr_value = {
-  cu, attr_die_offset, {attr, form, DWARFFormValue::ValueType()}};
-  m_infos.push_back(attr_value);
-}
-
 bool DWARFAttributes::ExtractFormValueAtIndex(
 uint32_t i, DWARFFormValue &form_value) const {
   const DWARFUnit *cu = CompileUnitAtIndex(i);


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -53,7 +53,9 @@
   ~DWARFAttributes();
 
   void Append(const DWARFUnit *cu, dw_offset_t attr_die_offset,
-  dw_attr_t attr, dw_form_t form);
+  dw_attr_t attr, dw_form_t form) {
+m_infos.emplace_back(cu, attr_die_offset, attr, form);
+  }
   const DWARFUnit *CompileUnitAtIndex(uint32_t i) const {
 return m_infos[i].cu;
   }
@@ -77,6 +79,12 @@
 // case we have DW_FORM_ref_addr values
 dw_offset_t die_offset;
 DWARFAttribute attr;
+
+AttributeValue(const DWARFUnit *_cu, dw_offset_t _die_offset,
+   dw_attr_t _attr, dw_form_t _form)
+  : cu(_cu), die_offset(_die_offset),
+attr(_attr, _form, DWARFFormValue::ValueType()) {
+}
   };
   typedef llvm::SmallVector collection;
   collection m_infos;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -25,13 +25,6 @@
   return UINT32_MAX;
 }
 
-void DWARFAttributes::Append(const DWARFUnit *cu, dw_offset_t attr_die_offset,
- dw_attr_t attr, dw_form_t form) {
-  AttributeValue attr_value = {
-  cu, attr_die_offset, {attr, form, DWARFFormValue::ValueType()}};
-  m_infos.push_back(attr_value);
-}
-
 bool DWARFAttributes::ExtractFormValueAtIndex(
 uint32_t i, DWARFFormValue &form_value) const {
   const DWARFUnit *cu = CompileUnitAtIndex(i);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D87442: [lldb] Show flags for memory regions

2020-09-10 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
DavidSpickett requested review of this revision.
Herald added a subscriber: JDevlieghere.

This extends the "memory region" command to
show flags such as those found in /proc/smaps
on Linux.

(lldb) memory region addr
[0x77ed3000-0x77fd3000) rw- /dev/zero (deleted)
flags: me mr ms mw rd sd sh wr

- Added an optional "flags" field to the qMemoryRegion packet
- "memory region" command will show flags where possible
- HasFlags and GetFlags added to Python API for memory regions
- Added testing for Linux proc maps parsing

Flags are represented as strings, space seperated when
together. This is done to account for differences
between OS naming. (versus inventing some generic
set of names)

For now we'll just show the information to the user.
Future HasSomeFlag() methods can check for spellings
based on platform.

Only Linux /proc/smaps parsing is supported in this initial
change. Targets that don't have or currently support this
information can leave out the field and it won't be shown
in the command output.
(API users can check HasFlags() for this)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87442

Files:
  lldb/bindings/interface/SBMemoryRegionInfo.i
  lldb/docs/lldb-gdb-remote.txt
  lldb/include/lldb/API/SBMemoryRegionInfo.h
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  lldb/source/API/SBMemoryRegionInfo.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Target/MemoryRegionInfo.cpp
  lldb/unittests/Process/CMakeLists.txt
  lldb/unittests/Process/Utility/CMakeLists.txt
  lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -378,15 +378,15 @@
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(
 MemoryRegionInfo({0x0, 0x1}, no, no, no, no,
- ConstString(), unknown, 0),
+ ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, yes,
- ConstString(), unknown, 0),
+ ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x4, 0x1000}, yes, no, no, yes,
- ConstString(), unknown, 0),
+ ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, yes,
- ConstString(), unknown, 0),
+ ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
- ConstString(), unknown, 0)),
+ ConstString(), unknown, 0, llvm::None)),
 true));
 }
 
@@ -411,9 +411,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(
 MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown,
- yes, ConstString(), unknown, 0),
+ yes, ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown,
- yes, ConstString(), unknown, 0)),
+ yes, ConstString(), unknown, 0, llvm::None)),
 false));
 }
 
@@ -426,9 +426,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(
 MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown,
- yes, ConstString(), unknown, 0),
+ yes, ConstString(), unknown, 0, llvm::None),
 MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown,
- yes, ConstString(), unknown, 0)),
+ yes, ConstString(), unknown, 0, llvm::None))

[Lldb-commits] [PATCH] D87442: [lldb] Show flags for memory regions

2020-09-10 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

This is in support of AArch64 memory tagging support as described here: 
http://lists.llvm.org/pipermail/lldb-dev/2020-August/016402.html
See "### Extending qMemoryRegion"

smaps format described here: https://man7.org/linux/man-pages/man5/proc.5.html
Support not added to minidumps, this would need doing in breakpad itself first 
(https://chromium.googlesource.com/breakpad/breakpad/+/refs/heads/master/src/google_breakpad/common/minidump_format.h#348).

General strategy is to keep the flags as strings so that we don't have to 
invent a new enum/bitfield value each time one is added. Plus we get to give 
some value by showing them all to the user without special support.

Later, I'll be adding a HasMemoryTagging() method to the region to use for 
memory tagging commands, something like:

  bool HasMemoryTagging() {
return m_flags && (m_flags->find("mt") != m_flags->end());
  }

If BSD/MacOS/Windows had a different naming you could either check for both (if 
not overlapping with anything else), or add a platform argument to decide what 
to look for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87442

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


[Lldb-commits] [PATCH] D87442: [lldb] Show flags for memory regions

2020-09-10 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: omjavaid.
DavidSpickett added a comment.

What isn't covered in testing is checking that "memory region" will not print 
"flags:" if there aren't any. This would need a way to make a fake lldbserver 
that didn't reply with the flags field, I could write tests that expect the 
"flags:" but then when you ran them on a different kernel they might fail. 
Perhaps there is a way to replay a gdb comms session to lldb instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87442

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


[Lldb-commits] [lldb] 52f4272 - [lldb] [netbsd] Avoid comparison of signed and unsigned integers

2020-09-10 Thread Kamil Rytarowski via lldb-commits

Author: Kamil Rytarowski
Date: 2020-09-10T15:49:15+02:00
New Revision: 52f42720b26a32c9dffc9331841415442f784700

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

LOG: [lldb] [netbsd] Avoid comparison of signed and unsigned integers

Cast ProcessID to ::pid_t.

Added: 


Modified: 
lldb/source/Host/netbsd/HostNetBSD.cpp

Removed: 




diff  --git a/lldb/source/Host/netbsd/HostNetBSD.cpp 
b/lldb/source/Host/netbsd/HostNetBSD.cpp
index 4708fb45deed..38e2aa5c1e05 100644
--- a/lldb/source/Host/netbsd/HostNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostNetBSD.cpp
@@ -220,7 +220,7 @@ uint32_t Host::FindProcessesImpl(const 
ProcessInstanceInfoMatch &match_info,
 if (proc_kinfo[i].p_nlwps > 1) {
   bool already_registered = false;
   for (size_t pi = 0; pi < process_infos.size(); pi++) {
-if (process_infos[pi].GetProcessID() == proc_kinfo[i].p_pid) {
+if ((::pid_t)process_infos[pi].GetProcessID() == proc_kinfo[i].p_pid) {
   already_registered = true;
   break;
 }



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


[Lldb-commits] [PATCH] D87466: [lldb, tests] Correctly configure the yaml2obj paths

2020-09-10 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova created this revision.
stella.stamenova added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
stella.stamenova requested review of this revision.

They are currently not being set correctly for the case of multi-config 
generators like XCode and VS. There's also a typo in one of the cmake files.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87466

Files:
  lldb/test/API/lit.site.cfg.py.in
  lldb/utils/lldb-dotest/CMakeLists.txt


Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -49,7 +49,7 @@
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED 
"${LLDB_TEST_COMPILER}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED 
"${LLDB_TEST_DSYMUTIL}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED 
"${LLDB_TEST_FILECHECK}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ_CONFIGURED}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED 
"${LLDB_LIBS_DIR}")
 endif()
 
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -58,6 +58,7 @@
 config.test_compiler = config.test_compiler % lit_config.params
 config.dsymutil = config.dsymutil % lit_config.params
 config.filecheck = config.filecheck % lit_config.params
+config.yaml2obj = config.yaml2obj % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args


Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -49,7 +49,7 @@
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ_CONFIGURED}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
 endif()
 
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -58,6 +58,7 @@
 config.test_compiler = config.test_compiler % lit_config.params
 config.dsymutil = config.dsymutil % lit_config.params
 config.filecheck = config.filecheck % lit_config.params
+config.yaml2obj = config.yaml2obj % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D87466: [lldb, tests] Correctly configure the yaml2obj paths

2020-09-10 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. This must've been broken for a while. I'll re-enable running the API 
tests on http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/ 
so we can catch this earlier.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87466

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


[Lldb-commits] [lldb] c464f1d - [lldb, tests] Correctly configure the yaml2obj paths

2020-09-10 Thread Stella Stamenova via lldb-commits

Author: Stella Stamenova
Date: 2020-09-10T10:10:28-07:00
New Revision: c464f1d8f9a04d7b4b6cc81eac0891c46aba5950

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

LOG: [lldb, tests] Correctly configure the yaml2obj paths

They are currently not being set correctly for the case of multi-config 
generators like XCode and VS. There's also a typo in one of the cmake files.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
lldb/test/API/lit.site.cfg.py.in
lldb/utils/lldb-dotest/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/API/lit.site.cfg.py.in 
b/lldb/test/API/lit.site.cfg.py.in
index 6554d05d7df9..f2e1f855fe39 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -58,6 +58,7 @@ try:
 config.test_compiler = config.test_compiler % lit_config.params
 config.dsymutil = config.dsymutil % lit_config.params
 config.filecheck = config.filecheck % lit_config.params
+config.yaml2obj = config.yaml2obj % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args

diff  --git a/lldb/utils/lldb-dotest/CMakeLists.txt 
b/lldb/utils/lldb-dotest/CMakeLists.txt
index 0ef60c142761..e5a73c2b1dec 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -49,7 +49,7 @@ if(LLDB_BUILT_STANDALONE)
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED 
"${LLDB_TEST_COMPILER}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED 
"${LLDB_TEST_DSYMUTIL}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED 
"${LLDB_TEST_FILECHECK}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ_CONFIGURED}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED 
"${LLDB_LIBS_DIR}")
 endif()
 



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


[Lldb-commits] [PATCH] D87466: [lldb, tests] Correctly configure the yaml2obj paths

2020-09-10 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc464f1d8f9a0: [lldb, tests] Correctly configure the yaml2obj 
paths (authored by stella.stamenova).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87466

Files:
  lldb/test/API/lit.site.cfg.py.in
  lldb/utils/lldb-dotest/CMakeLists.txt


Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -49,7 +49,7 @@
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED 
"${LLDB_TEST_COMPILER}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED 
"${LLDB_TEST_DSYMUTIL}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED 
"${LLDB_TEST_FILECHECK}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ_CONFIGURED}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED 
"${LLDB_TEST_YAML2OBJ}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED 
"${LLDB_LIBS_DIR}")
 endif()
 
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -58,6 +58,7 @@
 config.test_compiler = config.test_compiler % lit_config.params
 config.dsymutil = config.dsymutil % lit_config.params
 config.filecheck = config.filecheck % lit_config.params
+config.yaml2obj = config.yaml2obj % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args


Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -49,7 +49,7 @@
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ_CONFIGURED}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
   string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
 endif()
 
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -58,6 +58,7 @@
 config.test_compiler = config.test_compiler % lit_config.params
 config.dsymutil = config.dsymutil % lit_config.params
 config.filecheck = config.filecheck % lit_config.params
+config.yaml2obj = config.yaml2obj % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 6040d52 - [NFC] Fix whitespace in lldb-vscode --help

2020-09-10 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2020-09-10T10:57:23-07:00
New Revision: 6040d525507ba8a2593f0906259d012725b6aed2

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

LOG: [NFC] Fix whitespace in lldb-vscode --help

Added: 


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

Removed: 




diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 54f2e653d069..7d7d0f9ebe91 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2869,7 +2869,7 @@ const std::map 
&GetRequestHandlers() {
 } // anonymous namespace
 
 static void printHelp(LLDBVSCodeOptTable &table, llvm::StringRef tool_name) {
-  std::string usage_str = tool_name.str() + "options";
+  std::string usage_str = tool_name.str() + " options";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB VSCode", false);
 
   std::string examples = R"___(



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


[Lldb-commits] [lldb] bc0a35f - [lldb] Add missing LLDB_REGISTER_CONSTRUCTOR in SBPlatform

2020-09-10 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-09-10T18:50:02-07:00
New Revision: bc0a35f3b7dd45077d16b064c8d5c37e6a907d58

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

LOG: [lldb] Add missing LLDB_REGISTER_CONSTRUCTOR in SBPlatform

This fixes the following assertion in TestPlatformPython.py.

  Assertion failed: (id != 0 && "Forgot to add function to
  registry?")

Added: 


Modified: 
lldb/source/API/SBPlatform.cpp

Removed: 




diff  --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 3c6422e211fc..f118048156b9 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -93,8 +93,8 @@ SBPlatformConnectOptions::SBPlatformConnectOptions(
 
 SBPlatformConnectOptions::~SBPlatformConnectOptions() { delete m_opaque_ptr; }
 
-SBPlatformConnectOptions &SBPlatformConnectOptions::
-operator=(const SBPlatformConnectOptions &rhs) {
+SBPlatformConnectOptions &
+SBPlatformConnectOptions::operator=(const SBPlatformConnectOptions &rhs) {
   LLDB_RECORD_METHOD(
   SBPlatformConnectOptions &,
   SBPlatformConnectOptions, operator=,(
@@ -196,8 +196,8 @@ SBPlatformShellCommand::SBPlatformShellCommand(
   *m_opaque_ptr = *rhs.m_opaque_ptr;
 }
 
-SBPlatformShellCommand &SBPlatformShellCommand::
-operator=(const SBPlatformShellCommand &rhs) {
+SBPlatformShellCommand &
+SBPlatformShellCommand::operator=(const SBPlatformShellCommand &rhs) {
 
   LLDB_RECORD_METHOD(
   SBPlatformShellCommand &,
@@ -581,25 +581,25 @@ SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec 
&dst) {
 SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) {
   LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Run,
  (lldb::SBPlatformShellCommand &), shell_command);
-  return LLDB_RECORD_RESULT(ExecuteConnected([&](const lldb::PlatformSP
- &platform_sp) {
-const char *command = shell_command.GetCommand();
-if (!command)
-  return Status("invalid shell command (empty)");
-
-const char *working_dir = shell_command.GetWorkingDirectory();
-if (working_dir == nullptr) {
-  working_dir = platform_sp->GetWorkingDirectory().GetCString();
-  if (working_dir)
-shell_command.SetWorkingDirectory(working_dir);
-}
-return platform_sp->RunShellCommand(shell_command.m_opaque_ptr->m_shell,
-command, FileSpec(working_dir),
-&shell_command.m_opaque_ptr->m_status,
-&shell_command.m_opaque_ptr->m_signo,
-&shell_command.m_opaque_ptr->m_output,
-shell_command.m_opaque_ptr->m_timeout);
-  }));
+  return LLDB_RECORD_RESULT(
+  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
+const char *command = shell_command.GetCommand();
+if (!command)
+  return Status("invalid shell command (empty)");
+
+const char *working_dir = shell_command.GetWorkingDirectory();
+if (working_dir == nullptr) {
+  working_dir = platform_sp->GetWorkingDirectory().GetCString();
+  if (working_dir)
+shell_command.SetWorkingDirectory(working_dir);
+}
+return platform_sp->RunShellCommand(
+shell_command.m_opaque_ptr->m_shell, command, 
FileSpec(working_dir),
+&shell_command.m_opaque_ptr->m_status,
+&shell_command.m_opaque_ptr->m_signo,
+&shell_command.m_opaque_ptr->m_output,
+shell_command.m_opaque_ptr->m_timeout);
+  }));
 }
 
 SBError SBPlatform::Launch(SBLaunchInfo &launch_info) {
@@ -705,8 +705,7 @@ SBEnvironment SBPlatform::GetEnvironment() {
 namespace lldb_private {
 namespace repro {
 
-template <>
-void RegisterMethods(Registry &R) {
+template <> void RegisterMethods(Registry &R) {
   LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions, (const char *));
   LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions,
 (const lldb::SBPlatformConnectOptions &));
@@ -715,8 +714,7 @@ void RegisterMethods(Registry &R) 
{
   SBPlatformConnectOptions, operator=,(
 const lldb::SBPlatformConnectOptions &));
   LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions, GetURL, ());
-  LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetURL,
-   (const char *));
+  LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetURL, (const char *));
   LLDB_REGISTER_METHOD(bool, SBPlatformConnectOptions, GetRsyncEnabled, ());
   LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, EnableRsync,
(const char *, const char *, bool));
@@ -727,8 +725,7 @@ vo

[Lldb-commits] [PATCH] D87491: [lldb/API] Add Breakpoint::SerializeToStructuredData to SBAPI

2020-09-10 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added reviewers: jingham, kastiglione, teemperor.
mib added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere.
mib requested review of this revision.

This patch adds a way to get fetch breakpoint metadatas as a serialized
Structured Data (JSON). This can be used by IDEs to update their UI when
a breakpoint is set or modified from the console.

rdar://11013798

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87491

Files:
  lldb/bindings/interface/SBBreakpoint.i
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/source/API/SBBreakpoint.cpp
  
lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py

Index: lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
===
--- lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -3,6 +3,7 @@
 """
 
 import os
+import json
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -56,6 +57,35 @@
 self.setup_targets_and_cleanup()
 self.do_check_extra_args()
 
+def test_structured_data_serialization(self):
+target = self.dbg.GetDummyTarget()
+self.assertTrue(target.IsValid(), VALID_TARGET)
+
+interpreter = self.dbg.GetCommandInterpreter()
+result = lldb.SBCommandReturnObject()
+interpreter.HandleCommand("br set -f foo -l 42", result)
+result = lldb.SBCommandReturnObject()
+interpreter.HandleCommand("br set -c 'argc == 1' -n main", result)
+
+bkp1 =  target.GetBreakpointAtIndex(0)
+self.assertTrue(bkp1.IsValid(), VALID_BREAKPOINT)
+stream = lldb.SBStream()
+sd = bkp1.SerializeToStructuredData()
+sd.GetAsJSON(stream)
+serialized_data = json.loads(stream.GetData())
+self.assertEqual(serialized_data["Breakpoint"]["BKPTResolver"]["Options"]["FileName"], "foo")
+self.assertEqual(serialized_data["Breakpoint"]["BKPTResolver"]["Options"]["LineNumber"], 42)
+
+bkp2 =  target.GetBreakpointAtIndex(1)
+self.assertTrue(bkp2.IsValid(), VALID_BREAKPOINT)
+stream = lldb.SBStream()
+sd = bkp2.SerializeToStructuredData()
+sd.GetAsJSON(stream)
+serialized_data = json.loads(stream.GetData())
+self.assertIn("main", serialized_data["Breakpoint"]["BKPTResolver"]["Options"]["SymbolNames"])
+self.assertEqual(serialized_data["Breakpoint"]["BKPTOptions"]["ConditionText"],"argc == 1")
+
+
 def setup_targets_and_cleanup(self):
 def cleanup ():
 self.RemoveTempFile(self.bkpts_file_path)
Index: lldb/source/API/SBBreakpoint.cpp
===
--- lldb/source/API/SBBreakpoint.cpp
+++ lldb/source/API/SBBreakpoint.cpp
@@ -575,7 +575,22 @@
   return LLDB_RECORD_RESULT(error);
 }
 
-void SBBreakpoint ::SetCallback(SBBreakpointHitCallback callback, void *baton) {
+SBStructuredData SBBreakpoint::SerializeToStructuredData() {
+  LLDB_RECORD_METHOD_NO_ARGS(lldb::SBStructuredData, SBBreakpoint,
+ SerializeToStructuredData);
+
+  SBStructuredData data;
+  BreakpointSP bkpt_sp = GetSP();
+
+  if (!bkpt_sp)
+return LLDB_RECORD_RESULT(data);
+
+  StructuredData::ObjectSP bkpt_dict = bkpt_sp->SerializeToStructuredData();
+  data.m_impl_up->SetObjectSP(bkpt_dict);
+  return LLDB_RECORD_RESULT(data);
+}
+
+void SBBreakpoint::SetCallback(SBBreakpointHitCallback callback, void *baton) {
   LLDB_RECORD_DUMMY(void, SBBreakpoint, SetCallback,
 (lldb::SBBreakpointHitCallback, void *), callback, baton);
 
@@ -1017,6 +1032,8 @@
(lldb::SBStream &, bool));
   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddLocation,
(lldb::SBAddress &));
+  LLDB_REGISTER_METHOD(lldb::SBStructuredData, SBBreakpoint,
+   SerializeToStructuredData, ());
   LLDB_REGISTER_METHOD(void, SBBreakpoint, SetScriptCallbackFunction,
(const char *));
   LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackFunction,
Index: lldb/include/lldb/API/SBBreakpoint.h
===
--- lldb/include/lldb/API/SBBreakpoint.h
+++ lldb/include/lldb/API/SBBreakpoint.h
@@ -140,7 +140,9 @@
   // Can only be called from a ScriptedBreakpointResolver...
   SBError
   AddLocation(SBAddress &address);
-  
+
+  SBStructuredData SerializeToStructuredData();
+
 private:
   friend class SBBreakpointList;
   friend class SBBreakpointLocation;
Index: lldb/bindings/interface/SBBreakpoint.i
===
--- lldb/bindings/interface/SBBreakpoint.i
+++ lldb/bindings/interface/SBBreak