[Lldb-commits] [PATCH] D136795: [LLDB] Mark placeholder modules in `target module list` output.

2022-10-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

It's a good idea, but this is a pretty bad layering violation. The 
"placeholder" object files aren't even first class plugins (though I think they 
should be -- as the concept is useful in other situations as well), but an 
internal detail of the minidump process plugin.

Ideally, we would do this from inside the minidump code, perhaps by modifying 
the name (file spec) of the fake object file?

A test would be nice as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136795

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


[Lldb-commits] [PATCH] D136761: [lldb][FormatEntity] Fix closing parenthesis for function.name-with-args frame format

2022-10-27 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

> Keep the argument printing part, and replace the basename parsing with a call 
> to the language parser ?

The two main caveats here are:

1. the name parser drops the return type when parsing a basename
2. the code-path is also used for cases where a language plugin isn't available 
(not sure how often/whether that happens in practice). So I don't think we can 
"replace"

I think we want to:

1. Add something like `CPlusPlusNameParser::MethodName::GetReturnType`
2. Implement `CPlusPlusLanguage::GetFunctionDisplayName` where we could re-use 
the argument parsing code from `FormatEntity` but get the basename from the 
language plugin

Shouldn't be too bad


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136761

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


[Lldb-commits] [PATCH] D136362: [LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV

2022-10-27 Thread Tiezhu Yang via Phabricator via lldb-commits
seehearfeel added a comment.

After commit 05ae747a5353811f93f5814f24d2335e6229d78a 
 
("[LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV"),
build failed when "ninja check-lldb" on my local machine:

  [1/3] Building CXX object 
tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
  FAILED: 
tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
 
  /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/loongson/llvm-project/llvm/build/tools/lldb/unittests/Instruction 
-I/home/loongson/llvm-project/lldb/unittests/Instruction 
-I/home/loongson/llvm-project/lldb/include 
-I/home/loongson/llvm-project/llvm/build/tools/lldb/include 
-I/home/loongson/llvm-project/llvm/build/include 
-I/home/loongson/llvm-project/llvm/include 
-I/home/loongson/llvm-project/llvm/../clang/include 
-I/home/loongson/llvm-project/llvm/build/tools/lldb/../clang/include 
-I/home/loongson/llvm-project/lldb/source 
-I/home/loongson/llvm-project/lldb/unittests 
-I/home/loongson/llvm-project/llvm/utils/unittest/googletest/include 
-I/home/loongson/llvm-project/llvm/utils/unittest/googlemock/include -isystem 
/usr/include/libxml2 -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move 
-Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor 
-Wsuggest-override -Wno-comment -Wno-misleading-indentation 
-Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections 
-fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas 
-Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG  -include 
/home/loongson/llvm-project/lldb/unittests/gtest_common.h -Wno-variadic-macros 
-fno-exceptions -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT 
tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
 -MF 
tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o.d
 -o 
tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
 -c 
/home/loongson/llvm-project/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
  c++: fatal error: Killed signal terminated program cc1plus
  compilation terminated.
  ninja: build stopped: subcommand failed.

After revert the changes in 
lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp, build successful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136362

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


[Lldb-commits] [lldb] 88d7508 - Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-10-27T13:46:56+02:00
New Revision: 88d7508dc479210f07abccb17f0194b66264b125

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

LOG: Harmonize cmake_policy() across standalone builds of all projects

Move `cmake_policy()` settings from `llvm/CMakeLists.txt` into a shared
`cmake/modules/CMakePolicy.cmake`.  Include it from all relevant
projects that support standalone builds, in order to ensure that
the policies are consistently set whether they are built in-tree
or stand-alone.

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

Added: 
cmake/Modules/CMakePolicy.cmake

Modified: 
clang/CMakeLists.txt
flang/CMakeLists.txt
lld/CMakeLists.txt
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
llvm/CMakeLists.txt
mlir/CMakeLists.txt

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 6f590c830b23d..fcd09c16bb57e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # If we are not building as a part of LLVM, build Clang as an
 # standalone project, using LLVM as an external library:

diff  --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
new file mode 100644
index 0..0ec32ad8637f3
--- /dev/null
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -0,0 +1,12 @@
+# CMake policy settings shared between LLVM projects
+
+# CMP0114: ExternalProject step targets fully adopt their steps.
+# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
+if(POLICY CMP0114)
+  cmake_policy(SET CMP0114 OLD)
+endif()
+# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
+# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
+if(POLICY CMP0116)
+  cmake_policy(SET CMP0116 OLD)
+endif()

diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 27cb22ba0e382..a938ab949481a 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index be4ea8540750e..964bc3fd8b175 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # If we are not building as a part of LLVM, build LLD as an
 # standalone project, using LLVM as an external library:

diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 12ba8a9d79e20..fad7b00dc624d 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH

diff  --git a/lldb/cmake/modules/LLDBStandalone.cmake 
b/lldb/cmake/modules/LLDBStandalone.cmake
index 1a03c5a5ef749..3ce63f12eef39 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,9 +1,3 @@
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 5b493a7ebad55..5a81bd4598824 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1,17 +1,8 @@
 # See docs/CMake.html for instructions about how to build LLVM with CMake.
 
 cmake_minimum_required(VERSION 3.13.4)
-
-# CMP0114: ExternalProject step targets fully adopt their steps.
-# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
-if(POLICY CMP0114)
-  cmake_policy(SET CMP0114 OLD)
-endif()
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 

diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5b6650d182a56..33988682c8231 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -1,4 +1,7 @@
 # MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Mo

[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG88d7508dc479: Harmonize cmake_policy() across standalone 
builds of all projects (authored by mgorny).
Herald added projects: clang, LLDB, Flang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136572

Files:
  clang/CMakeLists.txt
  cmake/Modules/CMakePolicy.cmake
  flang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt

Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,4 +1,7 @@
 # MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -10,8 +13,6 @@
 include(GNUInstallDirs)
 
 if(MLIR_STANDALONE_BUILD)
-  cmake_minimum_required(VERSION 3.13.4)
-
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
   include(HandleLLVMOptions)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1,17 +1,8 @@
 # See docs/CMake.html for instructions about how to build LLVM with CMake.
 
 cmake_minimum_required(VERSION 3.13.4)
-
-# CMP0114: ExternalProject step targets fully adopt their steps.
-# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
-if(POLICY CMP0114)
-  cmake_policy(SET CMP0114 OLD)
-endif()
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,9 +1,3 @@
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # If we are not building as a part of LLVM, build LLD as an
 # standalone project, using LLVM as an external library:
Index: flang/CMakeLists.txt
===
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 
Index: cmake/Modules/CMakePolicy.cmake
===
--- /dev/null
+++ cmake/Modules/CMakePolicy.cmake
@@ -0,0 +1,12 @@
+# CMake policy settings shared between LLVM projects
+
+# CMP0114: ExternalProject step targets fully adopt their steps.
+# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
+if(POLICY CMP0114)
+  cmake_policy(SET CMP0114 OLD)
+endif()
+# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
+# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
+if(POLICY CMP0116)
+  cmake_policy(SET CMP0116 OLD)
+endif()
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -1,4 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # If we are not building as a part of LLVM, build Clang as an
 # standalone project, using LLVM as an external library:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://

[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.
Herald added subscribers: JDevlieghere, jdoerfert.

This broke builds where clang/lld/lldb are symlinked into `llvm/tools` instead 
of specified via `LLVM_ENABLE_PROJECTS` - since 
`${CMAKE_CURRENT_SOURCE_DIR}/../cmake` doesn't find anything in that context.

(The reason for wanting to stick to such a legacy setup, is that ccache caches 
can't be shared between workdirs for source files that are found outside of the 
base `llvm-project/llvm` directory - and I'm heavily reliant on ccache for 
keeping build times manageable in my dev workflow.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136801: [intelpt] Update Python tests to account for new errrors

2022-10-27 Thread Jakob Johnson via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG17c65e51b916: [intelpt] Update Python tests to account for 
new errrors (authored by jj10306).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136801

Files:
  lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
  lldb/test/API/commands/trace/TestTraceLoad.py

Index: lldb/test/API/commands/trace/TestTraceLoad.py
===
--- lldb/test/API/commands/trace/TestTraceLoad.py
+++ lldb/test/API/commands/trace/TestTraceLoad.py
@@ -13,11 +13,11 @@
 trace_description_file_path = os.path.join(src_dir, "intelpt-multi-core-trace", "trace.json")
 self.traceLoad(traceDescriptionFilePath=trace_description_file_path, substrs=["intel-pt"])
 self.expect("thread trace dump instructions 2 -t",
-  substrs=["19532: [20456513.000 ns] (error) expected tracing enabled event",
+  substrs=["19526: [19691636.212 ns] (error) decoding truncated: TSC 40450075478109270 exceeds maximum TSC value 40450075477704372, will skip decoding the remaining data of the PSB (skipping 774 of 825 bytes)",
"m.out`foo() + 65 at multi_thread.cpp:12:21",
-   "9524: [19691630.226 ns] 0x00400ba7jg 0x400bb3"])
+   "9524: [19691632.221 ns] 0x00400ba7jg 0x400bb3"])
 self.expect("thread trace dump instructions 3 -t",
-  substrs=["61831: [19736134.073 ns] 0x00400bd7addl   $0x1, -0x4(%rbp)",
+  substrs=["61831: [19736132.088 ns] 0x00400bd7addl   $0x1, -0x4(%rbp)",
"m.out`bar() + 26 at multi_thread.cpp:20:6"])
 
 self.expect("thread trace dump info --json",
@@ -62,20 +62,20 @@
   "traceTechnology": "intel-pt",
   "threadStats": {
 "tid": 3497496,
-"traceItemsCount": 19533,
+"traceItemsCount": 19527,
 "memoryUsage": {
-  "totalInBytes": "176065",
-  "avgPerItemInBytes": 9.''', '''},
+  "totalInBytes": "175819",
+  "avgPerItemInBytes": 9.0038920469094084''', '''},
 "timingInSeconds": {
   "Decoding instructions": ''', '''
 },
 "events": {
-  "totalCount": 11,
+  "totalCount": 5,
   "individualCounts": {
 "software disabled tracing": 1,
 "trace synchronization point": 1,
 "CPU core changed": 1,
-"HW clock tick": 8
+"HW clock tick": 2
   }
 },
 "errors": {
@@ -116,11 +116,12 @@
 # we'll load the compact trace and make sure it works
 self.traceLoad(os.path.join(compact_trace_bundle_dir, "trace.json"), substrs=["intel-pt"])
 self.expect("thread trace dump instructions 2 -t",
-  substrs=["19532: [20456513.000 ns] (error) expected tracing enabled event",
+  substrs=["19526: [19691636.212 ns] (error) decoding truncated: TSC 40450075478109270 exceeds maximum TSC value 40450075477704372, will skip decoding the remaining data of the PSB (skipping 774 of 825 bytes)",
"m.out`foo() + 65 at multi_thread.cpp:12:21",
-   "19524: [19691630.226 ns] 0x00400ba7jg 0x400bb3"])
+   "19524: [19691632.221 ns] 0x00400ba7jg 0x400bb3"])
 self.expect("thread trace dump instructions 3 -t",
-  substrs=["61831: [19736134.073 ns] 0x00400bd7addl   $0x1, -0x4(%rbp)",
+  substrs=["61833: [19736136.079 ns] (error) decoding truncated: TSC 40450075478174268 exceeds maximum TSC value 40450075477820383, will skip decoding the remaining data of the PSB (skipping 296 of 297 bytes)",
+   "61831: [19736132.088 ns] 0x00400bd7addl   $0x1, -0x4(%rbp)",
"m.out`bar() + 26 at multi_thread.cpp:20:6"])
 
 # This reduced the number of continuous executions to look at
@@ -135,11 +136,11 @@
 trace_description_file_path = os.path.join(src_dir, "intelpt-multi-core-trace", "trace_with_string_numbers.json")
 self.traceLoad(traceDescriptionFilePath=trace_description_file_path, substrs=["intel-pt"])
 self.expect("thread trace dump instructions 2 -t",
-  substrs=["19532: [20456513.000 ns] (error) expected tracing enabled event",
+  substrs=["19526: [19691636.212 ns] (error) decoding truncated: TSC 40450075478109270 exceeds maximum TSC value 40450075477704372, will skip decoding the remaining data of the PSB (skipping 774 of 825 bytes)",
"m.out`foo() + 65 at multi_thread.cpp:12:21",
-   "19524: [19691630.226 ns] 0x00400ba7jg 0x400bb3"])
+   "19524: [19691632.221 ns] 0x00400ba7jg 0x400bb3"])
 self.expect("thread trace dump instructions 3 -t",
-  substrs=["61831: [19736134.073 ns] 0x00400bd7addl   $0x1, -0x4(%rbp)",
+ 

[Lldb-commits] [lldb] 17c65e5 - [intelpt] Update Python tests to account for new errrors

2022-10-27 Thread Jakob Johnson via lldb-commits

Author: Jakob Johnson
Date: 2022-10-27T05:09:08-07:00
New Revision: 17c65e51b91620181662302e9abd7e9694154c5d

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

LOG: [intelpt] Update Python tests to account for new errrors

Update the Python tests (ie tests run via `lldb-dotest -p TestTrace`) to
handle new error introduced in D136610.

Test Plan:
`lldb-dotest -p TestTrace`

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

Added: 


Modified: 
lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
lldb/test/API/commands/trace/TestTraceLoad.py

Removed: 




diff  --git a/lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py 
b/lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
index 0a8b4f4d2a3dd..a022dd3b31522 100644
--- a/lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
+++ b/lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
@@ -44,7 +44,7 @@ def testFunctionCallsWithErrors(self):
 m.out`foo() + 65 at multi_thread.cpp:12:21 to 12:21  [4, 19524]
 
 [call tree #1]
-  [19532, 19532]'''])
+  [19526, 19526]'''])
 
   self.expect("thread trace dump function-calls 2 -J",
 substrs=['''[
@@ -59,8 +59,8 @@ def testFunctionCallsWithErrors(self):
   {
 "tracedSegments": [
   {
-"firstInstructionId": "19532",
-"lastInstructionId": "19532"
+"firstInstructionId": "19526",
+"lastInstructionId": "19526"
   }
 ]
   }
@@ -73,7 +73,7 @@ def testFunctionCallsWithErrors(self):
 m.out`bar() + 30 at multi_thread.cpp:19:3 to 20:6  [5, 61831]
 
 [call tree #1]
-  [61834, 61834]'''])
+  [61833, 61833]'''])
 
   self.expect("thread trace dump function-calls 3 -J",
 substrs=['''[
@@ -88,8 +88,8 @@ def testFunctionCallsWithErrors(self):
   {
 "tracedSegments": [
   {
-"firstInstructionId": "61834",
-"lastInstructionId": "61834"
+"firstInstructionId": "61833",
+"lastInstructionId": "61833"
   }
 ]
   }

diff  --git a/lldb/test/API/commands/trace/TestTraceLoad.py 
b/lldb/test/API/commands/trace/TestTraceLoad.py
index 298be086b2046..09d7e0b7aabe5 100644
--- a/lldb/test/API/commands/trace/TestTraceLoad.py
+++ b/lldb/test/API/commands/trace/TestTraceLoad.py
@@ -13,11 +13,11 @@ def testLoadMultiCoreTrace(self):
 trace_description_file_path = os.path.join(src_dir, 
"intelpt-multi-core-trace", "trace.json")
 self.traceLoad(traceDescriptionFilePath=trace_description_file_path, 
substrs=["intel-pt"])
 self.expect("thread trace dump instructions 2 -t",
-  substrs=["19532: [20456513.000 ns] (error) expected tracing enabled 
event",
+  substrs=["19526: [19691636.212 ns] (error) decoding truncated: TSC 
40450075478109270 exceeds maximum TSC value 40450075477704372, will skip 
decoding the remaining data of the PSB (skipping 774 of 825 bytes)",
"m.out`foo() + 65 at multi_thread.cpp:12:21",
-   "9524: [19691630.226 ns] 0x00400ba7jg 
0x400bb3"])
+   "9524: [19691632.221 ns] 0x00400ba7jg 
0x400bb3"])
 self.expect("thread trace dump instructions 3 -t",
-  substrs=["61831: [19736134.073 ns] 0x00400bd7addl   
$0x1, -0x4(%rbp)",
+  substrs=["61831: [19736132.088 ns] 0x00400bd7addl   
$0x1, -0x4(%rbp)",
"m.out`bar() + 26 at multi_thread.cpp:20:6"])
 
 self.expect("thread trace dump info --json",
@@ -62,20 +62,20 @@ def testLoadMultiCoreTrace(self):
   "traceTechnology": "intel-pt",
   "threadStats": {
 "tid": 3497496,
-"traceItemsCount": 19533,
+"traceItemsCount": 19527,
 "memoryUsage": {
-  "totalInBytes": "176065",
-  "avgPerItemInBytes": 9.''', '''},
+  "totalInBytes": "175819",
+  "avgPerItemInBytes": 9.0038920469094084''', '''},
 "timingInSeconds": {
   "Decoding instructions": ''', '''
 },
 "events": {
-  "totalCount": 11,
+  "totalCount": 5,
   "individualCounts": {
 "software disabled tracing": 1,
 "trace synchronization point": 1,
 "CPU core changed": 1,
-"HW clock tick": 8
+"HW clock tick": 2
   }
 },
 "errors": {
@@ -116,11 +116,12 @@ def testLoadCompactMultiCoreTrace(self):
 # we'll load the compact trace and make sure it works
 self.traceLoad(os.path.join(compact_trace_bundle_dir, "trace.json"), 
substrs=["intel-pt"])
 self.expect("thread trace dump instructions 2 -t",
-  substrs=["19532: [20456513.000 ns] (error) expected tracing enabled 
event",
+  substrs=["19526: [19691636.212 ns] (error) decoding truncated: TSC 
40450075478109270 exceeds maximum TSC value 40450075477704372, will skip 
decoding the remai

[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D136572#3888177 , @mstorsjo wrote:

> This broke builds where clang/lld/lldb are symlinked into `llvm/tools` 
> instead of specified via `LLVM_ENABLE_PROJECTS` - since 
> `${CMAKE_CURRENT_SOURCE_DIR}/../cmake` doesn't find anything in that context.

This aspect, for finding the shared cmake directory, is handled elsewhere by 
the main LLVM build setting the `LLVM_COMMON_CMAKE_UTILS` variable, and if not 
found, it's assumed to be in `${CMAKE_CURRENT_SOURCE_DIR}/..`. See e.g. 
https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/lld/CMakeLists.txt#L198-L206.

Since this is invoked very early in the per-project cmakefiles, I guess we 
can't assume to have all those variables set up yet, but e.g. something like 
this fixes the issue for me:

  diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
  index 964bc3fd8b17..530f52b05bac 100644
  --- a/lld/CMakeLists.txt
  +++ b/lld/CMakeLists.txt
  @@ -1,6 +1,11 @@
   cmake_minimum_required(VERSION 3.13.4)
  -include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
  -  NO_POLICY_SCOPE)
  +if(DEFINED LLVM_COMMON_CMAKE_UTILS)
  +  include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
  +NO_POLICY_SCOPE)
  +else()
  +  include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
  +NO_POLICY_SCOPE)
  +endif()
   
   # If we are not building as a part of LLVM, build LLD as an
   # standalone project, using LLVM as an external library:

(And the same applied for all the other subprojects.) It's admittedly not very 
pretty though...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

I've reverted it right now, and I'll update the patch later today.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136362: [LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV

2022-10-27 Thread Emmmer S via Phabricator via lldb-commits
Emmmer added a comment.

In D136362#3887927 , @seehearfeel 
wrote:

> After commit 05ae747a5353811f93f5814f24d2335e6229d78a 
>  
> ("[LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV"),
> build failed when "ninja check-lldb" on my local machine:
>
>   [1/3] Building CXX object 
> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>   FAILED: 
> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>  
>   /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -I/home/loongson/llvm-project/llvm/build/tools/lldb/unittests/Instruction 
> -I/home/loongson/llvm-project/lldb/unittests/Instruction 
> -I/home/loongson/llvm-project/lldb/include 
> -I/home/loongson/llvm-project/llvm/build/tools/lldb/include 
> -I/home/loongson/llvm-project/llvm/build/include 
> -I/home/loongson/llvm-project/llvm/include 
> -I/home/loongson/llvm-project/llvm/../clang/include 
> -I/home/loongson/llvm-project/llvm/build/tools/lldb/../clang/include 
> -I/home/loongson/llvm-project/lldb/source 
> -I/home/loongson/llvm-project/lldb/unittests 
> -I/home/loongson/llvm-project/llvm/utils/unittest/googletest/include 
> -I/home/loongson/llvm-project/llvm/utils/unittest/googlemock/include -isystem 
> /usr/include/libxml2 -fPIC -fno-semantic-interposition 
> -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
> -Wno-missing-field-initializers -pedantic -Wno-long-long 
> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
> -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
> -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
> -ffunction-sections -fdata-sections -Wno-deprecated-declarations 
> -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 
> -DNDEBUG  -include /home/loongson/llvm-project/lldb/unittests/gtest_common.h 
> -Wno-variadic-macros -fno-exceptions -fno-rtti -Wno-suggest-override 
> -std=c++17 -MD -MT 
> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>  -MF 
> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o.d
>  -o 
> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>  -c 
> /home/loongson/llvm-project/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
>   c++: fatal error: Killed signal terminated program cc1plus
>   compilation terminated.
>   ninja: build stopped: subcommand failed.
>
> After revert the changes in 
> lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp, build successful.

I failed to repro this error. :(

> c++: fatal error: Killed signal terminated program cc1plus

With such a vague error message it is hard to find the problematic part and it 
does not look like a code problem. Would you mind checking your build 
configuration and trying `ninja check-lldb -j1` for detailed information?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136362

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


[Lldb-commits] [PATCH] D136761: [lldb][FormatEntity] Fix closing parenthesis for function.name-with-args frame format

2022-10-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Yeah, something like that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136761

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


[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I can't say I fully understand all of this code, but I also don't know who 
would, so I guess I'll just say it "looks good" :)

I am wondering about the testing situation though. If I understand correctly, 
you've run the test suite with hardcoded simplified names, and it all passed (?)

I am definitely not suggesting we add a new test suite mode for that, but maybe 
we could extend this one test case with extra check that look at the type names 
in other contexts than in name lookup (e.g. expression evaluation, backtraces, 
???) -- just to make sure that something doesn't break there in the future. 
WDYT?




Comment at: lldb/test/API/lang/cpp/unique-types2/main.cpp:20
+  FooPack t6;
+  FooPack t7;
+  // Set breakpoint here

Would it be interesting to test nested types as well (`Foo::Bar`) ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

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


[Lldb-commits] [PATCH] D136209: [LLDB][NativePDB] Fix parameter size for member functions LF_MFUNCTION

2022-10-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

In D136209#3880121 , @zequanwu wrote:

> In D136209#3878821 , @labath wrote:
>
>> So if I understand correctly, when we deserialize incorrectly, this causes 
>> us to misclassify some function parameters (arguments) as local variables. 
>> Is that correct? If yes, then that is something that can be checked. Even if 
>> the misclassified variables behave perfectly, their kind is still visible, 
>> e.g. in the output of "frame variable --scope".
>
> It's the opposite. Some non parameters local variables are misclassified as 
> parameters, since deserialized parameter count is incorrect/larger. Those 
> misclassified local variables will have the parameter bit set. See the inline 
> comment for detail.

Ugh, yeah, carry on as you were.

> Or maybe we should just rely on individual variable's debug info to determine 
> if a local var is parameter or not, not the parameter count found in function 
> debug info.

If it's sufficient, then yeah, definitely.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136209

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 471173.
mgorny added a comment.

Move `LLVM_COMMON_CMAKE_UTILS` earlier and use it for CMakePolicy path.


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

https://reviews.llvm.org/D136572

Files:
  clang/CMakeLists.txt
  cmake/Modules/CMakePolicy.cmake
  flang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt

Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,4 +1,11 @@
 # MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -10,8 +17,6 @@
 include(GNUInstallDirs)
 
 if(MLIR_STANDALONE_BUILD)
-  cmake_minimum_required(VERSION 3.13.4)
-
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
   include(HandleLLVMOptions)
@@ -46,10 +51,6 @@
 set(MLIR_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
 set(MLIR_TOOLS_DIR   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
-  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-endif()
-
 # Make sure that our source directory is on the current cmake module path so
 # that we can include cmake files from this directory.
 list(INSERT CMAKE_MODULE_PATH 0
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,16 +2,9 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-# CMP0114: ExternalProject step targets fully adopt their steps.
-# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
-if(POLICY CMP0114)
-  cmake_policy(SET CMP0114 OLD)
-endif()
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
+set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 
@@ -281,8 +274,6 @@
   set(LLVM_GISEL_COV_PREFIX "${CMAKE_BINARY_DIR}/gisel-coverage-" CACHE STRING "Provide a filename prefix to collect the GlobalISel rule coverage")
 endif()
 
-set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
 # Add path for custom modules
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,9 +1,3 @@
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,5 +1,11 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
+
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,5 +1,11 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
+
 # If we are not building as a part of LLVM, build LLD as an
 # standalone project, using LLVM as an external library:
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -140,10 +146,6 @@
 "`CMakeFiles'. Please delete them.")
 endif()
 
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
-  set(LLVM_COMMON_CMAKE_UTILS ${LLD_SOURCE_DIR}/../cmake)
-endif()
-
 # Add path for custom modules.
 list(INSERT CMAKE_MODULE_PATH 0
   "${LLD_SOURCE_DIR}/cmake/modules"
Index: flang/CMakeLists.txt
===
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -1,5 +1,11 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLV

[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a reviewer: mstorsjo.
mgorny added a comment.

@mstorsjo, could you check this version?


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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [lldb] 995d556 - [lldb][test] Remove empty setUp/tearDown methods (NFC)

2022-10-27 Thread Dave Lee via lldb-commits

Author: Dave Lee
Date: 2022-10-27T08:41:00-07:00
New Revision: 995d556f427d2ac7d3d9f80041adc7c51e80308b

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

LOG: [lldb][test] Remove empty setUp/tearDown methods (NFC)

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py

lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py

lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py

lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
lldb/test/API/python_api/compile_unit/TestCompileUnitAPI.py

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index 9b34a2e83d2a9..e60dd88625068 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -6,9 +6,6 @@
 class TestWatchpointCount(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-
 @skipIf(oslist=["freebsd", "linux"], archs=["arm", "aarch64"],
 bugnumber="llvm.org/pr26031")
 def test_watchpoint_count(self):

diff  --git 
a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py 
b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index 7c6ce83cc56dd..909413c0c2930 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -14,12 +14,6 @@ class ScriptedProcesTestCase(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-
-def tearDown(self):
-TestBase.tearDown(self)
-
 def test_python_plugin_package(self):
 """Test that the lldb python module has a `plugins.scripted_process`
 package."""

diff  --git 
a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
 
b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
index 773c34c537636..7a6a7ddb4b77d 100644
--- 
a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
+++ 
b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
@@ -14,12 +14,6 @@ class StackCoreScriptedProcesTestCase(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
 
-def setUp(self):
-TestBase.setUp(self)
-
-def tearDown(self):
-TestBase.tearDown(self)
-
 def create_stack_skinny_corefile(self, file):
 self.build()
 target, process, thread, _ = lldbutil.run_to_source_breakpoint(self, 
"// break here",

diff  --git 
a/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
 
b/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
index ee87f5f67a7bf..658cab13a2da5 100644
--- 
a/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
+++ 
b/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
@@ -10,9 +10,6 @@
 
 class TestCrossDSOTailCalls(TestBase):
 
-def setUp(self):
-TestBase.setUp(self)
-
 @skipIf(compiler="clang", compiler_version=['<', '10.0'])
 @skipIf(dwarf_version=['<', '4'])
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")

diff  --git 
a/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
 
b/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
index 0249a0490eeaa..4a60776140aad 100644
--- 
a/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
+++ 
b/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
@@ -10,9 +10,6 @@
 
 class TestCrossObjectTailCalls(TestBase):
 
-def setUp(self):
-TestBase.setUp(self)
-
 @skipIf(compiler="clang", compiler_version=['<', '10.0'])
 @skipIf(dwarf_version=['<', '4'])
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")

diff  --git a/lldb/test/API/python_api/compile_unit/TestCompileUnitAPI.py 
b/lldb/test/API/python_api/compile_unit/TestCompileUnitAPI.py
index c4eceeae7ff81..45ef14c1df9fc 100644
--- a/lldb/test/API/python_api/compile_unit/TestCompileUnitAPI.py
+++ b/lldb/test/API/python_api/compile_unit/TestCompileUnitAPI.py
@@ -10,9 +10,6 @@
 
 class CompileUnitAPITestCase(TestBase):
 
-def setUp(self):
-TestBase.setUp(self)
-
 def test(self):
 """

[Lldb-commits] [lldb] 4e10b2b - [lldb][test] Remove explicit mydir definitions (NFC)

2022-10-27 Thread Dave Lee via lldb-commits

Author: Dave Lee
Date: 2022-10-27T09:08:54-07:00
New Revision: 4e10b2bee71a45ffbf07fcce00d24ddf51867a0c

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

LOG: [lldb][test] Remove explicit mydir definitions (NFC)

Added: 


Modified: 

lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py
lldb/test/API/lang/c/fpeval/TestFPEval.py
lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py

lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py 
b/lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py
index aa7c01c055fc2..e1e146ac4d110 100644
--- 
a/lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py
+++ 
b/lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py
@@ -11,8 +11,6 @@
 
 class ExprInsideLambdaTestCase(TestBase):
 
-mydir = TestBase.compute_mydir(__file__)
-
 def expectExprError(self, expr : str, expected : str):
 frame = self.thread.GetFrameAtIndex(0)
 value = frame.EvaluateExpression(expr)

diff  --git a/lldb/test/API/lang/c/fpeval/TestFPEval.py 
b/lldb/test/API/lang/c/fpeval/TestFPEval.py
index 694d1ed7aa99d..42ea02cc00123 100644
--- a/lldb/test/API/lang/c/fpeval/TestFPEval.py
+++ b/lldb/test/API/lang/c/fpeval/TestFPEval.py
@@ -7,8 +7,6 @@
 
 class FPEvalTestCase(TestBase):
 
-mydir = TestBase.compute_mydir(__file__)
-
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)

diff  --git 
a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py
index 180d3f503c4f2..58b5881b47ee3 100644
--- 
a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py
+++ 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py
@@ -10,8 +10,6 @@
 
 class TemplatePackArgsTestCase(TestBase):
 
-mydir = TestBase.compute_mydir(__file__)
-
 def test_template_argument_pack(self):
 self.build()
 (_, _, thread, _) = lldbutil.run_to_source_breakpoint(self,

diff  --git 
a/lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
 
b/lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
index d16916cb1b23a..a174616cd89d8 100644
--- 
a/lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
+++ 
b/lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
@@ -10,8 +10,6 @@
 
 class AArch64LinuxMTEMemoryTagCoreFileTestCase(TestBase):
 
-mydir = TestBase.compute_mydir(__file__)
-
 NO_DEBUG_INFO_TESTCASE = True
 
 MTE_BUF_ADDR = hex(0x82c74000)



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


[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:29
+lldb::SBError BreakpointBase::AppendLogMessagePart(llvm::StringRef part,
+  bool is_expr) {
+  if (is_expr) {

clayborg wrote:
> indentation is off here. 
Hmm, it is chosen by clang-format. I tried again it is still the same result. I 
will leave the decision to clang-format.



Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:53
+}
+assert(backslash_pos >=0 && backslash_pos < text.size());
+

clayborg wrote:
> Remove assert, this should be already tested in StringRef::find(...)
I know but I like to use assertion as a contract documentation here so that it 
is easier to reason later code. I can remove if you feel strong about it.



Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:55
+
+formatted += text.substr(0, backslash_pos + 1).str();
+// Skip the characters before (and include) '\'.

clayborg wrote:
> Is this going to append the backslash character as well? Seems like a bug. 
> Above suggested code did this correctly I think with:
> 
> ```
>   // Append anything before the backslash character.
>   if (backslash_pos > 0)
> formatted += text.drop_front(backslash_pos).str();
> ```
> Which was always then followed by:
> ```
>   text = text.drop_front(); // Drop the backslash
> ```
Thanks!

I wonder why the testcase did not catch it, turns out the testcase has a bug -- 
it uses escaped string for logmessage which did not trigger the code path at 
all!!
Fixed the testcase caused this bug to show up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

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


[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:306
   }
+  output.push_back('\n'); // Ensure log message has line break.
   g_vsc.SendOutput(OutputType::Console, output.c_str());

clayborg wrote:
> I would still only push one if the output doesn't end with one and add a test 
> for this.
> ```
> if (!output.empty() && output.back() != '\n')
>   output.push_back('\n'); // Ensure log message has line break.
> ```
Ok, I can do this. But the existing tests (which has ending newline removed) 
should be testing this -- they do not have newline in log-message, but we still 
can correctly split-lines to get message boundary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

It'll be good if we have a wiki describing how downstream users invoke cmake, 
so that large cmake refactoring can be verified beforehand.
(like usage verification 
https://github.com/opencollab/llvm-toolchain-integration-test-suite, but for 
cmake invocations)


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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo accepted this revision.
mstorsjo added a comment.

In D136572#3888630 , @mgorny wrote:

> @mstorsjo, could you check this version?

LGTM, this seems to work for my usecase (with lld,lldb,clang enabled this way). 
Thanks for the quick revert and fix!


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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

Also for the record, I'd love to get rid of this symlink based setup, if I 
could make cmake produce project files where caching works in the same way. The 
main requirement for that would be to have the whole cmake build started from 
the toplevel llvm-project directory (so that all source from all subprojects 
are subdirectories to this), instead of the llvm-project/llvm directory.


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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136719: change debugserver to return an empty platform name for unknown platforms, instead of crashing

2022-10-27 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 471272.
jasonmolenda added a comment.

Incorporate Thorsten's suggestions for more idiomatic use of the std::optional 
result.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136719

Files:
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/DNB.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/RNBRemote.cpp

Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -6258,12 +6258,12 @@
 
 bool is_executable = true;
 uint32_t major_version, minor_version, patch_version;
-auto *platform =
+std::optional platform =
 DNBGetDeploymentInfo(pid, is_executable, lc, load_command_addr,
  major_version, minor_version, patch_version);
 if (platform) {
   os_handled = true;
-  rep << "ostype:" << platform << ";";
+  rep << "ostype:" << *platform << ";";
   break;
 }
 load_command_addr = load_command_addr + lc.cmdsize;
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -720,7 +720,9 @@
   return info;
 }
 
-const char *MachProcess::GetPlatformString(unsigned char platform) {
+std::optional
+MachProcess::GetPlatformString(unsigned char platform) {
+  std::optional platform_string;
   switch (platform) {
   case PLATFORM_MACOS:
 return "macosx";
@@ -742,8 +744,10 @@
 return "bridgeos";
   case PLATFORM_DRIVERKIT:
 return "driverkit";
+  default:
+DNBLogError("Unknown platform %u found for one binary", platform);
+return std::nullopt;
   }
-  return nullptr;
 }
 
 static bool mach_header_validity_test(uint32_t magic, uint32_t cputype) {
@@ -867,7 +871,8 @@
 }
 if (DeploymentInfo deployment_info = GetDeploymentInfo(
 lc, load_cmds_p, inf.mach_header.filetype == MH_EXECUTE)) {
-  const char *lc_platform = GetPlatformString(deployment_info.platform);
+  std::optional lc_platform =
+  GetPlatformString(deployment_info.platform);
   if (dyld_platform != PLATFORM_MACCATALYST &&
   inf.min_version_os_name == "macosx") {
 // macCatalyst support.
@@ -882,7 +887,7 @@
 // processed, ignore this one, which is presumed to be a
 // PLATFORM_MACCATALYST one.
   } else {
-inf.min_version_os_name = lc_platform;
+inf.min_version_os_name = lc_platform.value_or("");
 inf.min_version_os_version = "";
 inf.min_version_os_version +=
 std::to_string(deployment_info.major_version);
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.h
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -252,7 +253,7 @@
   DeploymentInfo GetDeploymentInfo(const struct load_command &,
uint64_t load_command_address,
bool is_executable);
-  static const char *GetPlatformString(unsigned char platform);
+  static std::optional GetPlatformString(unsigned char platform);
   bool GetMachOInformationFromMemory(uint32_t platform,
  nub_addr_t mach_o_header_addr,
  int wordsize,
Index: lldb/tools/debugserver/source/DNB.h
===
--- lldb/tools/debugserver/source/DNB.h
+++ lldb/tools/debugserver/source/DNB.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DNB_EXPORT __attribute__((visibility("default")))
@@ -134,12 +135,11 @@
 nub_size_t
 DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed,
DNBExecutableImageInfo **image_infos) DNB_EXPORT;
-const char *DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
- uint64_t load_command_address,
- uint32_t &major_version,
- uint32_t &minor_version,
- uint32_t &patch_version);
+std::optional
+DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
+ const struct load_command &lc,
+ uint64_t load_command_address, uint32_t &major_version,
+

[Lldb-commits] [PATCH] D136719: change debugserver to return an empty platform name for unknown platforms, instead of crashing

2022-10-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Nice use of std::optional. LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136719

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


[Lldb-commits] [PATCH] D136719: change debugserver to return an empty platform name for unknown platforms, instead of crashing

2022-10-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/tools/debugserver/source/MacOSX/MachProcess.mm:725
+MachProcess::GetPlatformString(unsigned char platform) {
+  std::optional platform_string;
   switch (platform) {

This is unused


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136719

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


[Lldb-commits] [lldb] d40f463 - Handle an unknown binary platform type in debugserver

2022-10-27 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2022-10-27T13:11:20-07:00
New Revision: d40f4636c454cf278b390b6591bf1e8dde8252aa

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

LOG: Handle an unknown binary platform type in debugserver

debugserver parses the Mach-O header & load commands of
binaries; if it does this with a binary whose LC_BUILD
platform enum it does not recognize, it will currently crash.
This patch changes MachProcss::GetPlatformString to return
an optional platform string, and updates the callers to
do the right thing when this optional could not be
provided.

Differential Revision: https://reviews.llvm.org/D136719
rdar://100452994

Added: 


Modified: 
lldb/tools/debugserver/source/DNB.cpp
lldb/tools/debugserver/source/DNB.h
lldb/tools/debugserver/source/MacOSX/MachProcess.h
lldb/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/DNB.cpp 
b/lldb/tools/debugserver/source/DNB.cpp
index 89f573d54bf97..d38c151d9f808 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -1433,12 +1433,11 @@ nub_bool_t 
DNBProcessSharedLibrariesUpdated(nub_process_t pid) {
   return false;
 }
 
-const char *DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
- uint64_t load_command_address,
- uint32_t &major_version,
- uint32_t &minor_version,
- uint32_t &patch_version) {
+std::optional
+DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
+ const struct load_command &lc,
+ uint64_t load_command_address, uint32_t &major_version,
+ uint32_t &minor_version, uint32_t &patch_version) {
   MachProcessSP procSP;
   if (GetProcessSP(pid, procSP)) {
 // FIXME: This doesn't return the correct result when xctest (a

diff  --git a/lldb/tools/debugserver/source/DNB.h 
b/lldb/tools/debugserver/source/DNB.h
index b0ab37adad00c..15d11fa794162 100644
--- a/lldb/tools/debugserver/source/DNB.h
+++ b/lldb/tools/debugserver/source/DNB.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DNB_EXPORT __attribute__((visibility("default")))
@@ -134,12 +135,11 @@ nub_bool_t DNBProcessSharedLibrariesUpdated(nub_process_t 
pid) DNB_EXPORT;
 nub_size_t
 DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed,
DNBExecutableImageInfo **image_infos) 
DNB_EXPORT;
-const char *DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
- uint64_t load_command_address,
- uint32_t &major_version,
- uint32_t &minor_version,
- uint32_t &patch_version);
+std::optional
+DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
+ const struct load_command &lc,
+ uint64_t load_command_address, uint32_t &major_version,
+ uint32_t &minor_version, uint32_t &patch_version);
 nub_bool_t DNBProcessSetNameToAddressCallback(nub_process_t pid,
   DNBCallbackNameToAddress 
callback,
   void *baton) DNB_EXPORT;

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
index 97efb5985ab4a..2ff48879a5bfd 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -252,7 +253,7 @@ class MachProcess {
   DeploymentInfo GetDeploymentInfo(const struct load_command &,
uint64_t load_command_address,
bool is_executable);
-  static const char *GetPlatformString(unsigned char platform);
+  static std::optional GetPlatformString(unsigned char platform);
   bool GetMachOInformationFromMemory(uint32_t platform,
  nub_addr_t mach_o_header_addr,
  int wordsize,

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index c12e07040a604..70a8ecd708456 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -720,7 +720,8 @@ static bool

[Lldb-commits] [PATCH] D136719: change debugserver to return an empty platform name for unknown platforms, instead of crashing

2022-10-27 Thread Jason Molenda via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd40f4636c454: Handle an unknown binary platform type in 
debugserver (authored by jasonmolenda).

Changed prior to commit:
  https://reviews.llvm.org/D136719?vs=471272&id=471278#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136719

Files:
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/DNB.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/RNBRemote.cpp

Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -6258,12 +6258,12 @@
 
 bool is_executable = true;
 uint32_t major_version, minor_version, patch_version;
-auto *platform =
+std::optional platform =
 DNBGetDeploymentInfo(pid, is_executable, lc, load_command_addr,
  major_version, minor_version, patch_version);
 if (platform) {
   os_handled = true;
-  rep << "ostype:" << platform << ";";
+  rep << "ostype:" << *platform << ";";
   break;
 }
 load_command_addr = load_command_addr + lc.cmdsize;
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -720,7 +720,8 @@
   return info;
 }
 
-const char *MachProcess::GetPlatformString(unsigned char platform) {
+std::optional
+MachProcess::GetPlatformString(unsigned char platform) {
   switch (platform) {
   case PLATFORM_MACOS:
 return "macosx";
@@ -742,8 +743,10 @@
 return "bridgeos";
   case PLATFORM_DRIVERKIT:
 return "driverkit";
+  default:
+DNBLogError("Unknown platform %u found for one binary", platform);
+return std::nullopt;
   }
-  return nullptr;
 }
 
 static bool mach_header_validity_test(uint32_t magic, uint32_t cputype) {
@@ -867,7 +870,8 @@
 }
 if (DeploymentInfo deployment_info = GetDeploymentInfo(
 lc, load_cmds_p, inf.mach_header.filetype == MH_EXECUTE)) {
-  const char *lc_platform = GetPlatformString(deployment_info.platform);
+  std::optional lc_platform =
+  GetPlatformString(deployment_info.platform);
   if (dyld_platform != PLATFORM_MACCATALYST &&
   inf.min_version_os_name == "macosx") {
 // macCatalyst support.
@@ -882,7 +886,7 @@
 // processed, ignore this one, which is presumed to be a
 // PLATFORM_MACCATALYST one.
   } else {
-inf.min_version_os_name = lc_platform;
+inf.min_version_os_name = lc_platform.value_or("");
 inf.min_version_os_version = "";
 inf.min_version_os_version +=
 std::to_string(deployment_info.major_version);
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.h
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -252,7 +253,7 @@
   DeploymentInfo GetDeploymentInfo(const struct load_command &,
uint64_t load_command_address,
bool is_executable);
-  static const char *GetPlatformString(unsigned char platform);
+  static std::optional GetPlatformString(unsigned char platform);
   bool GetMachOInformationFromMemory(uint32_t platform,
  nub_addr_t mach_o_header_addr,
  int wordsize,
Index: lldb/tools/debugserver/source/DNB.h
===
--- lldb/tools/debugserver/source/DNB.h
+++ lldb/tools/debugserver/source/DNB.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DNB_EXPORT __attribute__((visibility("default")))
@@ -134,12 +135,11 @@
 nub_size_t
 DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed,
DNBExecutableImageInfo **image_infos) DNB_EXPORT;
-const char *DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
- uint64_t load_command_address,
- uint32_t &major_version,
- uint32_t &minor_version,
- uint32_t &patch_version);
+std::optional
+DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
+ const struct load_command &lc,
+

[Lldb-commits] [PATCH] D136890: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe created this revision.
jgorbe added reviewers: yinghuitan, clayborg.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

In some occasions, SBValue::GetError can invalidate its cached
`m_summary_str` member. This in turn invalidates any StringRef variables
pointing to it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136890

Files:
  lldb/tools/lldb-vscode/JSONUtils.cpp


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -132,27 +132,28 @@
 
 void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 llvm::StringRef key) {
-
-  llvm::StringRef value = v.GetValue();
-  llvm::StringRef summary = v.GetSummary();
-  llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  lldb::SBError error = v.GetError();
-
   std::string result;
   llvm::raw_string_ostream strm(result);
+
+  lldb::SBError error = v.GetError();
   if (!error.Success()) {
 strm << "";
-  } else if (!value.empty()) {
-strm << value;
-if (!summary.empty())
+  } else {
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+if (!value.empty()) {
+  strm << value;
+  if (!summary.empty())
+strm << ' ' << summary;
+} else if (!summary.empty()) {
   strm << ' ' << summary;
-  } else if (!summary.empty()) {
-strm << ' ' << summary;
-  } else if (!type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
+} else if (!type_name.empty()) {
+  strm << type_name;
+  lldb::addr_t address = v.GetLoadAddress();
+  if (address != LLDB_INVALID_ADDRESS)
+strm << " @ " << llvm::format_hex(address, 0);
+}
   }
   strm.flush();
   EmplaceSafeString(object, key, result);


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -132,27 +132,28 @@
 
 void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 llvm::StringRef key) {
-
-  llvm::StringRef value = v.GetValue();
-  llvm::StringRef summary = v.GetSummary();
-  llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  lldb::SBError error = v.GetError();
-
   std::string result;
   llvm::raw_string_ostream strm(result);
+
+  lldb::SBError error = v.GetError();
   if (!error.Success()) {
 strm << "";
-  } else if (!value.empty()) {
-strm << value;
-if (!summary.empty())
+  } else {
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+if (!value.empty()) {
+  strm << value;
+  if (!summary.empty())
+strm << ' ' << summary;
+} else if (!summary.empty()) {
   strm << ' ' << summary;
-  } else if (!summary.empty()) {
-strm << ' ' << summary;
-  } else if (!type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
+} else if (!type_name.empty()) {
+  strm << type_name;
+  lldb::addr_t address = v.GetLoadAddress();
+  if (address != LLDB_INVALID_ADDRESS)
+strm << " @ " << llvm::format_hex(address, 0);
+}
   }
   strm.flush();
   EmplaceSafeString(object, key, result);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D126014: Show error message for optimized variables

2022-10-27 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe added inline comments.



Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:136-156
   llvm::StringRef value = v.GetValue();
   llvm::StringRef summary = v.GetSummary();
   llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+  lldb::SBError error = v.GetError();
 
   std::string result;
   llvm::raw_string_ostream strm(result);

clayborg wrote:
> Another way to fix this is to re-org the code a bit. We don't need the value, 
> summary or typename if there is an error.
Going with this for now in https://reviews.llvm.org/D136890.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126014

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


[Lldb-commits] [PATCH] D136890: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136890

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


[Lldb-commits] [lldb] 7d4d25c - [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread Jorge Gorbe Moya via lldb-commits

Author: Jorge Gorbe Moya
Date: 2022-10-27T15:05:27-07:00
New Revision: 7d4d25c42a682ec5abcc008225268a6ce82673f3

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

LOG: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

In some occasions, SBValue::GetError can invalidate its cached
`m_summary_str` member. This in turn invalidates any StringRef variables
pointing to it.

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

Added: 


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

Removed: 




diff  --git a/lldb/tools/lldb-vscode/JSONUtils.cpp 
b/lldb/tools/lldb-vscode/JSONUtils.cpp
index baeed2a81105c..39c24f8b23e39 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -132,27 +132,28 @@ std::vector GetStrings(const 
llvm::json::Object *obj,
 
 void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 llvm::StringRef key) {
-
-  llvm::StringRef value = v.GetValue();
-  llvm::StringRef summary = v.GetSummary();
-  llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  lldb::SBError error = v.GetError();
-
   std::string result;
   llvm::raw_string_ostream strm(result);
+
+  lldb::SBError error = v.GetError();
   if (!error.Success()) {
 strm << "";
-  } else if (!value.empty()) {
-strm << value;
-if (!summary.empty())
+  } else {
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+if (!value.empty()) {
+  strm << value;
+  if (!summary.empty())
+strm << ' ' << summary;
+} else if (!summary.empty()) {
   strm << ' ' << summary;
-  } else if (!summary.empty()) {
-strm << ' ' << summary;
-  } else if (!type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
+} else if (!type_name.empty()) {
+  strm << type_name;
+  lldb::addr_t address = v.GetLoadAddress();
+  if (address != LLDB_INVALID_ADDRESS)
+strm << " @ " << llvm::format_hex(address, 0);
+}
   }
   strm.flush();
   EmplaceSafeString(object, key, result);



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


[Lldb-commits] [PATCH] D136890: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7d4d25c42a68: [lldb-vscode] Don't call SBValue.GetError 
after generating a summary. (authored by jgorbe).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136890

Files:
  lldb/tools/lldb-vscode/JSONUtils.cpp


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -132,27 +132,28 @@
 
 void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 llvm::StringRef key) {
-
-  llvm::StringRef value = v.GetValue();
-  llvm::StringRef summary = v.GetSummary();
-  llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  lldb::SBError error = v.GetError();
-
   std::string result;
   llvm::raw_string_ostream strm(result);
+
+  lldb::SBError error = v.GetError();
   if (!error.Success()) {
 strm << "";
-  } else if (!value.empty()) {
-strm << value;
-if (!summary.empty())
+  } else {
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+if (!value.empty()) {
+  strm << value;
+  if (!summary.empty())
+strm << ' ' << summary;
+} else if (!summary.empty()) {
   strm << ' ' << summary;
-  } else if (!summary.empty()) {
-strm << ' ' << summary;
-  } else if (!type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
+} else if (!type_name.empty()) {
+  strm << type_name;
+  lldb::addr_t address = v.GetLoadAddress();
+  if (address != LLDB_INVALID_ADDRESS)
+strm << " @ " << llvm::format_hex(address, 0);
+}
   }
   strm.flush();
   EmplaceSafeString(object, key, result);


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -132,27 +132,28 @@
 
 void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 llvm::StringRef key) {
-
-  llvm::StringRef value = v.GetValue();
-  llvm::StringRef summary = v.GetSummary();
-  llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  lldb::SBError error = v.GetError();
-
   std::string result;
   llvm::raw_string_ostream strm(result);
+
+  lldb::SBError error = v.GetError();
   if (!error.Success()) {
 strm << "";
-  } else if (!value.empty()) {
-strm << value;
-if (!summary.empty())
+  } else {
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
+if (!value.empty()) {
+  strm << value;
+  if (!summary.empty())
+strm << ' ' << summary;
+} else if (!summary.empty()) {
   strm << ' ' << summary;
-  } else if (!summary.empty()) {
-strm << ' ' << summary;
-  } else if (!type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
+} else if (!type_name.empty()) {
+  strm << type_name;
+  lldb::addr_t address = v.GetLoadAddress();
+  if (address != LLDB_INVALID_ADDRESS)
+strm << " @ " << llvm::format_hex(address, 0);
+}
   }
   strm.flush();
   EmplaceSafeString(object, key, result);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan updated this revision to Diff 471314.
yinghuitan added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

Files:
  lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_logpoints.py
  lldb/tools/lldb-vscode/BreakpointBase.cpp
  lldb/tools/lldb-vscode/BreakpointBase.h

Index: lldb/tools/lldb-vscode/BreakpointBase.h
===
--- lldb/tools/lldb-vscode/BreakpointBase.h
+++ lldb/tools/lldb-vscode/BreakpointBase.h
@@ -22,7 +22,7 @@
   struct LogMessagePart {
 LogMessagePart(llvm::StringRef text, bool is_expr)
 : text(text), is_expr(is_expr) {}
-llvm::StringRef text;
+std::string text;
 bool is_expr;
   };
   // An optional expression for conditional breakpoints.
@@ -45,6 +45,13 @@
   void SetHitCondition();
   void SetLogMessage();
   void UpdateBreakpoint(const BreakpointBase &request_bp);
+
+  // Format \param text and return formatted text in \param formatted.
+  // \return any formatting failures.
+  lldb::SBError FormatLogText(llvm::StringRef text, std::string &formatted);
+  lldb::SBError AppendLogMessagePart(llvm::StringRef part, bool is_expr);
+  void NotifyLogMessageError(llvm::StringRef error);
+
   static const char *GetBreakpointLabel();
   static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process,
 lldb::SBThread &thread,
Index: lldb/tools/lldb-vscode/BreakpointBase.cpp
===
--- lldb/tools/lldb-vscode/BreakpointBase.cpp
+++ lldb/tools/lldb-vscode/BreakpointBase.cpp
@@ -25,6 +25,145 @@
 bp.SetIgnoreCount(hitCount - 1);
 }
 
+lldb::SBError BreakpointBase::AppendLogMessagePart(llvm::StringRef part,
+   bool is_expr) {
+  if (is_expr) {
+logMessageParts.emplace_back(part, is_expr);
+  } else {
+std::string formatted;
+lldb::SBError error = FormatLogText(part, formatted);
+if (error.Fail())
+  return error;
+logMessageParts.emplace_back(formatted, is_expr);
+  }
+  return lldb::SBError();
+}
+
+// TODO: consolidate this code with the implementation in
+// FormatEntity::ParseInternal().
+lldb::SBError BreakpointBase::FormatLogText(llvm::StringRef text,
+std::string &formatted) {
+  lldb::SBError error;
+  while (!text.empty()) {
+size_t backslash_pos = text.find_first_of('\\');
+if (backslash_pos == std::string::npos) {
+  formatted += text.str();
+  return error;
+}
+assert(backslash_pos >= 0 && backslash_pos < text.size());
+
+formatted += text.substr(0, backslash_pos).str();
+// Skip the characters before (and include) '\'.
+text = text.drop_front(backslash_pos + 1);
+
+if (text.empty()) {
+  error.SetErrorString(
+  "'\\' character was not followed by another character");
+  return error;
+}
+
+const char desens_char = text[0];
+text = text.drop_front(); // Skip the desensitized char character
+switch (desens_char) {
+case 'a':
+  formatted.push_back('\a');
+  break;
+case 'b':
+  formatted.push_back('\b');
+  break;
+case 'f':
+  formatted.push_back('\f');
+  break;
+case 'n':
+  formatted.push_back('\n');
+  break;
+case 'r':
+  formatted.push_back('\r');
+  break;
+case 't':
+  formatted.push_back('\t');
+  break;
+case 'v':
+  formatted.push_back('\v');
+  break;
+case '\'':
+  formatted.push_back('\'');
+  break;
+case '\\':
+  formatted.push_back('\\');
+  break;
+case '0':
+  // 1 to 3 octal chars
+  {
+if (text.empty()) {
+  error.SetErrorString("missing octal number following '\\0'");
+  return error;
+}
+
+// Make a string that can hold onto the initial zero char, up to 3
+// octal digits, and a terminating NULL.
+char oct_str[5] = {0, 0, 0, 0, 0};
+
+size_t i;
+for (i = 0;
+ i < text.size() && i < 4 && (text[i] >= '0' && text[i] <= '7');
+ ++i) {
+  oct_str[i] = text[i];
+}
+
+text = text.drop_front(i);
+unsigned long octal_value = ::strtoul(oct_str, nullptr, 8);
+if (octal_value <= UINT8_MAX) {
+  formatted.push_back((char)octal_value);
+} else {
+  error.SetErrorString("octal number is larger than a single byte");
+  return error;
+}
+  }
+  break;
+
+case 'x': {
+  if (text.empty()) {
+error.SetErrorString("missing hex number following '\\x'");
+return error;
+  }
+  // hex number in the text
+  if (isxdigit(text[0])) {
+// Make a string that can hold onto two hex chars plus a
+// NULL terminator
+char hex_str[3]

[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Just a few nits and this is good to go




Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:56
+formatted += text.substr(0, backslash_pos).str();
+// Skip the characters before (and include) '\'.
+text = text.drop_front(backslash_pos + 1);





Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:29
+lldb::SBError BreakpointBase::AppendLogMessagePart(llvm::StringRef part,
+  bool is_expr) {
+  if (is_expr) {

yinghuitan wrote:
> clayborg wrote:
> > indentation is off here. 
> Hmm, it is chosen by clang-format. I tried again it is still the same result. 
> I will leave the decision to clang-format.
no, it is fixed now, so all good.



Comment at: lldb/tools/lldb-vscode/BreakpointBase.cpp:53
+}
+assert(backslash_pos >=0 && backslash_pos < text.size());
+

yinghuitan wrote:
> clayborg wrote:
> > Remove assert, this should be already tested in StringRef::find(...)
> I know but I like to use assertion as a contract documentation here so that 
> it is easier to reason later code. I can remove if you feel strong about it.
I would remove it because it is already part of the StringRef::find() contract 
and it isn't needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

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


[Lldb-commits] [PATCH] D136890: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:143
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();

Sorry for the late comment. The fix is fine but it depends on an important 
assumption that GetError() has to be called before GetSummary(). Can we add an 
explicit comment to document this so that future refactoring won't violate it 
again.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136890

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


[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan updated this revision to Diff 471318.
yinghuitan added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

Files:
  lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_logpoints.py
  lldb/tools/lldb-vscode/BreakpointBase.cpp
  lldb/tools/lldb-vscode/BreakpointBase.h

Index: lldb/tools/lldb-vscode/BreakpointBase.h
===
--- lldb/tools/lldb-vscode/BreakpointBase.h
+++ lldb/tools/lldb-vscode/BreakpointBase.h
@@ -22,7 +22,7 @@
   struct LogMessagePart {
 LogMessagePart(llvm::StringRef text, bool is_expr)
 : text(text), is_expr(is_expr) {}
-llvm::StringRef text;
+std::string text;
 bool is_expr;
   };
   // An optional expression for conditional breakpoints.
@@ -45,6 +45,13 @@
   void SetHitCondition();
   void SetLogMessage();
   void UpdateBreakpoint(const BreakpointBase &request_bp);
+
+  // Format \param text and return formatted text in \param formatted.
+  // \return any formatting failures.
+  lldb::SBError FormatLogText(llvm::StringRef text, std::string &formatted);
+  lldb::SBError AppendLogMessagePart(llvm::StringRef part, bool is_expr);
+  void NotifyLogMessageError(llvm::StringRef error);
+
   static const char *GetBreakpointLabel();
   static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process,
 lldb::SBThread &thread,
Index: lldb/tools/lldb-vscode/BreakpointBase.cpp
===
--- lldb/tools/lldb-vscode/BreakpointBase.cpp
+++ lldb/tools/lldb-vscode/BreakpointBase.cpp
@@ -25,6 +25,144 @@
 bp.SetIgnoreCount(hitCount - 1);
 }
 
+lldb::SBError BreakpointBase::AppendLogMessagePart(llvm::StringRef part,
+   bool is_expr) {
+  if (is_expr) {
+logMessageParts.emplace_back(part, is_expr);
+  } else {
+std::string formatted;
+lldb::SBError error = FormatLogText(part, formatted);
+if (error.Fail())
+  return error;
+logMessageParts.emplace_back(formatted, is_expr);
+  }
+  return lldb::SBError();
+}
+
+// TODO: consolidate this code with the implementation in
+// FormatEntity::ParseInternal().
+lldb::SBError BreakpointBase::FormatLogText(llvm::StringRef text,
+std::string &formatted) {
+  lldb::SBError error;
+  while (!text.empty()) {
+size_t backslash_pos = text.find_first_of('\\');
+if (backslash_pos == std::string::npos) {
+  formatted += text.str();
+  return error;
+}
+
+formatted += text.substr(0, backslash_pos).str();
+// Skip the characters before and including '\'.
+text = text.drop_front(backslash_pos + 1);
+
+if (text.empty()) {
+  error.SetErrorString(
+  "'\\' character was not followed by another character");
+  return error;
+}
+
+const char desens_char = text[0];
+text = text.drop_front(); // Skip the desensitized char character
+switch (desens_char) {
+case 'a':
+  formatted.push_back('\a');
+  break;
+case 'b':
+  formatted.push_back('\b');
+  break;
+case 'f':
+  formatted.push_back('\f');
+  break;
+case 'n':
+  formatted.push_back('\n');
+  break;
+case 'r':
+  formatted.push_back('\r');
+  break;
+case 't':
+  formatted.push_back('\t');
+  break;
+case 'v':
+  formatted.push_back('\v');
+  break;
+case '\'':
+  formatted.push_back('\'');
+  break;
+case '\\':
+  formatted.push_back('\\');
+  break;
+case '0':
+  // 1 to 3 octal chars
+  {
+if (text.empty()) {
+  error.SetErrorString("missing octal number following '\\0'");
+  return error;
+}
+
+// Make a string that can hold onto the initial zero char, up to 3
+// octal digits, and a terminating NULL.
+char oct_str[5] = {0, 0, 0, 0, 0};
+
+size_t i;
+for (i = 0;
+ i < text.size() && i < 4 && (text[i] >= '0' && text[i] <= '7');
+ ++i) {
+  oct_str[i] = text[i];
+}
+
+text = text.drop_front(i);
+unsigned long octal_value = ::strtoul(oct_str, nullptr, 8);
+if (octal_value <= UINT8_MAX) {
+  formatted.push_back((char)octal_value);
+} else {
+  error.SetErrorString("octal number is larger than a single byte");
+  return error;
+}
+  }
+  break;
+
+case 'x': {
+  if (text.empty()) {
+error.SetErrorString("missing hex number following '\\x'");
+return error;
+  }
+  // hex number in the text
+  if (isxdigit(text[0])) {
+// Make a string that can hold onto two hex chars plus a
+// NULL terminator
+char hex_str[3] = {0, 0, 0};
+hex_str[0] = text[0];
+
+text = te

[Lldb-commits] [PATCH] D136890: [lldb-vscode] Don't call SBValue.GetError after generating a summary.

2022-10-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:143
+llvm::StringRef value = v.GetValue();
+llvm::StringRef summary = v.GetSummary();
+llvm::StringRef type_name = v.GetType().GetDisplayTypeName();

yinghuitan wrote:
> Sorry for the late comment. The fix is fine but it depends on an important 
> assumption that GetError() has to be called before GetSummary(). Can we add 
> an explicit comment to document this so that future refactoring won't violate 
> it again.
We shouldn't, we need to fix this API bug in LLDB itself. Just calling 
SBValue::GetError() shouldn't end up clearing the m_summary_str IMHO. This 
seems like the real bug. This is working around this. IF we add a comment, it 
won't end up being true when we fix the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136890

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


[Lldb-commits] [PATCH] D136900: Don't test dyld_process_create_for_current_task symbol before calling it in HostInfoMacOSX.mm

2022-10-27 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added a reviewer: aprantl.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

In a patch Fred landed a year and a half ago, he checks for a header to be 
available before enabling a block of code, and within that block of code, tests 
that a symbol, dyld_process_create_for_current_task(), is actually available 
before calling it - a trick with darwin weak leaking.  This SPI has been 
present in the system since macOS 10.12 (macOS Sierra, released September 
2016).  We don't need to test for this symbol; this would only happen if you do 
have the new API on the build host, and were setting a deployment target of 
macOS 10.12, but you took that binary and tried to run it on an older system.

It also happens to generate a "always evaluates to true" warning.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136900

Files:
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -530,48 +530,43 @@
 
 bool SharedCacheInfo::CreateSharedCacheInfoWithInstrospectionSPIs() {
 #if defined(SDK_HAS_NEW_DYLD_INTROSPECTION_SPIS)
-  if (__builtin_available(macOS 12, *)) {
-if (dyld_process_create_for_current_task) {
-  dyld_process_t dyld_process = dyld_process_create_for_current_task();
-  if (!dyld_process)
-return false;
-
-  dyld_process_snapshot_t snapshot =
-  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
-  if (!snapshot)
-return false;
-
-  auto on_exit = llvm::make_scope_exit(
-  [&]() { dyld_process_snapshot_dispose(snapshot); });
-
-  dyld_shared_cache_t shared_cache =
-  dyld_process_snapshot_get_shared_cache(snapshot);
-  if (!shared_cache)
-return false;
-
-  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
-__block uint64_t minVmAddr = UINT64_MAX;
-__block uint64_t maxVmAddr = 0;
-uuid_t uuidStore;
-__block uuid_t *uuid = &uuidStore;
-
-dyld_image_for_each_segment_info(image, ^(const char *segmentName,
-  uint64_t vmAddr,
-  uint64_t vmSize, int perm) {
+  dyld_process_t dyld_process = dyld_process_create_for_current_task();
+  if (!dyld_process)
+return false;
+
+  dyld_process_snapshot_t snapshot =
+  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
+  if (!snapshot)
+return false;
+
+  auto on_exit =
+  llvm::make_scope_exit([&]() { dyld_process_snapshot_dispose(snapshot); 
});
+
+  dyld_shared_cache_t shared_cache =
+  dyld_process_snapshot_get_shared_cache(snapshot);
+  if (!shared_cache)
+return false;
+
+  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
+__block uint64_t minVmAddr = UINT64_MAX;
+__block uint64_t maxVmAddr = 0;
+uuid_t uuidStore;
+__block uuid_t *uuid = &uuidStore;
+
+dyld_image_for_each_segment_info(
+image,
+^(const char *segmentName, uint64_t vmAddr, uint64_t vmSize, int perm) 
{
   minVmAddr = std::min(minVmAddr, vmAddr);
   maxVmAddr = std::max(maxVmAddr, vmAddr + vmSize);
   dyld_image_copy_uuid(image, uuid);
 });
-assert(minVmAddr != UINT_MAX);
-assert(maxVmAddr != 0);
-m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
-UUID(uuid, 16),
-std::make_shared((uint8_t *)minVmAddr,
-maxVmAddr - minVmAddr)};
-  });
-  return true;
-}
-  }
+assert(minVmAddr != UINT_MAX);
+assert(maxVmAddr != 0);
+m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
+UUID(uuid, 16), std::make_shared(
+(uint8_t *)minVmAddr, maxVmAddr - minVmAddr)};
+  });
+  return true;
 #endif
   return false;
 }


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -530,48 +530,43 @@
 
 bool SharedCacheInfo::CreateSharedCacheInfoWithInstrospectionSPIs() {
 #if defined(SDK_HAS_NEW_DYLD_INTROSPECTION_SPIS)
-  if (__builtin_available(macOS 12, *)) {
-if (dyld_process_create_for_current_task) {
-  dyld_process_t dyld_process = dyld_process_create_for_current_task();
-  if (!dyld_process)
-return false;
-
-  dyld_process_snapshot_t snapshot =
-  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
-

[Lldb-commits] [PATCH] D136900: Don't test dyld_process_create_for_current_task symbol before calling it in HostInfoMacOSX.mm

2022-10-27 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

The patch only removes the tests for the deployment target (compile-time) and 
for the symbol to be defined (runtime); clang-format shifted everything around 
to make it look like the diff is larger.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136900

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


[Lldb-commits] [PATCH] D136900: Don't test dyld_process_create_for_current_task symbol before calling it in HostInfoMacOSX.mm

2022-10-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Two less levels of indentation 🥳

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136900

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


[Lldb-commits] [lldb] 3b0f38b - [LLDB][NativePDB] Fix parameter size for member functions LF_MFUNCTION

2022-10-27 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-10-27T16:36:05-07:00
New Revision: 3b0f38bb5186cdda52ab38b13965678036aba22c

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

LOG: [LLDB][NativePDB] Fix parameter size for member functions LF_MFUNCTION

Fix the problem that it was treating member functions as non-member functions
when trying to get the parameter size. This causes some non-parameter variables
showing up in function signature. Suprisingly,
`cantFail(TypeDeserializer::deserializeAs(...))` just sliently
parse it without error and gave the wrong result.

It's hard to test it. This only causes problem when `params_remaining`
is larger than the real parameter size. If it's smaller, we also check
individual local variable's attribute to see it's a parameter. When I trying to
come up with a test, the parameter size is always 0 if we parse LF_MFUNCTION as
LF_PROCEDURE.

Reviewed By: labath

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index a34ce045e6759..8fdd23d942d85 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1897,9 +1897,24 @@ size_t 
SymbolFileNativePDB::ParseVariablesForBlock(PdbCompilandSymId block_id) {
 ProcSym proc(static_cast(sym.kind()));
 cantFail(SymbolDeserializer::deserializeAs(sym, proc));
 CVType signature = m_index->tpi().getType(proc.FunctionType);
-ProcedureRecord sig;
-cantFail(TypeDeserializer::deserializeAs(signature, sig));
-params_remaining = sig.getParameterCount();
+if (signature.kind() == LF_PROCEDURE) {
+  ProcedureRecord sig;
+  if (llvm::Error e = TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else if (signature.kind() == LF_MFUNCTION) {
+  MemberFunctionRecord sig;
+  if (llvm::Error e = 
TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else
+  return 0;
 break;
   }
   case S_BLOCK32:



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


[Lldb-commits] [PATCH] D136209: [LLDB][NativePDB] Fix parameter size for member functions LF_MFUNCTION

2022-10-27 Thread Zequan Wu via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b0f38bb5186: [LLDB][NativePDB] Fix parameter size for 
member functions LF_MFUNCTION (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136209

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp


Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1897,9 +1897,24 @@
 ProcSym proc(static_cast(sym.kind()));
 cantFail(SymbolDeserializer::deserializeAs(sym, proc));
 CVType signature = m_index->tpi().getType(proc.FunctionType);
-ProcedureRecord sig;
-cantFail(TypeDeserializer::deserializeAs(signature, sig));
-params_remaining = sig.getParameterCount();
+if (signature.kind() == LF_PROCEDURE) {
+  ProcedureRecord sig;
+  if (llvm::Error e = TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else if (signature.kind() == LF_MFUNCTION) {
+  MemberFunctionRecord sig;
+  if (llvm::Error e = 
TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else
+  return 0;
 break;
   }
   case S_BLOCK32:


Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1897,9 +1897,24 @@
 ProcSym proc(static_cast(sym.kind()));
 cantFail(SymbolDeserializer::deserializeAs(sym, proc));
 CVType signature = m_index->tpi().getType(proc.FunctionType);
-ProcedureRecord sig;
-cantFail(TypeDeserializer::deserializeAs(signature, sig));
-params_remaining = sig.getParameterCount();
+if (signature.kind() == LF_PROCEDURE) {
+  ProcedureRecord sig;
+  if (llvm::Error e = TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else if (signature.kind() == LF_MFUNCTION) {
+  MemberFunctionRecord sig;
+  if (llvm::Error e = TypeDeserializer::deserializeAs(
+  signature, sig)) {
+llvm::consumeError(std::move(e));
+return 0;
+  }
+  params_remaining = sig.getParameterCount();
+} else
+  return 0;
 break;
   }
   case S_BLOCK32:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks updated this revision to Diff 471330.
aeubanks added a comment.

fix nested types by introducing Type::GetBaseName()
add expr eval tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

Files:
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/Type.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Symbol/Type.cpp
  lldb/test/API/lang/cpp/complete-type-check/TestCppIsTypeComplete.py
  lldb/test/API/lang/cpp/unique-types2/Makefile
  lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
  lldb/test/API/lang/cpp/unique-types2/main.cpp

Index: lldb/test/API/lang/cpp/unique-types2/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types2/main.cpp
@@ -0,0 +1,27 @@
+template  struct Foo {
+  T t;
+  template  class Nested {
+U u;
+  };
+};
+
+template  class FooPack {
+  T t;
+};
+
+int main() {
+  Foo t1;
+  Foo t2;
+  Foo> t3;
+
+  FooPack p1;
+  FooPack p2;
+  FooPack> p3;
+  FooPack p4;
+  FooPack p5;
+  FooPack p6;
+  FooPack p7;
+
+  Foo::Nested n1;
+  // Set breakpoint here
+}
Index: lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
@@ -0,0 +1,61 @@
+"""
+Test that we return only the requested template instantiation.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class UniqueTypesTestCase(TestBase):
+def do_test(self, debug_flags):
+"""Test that we only display the requested Foo instantiation, not all Foo instantiations."""
+self.build(dictionary=debug_flags)
+lldbutil.run_to_source_breakpoint(self, "// Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+
+self.expect("image lookup -A -t '::Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo >'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect("image lookup -A -t '::FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack >'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect("image lookup -A -t '::Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t '::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect_expr("t1", result_type="Foo")
+self.expect_expr("t1", result_type="Foo")
+self.expect_expr("t2", result_type="Foo")
+self.expect_expr("t3", result_type="Foo >")
+self.expect_expr("p1", result_type="FooPack")
+self.expect_expr("p2", result_type="FooPack")
+self.expect_expr("p3", result_type="FooPack >")
+self.expect_expr("p4", result_type="FooPack")

[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added a comment.

regarding the failure in TestCPPBreakpointLocations.py (added recently in 
https://reviews.llvm.org/D135921, seems like it's catching real issues with 
this patch), it looks like the manual dwarf index needs a similar fix to this

In D134378#3888462 , @labath wrote:

> I can't say I fully understand all of this code, but I also don't know who 
> would, so I guess I'll just say it "looks good" :)
>
> I am wondering about the testing situation though. If I understand correctly, 
> you've run the test suite with hardcoded simplified names, and it all passed 
> (?)

yes, that was true until https://reviews.llvm.org/D135921, which catches some 
missing functionality in this patch around breakpoints (I'd still like to defer 
that to a separate patch)

> I am definitely not suggesting we add a new test suite mode for that, but 
> maybe we could extend this one test case with extra check that look at the 
> type names in other contexts than in name lookup (e.g. expression evaluation, 
> backtraces, ???) -- just to make sure that something doesn't break there in 
> the future. WDYT?

I've added expression evaluation to the test. do you have examples of backtrace 
tests?




Comment at: lldb/test/API/lang/cpp/unique-types2/main.cpp:20
+  FooPack t6;
+  FooPack t7;
+  // Set breakpoint here

labath wrote:
> Would it be interesting to test nested types as well (`Foo::Bar`) ?
yes, and that caught a bug, thanks for the suggestion

I've added a `Type::GetBaseName()`, could you take a look at that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

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


[Lldb-commits] [lldb] bc19697 - Remove compile-time and runtime checks for SPI in HostInfoMacOSX

2022-10-27 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2022-10-27T16:57:48-07:00
New Revision: bc196970b549782bffde5fdbfa450c565af11fc1

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

LOG: Remove compile-time and runtime checks for SPI in HostInfoMacOSX

There are conditionalized calls to an SPI in HostInfoMacOSX.mm
to test if lldb is being built against a pre-macOS 10.12 SDK,
or being run on a pre-macOS 10.12 system.  macOS 10.12 was released
six years ago, and I don't know of any active users of this system
so let's remove the checks.

Differential Revision: https://reviews.llvm.org/D136900
rdar://101652340

Added: 


Modified: 
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm

Removed: 




diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm 
b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index 11590be56fbc8..d0d964b0903be 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -530,48 +530,43 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
 
 bool SharedCacheInfo::CreateSharedCacheInfoWithInstrospectionSPIs() {
 #if defined(SDK_HAS_NEW_DYLD_INTROSPECTION_SPIS)
-  if (__builtin_available(macOS 12, *)) {
-if (dyld_process_create_for_current_task) {
-  dyld_process_t dyld_process = dyld_process_create_for_current_task();
-  if (!dyld_process)
-return false;
-
-  dyld_process_snapshot_t snapshot =
-  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
-  if (!snapshot)
-return false;
-
-  auto on_exit = llvm::make_scope_exit(
-  [&]() { dyld_process_snapshot_dispose(snapshot); });
-
-  dyld_shared_cache_t shared_cache =
-  dyld_process_snapshot_get_shared_cache(snapshot);
-  if (!shared_cache)
-return false;
-
-  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
-__block uint64_t minVmAddr = UINT64_MAX;
-__block uint64_t maxVmAddr = 0;
-uuid_t uuidStore;
-__block uuid_t *uuid = &uuidStore;
-
-dyld_image_for_each_segment_info(image, ^(const char *segmentName,
-  uint64_t vmAddr,
-  uint64_t vmSize, int perm) {
+  dyld_process_t dyld_process = dyld_process_create_for_current_task();
+  if (!dyld_process)
+return false;
+
+  dyld_process_snapshot_t snapshot =
+  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
+  if (!snapshot)
+return false;
+
+  auto on_exit =
+  llvm::make_scope_exit([&]() { dyld_process_snapshot_dispose(snapshot); 
});
+
+  dyld_shared_cache_t shared_cache =
+  dyld_process_snapshot_get_shared_cache(snapshot);
+  if (!shared_cache)
+return false;
+
+  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
+__block uint64_t minVmAddr = UINT64_MAX;
+__block uint64_t maxVmAddr = 0;
+uuid_t uuidStore;
+__block uuid_t *uuid = &uuidStore;
+
+dyld_image_for_each_segment_info(
+image,
+^(const char *segmentName, uint64_t vmAddr, uint64_t vmSize, int perm) 
{
   minVmAddr = std::min(minVmAddr, vmAddr);
   maxVmAddr = std::max(maxVmAddr, vmAddr + vmSize);
   dyld_image_copy_uuid(image, uuid);
 });
-assert(minVmAddr != UINT_MAX);
-assert(maxVmAddr != 0);
-m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
-UUID(uuid, 16),
-std::make_shared((uint8_t *)minVmAddr,
-maxVmAddr - minVmAddr)};
-  });
-  return true;
-}
-  }
+assert(minVmAddr != UINT_MAX);
+assert(maxVmAddr != 0);
+m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
+UUID(uuid, 16), std::make_shared(
+(uint8_t *)minVmAddr, maxVmAddr - minVmAddr)};
+  });
+  return true;
 #endif
   return false;
 }



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


[Lldb-commits] [PATCH] D136900: Don't test dyld_process_create_for_current_task symbol before calling it in HostInfoMacOSX.mm

2022-10-27 Thread Jason Molenda via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc196970b549: Remove compile-time and runtime checks for SPI 
in HostInfoMacOSX (authored by jasonmolenda).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136900

Files:
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -530,48 +530,43 @@
 
 bool SharedCacheInfo::CreateSharedCacheInfoWithInstrospectionSPIs() {
 #if defined(SDK_HAS_NEW_DYLD_INTROSPECTION_SPIS)
-  if (__builtin_available(macOS 12, *)) {
-if (dyld_process_create_for_current_task) {
-  dyld_process_t dyld_process = dyld_process_create_for_current_task();
-  if (!dyld_process)
-return false;
-
-  dyld_process_snapshot_t snapshot =
-  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
-  if (!snapshot)
-return false;
-
-  auto on_exit = llvm::make_scope_exit(
-  [&]() { dyld_process_snapshot_dispose(snapshot); });
-
-  dyld_shared_cache_t shared_cache =
-  dyld_process_snapshot_get_shared_cache(snapshot);
-  if (!shared_cache)
-return false;
-
-  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
-__block uint64_t minVmAddr = UINT64_MAX;
-__block uint64_t maxVmAddr = 0;
-uuid_t uuidStore;
-__block uuid_t *uuid = &uuidStore;
-
-dyld_image_for_each_segment_info(image, ^(const char *segmentName,
-  uint64_t vmAddr,
-  uint64_t vmSize, int perm) {
+  dyld_process_t dyld_process = dyld_process_create_for_current_task();
+  if (!dyld_process)
+return false;
+
+  dyld_process_snapshot_t snapshot =
+  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
+  if (!snapshot)
+return false;
+
+  auto on_exit =
+  llvm::make_scope_exit([&]() { dyld_process_snapshot_dispose(snapshot); 
});
+
+  dyld_shared_cache_t shared_cache =
+  dyld_process_snapshot_get_shared_cache(snapshot);
+  if (!shared_cache)
+return false;
+
+  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
+__block uint64_t minVmAddr = UINT64_MAX;
+__block uint64_t maxVmAddr = 0;
+uuid_t uuidStore;
+__block uuid_t *uuid = &uuidStore;
+
+dyld_image_for_each_segment_info(
+image,
+^(const char *segmentName, uint64_t vmAddr, uint64_t vmSize, int perm) 
{
   minVmAddr = std::min(minVmAddr, vmAddr);
   maxVmAddr = std::max(maxVmAddr, vmAddr + vmSize);
   dyld_image_copy_uuid(image, uuid);
 });
-assert(minVmAddr != UINT_MAX);
-assert(maxVmAddr != 0);
-m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
-UUID(uuid, 16),
-std::make_shared((uint8_t *)minVmAddr,
-maxVmAddr - minVmAddr)};
-  });
-  return true;
-}
-  }
+assert(minVmAddr != UINT_MAX);
+assert(maxVmAddr != 0);
+m_images[dyld_image_get_installname(image)] = SharedCacheImageInfo{
+UUID(uuid, 16), std::make_shared(
+(uint8_t *)minVmAddr, maxVmAddr - minVmAddr)};
+  });
+  return true;
 #endif
   return false;
 }


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -530,48 +530,43 @@
 
 bool SharedCacheInfo::CreateSharedCacheInfoWithInstrospectionSPIs() {
 #if defined(SDK_HAS_NEW_DYLD_INTROSPECTION_SPIS)
-  if (__builtin_available(macOS 12, *)) {
-if (dyld_process_create_for_current_task) {
-  dyld_process_t dyld_process = dyld_process_create_for_current_task();
-  if (!dyld_process)
-return false;
-
-  dyld_process_snapshot_t snapshot =
-  dyld_process_snapshot_create_for_process(dyld_process, nullptr);
-  if (!snapshot)
-return false;
-
-  auto on_exit = llvm::make_scope_exit(
-  [&]() { dyld_process_snapshot_dispose(snapshot); });
-
-  dyld_shared_cache_t shared_cache =
-  dyld_process_snapshot_get_shared_cache(snapshot);
-  if (!shared_cache)
-return false;
-
-  dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
-__block uint64_t minVmAddr = UINT64_MAX;
-__block uint64_t maxVmAddr = 0;
-uuid_t uuidStore;
-__block uuid_t *uuid = &uuidStore;
-
-dyld_image_for_each_segment_info(image, ^(const char *segmentName,
-  uint64_t vmAddr,

[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added inline comments.



Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:3831
+
+  clang::PrintingPolicy printing_policy(GetTypePrintingPolicy());
+  printing_policy.SuppressScope = true;

Could we just re-use `GetTypeName` and add an optional printing policy argument 
to it?



Comment at: lldb/test/API/lang/cpp/unique-types2/main.cpp:20
+  FooPack t6;
+  FooPack t7;
+  // Set breakpoint here

aeubanks wrote:
> labath wrote:
> > Would it be interesting to test nested types as well (`Foo::Bar`) ?
> yes, and that caught a bug, thanks for the suggestion
> 
> I've added a `Type::GetBaseName()`, could you take a look at that?
Out of curiosity, what was the issue with using the qualified name?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

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


[Lldb-commits] [PATCH] D136795: [LLDB] Mark placeholder modules in `target module list` output.

2022-10-27 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 471337.
zequanwu added a comment.

- Modify file spec of placeholder object file.
- Change it to "(not loaded)" which is more obvious than "(placeholder)".
- Use prefix so the file extension is preseved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136795

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/test/Shell/Minidump/modules-not-loaded.yaml


Index: lldb/test/Shell/Minidump/modules-not-loaded.yaml
===
--- /dev/null
+++ lldb/test/Shell/Minidump/modules-not-loaded.yaml
@@ -0,0 +1,23 @@
+# REQUIRES: x86
+
+# RUN: yaml2obj %s -o %t
+# RUN: %lldb -c %t -o "target modules list" 2>&1 | FileCheck %s
+
+# CHECK:  (lldb) target modules list
+# CHEKC-NEXT: [  0] 0400-1400--0300-474E5500 0x1000 (not 
loaded) /invalid/path/on/current/system/libbreakpad.so
+
+--- !minidump
+Streams:
+  - Type:SystemInfo
+Processor Arch:  ARM
+Platform ID: Linux
+CSD Version: '15E216'
+CPU:
+  CPUID:   0x
+  - Type:ModuleList
+Modules:
+  - Base of Image:   0x1000
+Size of Image:   0x1000
+Module Name: '/invalid/path/on/current/system/libbreakpad.so'
+CodeView Record: 52534453040014000300474e55
+...
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -598,7 +598,7 @@
"Unable to locate the matching object file, creating a "
"placeholder module for: {0}",
name);
-
+  module_spec.GetFileSpec().PrependPathComponent("(not loaded) ");
   module_sp = Module::CreateModuleFromObjectFile(
   module_spec, load_addr, load_size);
   GetTarget().GetImages().Append(module_sp, true /* notify */);


Index: lldb/test/Shell/Minidump/modules-not-loaded.yaml
===
--- /dev/null
+++ lldb/test/Shell/Minidump/modules-not-loaded.yaml
@@ -0,0 +1,23 @@
+# REQUIRES: x86
+
+# RUN: yaml2obj %s -o %t
+# RUN: %lldb -c %t -o "target modules list" 2>&1 | FileCheck %s
+
+# CHECK:  (lldb) target modules list
+# CHEKC-NEXT: [  0] 0400-1400--0300-474E5500 0x1000 (not loaded) /invalid/path/on/current/system/libbreakpad.so
+
+--- !minidump
+Streams:
+  - Type:SystemInfo
+Processor Arch:  ARM
+Platform ID: Linux
+CSD Version: '15E216'
+CPU:
+  CPUID:   0x
+  - Type:ModuleList
+Modules:
+  - Base of Image:   0x1000
+Size of Image:   0x1000
+Module Name: '/invalid/path/on/current/system/libbreakpad.so'
+CodeView Record: 52534453040014000300474e55
+...
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -598,7 +598,7 @@
"Unable to locate the matching object file, creating a "
"placeholder module for: {0}",
name);
-
+  module_spec.GetFileSpec().PrependPathComponent("(not loaded) ");
   module_sp = Module::CreateModuleFromObjectFile(
   module_spec, load_addr, load_size);
   GetTarget().GetImages().Append(module_sp, true /* notify */);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D136697: Add formatting support for VSCode logpoints message

2022-10-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

What happens when we have a log message error? I see we log to the console, but 
we should test this. Also, if there is an error, do we fail the breakpoint 
setting completely or do we just not set the log message? We need a test for 
these cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136697

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


[Lldb-commits] [PATCH] D136362: [LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV

2022-10-27 Thread Tiezhu Yang via Phabricator via lldb-commits
seehearfeel added a comment.

In D136362#3888328 , @Emmmer wrote:

> In D136362#3887927 , @seehearfeel 
> wrote:
>
>> After commit 05ae747a5353811f93f5814f24d2335e6229d78a 
>>  
>> ("[LLDB][RISCV] Add RV64C instruction support for EmulateInstructionRISCV"),
>> build failed when "ninja check-lldb" on my local machine:
>>
>>   [1/3] Building CXX object 
>> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>>   FAILED: 
>> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>>  
>>   /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_GNU_SOURCE 
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
>> -I/home/loongson/llvm-project/llvm/build/tools/lldb/unittests/Instruction 
>> -I/home/loongson/llvm-project/lldb/unittests/Instruction 
>> -I/home/loongson/llvm-project/lldb/include 
>> -I/home/loongson/llvm-project/llvm/build/tools/lldb/include 
>> -I/home/loongson/llvm-project/llvm/build/include 
>> -I/home/loongson/llvm-project/llvm/include 
>> -I/home/loongson/llvm-project/llvm/../clang/include 
>> -I/home/loongson/llvm-project/llvm/build/tools/lldb/../clang/include 
>> -I/home/loongson/llvm-project/lldb/source 
>> -I/home/loongson/llvm-project/lldb/unittests 
>> -I/home/loongson/llvm-project/llvm/utils/unittest/googletest/include 
>> -I/home/loongson/llvm-project/llvm/utils/unittest/googlemock/include 
>> -isystem /usr/include/libxml2 -fPIC -fno-semantic-interposition 
>> -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
>> -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
>> -Wno-missing-field-initializers -pedantic -Wno-long-long 
>> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
>> -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
>> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
>> -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
>> -ffunction-sections -fdata-sections -Wno-deprecated-declarations 
>> -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 
>> -DNDEBUG  -include /home/loongson/llvm-project/lldb/unittests/gtest_common.h 
>> -Wno-variadic-macros -fno-exceptions -fno-rtti -Wno-suggest-override 
>> -std=c++17 -MD -MT 
>> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>>  -MF 
>> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o.d
>>  -o 
>> tools/lldb/unittests/Instruction/CMakeFiles/EmulatorTests.dir/RISCV/TestRISCVEmulator.cpp.o
>>  -c 
>> /home/loongson/llvm-project/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
>>   c++: fatal error: Killed signal terminated program cc1plus
>>   compilation terminated.
>>   ninja: build stopped: subcommand failed.
>>
>> After revert the changes in 
>> lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp, build successful.
>
> I failed to repro this error. :(
>
>> c++: fatal error: Killed signal terminated program cc1plus
>
> With such a vague error message it is hard to find the problematic part and 
> it does not look like a code problem. Would you mind checking your build 
> configuration and trying `ninja check-lldb -j1` for detailed information?

dmesg shows that the compiler is getting killed by the OOM-killer due to using 
to many resources.
Adding 64G swap, it  is still OOM. Ref: 
https://github.com/soedinglab/hh-suite/issues/280
Using clang++ to build TestRISCVEmulator.cpp is OK, so maybe this issue is 
related with gcc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136362

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


[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks updated this revision to Diff 471375.
aeubanks marked an inline comment as done.
aeubanks added a comment.

combine GetBaseName into GetTypeName


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

Files:
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/Type.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Symbol/Type.cpp
  lldb/test/API/lang/cpp/complete-type-check/TestCppIsTypeComplete.py
  lldb/test/API/lang/cpp/unique-types2/Makefile
  lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
  lldb/test/API/lang/cpp/unique-types2/main.cpp

Index: lldb/test/API/lang/cpp/unique-types2/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types2/main.cpp
@@ -0,0 +1,27 @@
+template  struct Foo {
+  T t;
+  template  class Nested {
+U u;
+  };
+};
+
+template  class FooPack {
+  T t;
+};
+
+int main() {
+  Foo t1;
+  Foo t2;
+  Foo> t3;
+
+  FooPack p1;
+  FooPack p2;
+  FooPack> p3;
+  FooPack p4;
+  FooPack p5;
+  FooPack p6;
+  FooPack p7;
+
+  Foo::Nested n1;
+  // Set breakpoint here
+}
Index: lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
@@ -0,0 +1,61 @@
+"""
+Test that we return only the requested template instantiation.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class UniqueTypesTestCase(TestBase):
+def do_test(self, debug_flags):
+"""Test that we only display the requested Foo instantiation, not all Foo instantiations."""
+self.build(dictionary=debug_flags)
+lldbutil.run_to_source_breakpoint(self, "// Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+
+self.expect("image lookup -A -t '::Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo >'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect("image lookup -A -t '::FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack >'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'FooPack'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect("image lookup -A -t '::Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'Foo::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+self.expect("image lookup -A -t 'Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["1 match found"])
+self.expect("image lookup -A -t '::Nested'", DATA_TYPES_DISPLAYED_CORRECTLY, error=True)
+
+self.expect_expr("t1", result_type="Foo")
+self.expect_expr("t1", result_type="Foo")
+self.expect_expr("t2", result_type="Foo")
+self.expect_expr("t3", result_type="Foo >")
+self.expect_expr("p1", result_type="FooPack")
+self.expect_expr("p2", result_type="FooPack")
+self.expect_expr("p3", result_type="FooPack >")
+self.expect_expr("p4", result_type="F

[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

2022-10-27 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added inline comments.



Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:3809
 
+ConstString TypeSystemClang::GetBaseName(lldb::opaque_compiler_type_t type) {
+  if (!type)

this was mostly copied from `GetTypeName` above, not sure if these two should 
be factored out?



Comment at: lldb/test/API/lang/cpp/unique-types2/main.cpp:20
+  FooPack t6;
+  FooPack t7;
+  // Set breakpoint here

Michael137 wrote:
> aeubanks wrote:
> > labath wrote:
> > > Would it be interesting to test nested types as well (`Foo::Bar`) ?
> > yes, and that caught a bug, thanks for the suggestion
> > 
> > I've added a `Type::GetBaseName()`, could you take a look at that?
> Out of curiosity, what was the issue with using the qualified name?
`GetQualifiedName` returns the name including any scopes, so in this case it 
gave `Foo::Nested` rather than `Nested` and the `'<'` string 
logic ended up comparing `::Nested` to ``


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134378

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D136572#3889317 , @mstorsjo wrote:

> Also for the record, I'd love to get rid of this symlink based setup, if I 
> could make cmake produce project files where caching works in the same way. 
> The main requirement for that would be to have the whole cmake build started 
> from the toplevel llvm-project directory (so that all source from all 
> subprojects are subdirectories to this), instead of the llvm-project/llvm 
> directory.

To be honest, I also find it weird to start monorepo builds from within `llvm` 
subdirectory. Perhaps adding a top-level `CMakeLists.txt` that would work and 
wouldn't break people's workflows wouldn't be that hard, though.


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

https://reviews.llvm.org/D136572

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


[Lldb-commits] [PATCH] D136572: Harmonize cmake_policy() across standalone builds of all projects

2022-10-27 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9dd01a5241dc: Harmonize cmake_policy() across standalone 
builds of all projects (authored by mgorny).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136572

Files:
  clang/CMakeLists.txt
  cmake/Modules/CMakePolicy.cmake
  flang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt

Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,4 +1,11 @@
 # MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -10,8 +17,6 @@
 include(GNUInstallDirs)
 
 if(MLIR_STANDALONE_BUILD)
-  cmake_minimum_required(VERSION 3.13.4)
-
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
   include(HandleLLVMOptions)
@@ -46,10 +51,6 @@
 set(MLIR_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
 set(MLIR_TOOLS_DIR   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
-  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-endif()
-
 # Make sure that our source directory is on the current cmake module path so
 # that we can include cmake files from this directory.
 list(INSERT CMAKE_MODULE_PATH 0
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,16 +2,9 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-# CMP0114: ExternalProject step targets fully adopt their steps.
-# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
-if(POLICY CMP0114)
-  cmake_policy(SET CMP0114 OLD)
-endif()
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
+set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 
@@ -281,8 +274,6 @@
   set(LLVM_GISEL_COV_PREFIX "${CMAKE_BINARY_DIR}/gisel-coverage-" CACHE STRING "Provide a filename prefix to collect the GlobalISel rule coverage")
 endif()
 
-set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
 # Add path for custom modules
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,9 +1,3 @@
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,5 +1,11 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
+
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,5 +1,11 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
+
 # If we are not building as a part of LLVM, build LLD as an
 # standalone project, using LLVM as an external library:
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -140,10 +146,6 @@
 "`CMakeFiles'. Please delete them.")
 endif()
 
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
-  set(LLVM_COMMON_CMAKE_UTILS ${LLD_SOURCE_DIR}/../cmake)
-endif()
-
 # Add path for custom modules.
 list(INSERT CMAKE_MODULE_PATH 0
   "${LLD_SOURCE_DIR}/cmake/modules"
Index: flang/CMakeLists.txt
===
--- flang/CM