[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -600,6 +600,14 @@ StringRef extension(StringRef path, Style style) {
   return fname.substr(pos);
 }
 
+StringRef program_name(StringRef path, Style style) {
+  // In the future this may need to be extended to other
+  // program suffixes.

jh7370 wrote:

Unnecessarily wrapped.

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -1696,6 +1696,38 @@ TEST(Support, ReplacePathPrefix) {
   EXPECT_EQ(Path, "C:\\old/foo\\bar");
 }
 
+TEST(Support, FindProgramName) {
+  StringRef WindowsProgName =
+  path::program_name("C:\\Test\\foo.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgName, "foo");
+
+  StringRef WindowsProgNameManyDots = path::program_name(
+  "C:\\Test.7\\x86_64-freebsd14.0-clang.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgNameManyDots, "x86_64-freebsd14.0-clang");
+
+  StringRef PosixProgName =
+  path::program_name("/var/empty/clang.exe", path::Style::posix);
+  EXPECT_EQ(PosixProgName, "clang");
+
+  StringRef PosixProgNameManyDotsExe = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.exe",
+  path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDotsExe, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameManyDots = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar", path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDots, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameSh =
+  
path::program_name("/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.sh",
+ path::Style::posix);
+  EXPECT_EQ(PosixProgNameSh, "x86_64-portbld-freebsd13.2-llvm-ar.sh");
+
+  StringRef WorseThanFailure =

jh7370 wrote:

`WorseThanFailure` doesn't describe the case particularly well, especially as 
the behaviour here is the same as `stem`. Could it simply be `OnlyExe`?

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -5,16 +5,22 @@
 # RUN: mkdir %t
 # RUN: ln -s llvm-ar %t/llvm-ar-9
 # RUN: ln -s llvm-ar %t/ar.exe
+# RUN: ln -s llvm-ar %t/x86_64-portbld-freebsd13.2-llvm-ar
+# RUN: ln -s llvm-ar %t/x86_64-portbld-freebsd13.2-llvm-ar.exe
 # RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9
 
 # RUN: llvm-ar h | FileCheck %s --check-prefix=DEFAULT
 # RUN: %t/llvm-ar-9 h | FileCheck %s --check-prefix=VERSION
 # RUN: %t/ar.exe h | FileCheck %s --check-prefix=SUFFIX
+# RUN: %t/x86_64-portbld-freebsd13.2-llvm-ar h | FileCheck %s 
--check-prefix=TARGETDOT
+# RUN: %t/x86_64-portbld-freebsd13.2-llvm-ar.exe h | FileCheck %s 
--check-prefix=MULTIDOT
 ## Ensure that the "lib" substring does not result in misidentification as the
 ## llvm-lib tool.
 # RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s 
--check-prefix=ARM
 
 # DEFAULT: USAGE: llvm-ar{{ }}
 # VERSION: USAGE: llvm-ar-9{{ }}
 # SUFFIX: USAGE: ar{{ }}
+# TARGETDOT: USAGE: x86_64-portbld-freebsd13.2-llvm-ar{{ }}
+# MULTIDOT: USAGE: x86_64-portbld-freebsd13.2-llvm-ar{{ }}

jh7370 wrote:

These don't need to be separate CHECK patterns, as they check the same thing. 
Simply reuse the prefix and only have one of them.

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -390,6 +390,21 @@ StringRef stem(StringRef path, Style style = 
Style::native);
 /// @result The extension of \a path.
 StringRef extension(StringRef path, Style style = Style::native);
 
+/// Get the program's name
+///
+/// If the path ends with the string .exe, returns the stem of
+/// \a path. Otherwise returns the filename of \a path.
+///
+/// @code
+///   /foo/prog.exe => prog
+///   /bar/prog => prog
+///   /foo/prog1.2  => prog1.2
+/// @endcode
+///
+/// @param path Input path.
+/// @result The filename of \a path. Without any .exe component

jh7370 wrote:

```suggestion
/// @result The filename of \a path without any ".exe" component.
```

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


[Lldb-commits] [lldb] 1a8b36b - [lldb][Docs] Link up the newly restored data formatters page

2023-09-18 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-09-18T13:20:42+01:00
New Revision: 1a8b36b16c3778dc458182ea342904e574b008c7

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

LOG: [lldb][Docs] Link up the newly restored data formatters page

In the place it used to be linked from.

Added: 


Modified: 
lldb/docs/resources/dataformatters.rst
lldb/docs/resources/overview.rst

Removed: 




diff  --git a/lldb/docs/resources/dataformatters.rst 
b/lldb/docs/resources/dataformatters.rst
index a5b6261e363aefc..13d687e202461dc 100644
--- a/lldb/docs/resources/dataformatters.rst
+++ b/lldb/docs/resources/dataformatters.rst
@@ -4,8 +4,7 @@ Data Formatters
 This page is an introduction to the design of the LLDB data formatters
 subsystem. The intended target audience are people interested in understanding
 or modifying the formatters themselves rather than writing a specific data
-formatter. For this latter purpose, the user documentation about formatters is
-the main relevant document which one should refer to.
+formatter. For the latter, refer to :doc:`/use/variable/`.
 
 This page also highlights some open areas for improvement to the general
 subsystem, and more evolutions not anticipated here are certainly possible.

diff  --git a/lldb/docs/resources/overview.rst 
b/lldb/docs/resources/overview.rst
index 054fcbfea2164c2..dbdfb986139c7d6 100644
--- a/lldb/docs/resources/overview.rst
+++ b/lldb/docs/resources/overview.rst
@@ -92,7 +92,9 @@ layers to the implementation: DataVisualization at the 
highest end of the
 spectrum, backed by classes implementing individual formatters, matching rules,
 etc.
 
-For an introduction to data formatters, see :doc:`/use/variable`.
+For a general user-level introduction to data formatters, see 
:doc:`/use/variable`.
+
+More details on their architecture can be found in 
:doc:`/resources/dataformatters`.
 
 Expression
 --



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


[Lldb-commits] [lldb] [lldb] Revive internal data formatter documentation (PR #66527)

2023-09-18 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I updated the links to and from this in 
https://github.com/llvm/llvm-project/commit/1a8b36b16c3778dc458182ea342904e574b008c7.

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

dankm wrote:

> Just making sure I follow: the problem with `stem` is that if a filename 
> includes a dot, but no ".exe" or equivalent suffix, it would drop the bit 
> from the last dot onwards, even though it might be part of the tool's actual 
> name. Is that correct?

Yes, that's correct. The real examples I've run into have been 
`x86_64-unknown-freebsd13.2-clang`, fixed in 
[D135284](https://reviews.llvm.org/D135284), and the `llvm-ar` and 
`llvm-ranlib` cases in this PR. In both cases they had previously been using 
`stem` and returning `x86_64-unknown-freebsd13` and then failing to determine 
the tool name. I was mostly concerned with the cases where behaviour was 
affected. Tool name printing is valid too, though, of course.

> It looks like a number of tools have changed, but I don't see equivalent test 
> changes/new tests for all of them. It seems like we should have testing for 
> all cases where the code goes to some attempt to print the tool name. 
> Assuming it is, I note that some tools no longer will drop "other" file 
> extensions. However, I don't know of any real such extensions other than 
> Window's ".exe". Do any others exist on other platforms?

This makes sense. For my first round I did leave out the cases where having 
multiple dots in the tool name didn't make sense, such as for `dlltool` or 
`llvm-rc`. You're right though that we should test those. I'll add more tests, 
and see if I can find more examples of using `stem` or `filename` when printing 
a tool name.

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

dankm wrote:

> Do any others exist on other platforms?

I don't know. I explicitly tested that `.sh` remains, but that was just because 
it's relatively common (in my experience) to see tools like clang wrapped in a 
shell script. On Windows there are several executable extensions but I think 
the only one that makes sense in our use case is `.exe`, though `.ex_` might 
also be a possibility.

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


[Lldb-commits] [lldb] [mlir][sparse] refine sparse fusion with empty tensors materialization (PR #66563)

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

aartbik wrote:

I have to fix a merge conflict on the test. Coming up.


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


[Lldb-commits] [lldb] [LLDB] Add a setting for printing ValueObject hex values without leading zeroes (PR #66548)

2023-09-18 Thread via lldb-commits

jimingham wrote:

Sure.

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


[Lldb-commits] [lldb] [LLDB] Add a setting for printing ValueObject hex values without leading zeroes (PR #66548)

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

walter-erquinigo wrote:

Thanks Jim and Greg!

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


[Lldb-commits] [lldb] 710276a - [LLDB] Add a setting for printing ValueObject hex values without leading zeroes (#66548)

2023-09-18 Thread via lldb-commits

Author: Walter Erquinigo
Date: 2023-09-18T12:48:16-04:00
New Revision: 710276a2505514634a7cc805461b1219dcef9337

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

LOG: [LLDB] Add a setting for printing ValueObject hex values without leading 
zeroes (#66548)

As suggested by Greg in https://github.com/llvm/llvm-project/pull/66534,
I'm adding a setting at the Target level that controls whether to show
leading zeroes in hex ValueObject values.

This has the benefit of reducing the amount of characters displayed in
certain interfaces, like VSCode.

Added: 


Modified: 
lldb/include/lldb/Target/Target.h
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetProperties.td
lldb/test/API/python_api/value/TestValueAPI.py
lldb/test/API/python_api/value/main.c

Removed: 




diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index ed0ecbbddbf8149..e9e531d0e12640a 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -167,6 +167,8 @@ class TargetProperties : public Properties {
 
   bool GetEnableSyntheticValue() const;
 
+  bool ShowHexVariableValuesWithLeadingZeroes() const;
+
   uint32_t GetMaxZeroPaddingInFloatFormat() const;
 
   uint32_t GetMaximumNumberOfChildrenToDisplay() const;

diff  --git a/lldb/source/Core/DumpDataExtractor.cpp 
b/lldb/source/Core/DumpDataExtractor.cpp
index cb76b118325b7ef..986c9a181919ee0 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -620,10 +620,17 @@ lldb::offset_t lldb_private::DumpDataExtractor(
   case 2:
   case 4:
   case 8:
-s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64,
-  (int)(2 * item_byte_size), (int)(2 * item_byte_size),
-  DE.GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size,
-   item_bit_offset));
+if (Target::GetGlobalProperties()
+.ShowHexVariableValuesWithLeadingZeroes()) {
+  s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64,
+(int)(2 * item_byte_size), (int)(2 * item_byte_size),
+DE.GetMaxU64Bitfield(&offset, item_byte_size, 
item_bit_size,
+ item_bit_offset));
+} else {
+  s->Printf(wantsuppercase ? "0x%" PRIX64 : "0x%" PRIx64,
+DE.GetMaxU64Bitfield(&offset, item_byte_size, 
item_bit_size,
+ item_bit_offset));
+}
 break;
   default: {
 assert(item_bit_size == 0 && item_bit_offset == 0);

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 35f5ef324fde667..8de4fd033ec8785 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -4236,8 +4236,8 @@ bool 
TargetProperties::SetPreferDynamicValue(lldb::DynamicValueType d) {
 }
 
 bool TargetProperties::GetPreloadSymbols() const {
-  if (INTERRUPT_REQUESTED(m_target->GetDebugger(), 
-  "Interrupted checking preload symbols")) {
+  if (INTERRUPT_REQUESTED(m_target->GetDebugger(),
+  "Interrupted checking preload symbols")) {
 return false;
   }
   const uint32_t idx = ePropertyPreloadSymbols;
@@ -4539,6 +4539,12 @@ bool TargetProperties::GetEnableSyntheticValue() const {
   idx, g_target_properties[idx].default_uint_value != 0);
 }
 
+bool TargetProperties::ShowHexVariableValuesWithLeadingZeroes() const {
+  const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
+  return GetPropertyAtIndexAs(
+  idx, g_target_properties[idx].default_uint_value != 0);
+}
+
 uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat() const {
   const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
   return GetPropertyAtIndexAs(

diff  --git a/lldb/source/Target/TargetProperties.td 
b/lldb/source/Target/TargetProperties.td
index 3bfdfa8cfaa957f..154a6e5919ab0cd 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -82,6 +82,10 @@ let Definition = "target" in {
   def SaveObjectsDir: Property<"save-jit-objects-dir", "FileSpec">,
 DefaultStringValue<"">,
 Desc<"If specified, the directory to save intermediate object files 
generated by the LLVM JIT">;
+  def ShowHexVariableValuesWithLeadingZeroes: 
Property<"show-hex-variable-values-with-leading-zeroes", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"Whether to display leading zeroes when printing variable values in 
hex format.">;
   def MaxZeroPaddingInFloatFormat: 
Property<"max-zero-padding-in-float-format", "UInt64">,
 DefaultUnsignedValue<6>,
 Desc<"The maximum number 

[Lldb-commits] [lldb] [LLDB] Add a setting for printing ValueObject hex values without leading zeroes (PR #66548)

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

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


[Lldb-commits] [lldb] 15c8a76 - Skip tests with earlier versions of clang

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

Author: Adrian Prantl
Date: 2023-09-18T09:55:33-07:00
New Revision: 15c8a7628320f928d44317e3b3b706a4f57aa58d

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

LOG: Skip tests with earlier versions of clang

Added: 


Modified: 
lldb/test/API/functionalities/archives/TestBSDArchives.py
lldb/test/API/tools/lldb-vscode/completions/TestVSCode_completions.py

Removed: 




diff  --git a/lldb/test/API/functionalities/archives/TestBSDArchives.py 
b/lldb/test/API/functionalities/archives/TestBSDArchives.py
index b0609ac7410bd8c..570fd2ed8c0e608 100644
--- a/lldb/test/API/functionalities/archives/TestBSDArchives.py
+++ b/lldb/test/API/functionalities/archives/TestBSDArchives.py
@@ -123,6 +123,7 @@ def test_frame_var_errors_when_archive_missing(self):
 self.check_frame_variable_errors(thread, error_strings)
 
 @skipIfRemote
+@skipIf(compiler="clang", compiler_version=["<", "12.0"])
 @expectedFailureAll(
 oslist=["windows"],
 bugnumber="llvm.org/pr24527.  Makefile.rules doesn't know how to build 
static libs on Windows",

diff  --git 
a/lldb/test/API/tools/lldb-vscode/completions/TestVSCode_completions.py 
b/lldb/test/API/tools/lldb-vscode/completions/TestVSCode_completions.py
index 1cec2aad3b7e1f2..1b44c3c99361e3f 100644
--- a/lldb/test/API/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ b/lldb/test/API/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -19,6 +19,7 @@ def verify_completions(self, actual_list, expected_list, 
not_expected_list=[]):
 self.assertNotIn(not_expected_item, actual_list)
 
 @skipIfWindows
+@skipIf(compiler="clang", compiler_version=["<", "17.0"])
 def test_completions(self):
 """
 Tests the completion request at 
diff erent breakpoints



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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits


@@ -1696,6 +1696,38 @@ TEST(Support, ReplacePathPrefix) {
   EXPECT_EQ(Path, "C:\\old/foo\\bar");
 }
 
+TEST(Support, FindProgramName) {
+  StringRef WindowsProgName =
+  path::program_name("C:\\Test\\foo.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgName, "foo");
+
+  StringRef WindowsProgNameManyDots = path::program_name(
+  "C:\\Test.7\\x86_64-freebsd14.0-clang.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgNameManyDots, "x86_64-freebsd14.0-clang");
+
+  StringRef PosixProgName =
+  path::program_name("/var/empty/clang.exe", path::Style::posix);
+  EXPECT_EQ(PosixProgName, "clang");
+
+  StringRef PosixProgNameManyDotsExe = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.exe",
+  path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDotsExe, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameManyDots = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar", path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDots, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameSh =
+  
path::program_name("/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.sh",
+ path::Style::posix);
+  EXPECT_EQ(PosixProgNameSh, "x86_64-portbld-freebsd13.2-llvm-ar.sh");
+
+  StringRef WorseThanFailure =

dankm wrote:

Yeah, that one was purely for my own benefit. I was describing behaviour I 
wasn't sure I wanted to keep, just what it was currently doing. It was intended 
as a reminder to me to come up 1. A better name, and 2. what the intended 
output should be.

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-18 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035

>From 9a52ac5193af2a8ddca2a5d922684935b043d0ef Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Mon, 11 Sep 2023 17:17:13 -0700
Subject: [PATCH 1/2] Add `target modules dump separate-debug-info`

Summary:

Add a new command
```
target modules dump separate-debug-info [-j] [ [ [...]]]
```
or
```
image dump separate-debug-info [-j] [ [ [...]]]
```
(since `image` is an alias for `target modules`).

This lists the separate debug info files and their current status (loaded or 
not loaded) for the specified modules. This diff implements this command for 
mach-O files with OSO and ELF files with dwo.

Example dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example dwo with missing dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 
0x0014
0xbcc129959e76ff33 error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 
0x003c

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 
0x0014",
"loaded": false
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 
0x003c",
"loaded": false
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example output with dwp:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo)
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example oso on my Mac (after manipulating the mod times with `touch`):
```
(lldb) image dump separate-debug-info
Symbol file: /Users/toyang/workspace/scratch/a.out
Type: "oso"
Mod Time   Oso Path
-- -
0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o)
0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)",
"so_file": "/Users/toyang/workspace/scratch/foo.cpp"
  },
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)",
"so_file": "/Users/toyang/workspace/scratch/main.cpp"
  }
],
"symfile": "/Users/toyang/workspace/scratch/a.out",
   

[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-18 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] 9389b05 - [lldb] Fix the TestValueAPI test

2023-09-18 Thread walter erquinigo via lldb-commits

Author: walter erquinigo
Date: 2023-09-18T13:57:25-04:00
New Revision: 9389b056a604b7da9478bb40125d6a1ad379823a

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

LOG: [lldb] Fix the TestValueAPI test

This test was reported as failing by 
https://lab.llvm.org/buildbot/#/builders/68/builds/60172. The fix is very 
simple. We need to invoke the correct setting.

Added: 


Modified: 
lldb/test/API/python_api/value/TestValueAPI.py

Removed: 




diff  --git a/lldb/test/API/python_api/value/TestValueAPI.py 
b/lldb/test/API/python_api/value/TestValueAPI.py
index 05670b8db9bb77a..3855c67c8d37257 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -212,7 +212,7 @@ def test(self):
 frame0.FindVariable("fixed_int_ptr").GetValue(),
 "0x00aa",
 )
-self.runCmd("settings set target.show-hex-values-with-leading-zeroes 
false")
+self.runCmd("settings set 
target.show-hex-variable-values-with-leading-zeroes false")
 self.assertEqual(
 frame0.FindVariable("another_fixed_int_ptr").GetValue(),
 "0xaa",



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


[Lldb-commits] [lldb] [lldb-vscode] Show addresses next to dereferenced summaries when using enableAutoVariableSummaries (PR #66551)

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

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

This shouldn't be type specific. Any SBValue that reports a value when you call:
```
const char *SBValue::GetValue();
```
Should always show the value. In this case, a pointer always has a value to 
show. So it shouldn't matter that this is a pointer, it should be just "any 
SBValue that has a value should display the value and if it doesn't have a 
summary and we auto generate one, then we can append the generated summary 
string". If you look at the normal code it does this for any SBValue.

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits


@@ -5,11 +5,14 @@
 # RUN: mkdir %t
 # RUN: ln -s llvm-ranlib %t/llvm-ranlib-9
 # RUN: ln -s llvm-ranlib %t/ranlib.exe
+# RUN: ln -s llvm-ranlib %t/x86_64-unknown-freebsd13.2-llvm-ranlib

dankm wrote:

Yep, your second point is why I didn't bother making the second case for 
llvm-ranlib. On my first pass I just updated the existing testcases I found, 
but for ranlib I realised the same thing you did. I may just drop the ranlib 
test entirely.

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


[Lldb-commits] [lldb] [lldb-vscode] Show addresses next to dereferenced summaries when using enableAutoVariableSummaries (PR #66551)

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

walter-erquinigo wrote:

> if it doesn't have a summary and we auto generate one, then we can append the 
> generated summary string

That makes a ton of sense. I'll try that approach. Thanks

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

https://github.com/dtcxzyw updated 
https://github.com/llvm/llvm-project/pull/65852

>From d9d8bcbb98e8f5aecb9733329389d61a489bd731 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng 
Date: Sat, 9 Sep 2023 23:07:29 +0800
Subject: [PATCH 1/5] [InstCombine] Simplify the pattern `a ne/eq (zext (a
 ne/eq c))`

---
 .../InstCombine/InstCombineCompares.cpp   |  62 ++
 .../test/Transforms/InstCombine/icmp-range.ll | 181 ++
 2 files changed, 243 insertions(+)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 9fdc46fec631679..837b8e6d2619989 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -6309,7 +6309,69 @@ Instruction 
*InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
   Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
 return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  // icmp eq/ne X, (zext (icmp eq/ne X, C))
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+ m_ZExt(m_ICmp(Pred2, m_Deferred(X), m_APInt(C) &&
+  ICmpInst::isEquality(Pred1) && ICmpInst::isEquality(Pred2)) {
+if (C->isZero()) {
+  if (Pred2 == ICmpInst::ICMP_EQ) {
+// icmp eq X, (zext (icmp eq X, 0)) --> false
+// icmp ne X, (zext (icmp eq X, 0)) --> true
+return replaceInstUsesWith(
+I,
+Constant::getIntegerValue(
+I.getType(),
+APInt(1U, static_cast(Pred1 == ICmpInst::ICMP_NE;
+  } else {
+// icmp eq X, (zext (icmp ne X, 0)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp ne X, 0)) --> icmp ugt X, 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+X,
+Constant::getIntegerValue(
+X->getType(), APInt(X->getType()->getScalarSizeInBits(),
+Pred1 == ICmpInst::ICMP_NE ? 1 : 2)));
+  }
+} else if (C->isOne()) {
+  if (Pred2 == ICmpInst::ICMP_NE) {
+// icmp eq X, (zext (icmp ne X, 1)) --> false
+// icmp ne X, (zext (icmp ne X, 1)) --> true
+return replaceInstUsesWith(
+I,
+Constant::getIntegerValue(
+I.getType(),
+APInt(1U, static_cast(Pred1 == ICmpInst::ICMP_NE;
+  } else {
+// icmp eq X, (zext (icmp eq X, 1)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp eq X, 1)) --> icmp ugt X, 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+X,
+Constant::getIntegerValue(
+X->getType(), APInt(X->getType()->getScalarSizeInBits(),
+Pred1 == ICmpInst::ICMP_NE ? 1 : 2)));
+  }
+} else {
+  // C != 0 && C != 1
+  // icmp eq X, (zext (icmp eq X, C)) --> icmp eq X, 0
+  // icmp eq X, (zext (icmp ne X, C)) --> icmp eq X, 1
+  // icmp ne X, (zext (icmp eq X, C)) --> icmp ne X, 0
+  // icmp ne X, (zext (icmp ne X, C)) --> icmp ne X, 1
+  return ICmpInst::Create(
+  Instruction::ICmp, Pred1, X,
+  Constant::getIntegerValue(
+  X->getType(),
+  APInt(X->getType()->getScalarSizeInBits(),
+static_cast(Pred2 == ICmpInst::ICMP_NE;
+}
+  }
+
   if (match(I.getOperand(0), m_c_Add(m_ZExt(m_Value(X)), m_SExt(m_Value(Y 
&&
   match(I.getOperand(1), m_APInt(C)) &&
   X->getType()->isIntOrIntVectorTy(1) &&
diff --git a/llvm/test/Transforms/InstCombine/icmp-range.ll 
b/llvm/test/Transforms/InstCombine/icmp-range.ll
index 4281e09cb0309c8..15424fce33fdeea 100644
--- a/llvm/test/Transforms/InstCombine/icmp-range.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-range.ll
@@ -1034,6 +1034,187 @@ define i1 @icmp_ne_bool_1(ptr %ptr) {
   ret i1 %cmp
 }
 
+define i1 @icmp_ne_zext_eq_zero(i32 %a) {
+; CHECK-LABEL: @icmp_ne_zext_eq_zero(
+; CHECK-NEXT:ret i1 true
+;
+  %cmp = icmp eq i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp ne i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_ne_zext_ne_zero(i32 %a) {
+; CHECK-LABEL: @icmp_ne_zext_ne_zero(
+; CHECK-NEXT:[[CMP1:%.*]] = icmp ugt i32 [[A:%.*]], 1
+; CHECK-NEXT:ret i1 [[CMP1]]
+;
+  %cmp = icmp ne i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp ne i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_eq_zext_eq_zero(i32 %a) {
+; CHECK-LABEL: @icmp_eq_zext_eq_zero(
+; CHECK-NEXT:ret i1 false
+;
+  %cmp = icmp eq i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp eq i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_eq_zext_ne_zero(i32 %

[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits


@@ -366,19 +366,10 @@ define void @simplify_before_foldAndOfICmps(ptr %p) {
 ; CHECK-LABEL: @simplify_before_foldAndOfICmps(
 ; CHECK-NEXT:[[A8:%.*]] = alloca i16, align 2
 ; CHECK-NEXT:[[L7:%.*]] = load i16, ptr [[A8]], align 2
-; CHECK-NEXT:[[TMP1:%.*]] = icmp eq i16 [[L7]], -1
-; CHECK-NEXT:[[B11:%.*]] = zext i1 [[TMP1]] to i16
-; CHECK-NEXT:[[C10:%.*]] = icmp ugt i16 [[L7]], [[B11]]
-; CHECK-NEXT:[[C5:%.*]] = icmp slt i16 [[L7]], 1
-; CHECK-NEXT:[[C7:%.*]] = icmp slt i16 [[L7]], 0
-; CHECK-NEXT:[[B15:%.*]] = xor i1 [[C7]], [[C10]]
-; CHECK-NEXT:[[C6:%.*]] = xor i1 [[B15]], true
-; CHECK-NEXT:[[TMP2:%.*]] = and i1 [[C5]], [[C6]]
-; CHECK-NEXT:[[C3:%.*]] = and i1 [[TMP2]], [[C10]]
-; CHECK-NEXT:[[TMP3:%.*]] = xor i1 [[C10]], true
-; CHECK-NEXT:[[C18:%.*]] = or i1 [[C7]], [[TMP3]]
-; CHECK-NEXT:[[TMP4:%.*]] = sext i1 [[C3]] to i64
-; CHECK-NEXT:[[G26:%.*]] = getelementptr i1, ptr null, i64 [[TMP4]]
+; CHECK-NEXT:[[C18:%.*]] = icmp slt i16 [[L7]], 1
+; CHECK-NEXT:[[L7_LOBIT:%.*]] = ashr i16 [[L7]], 15
+; CHECK-NEXT:[[TMP1:%.*]] = sext i16 [[L7_LOBIT]] to i64
+; CHECK-NEXT:[[G26:%.*]] = getelementptr i1, ptr null, i64 [[TMP1]]
 ; CHECK-NEXT:store i16 [[L7]], ptr [[P:%.*]], align 2

dtcxzyw wrote:

Proof: https://alive2.llvm.org/ce/z/wBGCFz

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-18 Thread Jonas Devlieghere via lldb-commits

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

Thanks for working on this!

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


[Lldb-commits] [lldb] 014c41d - [LLDB] Attempt to fix DumpDataExtractorTest

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

Author: Walter Erquinigo
Date: 2023-09-18T21:30:42Z
New Revision: 014c41d688f961cdb81cf92e6ba97100a49766a6

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

LOG: [LLDB] Attempt to fix DumpDataExtractorTest

This test was broken by 710276a2505514634a7cc805461b1219dcef9337 because
DumpDataExtractor now accesses the Target properties, which someone ends
up relying on the file system.

This is an instance of this error 
https://lab.llvm.org/buildbot/#/builders/96/builds/45607/steps/6/logs/stdio

I cannot reproduce this locally, but it seems that the error happens
because we are not initializing the FileSystem and the Host as part of
the test setup.

Added: 


Modified: 
lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 




diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index bbe5e9e5ed9e299..3332cf6f07fd180 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 
 #include "lldb/Core/DumpDataExtractor.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Endian.h"
@@ -18,6 +20,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
+// This is needed for the tests because they rely on the Target global
+// properties.
+class DumpDataExtractorTest : public ::testing::Test {
+public:
+  void SetUp() override {
+FileSystem::Initialize();
+HostInfo::Initialize();
+  }
+  void TearDown() override {
+HostInfo::Terminate();
+FileSystem::Terminate();
+  }
+};
+
 static void TestDumpWithAddress(uint64_t base_addr, size_t item_count,
 llvm::StringRef expected) {
   std::vector data{0x11, 0x22};



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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

https://github.com/dankm updated https://github.com/llvm/llvm-project/pull/65812

>From 4a30a862b41aa6c570b0dc4d1eb82a7feef4ed8e Mon Sep 17 00:00:00 2001
From: Dan McGregor 
Date: Mon, 14 Aug 2023 18:44:08 -0600
Subject: [PATCH 1/2] Support: hoist lld's executable name code to Path

Instead of using custom code to find the program name throughout
the codebase, write one function as a path helper to consistently
determine the program name. This globally correctly finds target
names with dots in them (ie freebsd13.2).
---
 lld/COFF/Driver.cpp|  2 +-
 lld/Common/Args.cpp|  6 --
 lld/ELF/Driver.cpp |  2 +-
 lld/MachO/Driver.cpp   |  2 +-
 lld/include/lld/Common/Args.h  |  2 --
 lld/wasm/Driver.cpp|  2 +-
 lldb/tools/driver/Driver.cpp   |  2 +-
 llvm/include/llvm/Support/Path.h   | 15 +++
 llvm/lib/Support/Path.cpp  |  7 +++
 llvm/tools/llvm-ar/llvm-ar.cpp |  3 ++-
 llvm/tools/llvm-cov/llvm-cov.cpp   |  2 +-
 llvm/tools/llvm-driver/llvm-driver.cpp |  2 +-
 llvm/tools/llvm-objcopy/llvm-objcopy.cpp   |  2 +-
 llvm/tools/llvm-objdump/llvm-objdump.cpp   |  2 +-
 llvm/tools/llvm-rc/llvm-rc.cpp |  2 +-
 llvm/tools/llvm-readobj/llvm-readobj.cpp   |  2 +-
 llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp |  2 +-
 17 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index d7476e91e03e384..03a63bf3a306b4d 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -68,7 +68,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
   auto *ctx = new COFFLinkerContext;
 
   ctx->e.initialize(stdoutOS, stderrOS, exitEarly, disableOutput);
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now"
  " (use /errorlimit:0 to see all errors)";
 
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp
index 48c934df3a2c931..b02d023fe19aeb5 100644
--- a/lld/Common/Args.cpp
+++ b/lld/Common/Args.cpp
@@ -85,9 +85,3 @@ std::vector lld::args::getLines(MemoryBufferRef 
mb) {
   }
   return ret;
 }
-
-StringRef lld::args::getFilenameWithoutExe(StringRef path) {
-  if (path.ends_with_insensitive(".exe"))
-return sys::path::stem(path);
-  return sys::path::filename(path);
-}
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 9d167293574fa64..957d0da1589caf8 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -143,7 +143,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
 
 SharedFile::vernauxNum = 0;
   };
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now (use "
  "--error-limit=0 to see all errors)";
 
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 00ff3439a043be9..ed0b66d4b2ec6ba 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1428,7 +1428,7 @@ bool link(ArrayRef argsArr, 
llvm::raw_ostream &stdoutOS,
 InputFile::resetIdCount();
   };
 
-  ctx->e.logName = args::getFilenameWithoutExe(argsArr[0]);
+  ctx->e.logName = sys::path::program_name(argsArr[0]);
 
   MachOOptTable parser;
   InputArgList args = parser.parse(argsArr.slice(1));
diff --git a/lld/include/lld/Common/Args.h b/lld/include/lld/Common/Args.h
index 60f83fbbbf1a3c9..8822707a6a1f212 100644
--- a/lld/include/lld/Common/Args.h
+++ b/lld/include/lld/Common/Args.h
@@ -38,8 +38,6 @@ uint64_t getZOptionValue(llvm::opt::InputArgList &args, int 
id, StringRef key,
 
 std::vector getLines(MemoryBufferRef mb);
 
-StringRef getFilenameWithoutExe(StringRef path);
-
 } // namespace args
 } // namespace lld
 
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index c2f5f0185781f36..f13aa520f35b100 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -89,7 +89,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
   auto *ctx = new CommonLinkerContext;
 
   ctx->e.initialize(stdoutOS, stderrOS, exitEarly, disableOutput);
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now (use "
  "-error-limit=0 to see all errors)";
 
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index f8058f868d53ffe..2fb760ca97a001d 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -754,7 +754,7 @@ int main(int argc, char const *argv[]) {
   ArrayRef arg_arr = ArrayRef(argv + 1, argc - 1);
   opt::InputArgList input_args =
   T.ParseArgs(arg_arr, MissingA

[Lldb-commits] [lldb] 266630c - [LLDB] Attempt to fix DumpDataExtractorTest

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

Author: Walter Erquinigo
Date: 2023-09-18T22:02:05Z
New Revision: 266630cffceefbe3b00f34ba8efcfba62259335e

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

LOG: [LLDB] Attempt to fix DumpDataExtractorTest

In 014c41d688f961cdb81cf92e6ba97100a49766a6 I tried to fix these tests,
but it seems that I needed to change TEST for TEST_F to make that work.
It's a pain that these failures don't repro on any of my machines, but I
verified thta the initialization code for the tests is invoked.

Added: 


Modified: 
lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 




diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index 3332cf6f07fd180..8c58fecfee29cbe 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -48,7 +48,7 @@ static void TestDumpWithAddress(uint64_t base_addr, size_t 
item_count,
   ASSERT_EQ(expected, result.GetString());
 }
 
-TEST(DumpDataExtractorTest, BaseAddress) {
+TEST_F(DumpDataExtractorTest, BaseAddress) {
   TestDumpWithAddress(0x12341234, 1, "0x12341234: 0x11");
   TestDumpWithAddress(LLDB_INVALID_ADDRESS, 1, "0x11");
   TestDumpWithAddress(0x12341234, 2, "0x12341234: 0x11\n0x12341235: 0x22");
@@ -69,7 +69,7 @@ static void TestDumpWithOffset(offset_t start_offset,
   ASSERT_EQ(expected, result.GetString());
 }
 
-TEST(DumpDataExtractorTest, StartOffset) {
+TEST_F(DumpDataExtractorTest, StartOffset) {
   TestDumpWithOffset(0, "0x: 0x11 0x22 0x33");
   // The offset applies to the DataExtractor, not the address used when
   // formatting.
@@ -78,7 +78,7 @@ TEST(DumpDataExtractorTest, StartOffset) {
   TestDumpWithOffset(3, "");
 }
 
-TEST(DumpDataExtractorTest, NullStream) {
+TEST_F(DumpDataExtractorTest, NullStream) {
   // We don't do any work if there is no output stream.
   uint8_t c = 0x11;
   StreamString result;
@@ -128,7 +128,7 @@ static void TestDump(const std::vector data, 
lldb::Format format,
LLDB_INVALID_ADDRESS, format, expected);
 }
 
-TEST(DumpDataExtractorTest, Formats) {
+TEST_F(DumpDataExtractorTest, Formats) {
   TestDump(1, lldb::eFormatDefault, "0x01");
   TestDump(1, lldb::eFormatBoolean, "true");
   TestDump(0xAA, lldb::eFormatBinary, "0b10101010");
@@ -274,7 +274,7 @@ TEST(DumpDataExtractorTest, Formats) {
   TestDump(99, lldb::Format::eFormatVoid, "0x0063");
 }
 
-TEST(DumpDataExtractorTest, FormatCharArray) {
+TEST_F(DumpDataExtractorTest, FormatCharArray) {
   // Unlike the other formats, charArray isn't 1 array of N chars.
   // It must be passed as N chars of 1 byte each.
   // (eFormatVectorOfChar does this swap for you)
@@ -315,7 +315,7 @@ void TestDumpMultiLine(const T *data, size_t num_items, 
lldb::Format format,
0x8000, format, expected);
 }
 
-TEST(DumpDataExtractorTest, MultiLine) {
+TEST_F(DumpDataExtractorTest, MultiLine) {
   // A vector counts as 1 item regardless of size.
   TestDumpMultiLine(std::vector{0x11},
 lldb::Format::eFormatVectorOfUInt8, 1,
@@ -370,7 +370,7 @@ void TestDumpWithItemByteSize(size_t item_byte_size, 
lldb::Format format,
expected);
 }
 
-TEST(DumpDataExtractorTest, ItemByteSizeErrors) {
+TEST_F(DumpDataExtractorTest, ItemByteSizeErrors) {
   TestDumpWithItemByteSize(
   16, lldb::Format::eFormatBoolean,
   "error: unsupported byte size (16) for boolean format");



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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread via lldb-commits


@@ -6380,7 +6380,74 @@ Instruction 
*InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
   Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
 return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  // icmp eq/ne X, (zext/sext (icmp eq/ne X, C))
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  Instruction *ExtI;
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+ m_CombineAnd(m_Instruction(ExtI),
+  m_ZExtOrSExt(m_ICmp(Pred2, m_Deferred(X),
+  m_APInt(C))) {
+bool IsSExt = ExtI->getOpcode() == Instruction::SExt;
+bool HasOneUse = ExtI->hasOneUse() && ExtI->getOperand(0)->hasOneUse();
+if (C->isZero()) {
+  if (Pred2 == ICmpInst::ICMP_EQ) {
+// icmp eq X, (zext/sext (icmp eq X, 0)) --> false
+// icmp ne X, (zext/sext (icmp eq X, 0)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp ne X, 0)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp ne X, 0)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp ne X, 0)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp ne X, 0)) --> icmp ugt (X + 1), 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+IsSExt ? Builder.CreateAdd(X, ConstantInt::get(X->getType(), 1))
+   : X,
+ConstantInt::get(X->getType(), Pred1 == ICmpInst::ICMP_NE ? 1 : 
2));
+  }
+} else if (IsSExt ? C->isAllOnes() : C->isOne()) {
+  if (Pred2 == ICmpInst::ICMP_NE) {
+// icmp eq X, (zext (icmp ne X, 1)) --> false
+// icmp ne X, (zext (icmp ne X, 1)) --> true
+// icmp eq X, (sext (icmp ne X, -1)) --> false
+// icmp ne X, (sext (icmp ne X, -1)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp eq X, 1)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp eq X, 1)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp eq X, -1)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp eq X, -1)) --> icmp ugt (X + 1), 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+IsSExt ? Builder.CreateAdd(X, ConstantInt::get(X->getType(), 1))
+   : X,
+ConstantInt::get(X->getType(), Pred1 == ICmpInst::ICMP_NE ? 1 : 
2));
+  }
+} else {
+  // when C != 0 && C != 1:
+  //   icmp eq X, (zext (icmp eq X, C)) --> icmp eq X, 0
+  //   icmp eq X, (zext (icmp ne X, C)) --> icmp eq X, 1
+  //   icmp ne X, (zext (icmp eq X, C)) --> icmp ne X, 0
+  //   icmp ne X, (zext (icmp ne X, C)) --> icmp ne X, 1
+  // when C != 0 && C != -1:
+  //   icmp eq X, (zext (icmp eq X, C)) --> icmp eq X, 0
+  //   icmp eq X, (zext (icmp ne X, C)) --> icmp eq X, -1
+  //   icmp ne X, (zext (icmp eq X, C)) --> icmp ne X, 0
+  //   icmp ne X, (zext (icmp ne X, C)) --> icmp ne X, -1

goldsteinn wrote:

zext -> sext in the comments.

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread via lldb-commits


@@ -6380,7 +6380,74 @@ Instruction 
*InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
   Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
 return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  // icmp eq/ne X, (zext/sext (icmp eq/ne X, C))
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  Instruction *ExtI;
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+ m_CombineAnd(m_Instruction(ExtI),
+  m_ZExtOrSExt(m_ICmp(Pred2, m_Deferred(X),
+  m_APInt(C))) {
+bool IsSExt = ExtI->getOpcode() == Instruction::SExt;
+bool HasOneUse = ExtI->hasOneUse() && ExtI->getOperand(0)->hasOneUse();
+if (C->isZero()) {
+  if (Pred2 == ICmpInst::ICMP_EQ) {
+// icmp eq X, (zext/sext (icmp eq X, 0)) --> false
+// icmp ne X, (zext/sext (icmp eq X, 0)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp ne X, 0)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp ne X, 0)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp ne X, 0)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp ne X, 0)) --> icmp ugt (X + 1), 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+IsSExt ? Builder.CreateAdd(X, ConstantInt::get(X->getType(), 1))
+   : X,
+ConstantInt::get(X->getType(), Pred1 == ICmpInst::ICMP_NE ? 1 : 
2));
+  }
+} else if (IsSExt ? C->isAllOnes() : C->isOne()) {
+  if (Pred2 == ICmpInst::ICMP_NE) {
+// icmp eq X, (zext (icmp ne X, 1)) --> false
+// icmp ne X, (zext (icmp ne X, 1)) --> true
+// icmp eq X, (sext (icmp ne X, -1)) --> false
+// icmp ne X, (sext (icmp ne X, -1)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp eq X, 1)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp eq X, 1)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp eq X, -1)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp eq X, -1)) --> icmp ugt (X + 1), 1

goldsteinn wrote:

Imo for the `sext` ones its probably clearer to just produce two combined 
conditions i.e `x==0 || x==-1` or `x != 0 && x != -1`. Let later passes handle 
folding that.

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread via lldb-commits


@@ -6380,7 +6380,74 @@ Instruction 
*InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
   Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
 return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  // icmp eq/ne X, (zext/sext (icmp eq/ne X, C))
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  Instruction *ExtI;
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+ m_CombineAnd(m_Instruction(ExtI),
+  m_ZExtOrSExt(m_ICmp(Pred2, m_Deferred(X),
+  m_APInt(C))) {
+bool IsSExt = ExtI->getOpcode() == Instruction::SExt;
+bool HasOneUse = ExtI->hasOneUse() && ExtI->getOperand(0)->hasOneUse();
+if (C->isZero()) {
+  if (Pred2 == ICmpInst::ICMP_EQ) {
+// icmp eq X, (zext/sext (icmp eq X, 0)) --> false
+// icmp ne X, (zext/sext (icmp eq X, 0)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp ne X, 0)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp ne X, 0)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp ne X, 0)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp ne X, 0)) --> icmp ugt (X + 1), 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+IsSExt ? Builder.CreateAdd(X, ConstantInt::get(X->getType(), 1))
+   : X,
+ConstantInt::get(X->getType(), Pred1 == ICmpInst::ICMP_NE ? 1 : 
2));
+  }
+} else if (IsSExt ? C->isAllOnes() : C->isOne()) {
+  if (Pred2 == ICmpInst::ICMP_NE) {
+// icmp eq X, (zext (icmp ne X, 1)) --> false
+// icmp ne X, (zext (icmp ne X, 1)) --> true
+// icmp eq X, (sext (icmp ne X, -1)) --> false
+// icmp ne X, (sext (icmp ne X, -1)) --> true
+return replaceInstUsesWith(
+I, ConstantInt::getBool(I.getType(), Pred1 == ICmpInst::ICMP_NE));
+  } else if (!IsSExt || HasOneUse) {
+// icmp eq X, (zext (icmp eq X, 1)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp eq X, 1)) --> icmp ugt X, 1
+// icmp eq X, (sext (icmp eq X, -1)) --> icmp ult (X + 1), 2
+// icmp ne X, (sext (icmp eq X, -1)) --> icmp ugt (X + 1), 1

goldsteinn wrote:

@nikic, just wondering is there a reason we don't embed alive2 proofs in codes? 
I know a few occasions I've wanted to for non-trivially obvious comments and 
would be useful for something like this.

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/66308

>From 1efbce9f3b754f45372f0098163e70c2118b57d9 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 13 Sep 2023 17:38:31 -0700
Subject: [PATCH 1/3] [lldb] Add 'modify' type watchpoints, make it default

Watchpoints in lldb can be either 'read', 'write', or
'read/write'.  This is exposing the actual behavior of
hardware watchpoints.  gdb has a different behavior:
a "write" type watchpoint only stops when the watched
memory region *changes*.

A user is using a watchpoint for one of three reasons:

1. Want to find what is changing/corrupting this memory.
3. Want to find what is reading from this memory.
2. Want to find what is writing to this memory.

I believe (1) is the most common use case for watchpoints,
and it currently can't be done in lldb -- the user needs
to continue every time the same value is written to the
watched-memory manually.  I think gdb's behavior is the
correct one.  There are some use cases where a developer
wants to find every function that writes/reads to/from a memory
region, regardless of value, I want to still allow that
functionality.

This is also a bit of groundwork for my large watchpoint
support proposal
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
where I will be adding support for AArch64 MASK watchpoints
which watch power-of-2 memory regions.  A user might ask
to watch 24 bytes, and a MASK watchpoint stub can do this
with a 32-byte MASK watchpoint if it is properly aligned.
And we need to ignore writes to the final 8 bytes of that
watched region, and not show those hits to the user.

This patch adds a new 'modify' watchpoint type and it
is the default.

The part of this patch I think is the most questionable
is the
SBTarget::CreateWatchpoint(addr, size, bool read, bool write, error)
which I currently change the meaning of write==True to be
Modify.  This is part of making 'modify' the default watchpoint
type - a driver is likely setting write==True for its watchpoints.

I chatted with Alex and Jim about this a little and I'm not sure
how I should solve this for real.  Add a new SBTarget::CreateWatchpoint
API with a third `bool modify` argument in addition to the old one?
Add a new SBWatchpointOptions class in case we want to add more
types of watchpoints?  I'm not sure what other types of watchpoints
we'd want to hardcode in our support.  We have conditional expressions
or python callbacks that can do more unique operations.

There's more work here - the SB API needs to give the driver a way
to specify all three possible types of watchpoint ('write' and
'modify' being exclusive of the other) - but I'd love to hear what
other people think we should do for this API especially.
---
 lldb/include/lldb/Breakpoint/Watchpoint.h |  5 ++-
 .../lldb/Interpreter/OptionGroupWatchpoint.h  |  6 ++-
 lldb/include/lldb/lldb-defines.h  |  4 +-
 lldb/source/API/SBTarget.cpp  |  2 +-
 lldb/source/API/SBValue.cpp   |  2 +-
 lldb/source/Breakpoint/Watchpoint.cpp | 43 +--
 .../Commands/CommandObjectWatchpoint.cpp  | 30 ++---
 .../Interpreter/OptionGroupWatchpoint.cpp |  9 +++-
 .../Process/gdb-remote/ProcessGDBRemote.cpp   |  9 ++--
 lldb/source/Target/StopInfo.cpp   |  7 +++
 lldb/source/Target/Target.cpp |  3 +-
 .../watchpoint/modify-watchpoints/Makefile|  3 ++
 .../TestModifyWatchpoint.py   | 27 
 .../watchpoint/modify-watchpoints/main.c  | 17 
 14 files changed, 143 insertions(+), 24 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/Makefile
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/TestModifyWatchpoint.py
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/main.c

diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 8fde3b563a3f064..c86d3c7f8c0 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -76,12 +76,14 @@ class Watchpoint : public 
std::enable_shared_from_this,
   
   bool WatchpointRead() const;
   bool WatchpointWrite() const;
+  bool WatchpointModify() const;
   uint32_t GetIgnoreCount() const;
   void SetIgnoreCount(uint32_t n);
   void SetWatchpointType(uint32_t type, bool notify = true);
   void SetDeclInfo(const std::string &str);
   std::string GetWatchSpec();
   void SetWatchSpec(const std::string &str);
+  bool WatchedValueReportable(const ExecutionContext &exe_ctx);
 
   // Snapshot management interface.
   bool IsWatchVariable() const;
@@ -212,7 +214,8 @@ class Watchpoint : public 
std::enable_shared_from_this,
   // again, we check the count, if it is more than 1, it means the user-
   // supplied actions actually want the watchpoint to be disabled!
   uint32_t m_watch_read :

[Lldb-commits] [lldb] [lldb][NFCI] Remove unneeded ConstString from intel-pt plugin (PR #66721)

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

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

This is a follow-up to 14d95b26aee0ac0ac8a70252e8a3c7a986e0e812. I would have 
changed it in that commit, but I don't build the intel-pt plugin so I didn't 
see this until later.

>From 5adfbc5bd2c69422a6f03b94014eb0a96cf2ece6 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Mon, 18 Sep 2023 16:54:52 -0700
Subject: [PATCH] [lldb][NFCI] Remove unneeded ConstString from intel-pt plugin

This is a follow-up to 14d95b26aee0ac0ac8a70252e8a3c7a986e0e812. I would
have changed it in that commit, but I don't build the intel-pt plugin so
I didn't see this until later.
---
 lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | 4 ++--
 lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index bcac731713bb24b..015faa89fcfada8 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -48,8 +48,8 @@ enum {
 #include "TraceIntelPTPropertiesEnum.inc"
 };
 
-ConstString TraceIntelPT::PluginProperties::GetSettingName() {
-  return ConstString(TraceIntelPT::GetPluginNameStatic());
+llvm::StringRef TraceIntelPT::PluginProperties::GetSettingName() {
+  return TraceIntelPT::GetPluginNameStatic();
 }
 
 TraceIntelPT::PluginProperties::PluginProperties() : Properties() {
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index 20faabdce790241..da9cefe9ed95d67 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -26,7 +26,7 @@ class TraceIntelPT : public Trace {
   /// Properties to be used with the `settings` command.
   class PluginProperties : public Properties {
   public:
-static ConstString GetSettingName();
+static llvm::StringRef GetSettingName();
 
 PluginProperties();
 

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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneeded ConstString from intel-pt plugin (PR #66721)

2023-09-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes

This is a follow-up to 14d95b26aee0ac0ac8a70252e8a3c7a986e0e812. I would have 
changed it in that commit, but I don't build the intel-pt plugin so I didn't 
see this until later.

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


2 Files Affected:

- (modified) lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp (+2-2) 
- (modified) lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h (+1-1) 


``diff
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index bcac731713bb24b..015faa89fcfada8 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -48,8 +48,8 @@ enum {
 #include "TraceIntelPTPropertiesEnum.inc"
 };
 
-ConstString TraceIntelPT::PluginProperties::GetSettingName() {
-  return ConstString(TraceIntelPT::GetPluginNameStatic());
+llvm::StringRef TraceIntelPT::PluginProperties::GetSettingName() {
+  return TraceIntelPT::GetPluginNameStatic();
 }
 
 TraceIntelPT::PluginProperties::PluginProperties() : Properties() {
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index 20faabdce790241..da9cefe9ed95d67 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -26,7 +26,7 @@ class TraceIntelPT : public Trace {
   /// Properties to be used with the `settings` command.
   class PluginProperties : public Properties {
   public:
-static ConstString GetSettingName();
+static llvm::StringRef GetSettingName();
 
 PluginProperties();
 

``




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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

https://github.com/dankm updated https://github.com/llvm/llvm-project/pull/65812

>From 5f5e57a5c01088e7f0b9276ed02dd436a3f9cc0a Mon Sep 17 00:00:00 2001
From: Dan McGregor 
Date: Mon, 14 Aug 2023 18:44:08 -0600
Subject: [PATCH 1/2] Support: hoist lld's executable name code to Path

Instead of using custom code to find the program name throughout
the codebase, write one function as a path helper to consistently
determine the program name. This globally correctly finds target
names with dots in them (ie freebsd13.2).
---
 lld/COFF/Driver.cpp|  2 +-
 lld/Common/Args.cpp|  6 --
 lld/ELF/Driver.cpp |  2 +-
 lld/MachO/Driver.cpp   |  2 +-
 lld/include/lld/Common/Args.h  |  2 --
 lld/wasm/Driver.cpp|  2 +-
 lldb/tools/driver/Driver.cpp   |  2 +-
 llvm/include/llvm/Support/Path.h   | 15 +++
 llvm/lib/Support/Path.cpp  |  7 +++
 llvm/tools/llvm-ar/llvm-ar.cpp |  3 ++-
 llvm/tools/llvm-cov/llvm-cov.cpp   |  2 +-
 llvm/tools/llvm-driver/llvm-driver.cpp |  2 +-
 llvm/tools/llvm-objcopy/llvm-objcopy.cpp   |  2 +-
 llvm/tools/llvm-objdump/llvm-objdump.cpp   |  2 +-
 llvm/tools/llvm-rc/llvm-rc.cpp |  2 +-
 llvm/tools/llvm-readobj/llvm-readobj.cpp   |  2 +-
 llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp |  2 +-
 17 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index d7476e91e03e384..03a63bf3a306b4d 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -68,7 +68,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
   auto *ctx = new COFFLinkerContext;
 
   ctx->e.initialize(stdoutOS, stderrOS, exitEarly, disableOutput);
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now"
  " (use /errorlimit:0 to see all errors)";
 
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp
index 48c934df3a2c931..b02d023fe19aeb5 100644
--- a/lld/Common/Args.cpp
+++ b/lld/Common/Args.cpp
@@ -85,9 +85,3 @@ std::vector lld::args::getLines(MemoryBufferRef 
mb) {
   }
   return ret;
 }
-
-StringRef lld::args::getFilenameWithoutExe(StringRef path) {
-  if (path.ends_with_insensitive(".exe"))
-return sys::path::stem(path);
-  return sys::path::filename(path);
-}
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 9d167293574fa64..957d0da1589caf8 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -143,7 +143,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
 
 SharedFile::vernauxNum = 0;
   };
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now (use "
  "--error-limit=0 to see all errors)";
 
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 00ff3439a043be9..ed0b66d4b2ec6ba 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1428,7 +1428,7 @@ bool link(ArrayRef argsArr, 
llvm::raw_ostream &stdoutOS,
 InputFile::resetIdCount();
   };
 
-  ctx->e.logName = args::getFilenameWithoutExe(argsArr[0]);
+  ctx->e.logName = sys::path::program_name(argsArr[0]);
 
   MachOOptTable parser;
   InputArgList args = parser.parse(argsArr.slice(1));
diff --git a/lld/include/lld/Common/Args.h b/lld/include/lld/Common/Args.h
index 60f83fbbbf1a3c9..8822707a6a1f212 100644
--- a/lld/include/lld/Common/Args.h
+++ b/lld/include/lld/Common/Args.h
@@ -38,8 +38,6 @@ uint64_t getZOptionValue(llvm::opt::InputArgList &args, int 
id, StringRef key,
 
 std::vector getLines(MemoryBufferRef mb);
 
-StringRef getFilenameWithoutExe(StringRef path);
-
 } // namespace args
 } // namespace lld
 
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index c2f5f0185781f36..f13aa520f35b100 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -89,7 +89,7 @@ bool link(ArrayRef args, llvm::raw_ostream 
&stdoutOS,
   auto *ctx = new CommonLinkerContext;
 
   ctx->e.initialize(stdoutOS, stderrOS, exitEarly, disableOutput);
-  ctx->e.logName = args::getFilenameWithoutExe(args[0]);
+  ctx->e.logName = sys::path::program_name(args[0]);
   ctx->e.errorLimitExceededMsg = "too many errors emitted, stopping now (use "
  "-error-limit=0 to see all errors)";
 
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index f8058f868d53ffe..2fb760ca97a001d 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -754,7 +754,7 @@ int main(int argc, char const *argv[]) {
   ArrayRef arg_arr = ArrayRef(argv + 1, argc - 1);
   opt::InputArgList input_args =
   T.ParseArgs(arg_arr, MissingA

[Lldb-commits] [lldb] [lldb][NFCI] Remove unneccessary allocation in ScriptInterpreterPythonImpl::GetSyntheticTypeName (PR #66724)

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

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

Instead of copying memory out of the PythonString (via a std::string) and then 
using that to create a ConstString, it would make more sense to just create the 
ConstString from the original StringRef in the first place.

>From 8cd3cba6baf85e18b57a1b2853f03b7fc7db43f7 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Mon, 18 Sep 2023 17:32:28 -0700
Subject: [PATCH] [lldb][NFCI] Remove unneccessary allocation in
 ScriptInterpreterPythonImpl::GetSyntheticTypeName

Instead of copying memory out of the PythonString (via a std::string)
and then using that to create a ConstString, it would make more sense to
just create the ConstString from the original StringRef in the first
place.
---
 .../Python/ScriptInterpreterPython.cpp| 21 ---
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 3fbab6bacec7dbb..6280084ca806828 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2438,24 +2438,11 @@ ConstString 
ScriptInterpreterPythonImpl::GetSyntheticTypeName(
   }
 
   PythonObject py_return = std::move(expected_py_return.get());
+  if (!py_return.IsAllocated() || !PythonString::Check(py_return.get()))
+return {};
 
-  ConstString ret_val;
-  bool got_string = false;
-  std::string buffer;
-
-  if (py_return.IsAllocated() && PythonString::Check(py_return.get())) {
-PythonString py_string(PyRefType::Borrowed, py_return.get());
-llvm::StringRef return_data(py_string.GetString());
-if (!return_data.empty()) {
-  buffer.assign(return_data.data(), return_data.size());
-  got_string = true;
-}
-  }
-
-  if (got_string)
-ret_val.SetCStringWithLength(buffer.c_str(), buffer.size());
-
-  return ret_val;
+  PythonString type_name(PyRefType::Borrowed, py_return.get());
+  return ConstString(py_string.GetString());
 }
 
 bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(

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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneccessary allocation in ScriptInterpreterPythonImpl::GetSyntheticTypeName (PR #66724)

2023-09-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes

Instead of copying memory out of the PythonString (via a std::string) and then 
using that to create a ConstString, it would make more sense to just create the 
ConstString from the original StringRef in the first place.

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


1 Files Affected:

- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(+4-17) 


``diff
diff --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 3fbab6bacec7dbb..6280084ca806828 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2438,24 +2438,11 @@ ConstString 
ScriptInterpreterPythonImpl::GetSyntheticTypeName(
   }
 
   PythonObject py_return = std::move(expected_py_return.get());
+  if (!py_return.IsAllocated() || !PythonString::Check(py_return.get()))
+return {};
 
-  ConstString ret_val;
-  bool got_string = false;
-  std::string buffer;
-
-  if (py_return.IsAllocated() && PythonString::Check(py_return.get())) {
-PythonString py_string(PyRefType::Borrowed, py_return.get());
-llvm::StringRef return_data(py_string.GetString());
-if (!return_data.empty()) {
-  buffer.assign(return_data.data(), return_data.size());
-  got_string = true;
-}
-  }
-
-  if (got_string)
-ret_val.SetCStringWithLength(buffer.c_str(), buffer.size());
-
-  return ret_val;
+  PythonString type_name(PyRefType::Borrowed, py_return.get());
+  return ConstString(py_string.GetString());
 }
 
 bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(

``




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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

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

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

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

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

Thanks for the changes! Looks great

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

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


@@ -6,11 +6,7 @@
 ) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
 %feature("docstring", "Gets whether the watchpoint should stop on read 
accesses."
 ) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
-%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses."
+%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where 
lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways 
will stop on any write to the watched region, and on some targets there can 
false watchpoint stops where memory near the watched region was written, and 
lldb cannot detect that it is a spurious stop."

clayborg wrote:

Do we need to state "and on some targets there can false watchpoint stops where 
memory near the watched region was written, and lldb cannot detect that it is a 
spurious stop."? Can we remove that? Seems like information that most users 
wouldn't need to know?

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread via lldb-commits

jimingham wrote:

That watchpoints can be inaccurate is probably news to a lot of debugger users, 
and knowing that might save somebody a fruitless hour wondering "how that 
variable could be being modified here..."  But I don't think most folks are 
likely to see the API doc string.  Might be more useful to mention this in the 
"watch set" help.

Jikm

> On Sep 18, 2023, at 6:38 PM, Greg Clayton ***@***.***> wrote:
> 
> 
> @clayborg approved this pull request.
> 
> Thanks for the changes! Looks great
> 
> In lldb/bindings/interface/SBWatchpointOptionsDocstrings.i 
> :
> 
> > @@ -6,11 +6,7 @@
>  ) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
>  %feature("docstring", "Gets whether the watchpoint should stop on read 
> accesses."
>  ) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
> -%feature("docstring", "Sets whether the watchpoint should stop on write 
> accesses."
> +%feature("docstring", "Sets whether the watchpoint should stop on write 
> accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, 
> where lldb will stop when the watched value has changed. 
> eWatchpointWriteTypeAlways will stop on any write to the watched region, and 
> on some targets there can false watchpoint stops where memory near the 
> watched region was written, and lldb cannot detect that it is a spurious 
> stop."
> Do we need to state "and on some targets there can false watchpoint stops 
> where memory near the watched region was written, and lldb cannot detect that 
> it is a spurious stop."? Can we remove that? Seems like information that most 
> users wouldn't need to know?
> 
> —
> Reply to this email directly, view it on GitHub 
> ,
>  or unsubscribe 
> .
> You are receiving this because your review was requested.
> 



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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneeded ConstString from intel-pt plugin (PR #66721)

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

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


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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneccessary allocation in ScriptInterpreterPythonImpl::GetSyntheticTypeName (PR #66724)

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

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


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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneeded ConstString from intel-pt plugin (PR #66721)

2023-09-18 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread Jason Molenda via lldb-commits


@@ -6,11 +6,7 @@
 ) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
 %feature("docstring", "Gets whether the watchpoint should stop on read 
accesses."
 ) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
-%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses."
+%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where 
lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways 
will stop on any write to the watched region, and on some targets there can 
false watchpoint stops where memory near the watched region was written, and 
lldb cannot detect that it is a spurious stop."

jasonmolenda wrote:

Yeah I'll remove that text.  It's going to be part of my large watchpoints 
enhancement -- on stubs that support it on AArch64, we'll use a masking 
watchpoint, so you can watch a 48 byte object but we'll do it by watching 64 
bytes of memory.  for a straight-up "write" watchpoint, we can't tell whether 
the 48 bytes were written to with the same value, or the 16 bytes we aren't 
intending to watch were written to.  Also with AArch64 in SVE Streaming Mode, 
the address matching is at lower accuracy, so a write near a watchpoint can 
match the watchpoint, even if it didn't actually access the memory range.

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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unneccessary allocation in ScriptInterpreterPythonImpl::GetSyntheticTypeName (PR #66724)

2023-09-18 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread Jason Molenda via lldb-commits


@@ -6,11 +6,7 @@
 ) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
 %feature("docstring", "Gets whether the watchpoint should stop on read 
accesses."
 ) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
-%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses."
+%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where 
lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways 
will stop on any write to the watched region, and on some targets there can 
false watchpoint stops where memory near the watched region was written, and 
lldb cannot detect that it is a spurious stop."

jasonmolenda wrote:

(and the "modify" watchpoint type solves both of these, because we can only 
report watchpoint hits where the watched memory region changes)

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/66308

>From 1efbce9f3b754f45372f0098163e70c2118b57d9 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 13 Sep 2023 17:38:31 -0700
Subject: [PATCH 1/4] [lldb] Add 'modify' type watchpoints, make it default

Watchpoints in lldb can be either 'read', 'write', or
'read/write'.  This is exposing the actual behavior of
hardware watchpoints.  gdb has a different behavior:
a "write" type watchpoint only stops when the watched
memory region *changes*.

A user is using a watchpoint for one of three reasons:

1. Want to find what is changing/corrupting this memory.
3. Want to find what is reading from this memory.
2. Want to find what is writing to this memory.

I believe (1) is the most common use case for watchpoints,
and it currently can't be done in lldb -- the user needs
to continue every time the same value is written to the
watched-memory manually.  I think gdb's behavior is the
correct one.  There are some use cases where a developer
wants to find every function that writes/reads to/from a memory
region, regardless of value, I want to still allow that
functionality.

This is also a bit of groundwork for my large watchpoint
support proposal
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
where I will be adding support for AArch64 MASK watchpoints
which watch power-of-2 memory regions.  A user might ask
to watch 24 bytes, and a MASK watchpoint stub can do this
with a 32-byte MASK watchpoint if it is properly aligned.
And we need to ignore writes to the final 8 bytes of that
watched region, and not show those hits to the user.

This patch adds a new 'modify' watchpoint type and it
is the default.

The part of this patch I think is the most questionable
is the
SBTarget::CreateWatchpoint(addr, size, bool read, bool write, error)
which I currently change the meaning of write==True to be
Modify.  This is part of making 'modify' the default watchpoint
type - a driver is likely setting write==True for its watchpoints.

I chatted with Alex and Jim about this a little and I'm not sure
how I should solve this for real.  Add a new SBTarget::CreateWatchpoint
API with a third `bool modify` argument in addition to the old one?
Add a new SBWatchpointOptions class in case we want to add more
types of watchpoints?  I'm not sure what other types of watchpoints
we'd want to hardcode in our support.  We have conditional expressions
or python callbacks that can do more unique operations.

There's more work here - the SB API needs to give the driver a way
to specify all three possible types of watchpoint ('write' and
'modify' being exclusive of the other) - but I'd love to hear what
other people think we should do for this API especially.
---
 lldb/include/lldb/Breakpoint/Watchpoint.h |  5 ++-
 .../lldb/Interpreter/OptionGroupWatchpoint.h  |  6 ++-
 lldb/include/lldb/lldb-defines.h  |  4 +-
 lldb/source/API/SBTarget.cpp  |  2 +-
 lldb/source/API/SBValue.cpp   |  2 +-
 lldb/source/Breakpoint/Watchpoint.cpp | 43 +--
 .../Commands/CommandObjectWatchpoint.cpp  | 30 ++---
 .../Interpreter/OptionGroupWatchpoint.cpp |  9 +++-
 .../Process/gdb-remote/ProcessGDBRemote.cpp   |  9 ++--
 lldb/source/Target/StopInfo.cpp   |  7 +++
 lldb/source/Target/Target.cpp |  3 +-
 .../watchpoint/modify-watchpoints/Makefile|  3 ++
 .../TestModifyWatchpoint.py   | 27 
 .../watchpoint/modify-watchpoints/main.c  | 17 
 14 files changed, 143 insertions(+), 24 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/Makefile
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/TestModifyWatchpoint.py
 create mode 100644 
lldb/test/API/functionalities/watchpoint/modify-watchpoints/main.c

diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 8fde3b563a3f064..c86d3c7f8c0 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -76,12 +76,14 @@ class Watchpoint : public 
std::enable_shared_from_this,
   
   bool WatchpointRead() const;
   bool WatchpointWrite() const;
+  bool WatchpointModify() const;
   uint32_t GetIgnoreCount() const;
   void SetIgnoreCount(uint32_t n);
   void SetWatchpointType(uint32_t type, bool notify = true);
   void SetDeclInfo(const std::string &str);
   std::string GetWatchSpec();
   void SetWatchSpec(const std::string &str);
+  bool WatchedValueReportable(const ExecutionContext &exe_ctx);
 
   // Snapshot management interface.
   bool IsWatchVariable() const;
@@ -212,7 +214,8 @@ class Watchpoint : public 
std::enable_shared_from_this,
   // again, we check the count, if it is more than 1, it means the user-
   // supplied actions actually want the watchpoint to be disabled!
   uint32_t m_watch_read :

[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-18 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] 3692267 - [lldb] Add 'modify' type watchpoints, make it default (#66308)

2023-09-18 Thread via lldb-commits

Author: Jason Molenda
Date: 2023-09-18T19:16:45-07:00
New Revision: 3692267ca8f9c51cb55e4387283762d921fe2ae2

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

LOG: [lldb] Add 'modify' type watchpoints, make it default (#66308)

Watchpoints in lldb can be either 'read', 'write', or 'read/write'. This
is exposing the actual behavior of hardware watchpoints. gdb has a
different behavior: a "write" type watchpoint only stops when the
watched memory region *changes*.

A user is using a watchpoint for one of three reasons:

1. Want to find what is changing/corrupting this memory.
2. Want to find what is writing to this memory.
3. Want to find what is reading from this memory.

I believe (1) is the most common use case for watchpoints, and it
currently can't be done in lldb -- the user needs to continue every time
the same value is written to the watched-memory manually. I think gdb's
behavior is the correct one. There are some use cases where a developer
wants to find every function that writes/reads to/from a memory region,
regardless of value, I want to still allow that functionality.

This is also a bit of groundwork for my large watchpoint support
proposal
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
where I will be adding support for AArch64 MASK watchpoints which watch
power-of-2 memory regions. A user might ask to watch 24 bytes, and a
MASK watchpoint stub can do this with a 32-byte MASK watchpoint if it is
properly aligned. And we need to ignore writes to the final 8 bytes of
that watched region, and not show those hits to the user.

This patch adds a new 'modify' watchpoint type and it is the default.

rdar://108234227

Added: 
lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
lldb/include/lldb/API/SBWatchpointOptions.h
lldb/source/API/SBWatchpointOptions.cpp
lldb/test/API/functionalities/watchpoint/modify-watchpoints/Makefile

lldb/test/API/functionalities/watchpoint/modify-watchpoints/TestModifyWatchpoint.py
lldb/test/API/functionalities/watchpoint/modify-watchpoints/main.c

Modified: 
lldb/bindings/headers.swig
lldb/bindings/interfaces.swig
lldb/include/lldb/API/SBTarget.h
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/lldb-defines.h
lldb/include/lldb/lldb-enumerations.h
lldb/include/lldb/lldb-forward.h
lldb/source/API/CMakeLists.txt
lldb/source/API/SBTarget.cpp
lldb/source/API/SBValue.cpp
lldb/source/API/SBWatchpoint.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/StopInfo.cpp
lldb/source/Target/Target.cpp
lldb/test/API/commands/watchpoints/multiple_hits/main.cpp
lldb/test/API/commands/watchpoints/unaligned-watchpoint/main.c

lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py

lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py

lldb/test/API/functionalities/watchpoint/unaligned-spanning-two-dwords/TestUnalignedSpanningDwords.py
lldb/test/API/python_api/default-constructor/sb_target.py
lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py

Removed: 




diff  --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig
index f7871765624dd31..d392ed43d8c0c9e 100644
--- a/lldb/bindings/headers.swig
+++ b/lldb/bindings/headers.swig
@@ -77,4 +77,5 @@
 #include "lldb/API/SBValueList.h"
 #include "lldb/API/SBVariablesOptions.h"
 #include "lldb/API/SBWatchpoint.h"
+#include "lldb/API/SBWatchpointOptions.h"
 %}

diff  --git a/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i 
b/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
new file mode 100644
index 000..370bf95401dcb5e
--- /dev/null
+++ b/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
@@ -0,0 +1,12 @@
+%feature("docstring",
+"A container for options to use when creating watchpoints."
+) lldb::SBWatchpointOptions;
+
+%feature("docstring", "Sets whether the watchpoint should stop on read 
accesses."
+) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
+%feature("docstring", "Gets whether the watchpoint should stop on read 
accesses."
+) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
+%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where 
lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways 
will stop on any write to the watched region, even if it's the value is the 
same."
+) lldb::SBWatchpointOptions::SetWat

[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

https://github.com/dtcxzyw updated 
https://github.com/llvm/llvm-project/pull/65852

>From d9d8bcbb98e8f5aecb9733329389d61a489bd731 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng 
Date: Sat, 9 Sep 2023 23:07:29 +0800
Subject: [PATCH 1/6] [InstCombine] Simplify the pattern `a ne/eq (zext (a
 ne/eq c))`

---
 .../InstCombine/InstCombineCompares.cpp   |  62 ++
 .../test/Transforms/InstCombine/icmp-range.ll | 181 ++
 2 files changed, 243 insertions(+)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 9fdc46fec631679..837b8e6d2619989 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -6309,7 +6309,69 @@ Instruction 
*InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
   Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
 return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  // icmp eq/ne X, (zext (icmp eq/ne X, C))
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+ m_ZExt(m_ICmp(Pred2, m_Deferred(X), m_APInt(C) &&
+  ICmpInst::isEquality(Pred1) && ICmpInst::isEquality(Pred2)) {
+if (C->isZero()) {
+  if (Pred2 == ICmpInst::ICMP_EQ) {
+// icmp eq X, (zext (icmp eq X, 0)) --> false
+// icmp ne X, (zext (icmp eq X, 0)) --> true
+return replaceInstUsesWith(
+I,
+Constant::getIntegerValue(
+I.getType(),
+APInt(1U, static_cast(Pred1 == ICmpInst::ICMP_NE;
+  } else {
+// icmp eq X, (zext (icmp ne X, 0)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp ne X, 0)) --> icmp ugt X, 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+X,
+Constant::getIntegerValue(
+X->getType(), APInt(X->getType()->getScalarSizeInBits(),
+Pred1 == ICmpInst::ICMP_NE ? 1 : 2)));
+  }
+} else if (C->isOne()) {
+  if (Pred2 == ICmpInst::ICMP_NE) {
+// icmp eq X, (zext (icmp ne X, 1)) --> false
+// icmp ne X, (zext (icmp ne X, 1)) --> true
+return replaceInstUsesWith(
+I,
+Constant::getIntegerValue(
+I.getType(),
+APInt(1U, static_cast(Pred1 == ICmpInst::ICMP_NE;
+  } else {
+// icmp eq X, (zext (icmp eq X, 1)) --> icmp ult X, 2
+// icmp ne X, (zext (icmp eq X, 1)) --> icmp ugt X, 1
+return ICmpInst::Create(
+Instruction::ICmp,
+Pred1 == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGT
+   : ICmpInst::ICMP_ULT,
+X,
+Constant::getIntegerValue(
+X->getType(), APInt(X->getType()->getScalarSizeInBits(),
+Pred1 == ICmpInst::ICMP_NE ? 1 : 2)));
+  }
+} else {
+  // C != 0 && C != 1
+  // icmp eq X, (zext (icmp eq X, C)) --> icmp eq X, 0
+  // icmp eq X, (zext (icmp ne X, C)) --> icmp eq X, 1
+  // icmp ne X, (zext (icmp eq X, C)) --> icmp ne X, 0
+  // icmp ne X, (zext (icmp ne X, C)) --> icmp ne X, 1
+  return ICmpInst::Create(
+  Instruction::ICmp, Pred1, X,
+  Constant::getIntegerValue(
+  X->getType(),
+  APInt(X->getType()->getScalarSizeInBits(),
+static_cast(Pred2 == ICmpInst::ICMP_NE;
+}
+  }
+
   if (match(I.getOperand(0), m_c_Add(m_ZExt(m_Value(X)), m_SExt(m_Value(Y 
&&
   match(I.getOperand(1), m_APInt(C)) &&
   X->getType()->isIntOrIntVectorTy(1) &&
diff --git a/llvm/test/Transforms/InstCombine/icmp-range.ll 
b/llvm/test/Transforms/InstCombine/icmp-range.ll
index 4281e09cb0309c8..15424fce33fdeea 100644
--- a/llvm/test/Transforms/InstCombine/icmp-range.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-range.ll
@@ -1034,6 +1034,187 @@ define i1 @icmp_ne_bool_1(ptr %ptr) {
   ret i1 %cmp
 }
 
+define i1 @icmp_ne_zext_eq_zero(i32 %a) {
+; CHECK-LABEL: @icmp_ne_zext_eq_zero(
+; CHECK-NEXT:ret i1 true
+;
+  %cmp = icmp eq i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp ne i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_ne_zext_ne_zero(i32 %a) {
+; CHECK-LABEL: @icmp_ne_zext_ne_zero(
+; CHECK-NEXT:[[CMP1:%.*]] = icmp ugt i32 [[A:%.*]], 1
+; CHECK-NEXT:ret i1 [[CMP1]]
+;
+  %cmp = icmp ne i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp ne i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_eq_zext_eq_zero(i32 %a) {
+; CHECK-LABEL: @icmp_eq_zext_eq_zero(
+; CHECK-NEXT:ret i1 false
+;
+  %cmp = icmp eq i32 %a, 0
+  %conv = zext i1 %cmp to i32
+  %cmp1 = icmp eq i32 %conv, %a
+  ret i1 %cmp1
+}
+
+define i1 @icmp_eq_zext_ne_zero(i32 %

[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

2023-09-18 Thread Yingwei Zheng via lldb-commits

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


[Lldb-commits] [lldb] 44532a9 - Revert "[lldb] Add 'modify' type watchpoints, make it default (#66308)"

2023-09-18 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2023-09-18T22:50:39-07:00
New Revision: 44532a9dd4a0ed08850dbddf80b7abcc51c4a7f1

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

LOG: Revert "[lldb] Add 'modify' type watchpoints, make it default (#66308)"

TestStepOverWatchpoint.py and TestUnalignedWatchpoint.py are failing
on the ubuntu and debian bots
https://lab.llvm.org/buildbot/#/builders/68/builds/60204
https://lab.llvm.org/buildbot/#/builders/96/builds/45623

and the newly added test TestModifyWatchpoint.py does not
work on windows bot
https://lab.llvm.org/buildbot/#/builders/219/builds/5708

I will debug tomorrow morning and reland.

This reverts commit 3692267ca8f9c51cb55e4387283762d921fe2ae2.

Added: 


Modified: 
lldb/bindings/headers.swig
lldb/bindings/interfaces.swig
lldb/include/lldb/API/SBTarget.h
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/lldb-defines.h
lldb/include/lldb/lldb-enumerations.h
lldb/include/lldb/lldb-forward.h
lldb/source/API/CMakeLists.txt
lldb/source/API/SBTarget.cpp
lldb/source/API/SBValue.cpp
lldb/source/API/SBWatchpoint.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/StopInfo.cpp
lldb/source/Target/Target.cpp
lldb/test/API/commands/watchpoints/multiple_hits/main.cpp
lldb/test/API/commands/watchpoints/unaligned-watchpoint/main.c

lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py

lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py

lldb/test/API/functionalities/watchpoint/unaligned-spanning-two-dwords/TestUnalignedSpanningDwords.py
lldb/test/API/python_api/default-constructor/sb_target.py
lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py

Removed: 
lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
lldb/include/lldb/API/SBWatchpointOptions.h
lldb/source/API/SBWatchpointOptions.cpp
lldb/test/API/functionalities/watchpoint/modify-watchpoints/Makefile

lldb/test/API/functionalities/watchpoint/modify-watchpoints/TestModifyWatchpoint.py
lldb/test/API/functionalities/watchpoint/modify-watchpoints/main.c



diff  --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig
index d392ed43d8c0c9e..f7871765624dd31 100644
--- a/lldb/bindings/headers.swig
+++ b/lldb/bindings/headers.swig
@@ -77,5 +77,4 @@
 #include "lldb/API/SBValueList.h"
 #include "lldb/API/SBVariablesOptions.h"
 #include "lldb/API/SBWatchpoint.h"
-#include "lldb/API/SBWatchpointOptions.h"
 %}

diff  --git a/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i 
b/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
deleted file mode 100644
index 370bf95401dcb5e..000
--- a/lldb/bindings/interface/SBWatchpointOptionsDocstrings.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%feature("docstring",
-"A container for options to use when creating watchpoints."
-) lldb::SBWatchpointOptions;
-
-%feature("docstring", "Sets whether the watchpoint should stop on read 
accesses."
-) lldb::SBWatchpointOptions::SetWatchpointTypeRead;
-%feature("docstring", "Gets whether the watchpoint should stop on read 
accesses."
-) lldb::SBWatchpointOptions::GetWatchpointTypeRead;
-%feature("docstring", "Sets whether the watchpoint should stop on write 
accesses. eWatchpointWriteTypeOnModify is the most commonly useful mode, where 
lldb will stop when the watched value has changed. eWatchpointWriteTypeAlways 
will stop on any write to the watched region, even if it's the value is the 
same."
-) lldb::SBWatchpointOptions::SetWatchpointTypeWrite;
-%feature("docstring", "Gets whether the watchpoint should stop on write 
accesses, returning WatchpointWriteType to indicate the type of write watching 
that is enabled, or eWatchpointWriteTypeDisabled."
-) lldb::SBWatchpointOptions::GetWatchpointTypeWrite;

diff  --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index 306cfe683893271..53f8fcc8145ac18 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -80,7 +80,6 @@
 %include "./interface/SBValueListDocstrings.i"
 %include "./interface/SBVariablesOptionsDocstrings.i"
 %include "./interface/SBWatchpointDocstrings.i"
-%include "./interface/SBWatchpointOptionsDocstrings.i"
 
 /* API headers */
 %include "lldb/API/SBAddress.h"
@@ -153,7 +152,6 @@
 %include "lldb/API/SBValueList.h"
 %include "lldb/API/SBVariablesOptions.h"
 %include "lldb/API/SBWatchpoint.h"
-%include "lldb/API/SBWatchpointOptions.h"
 
 /* Extensions for SB classes */
 %include "./inter

[Lldb-commits] [lldb] [InstCombine] Canonicalize `and(zext(A), B)` into `select A, B & 1, 0` (PR #66740)

2023-09-18 Thread via lldb-commits

DianQK wrote:

We should use rebase instead of merge.
I recommend force push to change the code before the review starts.

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