[Lldb-commits] [lldb] [lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (PR #67106)

2023-09-29 Thread via lldb-commits

https://github.com/aokblast updated 
https://github.com/llvm/llvm-project/pull/67106

>From 17cad831181b07c4397aa78039ede79fc8b20513 Mon Sep 17 00:00:00 2001
From: aokblast 
Date: Fri, 29 Sep 2023 15:27:42 +0800
Subject: [PATCH] Add DynamicLoader Plugin Fore FreeBSD Kernel coredump

This patch add dynamicloader plguin for freebsd kernel coredump on lldb.
The implementation is by parsing linker_files structure and get all loaded 
kernel modules.

This patch was part of FreeBSD's participation in Google Summer of Code 2023
---
 .../Plugins/DynamicLoader/CMakeLists.txt  |   1 +
 .../FreeBSD-Kernel/CMakeLists.txt |  13 +
 .../DynamicLoaderFreeBSDKernel.cpp| 789 ++
 .../DynamicLoaderFreeBSDKernel.h  | 171 
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |  43 +-
 .../FreeBSDKernel/ProcessFreeBSDKernel.cpp|   4 +-
 6 files changed, 1014 insertions(+), 7 deletions(-)
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h

diff --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index f357fea02efbe68..30607159acdc088 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(Darwin-Kernel)
+add_subdirectory(FreeBSD-Kernel)
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
diff --git a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
new file mode 100644
index 000..76daf0a327cf97b
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_lldb_library(lldbPluginDynamicLoaderFreeBSDKernel PLUGIN
+  DynamicLoaderFreeBSDKernel.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginObjectFileELF
+  )
diff --git 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
new file mode 100644
index 000..bbb83ff0a118400
--- /dev/null
+++ 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -0,0 +1,789 @@
+//===-- DynamicLoaderFreeBSDKernel.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Host/StreamFile.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Symbol/LocateSymbolFile.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/OperatingSystem.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanRunToAddress.h"
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
+
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+
+#include "DynamicLoaderFreeBSDKernel.h"
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE(DynamicLoaderFreeBSDKernel)
+
+void DynamicLoaderFreeBSDKernel::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(),
+GetPluginDescriptionStatic(), CreateInstance,
+DebuggerInit);
+}
+
+void DynamicLoaderFreeBSDKernel::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+llvm::StringRef DynamicLoaderFreeBSDKernel::GetPluginDescriptionStatic() {
+  return "The Dynamic Loader Plugin For FreeBSD Kernel";
+}
+
+static bool is_kernel(Module *module) {
+  if (!module)
+return false;
+
+  ObjectFile *objfile = module->GetObjectFile();
+  if (!objfile)
+return false;
+  if (objfile->GetType() != ObjectFile::eTypeExecutable)
+return false;
+  if (objfile->GetStrata() != ObjectFile::eStrataUnknown &&
+  objfile->GetStrata() != ObjectFile::eStrataKernel)
+return false;
+
+  return true;
+}
+
+static bool is_kmod(Module *module) {
+  if (!module)
+return false;
+  if (!module->GetObjectFile())

[Lldb-commits] [lldb] [lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (PR #67106)

2023-09-29 Thread via lldb-commits

aokblast wrote:

OK, I have modified the commit message.

https://github.com/llvm/llvm-project/pull/67106
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread Pavel Kosov via lldb-commits

https://github.com/kpdev created https://github.com/llvm/llvm-project/pull/67782

Before this update strings has only DataFormatters, and therefore the way they 
were printed was slightly different (see comment here: 
https://github.com/llvm/llvm-project/blob/main/lldb/source/DataFormatters/FormatManager.cpp#L498),
 so tests which rely on this formatting also changed. 
std::string/std::wstring/std::u16(32)string synthetic frontend implemented Also 
tests for the frontend added.

~~

Huawei RRI, OS Lab

>From 433d3973716cc46e1ffd7044898189f845e536f6 Mon Sep 17 00:00:00 2001
From: Pavel Kosov 
Date: Fri, 29 Sep 2023 13:09:00 +0300
Subject: [PATCH] [lldb] Add support for updating string during debug process

Before this update strings has only DataFormatters,
and therefore the way they were printed was slightly different (see comment 
here:
https://github.com/llvm/llvm-project/blob/main/lldb/source/DataFormatters/FormatManager.cpp#L498),
so tests which rely on this formatting also changed.
std::string/std::wstring/std::u16(32)string synthetic frontend implemented
Also tests for the frontend added.

~~

Huawei RRI, OS Lab
---
 lldb/include/lldb/Core/ValueObject.h  |  11 ++
 .../lldb/DataFormatters/TypeSynthetic.h   |   8 +-
 lldb/source/Core/ValueObject.cpp  |   8 +-
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  87 +
 .../Plugins/Language/CPlusPlus/LibCxx.cpp |  96 +-
 .../Plugins/Language/CPlusPlus/LibCxx.h   |  15 ++
 .../Language/CPlusPlus/LibCxxString.cpp   | 171 ++
 .../CPlusPlus/LibCxxStringInfoExtractor.h | 119 
 lldb/source/Utility/Scalar.cpp|  11 +-
 .../TestDataFormatterGenericMultiMap.py   | 105 +++
 .../libcxx/map/TestDataFormatterLibccMap.py   | 112 
 .../TestDataFormatterLibcxxSharedPtr.py   |   2 +-
 .../TestDataFormatterLibcxxUniquePtr.py   |   2 +-
 .../change_values/libcxx/string/Makefile  |   6 +
 .../libcxx/string/TestChangeStringValue.py|  71 
 .../change_values/libcxx/string/main.cpp  |  21 +++
 17 files changed, 648 insertions(+), 198 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/LibCxxString.cpp
 create mode 100644 
lldb/source/Plugins/Language/CPlusPlus/LibCxxStringInfoExtractor.h
 create mode 100644 
lldb/test/API/python_api/value/change_values/libcxx/string/Makefile
 create mode 100644 
lldb/test/API/python_api/value/change_values/libcxx/string/TestChangeStringValue.py
 create mode 100644 
lldb/test/API/python_api/value/change_values/libcxx/string/main.cpp

diff --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 3af94f0a86e2fcc..892f5d0dea4f650 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -589,6 +589,14 @@ class ValueObject {
 
   virtual bool IsSynthetic() { return false; }
 
+  void SetSyntheticFrontend(SyntheticChildrenFrontEnd *synth_front) {
+m_synthetic_frontend = synth_front;
+  }
+
+  SyntheticChildrenFrontEnd *GetSyntheticFrontend() const {
+return m_synthetic_frontend;
+  }
+
   lldb::ValueObjectSP
   GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue,
 bool synthValue);
@@ -898,6 +906,9 @@ class ValueObject {
   /// Unique identifier for every value object.
   UserID m_id;
 
+  // If frontend exist - we may try to update our value through it
+  SyntheticChildrenFrontEnd *m_synthetic_frontend = nullptr;
+
   // Utility class for initializing all bitfields in ValueObject's 
constructors.
   // FIXME: This could be done via default initializers once we have C++20.
   struct Bitflags {
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 41be9b7efda8fdb..3a19804b22c196c 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -34,7 +34,9 @@ class SyntheticChildrenFrontEnd {
 
 public:
   SyntheticChildrenFrontEnd(ValueObject &backend)
-  : m_backend(backend), m_valid(true) {}
+  : m_backend(backend), m_valid(true) {
+backend.SetSyntheticFrontend(this);
+  }
 
   virtual ~SyntheticChildrenFrontEnd() = default;
 
@@ -75,6 +77,10 @@ class SyntheticChildrenFrontEnd {
   // display purposes
   virtual ConstString GetSyntheticTypeName() { return ConstString(); }
 
+  virtual bool SetValueFromCString(const char *value_str, Status &error) {
+return false;
+  }
+
   typedef std::shared_ptr SharedPointer;
   typedef std::unique_ptr AutoPointer;
 
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index ebfc1cf4d6fe9e1..ba88f848c0fb191 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1479,7 +1479,7 @@ bool ValueObject::SetValueFromCString(const char 
*value_str, Status &error) {
   if (v

[Lldb-commits] [lldb] [lldb] Add support for changing char in Scalar::SetValueFromCString (PR #67784)

2023-09-29 Thread Pavel Kosov via lldb-commits

https://github.com/kpdev created https://github.com/llvm/llvm-project/pull/67784

When we trying to change not the whole string,
but single character in it - lldb's ValueObject fits in Scalar and therefore 
lldb trying to update it as a Scalar value which is currently only support 
numbers, so characters support added.

~~

Huawei RRI, OS Lab

>From 55dbf63ab7a052859fc7b297f699f0957484d3bf Mon Sep 17 00:00:00 2001
From: Pavel Kosov 
Date: Fri, 29 Sep 2023 12:04:16 +0300
Subject: [PATCH] [lldb] Add support for changing char in
 Scalar::SetValueFromCString

When we trying to change not the whole string,
but single character in it - lldb's ValueObject fits in Scalar
and therefore lldb trying to update it as a Scalar value
which is currently only support numbers, so characters support added.

~~

Huawei RRI, OS Lab
---
 lldb/source/Utility/Scalar.cpp | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index 791c0fb74352913..33d0b832bfd9be6 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 
+#include  // for std::isalpha
 #include 
 #include 
 
@@ -646,7 +647,15 @@ Status Scalar::SetValueFromCString(const char *value_str, 
Encoding encoding,
 bool is_signed = encoding == eEncodingSint;
 bool is_negative = is_signed && str.consume_front("-");
 APInt integer;
-if (str.getAsInteger(0, integer)) {
+if (str.size() == 1 && std::isalpha(static_cast(str[0]))) {
+  // We can represent single character as Scalar -
+  // this is useful when working with symbols in string
+  // NOTE: it is okay to consider char size as 8-bit since we only have
+  // `SetValueFrom C String` api, not the `C Wstring` or something like
+  // that. If we can ever get wide characters here - we have to modify this
+  // behaviour somehow.
+  integer = APInt(8, static_cast(str[0]));
+} else if (str.getAsInteger(0, integer)) {
   error.SetErrorStringWithFormatv(
   "'{0}' is not a valid integer string value", value_str);
   break;

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


[Lldb-commits] [lldb] [lldb] Add SetValueFromCString API to SyntheticFronend (PR #67309)

2023-09-29 Thread Pavel Kosov via lldb-commits

kpdev wrote:

Patch 2: https://github.com/llvm/llvm-project/pull/67782
Patch 3: https://github.com/llvm/llvm-project/pull/67784 

https://github.com/llvm/llvm-project/pull/67309
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread Pavel Kosov via lldb-commits

kpdev wrote:

Depends on: 
https://github.com/llvm/llvm-project/pull/67309#issuecomment-1740657973

https://github.com/llvm/llvm-project/pull/67782
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for changing char in Scalar::SetValueFromCString (PR #67784)

2023-09-29 Thread Pavel Kosov via lldb-commits

kpdev wrote:

Depends on: 
https://github.com/llvm/llvm-project/pull/67309#issuecomment-1740657973

https://github.com/llvm/llvm-project/pull/67784
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
9284b03e87df5153fe425b6b81b8402f666deb18..433d3973716cc46e1ffd7044898189f845e536f6
 
lldb/test/API/python_api/value/change_values/libcxx/string/TestChangeStringValue.py
 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/multimap/TestDataFormatterGenericMultiMap.py
 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
``





View the diff from darker here.


``diff
--- 
functionalities/data-formatter/data-formatter-stl/generic/multimap/TestDataFormatterGenericMultiMap.py
  2023-09-29 10:14:24.00 +
+++ 
functionalities/data-formatter/data-formatter-stl/generic/multimap/TestDataFormatterGenericMultiMap.py
  2023-09-29 10:30:38.394519 +
@@ -178,40 +178,43 @@
 
 self.expect(
 "frame variable si",
 substrs=[
 multimap,
-'size=4',
-'[0] = ',
+"size=4",
+"[0] = ",
 'first = "one"',
-'second = 1',
-'[1] = ',
+"second = 1",
+"[1] = ",
 'first = "three"',
-'second = 3',
-'[2] = ',
+"second = 3",
+"[2] = ",
 'first = "two"',
-'second = 2',
-'[3] = ',
+"second = 2",
+"[3] = ",
 'first = "zero"',
-'second = 0',
-],
-)
-
-self.expect("p si",
-substrs=[multimap, 'size=4',
-'[0] = ',
+"second = 0",
+],
+)
+
+self.expect(
+"p si",
+substrs=[
+multimap,
+"size=4",
+"[0] = ",
 'first = "one"',
-'second = 1',
-'[1] = ',
+"second = 1",
+"[1] = ",
 'first = "three"',
-'second = 3',
-'[2] = ',
+"second = 3",
+"[2] = ",
 'first = "two"',
-'second = 2',
-'[3] = ',
+"second = 2",
+"[3] = ",
 'first = "zero"',
-'second = 0',
+"second = 0",
 ],
 )
 
 # check that MightHaveChildren() gets it right
 self.assertTrue(
@@ -242,42 +245,42 @@
 
 self.expect(
 "frame variable is",
 substrs=[
 multimap,
-'size=4',
-'[0] = ',
-'first = 1',
+"size=4",
+"[0] = ",
+"first = 1",
 'second = "is"',
-'[1] = ',
-'first = 2',
+"[1] = ",
+"first = 2",
 'second = "smart"',
-'[2] = ',
-'first = 3',
+"[2] = ",
+"first = 3",
 'second = "!!!"',
-'[3] = ',
-'first = 85',
+"[3] = ",
+"first = 85",
 'second = "goofy"',
 ],
 )
 
 self.expect(
 "expression is",
 substrs=[
 multimap,
-'size=4',
-'[0] = ',
-'first = 1',
+"size=4",
+"[0] = ",
+"first = 1",
 'second = "is"',
-'[1] = ',
-'first = 2',
+"[1] = ",
+"first = 2",
 'second = "smart"',
-'[2] = ',
-'first = 3',
+"[2] = ",
+"first = 3",
 'second = "!!!"',
-'[3] = ',
-'first = 85',
+"[3] = ",
+"first = 85",
 'second = "goofy"',
 ],
 )
 
 # check that MightHaveChildren() gets it right
@@ -313,18 +316,18 @@
 
 self.expect(
 "frame variable ss",
 substrs=[
 multimap,
-'size=3',
-'[0] = ',
+"size=3",
+"[0] = ",
 'first = "casa"',
 'second = "house"',
-'[1] = ',
+"[1] = ",
 'first

[Lldb-commits] [lldb] [lldb] Add SetValueFromCString API to SyntheticFronend (PR #67309)

2023-09-29 Thread Pavel Kosov via lldb-commits

kpdev wrote:

@jimingham @bulbazord Please check patch with all supposed changes (without 
breaking into different patches) https://github.com/llvm/llvm-project/pull/67784

https://github.com/llvm/llvm-project/pull/67309
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-09-29 Thread via lldb-commits


@@ -0,0 +1,145 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+
+#include <__algorithm/ranges_starts_with.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains_subrange {
+struct __fn {
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred,
+class _Proj1,
+class _Proj2,
+class _Offset = int>
+  static _LIBCPP_HIDE_FROM_ABI constexpr bool __contains_subrange_fn_impl(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred& __pred,
+  _Proj1& __proj1,
+  _Proj2& __proj2,
+  _Offset __offset) {
+if (__offset < 0)
+  return false;
+else {
+  for (; __offset >= 0; __offset--, __first1++) {
+auto result = ranges::starts_with(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+std::ref(__pred),
+std::ref(__proj1),
+std::ref(__proj2));
+if (result)
+  return true;
+  }
+  return false;
+}
+  }
+
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred  = ranges::equal_to,
+class _Proj1 = identity,
+class _Proj2 = identity>
+requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred __pred   = {},
+  _Proj1 __proj1 = {},
+  _Proj2 __proj2 = {}) const {
+int __n1 = ranges::distance(__first1, __last1);
+int __n2 = ranges::distance(__first2, __last2);
+int __offset = __n1 - __n2;

huixie90 wrote:

This still does not work.  `iter_difference_t` could be any integer class type, 
which is not guaranteed  to be explicitly convertible to `int`. Even it does, 
you don't want to do it, because this might be a narrowing conversion and you 
just get into undefined behaviour if actual distance is larger than the max of 
`int`

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-09-29 Thread via lldb-commits


@@ -0,0 +1,145 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+
+#include <__algorithm/ranges_starts_with.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains_subrange {
+struct __fn {
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred,
+class _Proj1,
+class _Proj2,
+class _Offset = int>
+  static _LIBCPP_HIDE_FROM_ABI constexpr bool __contains_subrange_fn_impl(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred& __pred,
+  _Proj1& __proj1,
+  _Proj2& __proj2,
+  _Offset __offset) {
+if (__offset < 0)
+  return false;
+else {
+  for (; __offset >= 0; __offset--, __first1++) {
+auto result = ranges::starts_with(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+std::ref(__pred),
+std::ref(__proj1),
+std::ref(__proj2));
+if (result)
+  return true;
+  }
+  return false;
+}
+  }
+
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred  = ranges::equal_to,
+class _Proj1 = identity,
+class _Proj2 = identity>
+requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred __pred   = {},
+  _Proj1 __proj1 = {},
+  _Proj2 __proj2 = {}) const {
+int __n1 = ranges::distance(__first1, __last1);
+int __n2 = ranges::distance(__first2, __last2);
+int __offset = __n1 - __n2;
+
+return __contains_subrange_fn_impl(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+__pred,
+__proj1,
+__proj2,
+std::move(__offset));
+  }
+
+  template 
+requires indirectly_comparable, iterator_t<_Range2>, 
_Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 
__proj1 = {}, _Proj2 __proj2 = {}) const {
+int __n1 = 0;
+int __n2 = 0;
+
+if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
+  __n1 = ranges::size(__range1);
+  __n2 = ranges::size(__range2);
+} else {
+  __n1 = ranges::distance(__range1);
+  __n2 = ranges::distance(__range2);
+}

huixie90 wrote:

as in the other comments. `int` won't work here

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-09-29 Thread via lldb-commits


@@ -0,0 +1,145 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+
+#include <__algorithm/ranges_starts_with.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains_subrange {
+struct __fn {
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred,
+class _Proj1,
+class _Proj2,
+class _Offset = int>
+  static _LIBCPP_HIDE_FROM_ABI constexpr bool __contains_subrange_fn_impl(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred& __pred,
+  _Proj1& __proj1,
+  _Proj2& __proj2,
+  _Offset __offset) {
+if (__offset < 0)
+  return false;
+else {
+  for (; __offset >= 0; __offset--, __first1++) {
+auto result = ranges::starts_with(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+std::ref(__pred),
+std::ref(__proj1),
+std::ref(__proj2));
+if (result)
+  return true;
+  }
+  return false;
+}
+  }
+
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred  = ranges::equal_to,
+class _Proj1 = identity,
+class _Proj2 = identity>
+requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred __pred   = {},
+  _Proj1 __proj1 = {},
+  _Proj2 __proj2 = {}) const {
+int __n1 = ranges::distance(__first1, __last1);
+int __n2 = ranges::distance(__first2, __last2);
+int __offset = __n1 - __n2;
+
+return __contains_subrange_fn_impl(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+__pred,
+__proj1,
+__proj2,
+std::move(__offset));
+  }
+
+  template https://eel.is/c++draft/alg.contains

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-09-29 Thread via lldb-commits

https://github.com/huixie90 requested changes to this pull request.


https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-09-29 Thread via lldb-commits


@@ -0,0 +1,145 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+
+#include <__algorithm/ranges_starts_with.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains_subrange {
+struct __fn {
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred,
+class _Proj1,
+class _Proj2,
+class _Offset>
+  static _LIBCPP_HIDE_FROM_ABI constexpr bool __contains_subrange_fn_impl(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred& __pred,
+  _Proj1& __proj1,
+  _Proj2& __proj2,
+  _Offset __offset) {
+if (__offset < 0)
+  return false;
+else {
+  for (; __offset >= 0; __offset--, __first1++) {
+auto result = ranges::starts_with(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+std::ref(__pred),
+std::ref(__proj1),
+std::ref(__proj2));
+if (result)
+  return true;
+  }
+  return false;
+}

huixie90 wrote:

`contains_subrange` only worked for `forward_iterator`, which is the same as 
`ranges::search`. Why do you test it with an `input_iterator`? It will fail as 
expected. 

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Resolve nested types when parsing structures (PR #66879)

2023-09-29 Thread Michael Buch via lldb-commits

Michael137 wrote:

Thanks, the API test looks good

Apologies for the delay, didn't have a chance to follow-up on Greg's concern 
yet. But will hopefully get a chance in the next few days

https://github.com/llvm/llvm-project/pull/66879
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl resolved 
https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/67019

From 11270775865a8415e00b4d899703f84717344967 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH 1/8] [lldb] add command start

---
 lldb/source/Commands/CMakeLists.txt   |   1 +
 lldb/source/Commands/CommandObjectStart.cpp   | 102 ++
 lldb/source/Commands/CommandObjectStart.h |  32 ++
 .../source/Interpreter/CommandInterpreter.cpp |   2 +
 4 files changed, 137 insertions(+)
 create mode 100644 lldb/source/Commands/CommandObjectStart.cpp
 create mode 100644 lldb/source/Commands/CommandObjectStart.h

diff --git a/lldb/source/Commands/CMakeLists.txt 
b/lldb/source/Commands/CMakeLists.txt
index 6a36c5376d5c574..54c62e0f5284beb 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -30,6 +30,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
   CommandObjectSession.cpp
   CommandObjectSettings.cpp
   CommandObjectSource.cpp
+  CommandObjectStart.cpp
   CommandObjectStats.cpp
   CommandObjectTarget.cpp
   CommandObjectThread.cpp
diff --git a/lldb/source/Commands/CommandObjectStart.cpp 
b/lldb/source/Commands/CommandObjectStart.cpp
new file mode 100644
index 000..7406143c50fec1b
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectStart.cpp
@@ -0,0 +1,102 @@
+//===-- CommandObjectStart.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "CommandObjectStart.h"
+#include "lldb/Interpreter/CommandObject.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// Constructor for CommandObjectStart
+CommandObjectStart::CommandObjectStart(CommandInterpreter &interpreter)
+: CommandObjectParsed(
+  interpreter, "start",
+  "Launches the process and pauses execution at main function",
+  "start args [optional args]") {
+  // Define command arguments
+  CommandArgumentData pause_location{eArgTypeName, eArgRepeatPlain};
+  m_arguments.push_back({pause_location});
+}
+
+CommandObjectStart::~CommandObjectStart() = default;
+
+// Execute the 'start' command
+bool CommandObjectStart::DoExecute(Args &command, CommandReturnObject &result) 
{
+  // Check if the 'first' subcommand is specified
+  bool pause_at_first_instruction = false;
+
+  if (command.GetArgumentCount() == 1 &&
+  strcmp(command.GetArgumentAtIndex(0), "first") == 0) {
+pause_at_first_instruction = true;
+  }
+
+  // Get the current selected target
+  TargetSP target_sp = GetDebugger().GetSelectedTarget();
+  if (!target_sp) {
+result.AppendError("No target selected.\n");
+return false;
+  }
+
+  // Create the breakpoint at main or the first instruction
+  BreakpointSP bp_sp;
+  if (pause_at_first_instruction) {
+ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+ObjectFile *object = exe_module_sp->GetObjectFile();
+Address address = object->GetEntryPointAddress();
+
+if (!address.IsValid()) {
+  result.AppendError("Failed to get the entry point address");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+bp_sp = target_sp->CreateBreakpoint(address, false, false);
+
+  } else {
+// Create a breakpoint at the main function
+bp_sp = target_sp->CreateBreakpoint(
+nullptr, nullptr, "main", eFunctionNameTypeAuto, eLanguageTypeUnknown,
+0, eLazyBoolNo, false, false);
+  }
+
+  if (!bp_sp) {
+result.AppendError("Breakpoint creation failed.\n");
+result.SetStatus(eReturnStatusFailed);
+return false;
+  } else {
+result.GetOutputStream().Printf("Breakpoint created%s.\n",
+pause_at_first_instruction
+? " at first instruction"
+: " in main function");
+result.SetStatus(eReturnStatusSuccessFinishResult);
+  }
+
+  // Construct the process launch info
+  ProcessLaunchInfo launch_info;
+  launch_info.SetShell(HostInfo::GetDefaultShell());
+  ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+  if (!exe_module_sp) {
+result.AppendError("No executable module found.\n");
+return false;
+  }
+
+  launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
+  // Launch the process
+  StreamString stream;
+  Status error = target_sp->Launch(launch_info, &stream);
+
+  if (error.Success()) {
+result.SetStatus(eReturnStatusSuccessFinishResult);
+result.GetOutputStream().Printf("Process launched successfully.\n");
+  } else {
+result.AppendErrorWithFormat("Process launch failed: %s\n",
+ error.AsC

[Lldb-commits] [lldb] [lldb] Add support for changing char in Scalar::SetValueFromCString (PR #67784)

2023-09-29 Thread via lldb-commits

jimingham wrote:

This seems like a somewhat limited way to poke a character into the value if 
the string has more than one character already in it.

If you are trying to do more fancy setting of the contents of an SBValue, then 
it would be more straightforward to get the SBData for the value with GetData, 
then you have access to the actual bytes in the data, and you can poke in 
values wherever you want.  I think that might be a better approach than trying 
to get SetValueFromCString to handle changing single character ValueObjects.

https://github.com/llvm/llvm-project/pull/67784
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

junior-jl wrote:

In this last commit, I changed the comments style and used @Michael137 
suggestion by declaring a `llvm::SetVector` instead of a temporary `std::set`.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits


@@ -38,7 +39,37 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
   case 's': // Stop at program entry point
 launch_info.GetFlags().Set(eLaunchFlagStopAtEntry);
 break;
-
+  case 'm': // Stop at user entry point
+  {
+TargetSP target_sp =
+execution_context ? execution_context->GetTargetSP() : TargetSP();
+ModuleSP main_module_sp = target_sp->GetExecutableModule();
+FileSpecList shared_lib_filter;
+shared_lib_filter.Append(main_module_sp->GetFileSpec());
+std::set entryPointNamesSet;
+for (LanguageType lang_type : Language::GetSupportedLanguages()) {
+  Language *lang = Language::FindPlugin(lang_type);
+  if (lang) {
+std::string entryPointName = lang->GetUserEntryPointName();
+if (!entryPointName.empty())
+  entryPointNamesSet.insert(entryPointName);
+  }
+}
+std::vector entryPointNames(entryPointNamesSet.begin(),

junior-jl wrote:

Done. Thank you for the help.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl resolved 
https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread via lldb-commits


@@ -231,23 +244,39 @@ def cleanup():
 "frame variable is",
 substrs=[
 multimap,
-"size=4",
-'[0] = (first = 1, second = "is")',
-'[1] = (first = 2, second = "smart")',
-'[2] = (first = 3, second = "!!!")',
-'[3] = (first = 85, second = "goofy")',
+'size=4',

jimingham wrote:

What is it about this change that is defeating the ValueObject printer from 
compressing this output onto one line?  It looks like the contents that get 
printed are the same, so there's something about switching from a Summary 
provider to a child provider that's causing problems.  We should fix that as 
people are really picky about variable printing being as space efficient as 
possible.

https://github.com/llvm/llvm-project/pull/67782
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread via lldb-commits

jimingham wrote:

To clear up terminology...  Strings had data formatters before AND after this 
change.  The difference is that you've switched from a "Summary Provider" data 
formatter to a "Synthetic Child Provider" data formatter.

It looks like you've made the printing of std::strings less space efficient.  
That shouldn't be necessary, and isn't desirable.  We should figure out why 
that's happening and fix that before this change is going to not cause 
complaints.

https://github.com/llvm/llvm-project/pull/67782
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 847de9c - [RISC-V] Add RISC-V ABI plugin

2023-09-29 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-09-29T10:31:01-05:00
New Revision: 847de9c332775d1841fec9fea5cb5c41592a4c8f

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

LOG: [RISC-V] Add RISC-V ABI plugin

Also default to disassembling a and m features
Some code taken from https://reviews.llvm.org/D62732 , which hasn't been
updated in a year.

Tested with 32 and 64 bit Linux user space QEMU

Reviewed By: jasonmolenda

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

Added: 
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
lldb/source/Plugins/ABI/RISCV/CMakeLists.txt

Modified: 
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/CMakeLists.txt 
b/lldb/source/Plugins/ABI/CMakeLists.txt
index 828aea674ea68c2..9241a2487d522fe 100644
--- a/lldb/source/Plugins/ABI/CMakeLists.txt
+++ b/lldb/source/Plugins/ABI/CMakeLists.txt
@@ -1,4 +1,4 @@
-foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC SystemZ X86)
+foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC RISCV SystemZ X86)
   if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
 add_subdirectory(${target})
   endif()

diff  --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
new file mode 100644
index 000..bdcbeaca68fa33d
--- /dev/null
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
@@ -0,0 +1,780 @@
+//===-- ABISysV_riscv.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===-===//
+
+#include "ABISysV_riscv.h"
+
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/RegisterValue.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+DEFINE_REG_NAME(dwarf_num), DEFINE_REG_NAME_STR(str_name), 0, 0,   
\
+eEncodingInvalid, eFormatDefault,  
\
+{dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num},   
\
+nullptr, nullptr, nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_riscv, ABIRISCV)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  zero,
+  ra,
+  sp,
+  gp,
+  tp,
+  t0,
+  t1,
+  t2,
+  fp,
+  s0 = fp,
+  s1,
+  a0,
+  a1,
+  a2,
+  a3,
+  a4,
+  a5,
+  a6,
+  a7,
+  s2,
+  s3,
+  s4,
+  s5,
+  s6,
+  s7,
+  s8,
+  s9,
+  s10,
+  s11,
+  t3,
+  t4,
+  t5,
+  t6,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(zero, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(ra, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_GENERIC_REGISTER_STUB(sp, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_REGISTER_STUB(gp, nullptr),
+ DEFINE_REGISTER_STUB(tp, nullptr),
+ DEFINE_REGISTER_STUB(t0, nullptr),
+ DEFINE_REGISTER_STUB(t1, nullptr),
+ DEFINE_REGISTER_STUB(t2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(fp, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(s1, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(a0, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(a1, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(a2, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(a3, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(a4, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(a5, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(a6, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(a7, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ 

[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-09-29 Thread Ted Woodward 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 rG847de9c33277: [RISC-V] Add RISC-V ABI plugin (authored by 
ted).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159101

Files:
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
  lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1576,6 +1576,8 @@
 ArchSpec::eRISCV_float_abi_quad)
   features_str += "+f,+d,+q,";
 // FIXME: how do we detect features such as `+a`, `+m`?
+// Turn them on by default now, since everyone seems to use them
+features_str += "+a,+m,";
   }
 
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this
Index: lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_lldb_library(lldbPluginABIRISCV PLUGIN
+  ABISysV_riscv.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+TargetParser
+  )
Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -0,0 +1,131 @@
+//===-- ABISysV_riscv.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_riscv_h_
+#define liblldb_ABISysV_riscv_h_
+
+// Other libraries and framework includes
+#include 
+
+#include "llvm/TargetParser/Triple.h"
+
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_riscv : public lldb_private::RegInfoBasedABI {
+public:
+  ~ABISysV_riscv() override = default;
+
+  size_t GetRedZoneSize() const override { return 0; }
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   llvm::Type &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// The CFA must be 128 bit aligned, unless the E ABI is used
+lldb_private::ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
+lldb_private::Flags arch_flags = arch.GetFlags();
+if (arch_flags.Test(lldb_private::ArchSpec::eRISCV_rve))
+  return (cfa & 0x3ull) == 0;
+return (cfa & 0xfull) == 0;
+  }
+
+  void SetIsRV64(bool is_rv64) { m_is_rv64 = is_rv64; }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Calls can use the least significant bit to store auxiliary information,
+// so no strict check is done for alignment.
+
+lldb_private::ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
+
+//  & 2 set is a fault if C extension is not used.
+lldb_private::

[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -38,7 +40,40 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
   case 's': // Stop at program entry point
 launch_info.GetFlags().Set(eLaunchFlagStopAtEntry);
 break;
-
+  case 'm': // Stop at user entry point
+  {
+TargetSP target_sp =
+execution_context ? execution_context->GetTargetSP() : TargetSP();
+ModuleSP main_module_sp = target_sp->GetExecutableModule();
+FileSpecList shared_lib_filter;
+shared_lib_filter.Append(main_module_sp->GetFileSpec());
+llvm::SetVector,
+std::unordered_set>
+entryPointNamesSet;
+for (LanguageType lang_type : Language::GetSupportedLanguages()) {
+  Language *lang = Language::FindPlugin(lang_type);
+  if (lang) {

medismailben wrote:

You could inverse the condition and return early.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


https://github.com/medismailben edited 
https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -103,6 +103,8 @@ class CPlusPlusLanguage : public Language {
 return lldb::eLanguageTypeC_plus_plus;
   }
 
+  const char *GetUserEntryPointName() const override { return "main"; }

medismailben wrote:

same comment as earlier regarding the return type.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -160,6 +166,10 @@ class Language : public PluginInterface {
 
   virtual lldb::LanguageType GetLanguageType() const = 0;
 
+  // Implement this function to return the user-defined entry point name
+  // for the language
+  virtual const char *GetUserEntryPointName() const { return nullptr; }

medismailben wrote:

```suggestion
  virtual llvm::StringRef GetUserEntryPointName() const { return {}; }
```

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -160,6 +166,10 @@ class Language : public PluginInterface {
 
   virtual lldb::LanguageType GetLanguageType() const = 0;
 
+  // Implement this function to return the user-defined entry point name
+  // for the language
+  virtual const char *GetUserEntryPointName() const { return nullptr; }

medismailben wrote:

nit: this could have returned an `llvm::StringRef` instead of an `const char *`.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -27,6 +27,8 @@ class ObjCPlusPlusLanguage : public Language {
 return lldb::eLanguageTypeObjC_plus_plus;
   }
 
+  const char *GetUserEntryPointName() const override { return "main"; }

medismailben wrote:

Unrelated to this PR but it would have been nice if this class was derived from 
the `CPlusPlus` and/or `ObjC` one so you wouldn't have to re-implement the same 
method here. @Michael137 do you think that it could be a useful refactor ? Or 
may be we should introduce a `C` language base class that every thing derives 
from ?

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -127,6 +127,8 @@ class ObjCLanguage : public Language {
 return lldb::eLanguageTypeObjC;
   }
 
+  const char *GetUserEntryPointName() const override { return "main"; }

medismailben wrote:

ditto.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -38,7 +40,40 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
   case 's': // Stop at program entry point
 launch_info.GetFlags().Set(eLaunchFlagStopAtEntry);
 break;
-
+  case 'm': // Stop at user entry point
+  {
+TargetSP target_sp =
+execution_context ? execution_context->GetTargetSP() : TargetSP();
+ModuleSP main_module_sp = target_sp->GetExecutableModule();
+FileSpecList shared_lib_filter;
+shared_lib_filter.Append(main_module_sp->GetFileSpec());
+llvm::SetVector,
+std::unordered_set>
+entryPointNamesSet;
+for (LanguageType lang_type : Language::GetSupportedLanguages()) {
+  Language *lang = Language::FindPlugin(lang_type);
+  if (lang) {
+std::string entryPointName = lang->GetUserEntryPointName();
+if (!entryPointName.empty())
+  entryPointNamesSet.insert(entryPointName);
+  }
+}

medismailben wrote:

You could check the size of `entryPointNamesSet` before trying to create the 
breakpoint, and return early if it's empty.
Breakpoint creation could fail for many reasons, so if you couldn't get any 
entry point name from the language plugin, we shouldn't bother creating a 
breakpoint and give the user a more accurate error message.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 


https://github.com/medismailben approved this pull request.

LGTM with some comments.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


medismailben wrote:

@junior-jl I'm actually in favor of adding a `start` alias (if it doesn't 
affect the behavior of the existing aliases and commands).

However, I've just noticed that the PR description doesn't describe the content 
of the commits anymore. Would you mind updating it before landing it ? Thanks!

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D159550: Remove unused #include

2023-09-29 Thread Ted Woodward via Phabricator via lldb-commits
ted created this revision.
Herald added subscribers: luke, sunshaoce, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, 
simoncook, johnrusso, rbar, asb.
Herald added a project: All.
ted requested review of this revision.
Herald added subscribers: lldb-commits, wangpc, MaskRay.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159550

Files:
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h


Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes


Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] b141534 - Remove unused #include

2023-09-29 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-09-29T11:07:38-05:00
New Revision: b14153490134e210c05bafae330a270cf60c0e2a

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

LOG: Remove unused #include

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

Added: 


Modified: 
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h

Removed: 




diff  --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
index 3ae663f42446afb..d8cf008dbb0bf8b 100644
--- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes



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


[Lldb-commits] [PATCH] D159550: Remove unused #include

2023-09-29 Thread Ted Woodward via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb14153490134: Remove unused #include (authored by ted).
Herald added a subscriber: JDevlieghere.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159550

Files:
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h


Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes


Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D159550: Remove unused #include

2023-09-29 Thread Ted Woodward via Phabricator via lldb-commits
ted added a subscriber: jasonmolenda.
ted added a comment.

Remove unused #include pointed out by @jasonmolenda in D159101 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159550

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


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl edited 
https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (PR #67106)

2023-09-29 Thread via lldb-commits

https://github.com/aokblast updated 
https://github.com/llvm/llvm-project/pull/67106

>From df60e39a644ddf0973c87f14b784a69b78c359f9 Mon Sep 17 00:00:00 2001
From: Sam McCall 
Date: Sat, 30 Sep 2023 00:14:08 +0800
Subject: [PATCH 1/2] [clangd] Allow --query-driver to match a dot-normalized
 form of the path (#66757)

(In addition to the un-normalized form, so this is back-compatible)
---
 clang-tools-extra/clangd/SystemIncludeExtractor.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp 
b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
index 88df5b04ccb09f3..74bae786425c829 100644
--- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -343,7 +343,13 @@ extractSystemIncludesAndTarget(const DriverArgs &InputArgs,
   SPAN_ATTACH(Tracer, "driver", Driver);
   SPAN_ATTACH(Tracer, "lang", InputArgs.Lang);
 
-  if (!QueryDriverRegex.match(Driver)) {
+  // If driver was "../foo" then having to allowlist "/path/a/../foo" rather
+  // than "/path/foo" is absurd.
+  // Allow either to match the allowlist, then proceed with "/path/a/../foo".
+  // This was our historical behavior, and it *could* resolve to something 
else.
+  llvm::SmallString<256> NoDots(Driver);
+  llvm::sys::path::remove_dots(NoDots, /*remove_dot_dot=*/true);
+  if (!QueryDriverRegex.match(Driver) && !QueryDriverRegex.match(NoDots)) {
 vlog("System include extraction: not allowed driver {0}", Driver);
 return std::nullopt;
   }

>From 2d243815fbf84874e748b2887329ce415cde3a72 Mon Sep 17 00:00:00 2001
From: SHENG-YI HONG 
Date: Sat, 30 Sep 2023 00:24:02 +0800
Subject: [PATCH 2/2] Add DynamicLoader Plugin Fore FreeBSD Kernel coredump
 This patch add dynamicloader plguin for freebsd kernel coredump on lldb. The
 implementation is by parsing linker_files structure and get all loaded kernel
 modules.

This patch was part of FreeBSD's participation in Google Summer of Code 2023
---
 .../Plugins/DynamicLoader/CMakeLists.txt  |   1 +
 .../FreeBSD-Kernel/CMakeLists.txt |  13 +
 .../DynamicLoaderFreeBSDKernel.cpp| 789 ++
 .../DynamicLoaderFreeBSDKernel.h  | 171 
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |  43 +-
 .../FreeBSDKernel/ProcessFreeBSDKernel.cpp|   4 +-
 6 files changed, 1014 insertions(+), 7 deletions(-)
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h

diff --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index f357fea02efbe68..30607159acdc088 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(Darwin-Kernel)
+add_subdirectory(FreeBSD-Kernel)
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
diff --git a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
new file mode 100644
index 000..76daf0a327cf97b
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_lldb_library(lldbPluginDynamicLoaderFreeBSDKernel PLUGIN
+  DynamicLoaderFreeBSDKernel.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginObjectFileELF
+  )
diff --git 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
new file mode 100644
index 000..bbb83ff0a118400
--- /dev/null
+++ 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -0,0 +1,789 @@
+//===-- DynamicLoaderFreeBSDKernel.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Host/StreamFile.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Symbol/LocateSymbolFile.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/OperatingSystem.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Targ

[Lldb-commits] [lldb] [lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (PR #67106)

2023-09-29 Thread via lldb-commits

https://github.com/aokblast updated 
https://github.com/llvm/llvm-project/pull/67106

>From a05c9b5c082395d0bade0bdef3faf7f00035c96d Mon Sep 17 00:00:00 2001
From: SHENG-YI HONG 
Date: Sat, 30 Sep 2023 00:28:38 +0800
Subject: [PATCH] Add DynamicLoader Plugin Fore FreeBSD Kernel coredump This
 patch add dynamicloader plguin for freebsd kernel coredump on lldb. The
 implementation is by parsing linker_files structure and get all loaded kernel
 modules.

This patch was part of FreeBSD's participation in Google Summer of Code 2023
---
 .../Plugins/DynamicLoader/CMakeLists.txt  |   1 +
 .../FreeBSD-Kernel/CMakeLists.txt |  13 +
 .../DynamicLoaderFreeBSDKernel.cpp| 789 ++
 .../DynamicLoaderFreeBSDKernel.h  | 171 
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |  43 +-
 .../FreeBSDKernel/ProcessFreeBSDKernel.cpp|   4 +-
 6 files changed, 1014 insertions(+), 7 deletions(-)
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 create mode 100644 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h

diff --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index f357fea02efbe68..30607159acdc088 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(Darwin-Kernel)
+add_subdirectory(FreeBSD-Kernel)
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
diff --git a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
new file mode 100644
index 000..76daf0a327cf97b
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_lldb_library(lldbPluginDynamicLoaderFreeBSDKernel PLUGIN
+  DynamicLoaderFreeBSDKernel.cpp
+
+  LINK_LIBS
+lldbBreakpoint
+lldbCore
+lldbHost
+lldbInterpreter
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginObjectFileELF
+  )
diff --git 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
new file mode 100644
index 000..bbb83ff0a118400
--- /dev/null
+++ 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -0,0 +1,789 @@
+//===-- DynamicLoaderFreeBSDKernel.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Host/StreamFile.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Symbol/LocateSymbolFile.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/OperatingSystem.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanRunToAddress.h"
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
+
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+
+#include "DynamicLoaderFreeBSDKernel.h"
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE(DynamicLoaderFreeBSDKernel)
+
+void DynamicLoaderFreeBSDKernel::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(),
+GetPluginDescriptionStatic(), CreateInstance,
+DebuggerInit);
+}
+
+void DynamicLoaderFreeBSDKernel::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+llvm::StringRef DynamicLoaderFreeBSDKernel::GetPluginDescriptionStatic() {
+  return "The Dynamic Loader Plugin For FreeBSD Kernel";
+}
+
+static bool is_kernel(Module *module) {
+  if (!module)
+return false;
+
+  ObjectFile *objfile = module->GetObjectFile();
+  if (!objfile)
+return false;
+  if (objfile->GetType() != ObjectFile::eTypeExecutable)
+return false;
+  if (objfile->GetStrata() != ObjectFile::eStrataUnknown &&
+  objfile->GetStrata() != ObjectFile::eStrataKernel)
+return false;
+
+  return true;
+}
+
+static bool is_kmod(Module *module) {
+  if (!module)
+return false;
+  if (!module->GetObjectFi

[Lldb-commits] [lldb] c87b2c9 - [RISC-V] Remove unnecessary VLA

2023-09-29 Thread Benjamin Kramer via lldb-commits

Author: Benjamin Kramer
Date: 2023-09-29T18:45:05+02:00
New Revision: c87b2c9c82e54b6cb21e668cd3e1097a44d5d48a

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

LOG: [RISC-V] Remove unnecessary VLA

They're still non-standard in C++17.

Added: 


Modified: 
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
index bdcbeaca68fa33d..6395f5bb5bd9b01 100644
--- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
@@ -231,7 +231,7 @@ bool ABISysV_riscv::PrepareTrivialCall(
   args_size <= regs_for_args_count ? 0 : args_size - regs_for_args_count;
   auto offset = on_stack * word_size;
 
-  uint8_t reg_value[reg_size];
+  uint8_t reg_value[8];
   size_t reg_index = LLDB_REGNUM_GENERIC_ARG1;
 
   for (size_t i = 0; i < args_size; ++i) {



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


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

junior-jl wrote:

Hi, @medismailben. I changed the code with your suggestions. Can you take a 
look if the early exits are correct before I commit, please?

```cpp
case 'm': // Stop at user entry point
  {
TargetSP target_sp =
execution_context ? execution_context->GetTargetSP() : TargetSP();
ModuleSP main_module_sp = target_sp->GetExecutableModule();
FileSpecList shared_lib_filter;
shared_lib_filter.Append(main_module_sp->GetFileSpec());
llvm::SetVector, 
std::unordered_set> entryPointNamesSet;
for (LanguageType lang_type : Language::GetSupportedLanguages()) {
  Language *lang = Language::FindPlugin(lang_type);
  if (!lang) {
error.SetErrorString("Language not found\n");
break;
  }
  std::string entryPointName = lang->GetUserEntryPointName().str();
  if (!entryPointName.empty())
entryPointNamesSet.insert(entryPointName);
}
if (entryPointNamesSet.empty()) {
  error.SetErrorString("No entry point name found\n");
  break;
}
BreakpointSP bp_sp = target_sp->CreateBreakpoint(
&shared_lib_filter, 
nullptr, // containingSourceFiles
entryPointNamesSet.takeVector(), 
eFunctionNameTypeFull,   // func_name_type_mask
eLanguageTypeUnknown,// language
0,   // offset
eLazyBoolNo, // skip_prologue
false,   // internal
false// hardware
);
if (!bp_sp) {
  error.SetErrorString("Breakpoint creation failed.\n");
  break;
}
bp_sp->SetOneShot(true);
break;
  }
```

Also, thank you for the reminder of changing the description of the PR. Done :)

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


medismailben wrote:

> Hi, @medismailben. I changed the code with your suggestions. Can you take a 
> look if the early exits are correct before I commit, please?
> 
LGTM 🚀

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2fc90af - [lldb] Fix build after 2da8f30c

2023-09-29 Thread Jan Svoboda via lldb-commits

Author: Jan Svoboda
Date: 2023-09-29T10:01:37-07:00
New Revision: 2fc90afdac451b49d67c72bd41a99886811dd36c

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

LOG: [lldb] Fix build after 2da8f30c

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index f65192a3225edc1..aee0f1f56ec74b5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1077,13 +1077,14 @@ ClangExpressionParser::ParseInternal(DiagnosticManager 
&diagnostic_manager,
   // While parsing the Sema will call this consumer with the provided
   // completion suggestions.
   if (completion_consumer) {
-auto main_file = source_mgr.getFileEntryForID(source_mgr.getMainFileID());
+auto main_file =
+source_mgr.getFileEntryRefForID(source_mgr.getMainFileID());
 auto &PP = m_compiler->getPreprocessor();
 // Lines and columns start at 1 in Clang, but code completion positions are
 // indexed from 0, so we need to add 1 to the line and column here.
 ++completion_line;
 ++completion_column;
-PP.SetCodeCompletionPoint(main_file, completion_line, completion_column);
+PP.SetCodeCompletionPoint(*main_file, completion_line, completion_column);
   }
 
   ASTConsumer *ast_transformer =



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


[Lldb-commits] [lldb] [lldb] Add support for updating string during debug process (PR #67782)

2023-09-29 Thread via lldb-commits

jimingham wrote:

BTW, I have no problem with the general direction of this change.  It makes a 
lot more sense to ask a synthetic child provider to change a value - since it 
does represent the value of the ValueObject - rather than the summary which is 
just some free-form text.  And being able to change characters in a string 
seems a reasonable thing to do, so switching the std::string comprehension from 
a Summary provider to a Synthetic Child Provider is the way to do that.  So 
that part if fine.  

But std::strings abound in code, and so if we're going to make this change I 
don't think we can make that printing less space efficient, which this change 
seems to have done.  We should figure out why that's the case and fix for this 
to be a really good change.

https://github.com/llvm/llvm-project/pull/67782
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/67019

From 11270775865a8415e00b4d899703f84717344967 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH 1/9] [lldb] add command start

---
 lldb/source/Commands/CMakeLists.txt   |   1 +
 lldb/source/Commands/CommandObjectStart.cpp   | 102 ++
 lldb/source/Commands/CommandObjectStart.h |  32 ++
 .../source/Interpreter/CommandInterpreter.cpp |   2 +
 4 files changed, 137 insertions(+)
 create mode 100644 lldb/source/Commands/CommandObjectStart.cpp
 create mode 100644 lldb/source/Commands/CommandObjectStart.h

diff --git a/lldb/source/Commands/CMakeLists.txt 
b/lldb/source/Commands/CMakeLists.txt
index 6a36c5376d5c574..54c62e0f5284beb 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -30,6 +30,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
   CommandObjectSession.cpp
   CommandObjectSettings.cpp
   CommandObjectSource.cpp
+  CommandObjectStart.cpp
   CommandObjectStats.cpp
   CommandObjectTarget.cpp
   CommandObjectThread.cpp
diff --git a/lldb/source/Commands/CommandObjectStart.cpp 
b/lldb/source/Commands/CommandObjectStart.cpp
new file mode 100644
index 000..7406143c50fec1b
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectStart.cpp
@@ -0,0 +1,102 @@
+//===-- CommandObjectStart.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "CommandObjectStart.h"
+#include "lldb/Interpreter/CommandObject.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// Constructor for CommandObjectStart
+CommandObjectStart::CommandObjectStart(CommandInterpreter &interpreter)
+: CommandObjectParsed(
+  interpreter, "start",
+  "Launches the process and pauses execution at main function",
+  "start args [optional args]") {
+  // Define command arguments
+  CommandArgumentData pause_location{eArgTypeName, eArgRepeatPlain};
+  m_arguments.push_back({pause_location});
+}
+
+CommandObjectStart::~CommandObjectStart() = default;
+
+// Execute the 'start' command
+bool CommandObjectStart::DoExecute(Args &command, CommandReturnObject &result) 
{
+  // Check if the 'first' subcommand is specified
+  bool pause_at_first_instruction = false;
+
+  if (command.GetArgumentCount() == 1 &&
+  strcmp(command.GetArgumentAtIndex(0), "first") == 0) {
+pause_at_first_instruction = true;
+  }
+
+  // Get the current selected target
+  TargetSP target_sp = GetDebugger().GetSelectedTarget();
+  if (!target_sp) {
+result.AppendError("No target selected.\n");
+return false;
+  }
+
+  // Create the breakpoint at main or the first instruction
+  BreakpointSP bp_sp;
+  if (pause_at_first_instruction) {
+ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+ObjectFile *object = exe_module_sp->GetObjectFile();
+Address address = object->GetEntryPointAddress();
+
+if (!address.IsValid()) {
+  result.AppendError("Failed to get the entry point address");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+bp_sp = target_sp->CreateBreakpoint(address, false, false);
+
+  } else {
+// Create a breakpoint at the main function
+bp_sp = target_sp->CreateBreakpoint(
+nullptr, nullptr, "main", eFunctionNameTypeAuto, eLanguageTypeUnknown,
+0, eLazyBoolNo, false, false);
+  }
+
+  if (!bp_sp) {
+result.AppendError("Breakpoint creation failed.\n");
+result.SetStatus(eReturnStatusFailed);
+return false;
+  } else {
+result.GetOutputStream().Printf("Breakpoint created%s.\n",
+pause_at_first_instruction
+? " at first instruction"
+: " in main function");
+result.SetStatus(eReturnStatusSuccessFinishResult);
+  }
+
+  // Construct the process launch info
+  ProcessLaunchInfo launch_info;
+  launch_info.SetShell(HostInfo::GetDefaultShell());
+  ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+  if (!exe_module_sp) {
+result.AppendError("No executable module found.\n");
+return false;
+  }
+
+  launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
+  // Launch the process
+  StreamString stream;
+  Status error = target_sp->Launch(launch_info, &stream);
+
+  if (error.Success()) {
+result.SetStatus(eReturnStatusSuccessFinishResult);
+result.GetOutputStream().Printf("Process launched successfully.\n");
+  } else {
+result.AppendErrorWithFormat("Process launch failed: %s\n",
+ error.AsC

[Lldb-commits] [lldb] [OpenMPIRBuilder] Remove wrapper function in `createTask` (PR #67723)

2023-09-29 Thread via lldb-commits

https://github.com/shraiysh updated 
https://github.com/llvm/llvm-project/pull/67723

>From 6aabc3c10ea2d587120b74966b7ce96f9b8167af Mon Sep 17 00:00:00 2001
From: Shraiysh Vaishay 
Date: Thu, 28 Sep 2023 13:35:07 -0500
Subject: [PATCH] [OpenMPIRBuilder] Remove wrapper function in `createTask`

This patch removes the wrapper function in
`OpenMPIRBuilder::createTask`. The outlined function is directly of the
form that is expected by the runtime library calls. This also fixes the
global thread ID argument, which should be used whenever
`kmpc_global_thread_num()` is called inside the outlined function.
---
 llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 106 --
 .../Frontend/OpenMPIRBuilderTest.cpp  |  56 +
 mlir/test/Target/LLVMIR/openmp-llvm.mlir  |  51 +++--
 3 files changed, 99 insertions(+), 114 deletions(-)

diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 9c70d384e55db2b..54012b488c6b671 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -35,6 +35,7 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/InstIterator.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Metadata.h"
@@ -1496,6 +1497,14 @@ OpenMPIRBuilder::createTask(const LocationDescription 
&Loc,
 InsertPointTy AllocaIP, BodyGenCallbackTy 
BodyGenCB,
 bool Tied, Value *Final, Value *IfCondition,
 SmallVector Dependencies) {
+  // We create a temporary i32 value that will represent the global tid after
+  // outlining.
+  SmallVector ToBeDeleted;
+  Builder.restoreIP(AllocaIP);
+  AllocaInst *TIDAddr = Builder.CreateAlloca(Int32, nullptr, "tid.addr");
+  LoadInst *TID = Builder.CreateLoad(Int32, TIDAddr, "tid.addr.use");
+  ToBeDeleted.append({TID, TIDAddr});
+
   if (!updateToLocation(Loc))
 return InsertPointTy();
 
@@ -1523,41 +1532,27 @@ OpenMPIRBuilder::createTask(const LocationDescription 
&Loc,
   BasicBlock *TaskAllocaBB =
   splitBB(Builder, /*CreateBranch=*/true, "task.alloca");
 
+  // Fake use of TID
+  Builder.SetInsertPoint(TaskAllocaBB, TaskAllocaBB->begin());
+  BinaryOperator *AddInst =
+  dyn_cast(Builder.CreateAdd(TID, Builder.getInt32(10)));
+  ToBeDeleted.push_back(AddInst);
+
   OutlineInfo OI;
   OI.EntryBB = TaskAllocaBB;
   OI.OuterAllocaBB = AllocaIP.getBlock();
   OI.ExitBB = TaskExitBB;
-  OI.PostOutlineCB = [this, Ident, Tied, Final, IfCondition,
-  Dependencies](Function &OutlinedFn) {
-// The input IR here looks like the following-
-// ```
-// func @current_fn() {
-//   outlined_fn(%args)
-// }
-// func @outlined_fn(%args) { ... }
-// ```
-//
-// This is changed to the following-
-//
-// ```
-// func @current_fn() {
-//   runtime_call(..., wrapper_fn, ...)
-// }
-// func @wrapper_fn(..., %args) {
-//   outlined_fn(%args)
-// }
-// func @outlined_fn(%args) { ... }
-// ```
-
-// The stale call instruction will be replaced with a new call instruction
-// for runtime call with a wrapper function.
+  OI.ExcludeArgsFromAggregate = {TID};
+  OI.PostOutlineCB = [this, Ident, Tied, Final, IfCondition, Dependencies,
+  TaskAllocaBB, ToBeDeleted](Function &OutlinedFn) {
+// Replace the Stale CI by appropriate RTL function call.
 assert(OutlinedFn.getNumUses() == 1 &&
"there must be a single user for the outlined function");
 CallInst *StaleCI = cast(OutlinedFn.user_back());
 
 // HasShareds is true if any variables are captured in the outlined region,
 // false otherwise.
-bool HasShareds = StaleCI->arg_size() > 0;
+bool HasShareds = StaleCI->arg_size() > 1;
 Builder.SetInsertPoint(StaleCI);
 
 // Gather the arguments for emitting the runtime call for
@@ -1595,7 +1590,7 @@ OpenMPIRBuilder::createTask(const LocationDescription 
&Loc,
 Value *SharedsSize = Builder.getInt64(0);
 if (HasShareds) {
   AllocaInst *ArgStructAlloca =
-  dyn_cast(StaleCI->getArgOperand(0));
+  dyn_cast(StaleCI->getArgOperand(1));
   assert(ArgStructAlloca &&
  "Unable to find the alloca instruction corresponding to arguments 
"
  "for extracted function");
@@ -1606,31 +1601,17 @@ OpenMPIRBuilder::createTask(const LocationDescription 
&Loc,
   SharedsSize =
   Builder.getInt64(M.getDataLayout().getTypeStoreSize(ArgStructType));
 }
-
-// Argument - task_entry (the wrapper function)
-// If the outlined function has some captured variables (i.e. HasShareds is
-// true), then the wrapper function will have an additional argument (the
-// struct containing captured variables). Otherwise, no such argument will
-// be present.
-SmallVector Wrap

[Lldb-commits] [lldb] a514c30 - [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (#67628)

2023-09-29 Thread via lldb-commits

Author: River Riddle
Date: 2023-09-29T10:33:11-07:00
New Revision: a514c30a7cf6ea99e5398b695601235b41a43939

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

LOG: [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (#67628)

LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree plugins and
extensions that rely on LLDB's internal symbols. For example, this is
how the Mojo language provides its REPL and debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these with
the public api. This PR takes an approach similar to what LLVM does with
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium does for
[abseil](https://github.com/chromium/chromium/blob/253d14e20fdc0cab05e5516770dceca18f9bddaf/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.

Added: 
lldb/scripts/msvc_extract_private_symbols.py

Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/source/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 19283b3cbb0194f..380016ce48015fa 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -122,14 +122,8 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
   endif()
 endif()
 
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
-"Causes lldb to export all symbols when building liblldb.")
-else()
-  # Windows doesn't support toggling this, so don't bother making it a
-  # cache variable.
-  set(LLDB_EXPORT_ALL_SYMBOLS 0)
-endif()
+set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+  "Causes lldb to export all symbols when building liblldb.")
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )

diff  --git a/lldb/scripts/msvc_extract_private_symbols.py 
b/lldb/scripts/msvc_extract_private_symbols.py
new file mode 100644
index 000..05e8b0e2095ca33
--- /dev/null
+++ b/lldb/scripts/msvc_extract_private_symbols.py
@@ -0,0 +1,102 @@
+"""A tool for extracting a list of private lldb symbols to export for MSVC.
+
+When exporting symbols from a dll or exe we either need to mark the symbols in
+the source code as __declspec(dllexport) or supply a list of symbols to the
+linker. Private symbols in LLDB don't explicitly specific dllexport, so we
+automate that by examining the symbol table.
+"""
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+
+def extract_symbols(nm_path: str, lib: str):
+"""Extract all of the private lldb symbols from the given path to llvm-nm 
and
+library to extract from."""
+
+# Matches mangled symbols containing 'lldb_private'.
+lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+
+# '-g' means we only get global symbols.
+# '-p' do not waste time sorting the symbols.
+process = subprocess.Popen(
+[nm_path, "-g", "-p", lib],
+bufsize=1,
+stdout=subprocess.PIPE,
+stdin=subprocess.PIPE,
+universal_newlines=True,
+)
+process.stdin.close()
+
+lldb_symbols = set()
+for line in process.stdout:
+match = re.match(lldb_sym_re, line)
+if match:
+symbol = match.group("symbol")
+assert (
+symbol.count(" ") == 0
+), "Regex matched too much, probably got undecorated name as well"
+# Deleting destructors start with ?_G or ?_E and can be discarded
+# because link.exe gives you a warning telling you they can't be
+# exported if you don't.
+if symbol.startswith("??_G") or symbol.startswith("??_E"):
+continue
+lldb_symbols.add(symbol)
+
+return lldb_symbols
+
+
+def main():
+parser = argparse.ArgumentParser(description="Generate LLDB dll exports")
+parser.add_argument(
+"-o", metavar="file", type=str, help="The name of the resultant export 
file."
+)
+parser.add_argument("--nm", help="Path to the llvm-nm executable.")
+parser.add_argument(
+"libs",
+metavar="lib",
+type=str,
+nargs="+",
+help="The libraries to extract symbols from.",
+)
+args = parser.parse_args()
+
+# Get the list of libraries to extract symbols from
+libs = list()
+for lib in args.libs:
+# When invoked by cmake the arguments are the cmake target names of the
+# libraries, so we need to add .lib/.a to the end and maybe lib to the
+# start to get the filename. Also allow objects.
+suffixes = [".lib", ".a", ".obj", ".o"]
+if not any([lib.endswith(s) for s i

[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-29 Thread River Riddle via lldb-commits

https://github.com/River707 closed 
https://github.com/llvm/llvm-project/pull/67628
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl resolved 
https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/67019

From 9130096419bd3211af0163ec28ba9471de398d47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH 1/9] [lldb] add command start

---
 lldb/source/Commands/CMakeLists.txt   |   1 +
 lldb/source/Commands/CommandObjectStart.cpp   | 102 ++
 lldb/source/Commands/CommandObjectStart.h |  32 ++
 .../source/Interpreter/CommandInterpreter.cpp |   2 +
 4 files changed, 137 insertions(+)
 create mode 100644 lldb/source/Commands/CommandObjectStart.cpp
 create mode 100644 lldb/source/Commands/CommandObjectStart.h

diff --git a/lldb/source/Commands/CMakeLists.txt 
b/lldb/source/Commands/CMakeLists.txt
index 6a36c5376d5c574..54c62e0f5284beb 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -30,6 +30,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
   CommandObjectSession.cpp
   CommandObjectSettings.cpp
   CommandObjectSource.cpp
+  CommandObjectStart.cpp
   CommandObjectStats.cpp
   CommandObjectTarget.cpp
   CommandObjectThread.cpp
diff --git a/lldb/source/Commands/CommandObjectStart.cpp 
b/lldb/source/Commands/CommandObjectStart.cpp
new file mode 100644
index 000..7406143c50fec1b
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectStart.cpp
@@ -0,0 +1,102 @@
+//===-- CommandObjectStart.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "CommandObjectStart.h"
+#include "lldb/Interpreter/CommandObject.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// Constructor for CommandObjectStart
+CommandObjectStart::CommandObjectStart(CommandInterpreter &interpreter)
+: CommandObjectParsed(
+  interpreter, "start",
+  "Launches the process and pauses execution at main function",
+  "start args [optional args]") {
+  // Define command arguments
+  CommandArgumentData pause_location{eArgTypeName, eArgRepeatPlain};
+  m_arguments.push_back({pause_location});
+}
+
+CommandObjectStart::~CommandObjectStart() = default;
+
+// Execute the 'start' command
+bool CommandObjectStart::DoExecute(Args &command, CommandReturnObject &result) 
{
+  // Check if the 'first' subcommand is specified
+  bool pause_at_first_instruction = false;
+
+  if (command.GetArgumentCount() == 1 &&
+  strcmp(command.GetArgumentAtIndex(0), "first") == 0) {
+pause_at_first_instruction = true;
+  }
+
+  // Get the current selected target
+  TargetSP target_sp = GetDebugger().GetSelectedTarget();
+  if (!target_sp) {
+result.AppendError("No target selected.\n");
+return false;
+  }
+
+  // Create the breakpoint at main or the first instruction
+  BreakpointSP bp_sp;
+  if (pause_at_first_instruction) {
+ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+ObjectFile *object = exe_module_sp->GetObjectFile();
+Address address = object->GetEntryPointAddress();
+
+if (!address.IsValid()) {
+  result.AppendError("Failed to get the entry point address");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+bp_sp = target_sp->CreateBreakpoint(address, false, false);
+
+  } else {
+// Create a breakpoint at the main function
+bp_sp = target_sp->CreateBreakpoint(
+nullptr, nullptr, "main", eFunctionNameTypeAuto, eLanguageTypeUnknown,
+0, eLazyBoolNo, false, false);
+  }
+
+  if (!bp_sp) {
+result.AppendError("Breakpoint creation failed.\n");
+result.SetStatus(eReturnStatusFailed);
+return false;
+  } else {
+result.GetOutputStream().Printf("Breakpoint created%s.\n",
+pause_at_first_instruction
+? " at first instruction"
+: " in main function");
+result.SetStatus(eReturnStatusSuccessFinishResult);
+  }
+
+  // Construct the process launch info
+  ProcessLaunchInfo launch_info;
+  launch_info.SetShell(HostInfo::GetDefaultShell());
+  ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+  if (!exe_module_sp) {
+result.AppendError("No executable module found.\n");
+return false;
+  }
+
+  launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
+  // Launch the process
+  StreamString stream;
+  Status error = target_sp->Launch(launch_info, &stream);
+
+  if (error.Success()) {
+result.SetStatus(eReturnStatusSuccessFinishResult);
+result.GetOutputStream().Printf("Process launched successfully.\n");
+  } else {
+result.AppendErrorWithFormat("Process launch failed: %s\n",
+ error.AsC

[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior ,Leandro Lupori
 ,David Spickett ,Nikita
 Popov ,Guray Ozen ,Nikita Popov
 ,Nikita Popov ,Alexey Bataev
 ,Jake Egan 
<5326451+jakee...@users.noreply.github.com>,Nikita
 Popov ,vic ,Mikhail R. Gadelha
 =?utf-8?q?=2C?=Alexey Bataev 
,Guillaume
 Chatelet ,JingZe Cui ,Scott Linder
 <72270781+slind...@users.noreply.github.com>,Sirish Pande 
,Louis
 Dionne ,Matthias Springer ,Ramkumar
 Ramachandra ,Joseph Huber
 <35342157+jhub...@users.noreply.github.com>,
Ingo =?utf-8?q?M=C3=BCller?= ,Matthias Springer
 ,=?utf-8?q?D=C3=A1vid_Ferenc_Szab=C3=B3?=,Amir Bishara
 ,jeanPerier ,Joseph Huber
 ,Justin Lebar ,Ramkumar
 Ramachandra ,Alexey Bataev
 ,Kazu Hirata ,Momchil Velikov
 ,Louis Dionne ,Louis Dionne
 ,Momchil Velikov ,Momchil
 Velikov ,Kristof Beyls ,Arthur
 Eubanks ,Andres Villegas ,Alexey
 Bataev ,michaelrj-google
 <71531609+michaelrj-goo...@users.noreply.github.com>,Matthew Devereau
 ,Jeff Niu ,Petr Hosek
 ,Eduard Zingerman ,Joseph Huber
 <35342157+jhub...@users.noreply.github.com>,Ziqing Luo 
,Richard
 Smith ,Florian Hahn ,Fangrui Song
 ,erichkeane ,Jim Ingham 
,Florian
 Hahn ,Louis Dionne ,Louis Dionne
 ,Artem Belevich ,ChiaHungDuan
 ,Vladislav Khmelevsky ,Chia-hung
 Duan ,Louis Dionne ,Vitaly
 Buka ,Louis Dionne ,Vitaly Buka
 ,Vitaly Buka ,Amy Huang
 ,Jason Molenda ,Vitaly Buka
 ,Amy Kwan ,Joseph Huber
 <35342157+jhub...@users.noreply.github.com>,Ziqing Luo ,Vitaly
 Buka ,Jian Cai 
,jeffreytan81
 ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,Fangrui Song 
,Vitaly
 Buka ,Arthur Eubanks ,Vitaly
 Buka ,Aart Bik
 <39774503+aart...@users.noreply.github.com>,Vitaly Buka
 ,Carl Ritson ,Diego Caballero
 ,Amara Emerson ,Amara Emerson
 ,Vitaly Buka ,Kazu Hirata
 ,Balazs Benics ,Jeff Bailey
 ,Bruno Cardoso Lopes
 ,David Green 
,jeanPerier
 ,Nikita Popov ,Fangrui Song
 ,Kazu Hirata ,Jie Fu 
,Heejin
 Ahn ,Heejin Ahn ,Nikita Popov
 ,Kazu Hirata ,Balint Cristian
 ,Kazu Hirata ,David Spickett
 ,Nikita Popov ,Tobias Hieta
 ,Guray Ozen ,Tobias Hieta
 ,Sam McCall ,Benjamin Maxwell
 ,Ivan Kosarev ,jeanPerier
 ,Sam McCall ,
Timm =?utf-8?q?B=C3=A4der?= ,Sam McCall
 ,Matthew Devereau ,Simon
 Pilgrim ,Simon Pilgrim ,Guray
 Ozen ,Ivan Kosarev ,Nikita Popov
 ,Ivan Kosarev ,Alcaro
 ,Simon Pilgrim ,Florian Hahn
 ,Ivan Kosarev ,Florian Hahn
 ,qcolombet ,Benjamin Maxwell
 ,Nikita Popov ,DianQK
 ,Nikita Popov ,Mirko Brkusanin
 ,Kiran Chandramohan ,David
 Green ,Haojian Wu ,Luke Lau
 ,Anatoly Trosinenko ,Kiran
 Chandramohan ,Felipe de Azevedo Piovezan
 ,Christian Ulmann
 ,Haojian Wu ,LLVM GN
 Syncbot ,"Ruiling, Song" ,David
 Green ,Haojian Wu ,Paulo Matos
 ,Zahira Ammarguellat ,Simon
 Pilgrim ,Matthias Springer ,Matthias
 Springer ,Florian Hahn ,"Mikhail R. Gadelha"
 ,Michael Liao ,Mikhail R.
 Gadelha =?utf-8?q?=2C?=Simon Pilgrim
 ,Simon Pilgrim ,Mirko
 Brkusanin ,"Ruiling, Song" ,Ivan
 Kosarev ,David Spickett 
,Alexey
 Bataev ,Guray Ozen ,Sam McCall
 ,Tobias Hieta ,Simon Pilgrim
 ,Luke Lau ,Siva Chandra
 ,Yinying Li
 <107574043+yinying-lisa...@users.noreply.github.com>,shen3qing1
 <145069838+shen3qi...@users.noreply.github.com>,"Mikhail R. Gadelha"
 ,Aart Bik <39774503+aart...@users.noreply.github.com>,Kazu
 Hirata ,Alex Langford ,Fabio D'Urso
 ,Craig Topper ,Craig Topper
 ,Wang Pengcheng
 <137158460+wangpc...@users.noreply.github.com>,Wang Pengcheng
 <137158460+wangpc...@users.noreply.github.com>,Walter Erquinigo
 ,Philip Reames ,Slava Zakharin
 ,Vitaly Buka ,Lang Hames
 ,Lang Hames ,Fangrui Song 
,Jonas
 Devlieghere ,Kazu Hirata ,Douglas
 Yung ,Alex Brachet ,Arthur
 Eubanks ,Nemanja Ivanovic ,Rahman
 Lavaee ,Frederic Cambus ,Christopher
 Ferris ,Krzysztof Drewniak
 ,michaelrj-google
 <71531609+michaelrj-goo...@users.noreply.github.com>,Matthias Braun
 ,Matt Harding ,Artem Belevich
 ,Florian Hahn ,Arthur Eubanks
 ,Craig Topper ,Florian Hahn
 ,Amy Huang ,Sam McCall
 ,Vitaly Buka ,Felipe de Azevedo
 Piovezan ,Philip Reames
 ,Rahman Lavaee ,Vitaly Buka
 ,Amy Huang ,Fangrui Song
 ,maxbartel ,Sylvestre Ledru
 ,
Markus =?utf-8?q?B=C3=B6ck?= ,Amy Huang
 ,Vitaly Buka ,Brad Smith
 ,Aart Bik <39774503+aart...@users.noreply.github.com>,Lang
 Hames ,Lang Hames ,Alex Richardson
 ,Lang Hames ,LLVM GN Syncbot
 ,Youngsuk Kim ,Aart Bik
 <39774503+aart...@users.noreply.github.com>,Craig Topper
 ,Craig Topper ,Kazu Hirata
 ,Kazu Hirata ,Kazu Hirata 
 =?utf-8?q?=2C?=Richard Smith ,Kazu Hirata
 ,Jason Molenda ,Jason Molenda
 ,Kai Sasaki ,Fangrui Song
 ,Kazu Hirata ,Zhuojia Shen
 ,Lang Hames ,LLVM GN Syncbot
 ,Antonio Frighetto ,Antonio
 Frighetto ,
Timm =?utf-8?q?B=C3=A4der?= ,Oskar Wirga
 <10386631+oskarwi...@users.noreply.github.com>,
Timm =?utf-8?q?B=C3=A4der?= ,Tobias Hieta
 ,Tobias Hieta ,Joseph Huber
 ,Umesh Kalappa ,
Timm =?utf-8?q?B=C3=A4der?= ,Noah Goldstein
 ,Tobias Hiet

[Lldb-commits] [lldb] [lldb] Replace lldb's DWARFDebugAbbrev implementation with llvm's (PR #67841)

2023-09-29 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/67841

The implementations are now close enough that replacing it is trivial.

>From 8913eb7f4c768545debf12dd42f2e308466f200b Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Fri, 29 Sep 2023 11:09:09 -0700
Subject: [PATCH] [lldb] Replace lldb's DWARFDebugAbbrev implementation with
 llvm's

The implementations are now close enough that replacing it is trivial.
---
 .../Plugins/SymbolFile/DWARF/CMakeLists.txt   |  1 -
 .../SymbolFile/DWARF/DWARFCompileUnit.h   |  6 +-
 .../SymbolFile/DWARF/DWARFDebugAbbrev.cpp | 63 ---
 .../SymbolFile/DWARF/DWARFDebugAbbrev.h   | 55 
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp  |  8 ++-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.h|  1 -
 .../Plugins/SymbolFile/DWARF/DWARFTypeUnit.h  |  6 +-
 .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 16 +++--
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  7 ++-
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 12 ++--
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  9 ++-
 11 files changed, 43 insertions(+), 141 deletions(-)
 delete mode 100644 lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
 delete mode 100644 lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index dad206040068716..0e4fd5b995d1ba9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -17,7 +17,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   DWARFCompileUnit.cpp
   DWARFContext.cpp
   DWARFDataExtractor.cpp
-  DWARFDebugAbbrev.cpp
   DWARFDebugAranges.cpp
   DWARFDebugArangeSet.cpp
   DWARFDebugInfo.cpp
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index ab3017ba0ffcbca..65debac4c7d9265 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -12,6 +12,10 @@
 #include "DWARFUnit.h"
 #include "llvm/Support/Error.h"
 
+namespace llvm {
+class DWARFAbbreviationDeclarationSet;
+}
+
 class DWARFCompileUnit : public DWARFUnit {
 public:
   void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges) override;
@@ -27,7 +31,7 @@ class DWARFCompileUnit : public DWARFUnit {
 private:
   DWARFCompileUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid,
const DWARFUnitHeader &header,
-   const DWARFAbbreviationDeclarationSet &abbrevs,
+   const llvm::DWARFAbbreviationDeclarationSet &abbrevs,
DIERef::Section section, bool is_dwo)
   : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {}
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
deleted file mode 100644
index f3c2755c5a527cc..000
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//===-- DWARFDebugAbbrev.cpp 
--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "DWARFDebugAbbrev.h"
-#include "DWARFDataExtractor.h"
-#include "DWARFFormValue.h"
-#include "lldb/Utility/Stream.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// DWARFDebugAbbrev constructor
-DWARFDebugAbbrev::DWARFDebugAbbrev(const DWARFDataExtractor &data)
-: m_abbrevCollMap(), m_prev_abbr_offset_pos(m_abbrevCollMap.end()),
-  m_data(data.GetAsLLVM()) {}
-
-// DWARFDebugAbbrev::Parse()
-llvm::Error DWARFDebugAbbrev::parse() {
-  if (!m_data)
-return llvm::Error::success();
-
-  lldb::offset_t offset = 0;
-
-  while (m_data->isValidOffset(offset)) {
-uint32_t initial_cu_offset = offset;
-DWARFAbbreviationDeclarationSet abbrevDeclSet;
-
-llvm::Error error = abbrevDeclSet.extract(*m_data, &offset);
-if (error) {
-  m_data = std::nullopt;
-  return error;
-}
-
-m_abbrevCollMap[initial_cu_offset] = abbrevDeclSet;
-  }
-  m_data = std::nullopt;
-  m_prev_abbr_offset_pos = m_abbrevCollMap.end();
-  return llvm::ErrorSuccess();
-}
-
-// DWARFDebugAbbrev::GetAbbreviationDeclarationSet()
-const DWARFAbbreviationDeclarationSet *
-DWARFDebugAbbrev::GetAbbreviationDeclarationSet(
-dw_offset_t cu_abbr_offset) const {
-  DWARFAbbreviationDeclarationCollMapConstIter end = m_abbrevCollMap.end();
-  DWARFAbbreviationDeclarationCollMapConstIter pos;
-  if (m_prev_abbr_offset_pos != end &&
-  m_prev_abbr_offset_pos->first == cu_abbr_offset)
-return &(m_prev_abbr_offset_pos->second);
-  else {
-

[Lldb-commits] [lldb] [lldb] Replace lldb's DWARFDebugAbbrev implementation with llvm's (PR #67841)

2023-09-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes

The implementations are now close enough that replacing it is trivial.

---
Full diff: https://github.com/llvm/llvm-project/pull/67841.diff


11 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (+5-1) 
- (removed) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (-63) 
- (removed) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h (-55) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(+5-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h (+5-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+11-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (+4-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+7-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+6-3) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index dad206040068716..0e4fd5b995d1ba9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -17,7 +17,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   DWARFCompileUnit.cpp
   DWARFContext.cpp
   DWARFDataExtractor.cpp
-  DWARFDebugAbbrev.cpp
   DWARFDebugAranges.cpp
   DWARFDebugArangeSet.cpp
   DWARFDebugInfo.cpp
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index ab3017ba0ffcbca..65debac4c7d9265 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -12,6 +12,10 @@
 #include "DWARFUnit.h"
 #include "llvm/Support/Error.h"
 
+namespace llvm {
+class DWARFAbbreviationDeclarationSet;
+}
+
 class DWARFCompileUnit : public DWARFUnit {
 public:
   void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges) override;
@@ -27,7 +31,7 @@ class DWARFCompileUnit : public DWARFUnit {
 private:
   DWARFCompileUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid,
const DWARFUnitHeader &header,
-   const DWARFAbbreviationDeclarationSet &abbrevs,
+   const llvm::DWARFAbbreviationDeclarationSet &abbrevs,
DIERef::Section section, bool is_dwo)
   : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {}
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
deleted file mode 100644
index f3c2755c5a527cc..000
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//===-- DWARFDebugAbbrev.cpp 
--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "DWARFDebugAbbrev.h"
-#include "DWARFDataExtractor.h"
-#include "DWARFFormValue.h"
-#include "lldb/Utility/Stream.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// DWARFDebugAbbrev constructor
-DWARFDebugAbbrev::DWARFDebugAbbrev(const DWARFDataExtractor &data)
-: m_abbrevCollMap(), m_prev_abbr_offset_pos(m_abbrevCollMap.end()),
-  m_data(data.GetAsLLVM()) {}
-
-// DWARFDebugAbbrev::Parse()
-llvm::Error DWARFDebugAbbrev::parse() {
-  if (!m_data)
-return llvm::Error::success();
-
-  lldb::offset_t offset = 0;
-
-  while (m_data->isValidOffset(offset)) {
-uint32_t initial_cu_offset = offset;
-DWARFAbbreviationDeclarationSet abbrevDeclSet;
-
-llvm::Error error = abbrevDeclSet.extract(*m_data, &offset);
-if (error) {
-  m_data = std::nullopt;
-  return error;
-}
-
-m_abbrevCollMap[initial_cu_offset] = abbrevDeclSet;
-  }
-  m_data = std::nullopt;
-  m_prev_abbr_offset_pos = m_abbrevCollMap.end();
-  return llvm::ErrorSuccess();
-}
-
-// DWARFDebugAbbrev::GetAbbreviationDeclarationSet()
-const DWARFAbbreviationDeclarationSet *
-DWARFDebugAbbrev::GetAbbreviationDeclarationSet(
-dw_offset_t cu_abbr_offset) const {
-  DWARFAbbreviationDeclarationCollMapConstIter end = m_abbrevCollMap.end();
-  DWARFAbbreviationDeclarationCollMapConstIter pos;
-  if (m_prev_abbr_offset_pos != end &&
-  m_prev_abbr_offset_pos->first == cu_abbr_offset)
-return &(m_prev_abbr_offset_pos->second);
-  else {
-pos = m_abbrevCollMap.find(cu_abbr_offset);
-m_prev_abbr_offset_pos = pos;
-  }
-
-  if (pos != m_abbrevCollMap.end())
-return &(pos->second);
-  return nullptr;
-}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDe

[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/67019

From 2cfb8089b455113524921d43565f1e1c1b569d8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH 1/9] [lldb] add command start

---
 lldb/source/Commands/CMakeLists.txt   |   1 +
 lldb/source/Commands/CommandObjectStart.cpp   | 102 ++
 lldb/source/Commands/CommandObjectStart.h |  32 ++
 .../source/Interpreter/CommandInterpreter.cpp |   2 +
 4 files changed, 137 insertions(+)
 create mode 100644 lldb/source/Commands/CommandObjectStart.cpp
 create mode 100644 lldb/source/Commands/CommandObjectStart.h

diff --git a/lldb/source/Commands/CMakeLists.txt 
b/lldb/source/Commands/CMakeLists.txt
index 6a36c5376d5c574..54c62e0f5284beb 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -30,6 +30,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
   CommandObjectSession.cpp
   CommandObjectSettings.cpp
   CommandObjectSource.cpp
+  CommandObjectStart.cpp
   CommandObjectStats.cpp
   CommandObjectTarget.cpp
   CommandObjectThread.cpp
diff --git a/lldb/source/Commands/CommandObjectStart.cpp 
b/lldb/source/Commands/CommandObjectStart.cpp
new file mode 100644
index 000..7406143c50fec1b
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectStart.cpp
@@ -0,0 +1,102 @@
+//===-- CommandObjectStart.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "CommandObjectStart.h"
+#include "lldb/Interpreter/CommandObject.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// Constructor for CommandObjectStart
+CommandObjectStart::CommandObjectStart(CommandInterpreter &interpreter)
+: CommandObjectParsed(
+  interpreter, "start",
+  "Launches the process and pauses execution at main function",
+  "start args [optional args]") {
+  // Define command arguments
+  CommandArgumentData pause_location{eArgTypeName, eArgRepeatPlain};
+  m_arguments.push_back({pause_location});
+}
+
+CommandObjectStart::~CommandObjectStart() = default;
+
+// Execute the 'start' command
+bool CommandObjectStart::DoExecute(Args &command, CommandReturnObject &result) 
{
+  // Check if the 'first' subcommand is specified
+  bool pause_at_first_instruction = false;
+
+  if (command.GetArgumentCount() == 1 &&
+  strcmp(command.GetArgumentAtIndex(0), "first") == 0) {
+pause_at_first_instruction = true;
+  }
+
+  // Get the current selected target
+  TargetSP target_sp = GetDebugger().GetSelectedTarget();
+  if (!target_sp) {
+result.AppendError("No target selected.\n");
+return false;
+  }
+
+  // Create the breakpoint at main or the first instruction
+  BreakpointSP bp_sp;
+  if (pause_at_first_instruction) {
+ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+ObjectFile *object = exe_module_sp->GetObjectFile();
+Address address = object->GetEntryPointAddress();
+
+if (!address.IsValid()) {
+  result.AppendError("Failed to get the entry point address");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+bp_sp = target_sp->CreateBreakpoint(address, false, false);
+
+  } else {
+// Create a breakpoint at the main function
+bp_sp = target_sp->CreateBreakpoint(
+nullptr, nullptr, "main", eFunctionNameTypeAuto, eLanguageTypeUnknown,
+0, eLazyBoolNo, false, false);
+  }
+
+  if (!bp_sp) {
+result.AppendError("Breakpoint creation failed.\n");
+result.SetStatus(eReturnStatusFailed);
+return false;
+  } else {
+result.GetOutputStream().Printf("Breakpoint created%s.\n",
+pause_at_first_instruction
+? " at first instruction"
+: " in main function");
+result.SetStatus(eReturnStatusSuccessFinishResult);
+  }
+
+  // Construct the process launch info
+  ProcessLaunchInfo launch_info;
+  launch_info.SetShell(HostInfo::GetDefaultShell());
+  ModuleSP exe_module_sp = target_sp->GetExecutableModule();
+  if (!exe_module_sp) {
+result.AppendError("No executable module found.\n");
+return false;
+  }
+
+  launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
+  // Launch the process
+  StreamString stream;
+  Status error = target_sp->Launch(launch_info, &stream);
+
+  if (error.Success()) {
+result.SetStatus(eReturnStatusSuccessFinishResult);
+result.GetOutputStream().Printf("Process launched successfully.\n");
+  } else {
+result.AppendErrorWithFormat("Process launch failed: %s\n",
+ error.AsC

[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik updated 
https://github.com/llvm/llvm-project/pull/67373

>From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour 
Date: Mon, 25 Sep 2023 13:56:43 -0700
Subject: [PATCH] [Clang] Fix crash when ill-formed code is treated as a
 deduction guide

In some cases where ill-formed code could be interpreted as a deduction guide
we can crash because we reach an unreachable path. This fixes this issue by
introducing a diagnostic instead.

Fixes: https://github.com/llvm/llvm-project/issues/65522
---
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 clang/lib/Sema/SemaTemplateInstantiate.cpp   |  4 +++-
 clang/test/SemaCXX/gh65522.cpp   | 11 +++
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 clang/test/SemaCXX/gh65522.cpp

diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f4eb02fd9570c2f..c3c1810fd7934a2 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5414,6 +5414,8 @@ def note_constraint_normalization_here : Note<
 def note_parameter_mapping_substitution_here : Note<
   "while substituting into concept arguments here; substitution failures not "
   "allowed in concept arguments">;
+def note_building_deduction_guide_here : Note<
+  "while building implicit deduction guide first needed here">;
 def note_lambda_substitution_here : Note<
   "while substituting into a lambda expression here">;
 def note_instantiation_contexts_suppressed : Note<
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 00a36696cf90450..1ed3df5a011bcb6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1075,7 +1075,9 @@ void Sema::PrintInstantiationStack() {
   << Active->InstantiationRange;
   break;
 case CodeSynthesisContext::BuildingDeductionGuides:
-  llvm_unreachable("unexpected deduction guide in instantiation stack");
+  Diags.Report(Active->PointOfInstantiation,
+   diag::note_building_deduction_guide_here);
+  break;
 }
   }
 }
diff --git a/clang/test/SemaCXX/gh65522.cpp b/clang/test/SemaCXX/gh65522.cpp
new file mode 100644
index 000..2d6331b0372a31d
--- /dev/null
+++ b/clang/test/SemaCXX/gh65522.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++20 -Wc++17-compat -verify -Wno-unused %s
+
+class X {};
+
+template
+class B3 { // expected-note {{candidate template ignored: could not match 
'B3' against 'int'}}
+  template B3(T); // expected-warning 2{{non-type template parameter of 
type 'X' is incompatible with C++ standards before C++20}} \
+   // expected-note {{candidate template ignored: couldn't 
infer template argument 'x'}}
+};
+B3 b3 = 0; // expected-error {{no viable constructor or deduction guide for 
deduction of template arguments of 'B3'}} \
+   // expected-note {{while building implicit deduction guide first 
needed here}}

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


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/67019

From c2396253b9584af9eabe1e67ed922f5f5f0e879c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH] [lldb] add stop-at-user-entry option to process launch

[lldb] add command start

[lldb] add stop-at-main option to process launch

Revert "[lldb] add command start"

This reverts commit 11270775865a8415e00b4d899703f84717344967.

[lldb] remove shell modification | make bp one-shot

add GetUserEntryPointName method | changed bp creating method

use clang-format

change option description | using set for entrypoint names

use SetVector | change comments style

replace const char* by StringRef | change if statements to return early
---
 lldb/include/lldb/Target/Language.h   | 20 ++--
 .../Commands/CommandOptionsProcessLaunch.cpp  | 48 ++-
 lldb/source/Commands/Options.td   |  4 ++
 .../Language/CPlusPlus/CPlusPlusLanguage.h|  6 ++-
 .../Plugins/Language/ObjC/ObjCLanguage.h  |  2 +
 .../ObjCPlusPlus/ObjCPlusPlusLanguage.h   |  2 +
 6 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/lldb/include/lldb/Target/Language.h 
b/lldb/include/lldb/Target/Language.h
index a6b9ccaf31b3c42..cf781fc0e8dd5ee 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -95,21 +95,24 @@ class Language : public PluginInterface {
   class EitherTypeScavenger : public TypeScavenger {
   public:
 EitherTypeScavenger() : TypeScavenger() {
-  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+  for (std::shared_ptr scavenger :
+   {std::shared_ptr(new ScavengerTypes())...}) {
 if (scavenger)
   m_scavengers.push_back(scavenger);
   }
 }
+
   protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = false;
-  for (auto& scavenger : m_scavengers) {
+  for (auto &scavenger : m_scavengers) {
 if (scavenger && scavenger->Find(exe_scope, key, results, append))
   return true;
   }
   return false;
 }
+
   private:
 std::vector> m_scavengers;
   };
@@ -118,22 +121,25 @@ class Language : public PluginInterface {
   class UnionTypeScavenger : public TypeScavenger {
   public:
 UnionTypeScavenger() : TypeScavenger() {
-  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+  for (std::shared_ptr scavenger :
+   {std::shared_ptr(new ScavengerTypes())...}) {
 if (scavenger)
   m_scavengers.push_back(scavenger);
   }
 }
+
   protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = true;
   bool success = false;
-  for (auto& scavenger : m_scavengers) {
+  for (auto &scavenger : m_scavengers) {
 if (scavenger)
   success = scavenger->Find(exe_scope, key, results, append) || 
success;
   }
   return success;
 }
+
   private:
 std::vector> m_scavengers;
   };
@@ -160,6 +166,10 @@ class Language : public PluginInterface {
 
   virtual lldb::LanguageType GetLanguageType() const = 0;
 
+  // Implement this function to return the user-defined entry point name
+  // for the language
+  virtual llvm::StringRef GetUserEntryPointName() const { return {}; }
+
   virtual bool IsTopLevelFunction(Function &function);
 
   virtual bool IsSourceFile(llvm::StringRef file_path) const = 0;
@@ -232,7 +242,7 @@ class Language : public PluginInterface {
   // a match.  But we wouldn't want this to match AnotherA::my_function.  The
   // user is specifying a truncated path, not a truncated set of characters.
   // This function does a language-aware comparison for those purposes.
-  virtual bool DemangledNameContainsPath(llvm::StringRef path, 
+  virtual bool DemangledNameContainsPath(llvm::StringRef path,
  ConstString demangled) const;
 
   // if a language has a custom format for printing variable declarations that
diff --git a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp 
b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
index 85ad8ff5e07132c..2645b7bdd8c4ae6 100644
--- a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
@@ -8,6 +8,7 @@
 
 #include "CommandOptionsProcessLaunch.h"
 
+#include "lldb/Core/Module.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/OptionParser.h"
@@ -15,11 +16,13 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandOptionArgumentTable.h"
 #include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "

[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread José Lira Junior via lldb-commits

junior-jl wrote:

> @junior-jl You pushed 921 commits to your branch, I doubt you wanted to do 
> this.
> 
> To fix this, I'd first find all your commits (so you don't lose your previous 
> work):
> 
> ```
> $ git log --author "José Lira Junior" # or your email address
> ```
> 
> Save the commit hashes to recover them later on.
> 
> I'd reset your branch to main:
> 
> ```
> $ git checkout start
> $ git fetch origin
> $ git reset --hard origin/main
> ```
> 
> Then, you just have to cherry-pick the commits you saved earlier:
> 
> ```
> $ git cherry-pick 
> ```
> 
> Finally, push your branch again to your personal GitHub remote:
> 
> ```
> $ git push -f  start
> ```
> 
> I think you can also squash all the commits into a single one to reduce the 
> noise and make it easier to revert in case your patch causes some issues when 
> it lands.

Oh, thank you so much!

I guess it is correct now.

https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [OpenMPIRBuilder] Remove wrapper function in `createTask` (PR #67723)

2023-09-29 Thread via lldb-commits

https://github.com/shraiysh edited 
https://github.com/llvm/llvm-project/pull/67723
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2e12fc3 - [lldb][NFCI] Remove unused constructors from BreakpointName

2023-09-29 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-09-29T12:06:13-07:00
New Revision: 2e12fc3d04032be743b2aded354d81d53c5195ec

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

LOG: [lldb][NFCI] Remove unused constructors from BreakpointName

There is only one constructor in use so the rest can be removed.

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointName.h
lldb/source/Breakpoint/BreakpointName.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointName.h 
b/lldb/include/lldb/Breakpoint/BreakpointName.h
index 8786dbc9a163517..22f017c77b26030 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointName.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointName.h
@@ -141,23 +141,11 @@ class BreakpointName {
{
  SetHelp(help);
}
-  
-  BreakpointName(ConstString name,
- BreakpointOptions &options,
- const Permissions &permissions = Permissions(),
- const char *help = nullptr) :
-  m_name(name), m_options(options), 
-  m_permissions(permissions) {
-SetHelp(help);
-  };
   
   BreakpointName(const BreakpointName &rhs) :
   m_name(rhs.m_name), m_options(rhs.m_options),
   m_permissions(rhs.m_permissions), m_help(rhs.m_help)
   {}
-  
-  BreakpointName(ConstString name, const Breakpoint &bkpt,
- const char *help);
   
   ConstString GetName() const { return m_name; }
   BreakpointOptions &GetOptions() { return m_options; }

diff  --git a/lldb/source/Breakpoint/BreakpointName.cpp 
b/lldb/source/Breakpoint/BreakpointName.cpp
index cb513fb436d6fe2..5a4aad172fc028a 100644
--- a/lldb/source/Breakpoint/BreakpointName.cpp
+++ b/lldb/source/Breakpoint/BreakpointName.cpp
@@ -28,13 +28,6 @@ const Flags::ValueType 
BreakpointName::Permissions::permissions_mask
   (0x5u)
 };
 
-BreakpointName::BreakpointName(ConstString name, const Breakpoint &bkpt,
- const char *help) :
-  m_name(name), m_options(bkpt.GetOptions())
-{
-  SetHelp(help);
-}
-
 bool BreakpointName::Permissions::GetDescription(Stream *s,
  lldb::DescriptionLevel level) 
{
 if (!AnySet())



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


[Lldb-commits] [lldb] [lldb] Replace lldb's DWARFDebugAbbrev implementation with llvm's (PR #67841)

2023-09-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.

Exciting!

https://github.com/llvm/llvm-project/pull/67841
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Replace lldb's DWARFDebugAbbrev implementation with llvm's (PR #67841)

2023-09-29 Thread Greg Clayton via lldb-commits

https://github.com/clayborg approved this pull request.


https://github.com/llvm/llvm-project/pull/67841
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Yinying Li via lldb-commits

https://github.com/yinying-lisa-li updated 
https://github.com/llvm/llvm-project/pull/67845

>From ab46cf0f76aeaa78f2eb8865d647400f810e35ec Mon Sep 17 00:00:00 2001
From: Yinying Li 
Date: Fri, 29 Sep 2023 19:09:21 +
Subject: [PATCH] [mlir][sparse] Update Enum name for CompressedWithHigh

Change CompressedWithHigh to LooseCompressed.
---
 mlir/include/mlir-c/Dialect/SparseTensor.h|  28 ++---
 .../mlir/Dialect/SparseTensor/IR/Enums.h  | 106 +-
 .../Dialect/SparseTensor/IR/SparseTensor.h|   4 +-
 .../SparseTensor/IR/SparseTensorAttrDefs.td   |   2 +-
 .../Bindings/Python/DialectSparseTensor.cpp   |  14 +--
 .../SparseTensor/IR/Detail/LvlTypeParser.cpp  |   2 +-
 .../SparseTensor/IR/SparseTensorDialect.cpp   |  10 +-
 .../SparseTensor/Transforms/LoopEmitter.cpp   |  16 +--
 .../Transforms/SparseTensorCodegen.cpp|   8 +-
 .../Transforms/Sparsification.cpp |   6 +-
 .../lib/Dialect/SparseTensor/Utils/Merger.cpp |   4 +-
 .../SparseTensor/roundtrip_encoding.mlir  |   2 +-
 .../SparseTensor/CPU/sparse_pack_libgen.mlir  |   2 +-
 13 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h 
b/mlir/include/mlir-c/Dialect/SparseTensor.h
index fecbeaf6b0f9d6c..7e47e54e7361d54 100644
--- a/mlir/include/mlir-c/Dialect/SparseTensor.h
+++ b/mlir/include/mlir-c/Dialect/SparseTensor.h
@@ -26,20 +26,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, 
sparse_tensor);
 /// If updating, keep them in sync and update the static_assert in the impl
 /// file.
 enum MlirSparseTensorDimLevelType {
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,// 0b00010_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9, // 0b00010_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,// 0b00010_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,// 0b00100_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17, // 0b00100_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18, // 0b00100_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,  // 0b00100_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI = 32,   // 0b01000_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU = 33,// 0b01000_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NO = 34,// 0b01000_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU_NO = 35, // 0b01000_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,  // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4,   // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,  // 0b00010_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9,   // 0b00010_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,  // 0b00010_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11,   // 0b00010_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,  // 0b00100_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17,   // 0b00100_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18,   // 0b00100_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,// 0b00100_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED = 32,   // 0b01000_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NU = 33,// 0b01000_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NO = 34,// 0b01000_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NU_NO = 35, // 0b01000_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,// 0b1_00
 };
 
 
//===--===//
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h 
b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
index 7a1aed509c2a360..bc351ec52c0946b 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
@@ -170,33 +170,33 @@ enum class Action : uint32_t {
 // TODO: We should generalize TwoOutOfFour to N out of M and use property to
 // encode the value of N and M.
 // TODO: Update DimLevelType to use lower 8 bits for storage formats and the
-// higher 4 bits to store level properties. Consider CompressedWithHi and
+// higher 4 bits to store level properties. Consider LooseCompressed and
 // TwoOutOfFour as properties instead of formats.
 enum class DimLevelType : uint8_t {
-  Undef = 0, // 0b0_00
-  Dense = 4, // 0b1_00
-  Compressed = 8,// 0b00010_00
-  CompressedNu = 9,  // 0b00010_01
-  CompressedNo = 10, // 0b00010_10
-  CompressedNuNo = 11,   // 0b00010_11
-  Singleton = 16,// 0b00100_00
-  SingletonNu = 17,  // 0b00100_01
-  SingletonNo = 18,  // 0b00100_10
-  SingletonNuNo = 19,

[Lldb-commits] [lldb] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Peiming Liu via lldb-commits


@@ -26,20 +26,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, 
sparse_tensor);
 /// If updating, keep them in sync and update the static_assert in the impl
 /// file.
 enum MlirSparseTensorDimLevelType {
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,// 0b00010_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9, // 0b00010_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,// 0b00010_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,// 0b00100_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17, // 0b00100_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18, // 0b00100_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,  // 0b00100_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI = 32,   // 0b01000_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU = 33,// 0b01000_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NO = 34,// 0b01000_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU_NO = 35, // 0b01000_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,  // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4,   // 0b1_00

PeimingLiu wrote:

Not directly related to this PR, but can we get rid of this enum completely? We 
can have a `class LevelType` that stores an integer (which encodes level 
format/property).

https://github.com/llvm/llvm-project/pull/67845
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Aart Bik via lldb-commits

https://github.com/aartbik approved this pull request.


https://github.com/llvm/llvm-project/pull/67845
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/67851

None

>From 78edde6c7b6294c0e1a78b18cdf81d156c636a38 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 29 Sep 2023 15:44:05 -0400
Subject: [PATCH] [LLDB] Export DWARF Parser symbols for external language
 plugins

---
 .../include/lldb/Expression/DWARFExpression.h |   5 +-
 .../lldb/Expression/DWARFExpressionList.h |   3 +-
 lldb/include/lldb/Symbol/TypeSystem.h |   7 +-
 lldb/source/Plugins/SymbolFile/DWARF/DIERef.h |   7 +-
 .../Plugins/SymbolFile/DWARF/DWARFASTParser.h |   4 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.h| 146 ++
 .../SymbolFile/DWARF/DWARFAttribute.cpp   |   1 +
 .../Plugins/SymbolFile/DWARF/DWARFAttribute.h |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFCompileUnit.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugAbbrev.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugArangeSet.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugAranges.h  |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |   2 +-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugMacro.h|   4 +-
 .../SymbolFile/DWARF/DWARFDebugRanges.h   |   4 +-
 .../SymbolFile/DWARF/DWARFDeclContext.cpp |   1 +
 .../SymbolFile/DWARF/DWARFDeclContext.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |   4 +-
 .../Plugins/SymbolFile/DWARF/DWARFIndex.h |   2 +-
 .../Plugins/SymbolFile/DWARF/DWARFTypeUnit.h  |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  14 +-
 .../SymbolFile/DWARF/ManualDWARFIndex.h   |   2 +-
 .../Plugins/SymbolFile/DWARF/NameToDIE.h  |   5 +-
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  64 
 .../DWARF/SymbolFileDWARFDebugMap.cpp |   2 +
 .../DWARF/SymbolFileDWARFDebugMap.h   |  16 +-
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |   9 +-
 .../SymbolFile/DWARF/UniqueDWARFASTType.cpp   |   1 +
 .../SymbolFile/DWARF/UniqueDWARFASTType.h |   5 +-
 33 files changed, 197 insertions(+), 135 deletions(-)

diff --git a/lldb/include/lldb/Expression/DWARFExpression.h 
b/lldb/include/lldb/Expression/DWARFExpression.h
index 380910ba0ea3d61..128c3637e9c24a3 100644
--- a/lldb/include/lldb/Expression/DWARFExpression.h
+++ b/lldb/include/lldb/Expression/DWARFExpression.h
@@ -18,9 +18,8 @@
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
 #include 
 
-class DWARFUnit;
-
 namespace lldb_private {
+class DWARFUnit;
 
 /// \class DWARFExpression DWARFExpression.h
 /// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
@@ -45,7 +44,7 @@ class DWARFExpression {
   DWARFExpression(const DataExtractor &data);
 
   /// Destructor
-  virtual ~DWARFExpression();
+  ~DWARFExpression();
 
   /// Return true if the location expression contains data
   bool IsValid() const;
diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h 
b/lldb/include/lldb/Expression/DWARFExpressionList.h
index c0939647056dcbf..63c772e51dfcba6 100644
--- a/lldb/include/lldb/Expression/DWARFExpressionList.h
+++ b/lldb/include/lldb/Expression/DWARFExpressionList.h
@@ -13,9 +13,8 @@
 #include "lldb/Utility/RangeMap.h"
 #include "lldb/lldb-private.h"
 
-class DWARFUnit;
-
 namespace lldb_private {
+class DWARFUnit;
 
 /// \class DWARFExpressionList DWARFExpressionList.h
 /// "lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..4cb12f8ca8632e1 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,11 +28,12 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/lldb-private.h"
 
-class DWARFDIE;
-class DWARFASTParser;
 class PDBASTParser;
 
 namespace lldb_private {
+class DWARFDIE;
+class DWARFASTParser;
+
 namespace npdb {
   class PdbAstBuilder;
 } // namespace npdb
@@ -581,6 +582,6 @@ class TypeSystemMap {
   std::optional create_callback = std::nullopt);
   };
 
-} // namespace lldb_private
+  } // namespace lldb_private
 
 #endif // LLDB_SYMBOL_TYPESYSTEM_H
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index b5a5cfe263f7804..7864189503a9666 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 
+namespace lldb_private {
 /// Identifies a DWARF debug info entry within a given Module. It contains 
three
 /// "coordinates":
 /// - file_index: identifies the separate stand alone debug info file
@@ -131,10 +132,12 @@ class DIERef {
 static_assert(sizeof(DIERef) == 8);
 
 typedef std::vector DIEArray;
+} // namespace lldb_private
 
 namespace llvm {
-template<> struct format_provider {

[Lldb-commits] [lldb] 12f4e11 - [lldb][NFCI] Remove unneeded use of ConstString from StructuredDataDarwinLog

2023-09-29 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-09-29T14:09:22-07:00
New Revision: 12f4e113869ff93d7b25cfc83c56f546e3d52c0f

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

LOG: [lldb][NFCI] Remove unneeded use of ConstString from 
StructuredDataDarwinLog

Added: 


Modified: 
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 2ea556ad954a94b..61e04900da342d2 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -1254,8 +1254,6 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process 
&process,
 return;
   }
 
-  const ConstString logging_module_name = ConstString(logging_module_cstr);
-
   // We need to see libtrace in the list of modules before we can enable
   // tracing for the target process.
   bool found_logging_support_module = false;
@@ -1266,7 +1264,7 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process 
&process,
 
 auto &file_spec = module_sp->GetFileSpec();
 found_logging_support_module =
-(file_spec.GetFilename() == logging_module_name);
+(file_spec.GetFilename() == logging_module_cstr);
 if (found_logging_support_module)
   break;
   }
@@ -1276,8 +1274,7 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process 
&process,
   "StructuredDataDarwinLog::%s logging module %s "
   "has not yet been loaded, can't set a breakpoint "
   "yet (process uid %u)",
-  __FUNCTION__, logging_module_name.AsCString(),
-  process.GetUniqueID());
+  __FUNCTION__, logging_module_cstr, process.GetUniqueID());
 return;
   }
 
@@ -1287,8 +1284,7 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process 
&process,
   LLDB_LOGF(log,
 "StructuredDataDarwinLog::%s post-init hook breakpoint "
 "set for logging module %s (process uid %u)",
-__FUNCTION__, logging_module_name.AsCString(),
-process.GetUniqueID());
+__FUNCTION__, logging_module_cstr, process.GetUniqueID());
 
   // We need to try the enable here as well, which will succeed in the event
   // that we're attaching to (rather than launching) the process and the



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


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via lldb-commits

shafik wrote:

ping

https://github.com/llvm/llvm-project/pull/67373
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/67851

>From 616b08f7c9e30b501d5f0fe2ff8d6fbf3ecb9582 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 29 Sep 2023 15:44:05 -0400
Subject: [PATCH] [LLDB] Export DWARF Parser symbols for external language
 plugins

---
 .../include/lldb/Expression/DWARFExpression.h |   6 +-
 .../lldb/Expression/DWARFExpressionList.h |   4 +-
 lldb/include/lldb/Symbol/TypeSystem.h |   8 +-
 lldb/source/Plugins/SymbolFile/DWARF/DIERef.h |   7 +-
 .../Plugins/SymbolFile/DWARF/DWARFASTParser.h |   4 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.h| 146 ++
 .../SymbolFile/DWARF/DWARFAttribute.cpp   |   1 +
 .../Plugins/SymbolFile/DWARF/DWARFAttribute.h |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFCompileUnit.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugAbbrev.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugArangeSet.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugAranges.h  |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |   2 +-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugMacro.h|   4 +-
 .../SymbolFile/DWARF/DWARFDebugRanges.h   |   4 +-
 .../SymbolFile/DWARF/DWARFDeclContext.cpp |   1 +
 .../SymbolFile/DWARF/DWARFDeclContext.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |   4 +-
 .../Plugins/SymbolFile/DWARF/DWARFIndex.h |   2 +-
 .../Plugins/SymbolFile/DWARF/DWARFTypeUnit.h  |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  14 +-
 .../SymbolFile/DWARF/ManualDWARFIndex.h   |   2 +-
 .../Plugins/SymbolFile/DWARF/NameToDIE.h  |   5 +-
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   5 +-
 .../DWARF/SymbolFileDWARFDebugMap.cpp |   2 +
 .../DWARF/SymbolFileDWARFDebugMap.h   |  16 +-
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |   9 +-
 .../SymbolFile/DWARF/UniqueDWARFASTType.cpp   |   1 +
 .../SymbolFile/DWARF/UniqueDWARFASTType.h |   5 +-
 33 files changed, 171 insertions(+), 105 deletions(-)

diff --git a/lldb/include/lldb/Expression/DWARFExpression.h 
b/lldb/include/lldb/Expression/DWARFExpression.h
index 380910ba0ea3d61..c9d747c4a82ad88 100644
--- a/lldb/include/lldb/Expression/DWARFExpression.h
+++ b/lldb/include/lldb/Expression/DWARFExpression.h
@@ -18,10 +18,10 @@
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
 #include 
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpression DWARFExpression.h
 /// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
 /// expression and interprets it.
@@ -45,7 +45,7 @@ class DWARFExpression {
   DWARFExpression(const DataExtractor &data);
 
   /// Destructor
-  virtual ~DWARFExpression();
+  ~DWARFExpression();
 
   /// Return true if the location expression contains data
   bool IsValid() const;
diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h 
b/lldb/include/lldb/Expression/DWARFExpressionList.h
index c0939647056dcbf..2bb83e05c8f304e 100644
--- a/lldb/include/lldb/Expression/DWARFExpressionList.h
+++ b/lldb/include/lldb/Expression/DWARFExpressionList.h
@@ -13,10 +13,10 @@
 #include "lldb/Utility/RangeMap.h"
 #include "lldb/lldb-private.h"
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpressionList DWARFExpressionList.h
 /// "lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file
 /// address range to a single DWARF location expression.
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..377fc51000b89cd 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,11 +28,13 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/lldb-private.h"
 
-class DWARFDIE;
-class DWARFASTParser;
 class PDBASTParser;
 
 namespace lldb_private {
+
+class DWARFDIE;
+class DWARFASTParser;
+
 namespace npdb {
   class PdbAstBuilder;
 } // namespace npdb
@@ -579,7 +581,7 @@ class TypeSystemMap {
   llvm::Expected GetTypeSystemForLanguage(
   lldb::LanguageType language,
   std::optional create_callback = std::nullopt);
-  };
+};
 
 } // namespace lldb_private
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index b5a5cfe263f7804..7864189503a9666 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 
+namespace lldb_private {
 /// Identifies a DWARF debug info entry within a given Module. It contains 
three
 /// "coordinates":
 /// - file_index: identifies the separate stand alone debug info file
@@ -131,10 +132,12 @@ class DIERef {
 static_assert(sizeof(DIERef) == 8);
 
 typedef

[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo ready_for_review 
https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo edited 
https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes

I'm developing support for the Mojo language as an out-of-tree plugin, and in 
order to implement the DWARF AST parser, I need to export the DWARF-related 
symbols that the TypeSystem expects me to use.
I have CMake configured to export all the lldb_private symbols, so, in order 
get access to these DWARF symbols, I need to move them to the lldb_private 
namespace.
This change is very NFC, but I also made two other changes: 
- remove the virtual destructor from `DWARFExpression` which doesn't have 
virtual methods but was giving me linking issues
- remove the clang parser as friend of SymbolFileDWARF and simply make its 
protected methods public, as both the clang and the mojo parser need to access 
these functions.

After these changes I was able to do some basic dwarf processing in my plugin 
and make the type system happy.

---

Patch is 43.30 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/67851.diff


33 Files Affected:

- (modified) lldb/include/lldb/Expression/DWARFExpression.h (+3-3) 
- (modified) lldb/include/lldb/Expression/DWARFExpressionList.h (+2-2) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+5-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DIERef.h (+5-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
(+83-63) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp (+1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h (+3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h (+1-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp (+1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (+3-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h (+3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (+9-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h (+3-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+3-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h 
(+9-7) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (+6-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp (+1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h (+3-2) 


``diff
diff --git a/lldb/include/lldb/Expression/DWARFExpression.h 
b/lldb/include/lldb/Expression/DWARFExpression.h
index 380910ba0ea3d61..c9d747c4a82ad88 100644
--- a/lldb/include/lldb/Expression/DWARFExpression.h
+++ b/lldb/include/lldb/Expression/DWARFExpression.h
@@ -18,10 +18,10 @@
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
 #include 
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpression DWARFExpression.h
 /// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
 /// expression and interprets it.
@@ -45,7 +45,7 @@ class DWARFExpression {
   DWARFExpression(const DataExtractor &data);
 
   /// Destructor
-  virtual ~DWARFExpression();
+  ~DWARFExpression();
 
   /// Return true if the location expression contains data
   bool IsValid() const;
diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h 
b/lldb/include/lldb/Expression/DWARFExpressionList.h
index c0939647056dcbf..2bb83e05c8f304e 100644
--- a/lldb/include/lldb/Expression/DWARFExpressionList.h
+++ b/lldb/include/lldb/Expression/DWARFExpressionList.h
@@ -13,10 +13,10 @@
 #include "lldb/Utility/RangeMap.h"
 #include "lldb/lldb-private.h"
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpressionList DWARFExpressionList.h
 /// "lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file
 /// address range to a single DWARF location expression.
diff --git a/lldb/include/

[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

Most plug-ins inside of lldb either have their own namespace or none. If there 
is a larger patch that will go into open source that exposes the lldb_private 
namespace, then this would be applicable. In that case we would need a 
liblldb_private.so which contained all of the lldb_private APIs, and then 
liblldb.so would need to link against that. For Apple systems we would need a 
LLDBPrivate.framework that LLDB.framework would link against. This would need 
to all be optional to enable via CMake. So unless this patch also attempts 
this, I don't see a reason to change these files in open source as you could 
just make this change in your branch.

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Greg Clayton via lldb-commits

clayborg wrote:

So no plug-ins currently exist in the lldb_private namespace. I would rather 
not have all plug-in code end up in the lldb_private namespace either if people 
want access to these unsafe APIs outside of lldb. Maybe we should be creating a 
lldb_plugins namespace, and each plugin would have its own namespace inside 
this, so the DWARF stuff may be in:
```
namespace lldb_plugins {
namespace dwarf {
...
}
}
```
Then add new cmake flags as needed to export only certain plugins if/when 
needed. Don't need to do all plug-ins in this new namespace with this patch, 
just the DWARF code. We can then allow users to specify exactly what they want 
to export and it can limit it to just what is needed.

But I am still not a fan of exporting private APIs that are going to change all 
of the time. 

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Greg Clayton via lldb-commits

clayborg wrote:

I didn't realize there was already a cmake option for exporting the 
lldb_private namespace when I made my first comments. For this option to truly 
be useful, I would prefer to have a liblldb_private.so/LLDBPrivate.framework 
that we would create and then have the liblldb.so/LLDB.framework link against 
these libraries. We went through great lengths to ensure that we vend a 
backward compatible API from liblldb.so/LLDB.framework and I would like to keep 
it that way. If nothing from lldb_private or other internal APIs are exported 
by enabling a special cmake config variable, then we should only have 
liblldb.so/LLDB.framework with a backward compatible API. If we enable a flag 
that exports unsafe APIs we have both a liblldb.so/LLDB.framework whichs links 
to the unsafe API libraries liblldb_private.so/LLDBPrivate.framework.

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/67851

>From b5cfeaad26ecd29f15aadaad408ff30899a8a16d Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 29 Sep 2023 15:44:05 -0400
Subject: [PATCH] [LLDB] Export DWARF Parser symbols for external language
 plugins

---
 .../include/lldb/Expression/DWARFExpression.h |   6 +-
 .../lldb/Expression/DWARFExpressionList.h |   4 +-
 lldb/include/lldb/Symbol/TypeSystem.h |   8 +-
 lldb/source/Plugins/SymbolFile/DWARF/DIERef.h |   7 +-
 .../Plugins/SymbolFile/DWARF/DWARFASTParser.h |   4 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.h| 146 ++
 .../SymbolFile/DWARF/DWARFAttribute.cpp   |   1 +
 .../Plugins/SymbolFile/DWARF/DWARFAttribute.h |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFCompileUnit.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDIE.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugAbbrev.h   |   2 +
 .../SymbolFile/DWARF/DWARFDebugArangeSet.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugAranges.h  |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |   2 +-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.h|   2 +
 .../SymbolFile/DWARF/DWARFDebugMacro.h|   4 +-
 .../SymbolFile/DWARF/DWARFDebugRanges.h   |   4 +-
 .../SymbolFile/DWARF/DWARFDeclContext.cpp |   1 +
 .../SymbolFile/DWARF/DWARFDeclContext.h   |   2 +
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |   4 +-
 .../Plugins/SymbolFile/DWARF/DWARFIndex.h |   2 +-
 .../Plugins/SymbolFile/DWARF/DWARFTypeUnit.h  |   3 +
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  14 +-
 .../SymbolFile/DWARF/ManualDWARFIndex.h   |   2 +-
 .../Plugins/SymbolFile/DWARF/NameToDIE.h  |   5 +-
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   5 +-
 .../DWARF/SymbolFileDWARFDebugMap.cpp |   2 +
 .../DWARF/SymbolFileDWARFDebugMap.h   |  16 +-
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |   9 +-
 .../SymbolFile/DWARF/UniqueDWARFASTType.cpp   |   1 +
 .../SymbolFile/DWARF/UniqueDWARFASTType.h |   5 +-
 33 files changed, 171 insertions(+), 105 deletions(-)

diff --git a/lldb/include/lldb/Expression/DWARFExpression.h 
b/lldb/include/lldb/Expression/DWARFExpression.h
index 380910ba0ea3d61..c9d747c4a82ad88 100644
--- a/lldb/include/lldb/Expression/DWARFExpression.h
+++ b/lldb/include/lldb/Expression/DWARFExpression.h
@@ -18,10 +18,10 @@
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
 #include 
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpression DWARFExpression.h
 /// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
 /// expression and interprets it.
@@ -45,7 +45,7 @@ class DWARFExpression {
   DWARFExpression(const DataExtractor &data);
 
   /// Destructor
-  virtual ~DWARFExpression();
+  ~DWARFExpression();
 
   /// Return true if the location expression contains data
   bool IsValid() const;
diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h 
b/lldb/include/lldb/Expression/DWARFExpressionList.h
index c0939647056dcbf..2bb83e05c8f304e 100644
--- a/lldb/include/lldb/Expression/DWARFExpressionList.h
+++ b/lldb/include/lldb/Expression/DWARFExpressionList.h
@@ -13,10 +13,10 @@
 #include "lldb/Utility/RangeMap.h"
 #include "lldb/lldb-private.h"
 
-class DWARFUnit;
-
 namespace lldb_private {
 
+class DWARFUnit;
+
 /// \class DWARFExpressionList DWARFExpressionList.h
 /// "lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file
 /// address range to a single DWARF location expression.
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..377fc51000b89cd 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,11 +28,13 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/lldb-private.h"
 
-class DWARFDIE;
-class DWARFASTParser;
 class PDBASTParser;
 
 namespace lldb_private {
+
+class DWARFDIE;
+class DWARFASTParser;
+
 namespace npdb {
   class PdbAstBuilder;
 } // namespace npdb
@@ -579,7 +581,7 @@ class TypeSystemMap {
   llvm::Expected GetTypeSystemForLanguage(
   lldb::LanguageType language,
   std::optional create_callback = std::nullopt);
-  };
+};
 
 } // namespace lldb_private
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index b5a5cfe263f7804..7864189503a9666 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 
+namespace lldb_private {
 /// Identifies a DWARF debug info entry within a given Module. It contains 
three
 /// "coordinates":
 /// - file_index: identifies the separate stand alone debug info file
@@ -131,10 +132,12 @@ class DIERef {
 static_assert(sizeof(DIERef) == 8);
 
 typedef

[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Greg Clayton via lldb-commits

clayborg wrote:

But the above comments are my personal opinion. I would love to hear from other 
developers on what they would like to see.

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

@clayborg , LLDB has the cmake flag `LLDB_EXPORT_ALL_SYMBOLS` (see 
https://github.com/llvm/llvm-project/blob/main/lldb/cmake/modules/AddLLDB.cmake#L177)
 that is used to export `lldb_private` as well as `lldb` symbols. This shows 
that there's been a precedent for this kind of features and it seems to be well 
maintained.

Besides that, I do like your idea of exporting specific namespaces for plugins, 
however for this specific case, I do think that lldb_private is the namespace 
to use. The main reason is that `lldb_private::TypeSystem` forces to implement 
`DWARFASTParser`, which is a base class with its implementation in the plugin 
folder. A cleaner API would have all of the necessary bits to implement the 
`DWARFASTParser` child in the lldb_private namespace outside of a plugin, 
because `lldb_private::TypeSystem` is already outside of any plugin folder, 
just like other DWARF-related classes like `DWARFExpression` are outside of 
plugin folders. I chatted with @bulbazord about moving some DWARF files from 
the symbol plugin to be at the same level as the type system, but that's 
particularly challenging because of heavy coupling between the DWARF parser 
code and clang/clang typesystem. So this patch at least puts some code in the 
correct namespace, so to speak.


https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

2023-09-29 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben approved this pull request.


https://github.com/llvm/llvm-project/pull/67019
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

After chatting with @clayborg , I'm going to try a different approach:
- putting all of these dwarf-related files from the plugin in a 
`lldb_plugins::dwarf` namespace.
- adding a new cmake flag that operates along with `LLDB_EXPORT_ALL_SYMBOLS` to 
specify a custom exports file, which would default to 
`lldb/source/API/liblldb-private.exports`. That way external plugins would have 
the option to decide what gets exported and what not.

In the meantime, I'm open to more feedback

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Alex Langford via lldb-commits

bulbazord wrote:

I think I am on the same page with Greg for not exposing these symbols for not 
shoving everything into `lldb_private`. Perhaps instead of `lldb_plugin` we can 
name it something like `lldb_private::plugin` instead? Not a huge difference, 
but keeping the top-level private namespace still indicates that it is still a 
"private" API. Even if most folks aren't going to export lldb_private symbols 
in their distribution of LLDB, perhaps the folks at Modular would like to do 
that for the lldb they ship. The fact that the only stable interface is the 
SBAPI will not change as a result of doing that.

Changing the architecture or the way we build LLDB (having some 
lldb_private.so/LLDBPrivate.framework) is a pretty big decision that I think 
will require more buy-in from the community. Whether or not that's the right 
direction to go in, I'm not sure. But that discussion is much more suitable for 
the LLVM Discourse.

I am a little curious though, it looks like this change is very DWARF centric. 
Are you also generating DWARF for Mojo on Windows? Will you be doing something 
similar for PDBs?

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Alex Langford via lldb-commits

bulbazord wrote:

Adding Jonas and Adrian for visibility

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

> Perhaps instead of lldb_plugin we can name it something like 
> lldb_private::plugin instead? 

Well, that would definitely work for me, as these symbols would be 
automatically exported alongside all the other `lldb_private` symbols. What I'm 
not completely sure about is if we want to go that route for plugins because 
then all of their symbols would be exported with this flag. @clayborg what do 
you think?

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Export DWARF Parser symbols for external language plugins (PR #67851)

2023-09-29 Thread Greg Clayton via lldb-commits

clayborg wrote:

> I think I am on the same page with Greg for not exposing these symbols for 
> not shoving everything into `lldb_private`. Perhaps instead of `lldb_plugin` 
> we can name it something like `lldb_private::plugin` instead? Not a huge 
> difference, but keeping the top-level private namespace still indicates that 
> it is still a "private" API.

I think of the lldb_private being the internal LLDB specific code, not plugin 
code. Right now most plugin code isn't in any namespace and I don't think it 
belongs in lldb_private.

> Even if most folks aren't going to export lldb_private symbols in their 
> distribution of LLDB, perhaps the folks at Modular would like to do that for 
> the lldb they ship. The fact that the only stable interface is the SBAPI will 
> not change as a result of doing that.

This would allow them access to the lldb specific code mostly needed to 
implement core functionality. But for plug-ins, it would be nice to be able to 
only export the specific plug-ins needed by folks to keep the number of 
exported functions down. If the plugin code is in "lldb_private::plugin", then 
if you export "lldb_private::*" you end up exporting all plug-ins whether you 
want them or not. Keeping them in a different namespace like "lldb_plugins" 
would allow you to export all of them "lldb_plugins::*", or just one with 
"lldb_plugins::dwarf*".

> Changing the architecture or the way we build LLDB (having some 
> lldb_private.so/LLDBPrivate.framework) is a pretty big decision that I think 
> will require more buy-in from the community. Whether or not that's the right 
> direction to go in, I'm not sure. But that discussion is much more suitable 
> for the LLVM Discourse.

Agreed
 

https://github.com/llvm/llvm-project/pull/67851
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 466ea89 - [lldb] Fix failures when evaluating C++ expression and loading modules

2023-09-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-09-29T18:56:02-07:00
New Revision: 466ea89fc6d8bfd197cbc1055bbc38e730e9d523

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

LOG: [lldb] Fix failures when evaluating C++ expression and loading modules

This patch tentatively fixes the various test failures introduced
following 0ea3d88bdb16:

https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/6316/

>From my understanding, the main issue here is that we can't find some headers
when evaluating C++ expressions since those headers have been promoted
to be system modules, and to be shipped as part of the toolchain.

Prior to 0ea3d88bdb16, the `BuiltinHeadersInSystemModules` flag for in
the clang `LangOpts` struct was always set, however, after it landed,
the flag becomes opt-in, depending on toolchain that is used with the
compiler instance. This gets set in `clang::createInvocation` down to
`Darwin::addClangTargetOptions`, as this is used mostly on Apple platforms.

However, since `ClangExpressionParser` makes a dummy `CompilerInstance`,
and sets the various language options arbitrarily, instead of using the
`clang::createInvocation`, the flag remains unset, which causes the
various error messages:

```
AssertionError: 'error: module.modulemap:96:11: header 'stdarg.h' not found
   96 |header "stdarg.h" // note: supplied by the compiler
  |   ^
```

Given that this flag was opt-out previously, this patch brings back that
behavior by setting it in lldb's `ClangExpressionParser` constructor,
until we actually decide to pull the language options from the compiler driver.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index aee0f1f56ec74b5..f6856b1a2558cbc 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -575,6 +575,7 @@ ClangExpressionParser::ClangExpressionParser(
 lang_opts.GNUMode = true;
 lang_opts.GNUKeywords = true;
 lang_opts.CPlusPlus11 = true;
+lang_opts.BuiltinHeadersInSystemModules = true;
 
 // The Darwin libc expects this macro to be set.
 lang_opts.GNUCVersion = 40201;



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


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Yuanfang Chen via lldb-commits

https://github.com/yuanfang-chen approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/67373
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits