[Lldb-commits] [PATCH] D98153: Some FormatEntity.cpp cleanup and unit testing

2021-03-29 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks for the patch (and especially the unit test)! Some two nits left 
but feel free to fix those when merging. If you don't have commit access I can 
also do that, just let me know.




Comment at: lldb/include/lldb/Core/FormatEntity.h:120
+  /// Whether the separator is kept during parsing or not (used
+  /// for entries with parameters)
+  const bool keep_separator = false;

Missing period



Comment at: lldb/unittests/Core/FormatEntityTest.cpp:154
+TEST(FormatEntity, LookupAllEntriesInTree) {
+  for (const auto &testString : lookupStrings) {
+Entry e;

teemperor wrote:
> You could just use `llvm::StringRef` here (it's shorter and more descriptive 
> than the `auto`).
I actually meant `llvm::StringRef` as the whole type (StringRef references are 
not really useful as StringRef is already a lightweight String reference)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98153

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


[Lldb-commits] [lldb] 3c95bdf - [lldb] Don't search for system specific strings in assert.test

2021-03-29 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-03-29T10:46:14+02:00
New Revision: 3c95bdf9fa35f0fe2143ea859b624c8f09513adb

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

LOG: [lldb] Don't search for system specific strings in assert.test

Commit 6bc1e69de270db8d7191200f54158e4192f997ba changed the search string
to also check for the generated strings that surround the plain assert:

Assertion `false && "lldb-test assert"' failed
 ^

This causes the test to fail on setups where the generated assert message
looks different. E.g., on macOS the generated message looks like this:

Assertion failed: (false && "lldb_assert failed"), function lldb_assert

This reverts the old behaviour of just checking for the actual string we
have inside LLDB.

Added: 


Modified: 
lldb/test/Shell/Error/assert.test

Removed: 




diff  --git a/lldb/test/Shell/Error/assert.test 
b/lldb/test/Shell/Error/assert.test
index 2585e64f3952..3678b45c0ad7 100644
--- a/lldb/test/Shell/Error/assert.test
+++ b/lldb/test/Shell/Error/assert.test
@@ -1,4 +1,4 @@
 # REQUIRES: asserts
 # RUN: not --crash lldb-test assert > %t.error 2>&1
 # RUN: cat %t.error | FileCheck %s
-# CHECK: "{{lldb_assert failed|lldb-test assert}}"' failed.
+# CHECK: {{lldb_assert failed|lldb-test assert}}



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


[Lldb-commits] [PATCH] D99426: [Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text

2021-03-29 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

This touches a lot of files. I am a bit worried that it would not be easy for a 
contributor to know OF_TextWithCRLF is needed to make SystemZ happy.

> On SystemZ we need to open text files in text mode,

Why can't it be served without CRLF translation?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99426

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


[Lldb-commits] [PATCH] D99182: [NFC] Reordering parameters in getFile and getFileOrSTDIN

2021-03-29 Thread Abhina Sree 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 rGc83cd8feef7e: [NFC] Reordering parameters in getFile and 
getFileOrSTDIN (authored by abhina.sreeskantharajan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99182

Files:
  clang/lib/Tooling/JSONCompilationDatabase.cpp
  clang/tools/arcmt-test/arcmt-test.cpp
  lld/COFF/Driver.cpp
  lld/COFF/DriverUtils.cpp
  lld/ELF/InputFiles.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
  lldb/unittests/TestingSupport/TestUtilities.cpp
  llvm/include/llvm/Support/MemoryBuffer.h
  llvm/lib/BinaryFormat/Magic.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/FuzzMutate/FuzzerCLI.cpp
  llvm/lib/IRReader/IRReader.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/Object/Binary.cpp
  llvm/lib/ProfileData/GCOV.cpp
  llvm/lib/Support/MemoryBuffer.cpp
  llvm/lib/TableGen/Main.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/lli/lli.cpp
  llvm/tools/llvm-ar/llvm-ar.cpp
  llvm/tools/llvm-cov/gcov.cpp
  llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
  llvm/tools/llvm-pdbutil/InputFile.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
  llvm/tools/llvm-rc/ResourceFileWriter.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/obj2yaml/obj2yaml.cpp
  llvm/tools/sanstats/sanstats.cpp
  llvm/utils/FileCheck/FileCheck.cpp

Index: llvm/utils/FileCheck/FileCheck.cpp
===
--- llvm/utils/FileCheck/FileCheck.cpp
+++ llvm/utils/FileCheck/FileCheck.cpp
@@ -821,9 +821,7 @@
 
   // Read the expected strings from the check file.
   ErrorOr> CheckFileOrErr =
-  MemoryBuffer::getFileOrSTDIN(CheckFilename, /*FileSize=*/-1,
-   /*RequiresNullTerminator=*/true,
-   /*IsText=*/true);
+  MemoryBuffer::getFileOrSTDIN(CheckFilename, /*IsText=*/true);
   if (std::error_code EC = CheckFileOrErr.getError()) {
 errs() << "Could not open check file '" << CheckFilename
<< "': " << EC.message() << '\n';
@@ -845,9 +843,7 @@
 
   // Open the file to check and add it to SourceMgr.
   ErrorOr> InputFileOrErr =
-  MemoryBuffer::getFileOrSTDIN(InputFilename, /*FileSize=*/-1,
-   /*RequiresNullTerminator=*/true,
-   /*IsText=*/true);
+  MemoryBuffer::getFileOrSTDIN(InputFilename, /*IsText=*/true);
   if (InputFilename == "-")
 InputFilename = ""; // Overwrite for improved diagnostic messages
   if (std::error_code EC = InputFileOrErr.getError()) {
Index: llvm/tools/sanstats/sanstats.cpp
===
--- llvm/tools/sanstats/sanstats.cpp
+++ llvm/tools/sanstats/sanstats.cpp
@@ -125,8 +125,8 @@
   cl::ParseCommandLineOptions(argc, argv,
   "Sanitizer Statistics Processing Tool");
 
-  ErrorOr> MBOrErr =
-  MemoryBuffer::getFile(ClInputFile, -1, false);
+  ErrorOr> MBOrErr = MemoryBuffer::getFile(
+  ClInputFile, /*IsText=*/false, /*RequiresNullTerminator=*/false);
   if (!MBOrErr) {
 errs() << argv[0] << ": " << ClInputFile << ": "
<< MBOrErr.getError().message() << '\n';
Index: llvm/tools/obj2yaml/obj2yaml.cpp
===
--- llvm/tools/obj2yaml/obj2yaml.cpp
+++ llvm/tools/obj2yaml/obj2yaml.cpp
@@ -36,7 +36,7 @@
 
 static Error dumpInput(StringRef File) {
   ErrorOr> FileOrErr =
-  MemoryBuffer::getFileOrSTDIN(File, /*FileSize=*/-1,
+  MemoryBuffer::getFileOrSTDIN(File, /*IsText=*/false,
/*RequiresNullTerminator=*/false);
   if (std::error_code EC = FileOrErr.getError())
 return errorCodeToError(EC);
Index: llvm/tools/llvm-readobj/llvm-readobj.cpp
===
--- llvm/tools/llvm-readobj/llvm-readobj.cpp
+++ llvm/tools/llvm-readobj/llvm-readobj.cpp
@@ -653,7 +653,7 @@
 /// Opens \a File and dumps it.
 static void dumpInput(StringRef File, ScopedPrinter &Writer) {
   ErrorOr> FileOrErr =
-  MemoryBuffer::getFileOrSTDIN(File, /*FileSize=*/-1,
+  MemoryBuffer::getFileOrSTDIN(File, /*IsText=*/false,
/*RequiresNullTerminator=*/false);
   if (std::error_code EC = FileOrErr.getError())
 return reportError(errorCodeToError(EC), File);
Index: llvm/tools/llvm-rc/ResourceFileWriter.cpp
===
--- llvm/tools/llvm-rc/ResourceFileWriter.cpp
+++ llvm/tools/llvm-rc/ResourceFileWriter.cpp
@@ -1524,14 +1524,16 @@
   // properly though, so if using that to append paths below, this early
   // exception case could be removed.)
   if (sys::path::has_root_directory(File))
-

[Lldb-commits] [PATCH] D99426: [Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text

2021-03-29 Thread Abhina Sree via Phabricator via lldb-commits
abhina.sreeskantharajan added a comment.

In D99426#2653725 , @MaskRay wrote:

> This touches a lot of files. I am a bit worried that it would not be easy for 
> a contributor to know OF_TextWithCRLF is needed to make SystemZ happy.
>
>> On SystemZ we need to open text files in text mode,
>
> Why can't it be served without CRLF translation?

So this is a quick summary of the problem we're facing: 
On SystemZ, we can accept both OF_Text or OF_TextWithCRLF, it makes no 
difference. However, there are many text files that are marked as 
binary/OF_None to suppress CRLF translation on Windows. (e.g. patches like this 
one https://reviews.llvm.org/rGe78a7a0ecddc747129512fabf4836e22d1805f00). On 
SystemZ we need the text files to be marked as text and have made patches in 
the past to do so (e.g. https://reviews.llvm.org/D67696). These efforts are 
conflicting with each other, so Reid suggested this solution where we create a 
new flag that will set text mode and turn on CRLF translation on Windows 
platform. Then we will be able to mark all remaining text files with OF_Text 
and not turn on CRLF translation for Windows.

I agree this patch is touching a lot of files,  I can maybe do the opposite and 
create a flag called OF_TextWithoutCRLF. I'm open to any new solutions to this 
problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99426

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


[Lldb-commits] [PATCH] D99426: [Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text

2021-03-29 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D99426#2653869 , 
@abhina.sreeskantharajan wrote:

> In D99426#2653725 , @MaskRay wrote:
>
>> This touches a lot of files. I am a bit worried that it would not be easy 
>> for a contributor to know OF_TextWithCRLF is needed to make SystemZ happy.
>>
>>> On SystemZ we need to open text files in text mode,
>>
>> Why can't it be served without CRLF translation?
>
> So this is a quick summary of the problem we're facing: 
> On SystemZ, we can accept both OF_Text or OF_TextWithCRLF, it makes no 
> difference. However, there are many text files that are marked as 
> binary/OF_None to suppress CRLF translation on Windows. (e.g. patches like 
> this one 
> https://reviews.llvm.org/rGe78a7a0ecddc747129512fabf4836e22d1805f00). On 
> SystemZ we need the text files to be marked as text and have made patches in 
> the past to do so (e.g. https://reviews.llvm.org/D67696). These efforts are 
> conflicting with each other, so Reid suggested this solution where we create 
> a new flag that will set text mode and turn on CRLF translation on Windows 
> platform. Then we will be able to mark all remaining text files with OF_Text 
> and not turn on CRLF translation for Windows.
>
> I agree this patch is touching a lot of files,  I can maybe do the opposite 
> and create a flag called OF_TextWithoutCRLF. I'm open to any new solutions to 
> this problem.

Hmm. I am still confused after seeting 
rGe78a7a0ecddc747129512fabf4836e22d1805f00 
 (does it 
imply that using OF_None on Windows is fine?)
If `OF_None` is used on SystemZ, does that regress functionality?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99426

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


[Lldb-commits] [PATCH] D99426: [Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text

2021-03-29 Thread Abhina Sree via Phabricator via lldb-commits
abhina.sreeskantharajan added a comment.

In D99426#2653949 , @MaskRay wrote:

> In D99426#2653869 , 
> @abhina.sreeskantharajan wrote:
>
>> In D99426#2653725 , @MaskRay wrote:
>>
>>> This touches a lot of files. I am a bit worried that it would not be easy 
>>> for a contributor to know OF_TextWithCRLF is needed to make SystemZ happy.
>>>
 On SystemZ we need to open text files in text mode,
>>>
>>> Why can't it be served without CRLF translation?
>>
>> So this is a quick summary of the problem we're facing: 
>> On SystemZ, we can accept both OF_Text or OF_TextWithCRLF, it makes no 
>> difference. However, there are many text files that are marked as 
>> binary/OF_None to suppress CRLF translation on Windows. (e.g. patches like 
>> this one 
>> https://reviews.llvm.org/rGe78a7a0ecddc747129512fabf4836e22d1805f00). On 
>> SystemZ we need the text files to be marked as text and have made patches in 
>> the past to do so (e.g. https://reviews.llvm.org/D67696). These efforts are 
>> conflicting with each other, so Reid suggested this solution where we create 
>> a new flag that will set text mode and turn on CRLF translation on Windows 
>> platform. Then we will be able to mark all remaining text files with OF_Text 
>> and not turn on CRLF translation for Windows.
>>
>> I agree this patch is touching a lot of files,  I can maybe do the opposite 
>> and create a flag called OF_TextWithoutCRLF. I'm open to any new solutions 
>> to this problem.
>
> Hmm. I am still confused after seeting 
> rGe78a7a0ecddc747129512fabf4836e22d1805f00 
>  (does 
> it imply that using OF_None on Windows is fine?)
> If `OF_None` is used on SystemZ, does that regress functionality?

On Windows, OF_None suppresses CRLF translation and OF_Text will allow CRLF 
translation. On SystemZ it does regress functionality by causing file encoding 
issues. z/OS uses a file's text/binary mode to determine whether to perform 
translation to the system encoding EBCDIC if needed. (On binary files, no 
translation should be performed)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99426

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


[Lldb-commits] [PATCH] D99182: [NFC] Reordering parameters in getFile and getFileOrSTDIN

2021-03-29 Thread Abhina Sree via Phabricator via lldb-commits
abhina.sreeskantharajan marked an inline comment as done.
abhina.sreeskantharajan added inline comments.



Comment at: llvm/lib/Support/MemoryBuffer.cpp:275
+  return getFileAux(
+  Filename, /*MapSize=*/-1, 0, /*IsText=*/false,
+  /*RequiresNullTerminator=*/false, IsVolatile);

jhenderson wrote:
> Whilst you're modifying, add the named parameter comment for the `0`, so that 
> it's not just a magic number.
Thanks for catching, this is fixed now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99182

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


[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-03-29 Thread Roman Lebedev via Phabricator via lldb-commits
lebedev.ri added a comment.

Thank you!
The changes here look about reasonable to me.
I have not checked if there are some changes that were missed.
Usage of `CMAKE_INSTALL_FULL_` is suspect to me. Are you sure those are correct?




Comment at: compiler-rt/cmake/Modules/AddCompilerRT.cmake:513
   install(FILES ${file_name}
-DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
+DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
 COMPONENT ${component})

This looks suspect



Comment at: compiler-rt/cmake/Modules/AddCompilerRT.cmake:530
 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE 
WORLD_READ WORLD_EXECUTE
-DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
+DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
 endmacro(add_compiler_rt_script src name)

This looks suspect



Comment at: compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake:511
 set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
-  ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
+  ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
   

This looks suspect



Comment at: compiler-rt/cmake/Modules/CompilerRTUtils.cmake:389
 get_compiler_rt_target(${arch} target)
-set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
+set(${install_dir} 
${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
   else()

This looks suspect



Comment at: compiler-rt/cmake/base-config-ix.cmake:100
   set(COMPILER_RT_LIBRARY_INSTALL_DIR
-${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
+
${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
 endif()

This looks suspect



Comment at: compiler-rt/include/CMakeLists.txt:72-87
+  DESTINATION 
${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
 # Install fuzzer headers.
 install(FILES ${FUZZER_HEADERS}
   COMPONENT compiler-rt-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
+  DESTINATION 
${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
 # Install xray headers.

This looks suspect



Comment at: compiler-rt/lib/dfsan/CMakeLists.txt:64-65
 add_dependencies(dfsan dfsan_abilist)
 install(FILES ${dfsan_abilist_filename}
-DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
+DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})

This looks suspect



Comment at: polly/cmake/CMakeLists.txt:85
+set(POLLY_CONFIG_CMAKE_DIR 
"${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_LIBRARY_DIRS 
"${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
 if (POLLY_BUNDLED_ISL)

This looks suspect


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-03-29 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 created this revision.
Herald added subscribers: libc-commits, libcxx-commits, dcaballe, cota, 
teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, 
Joonsoo, kerbowa, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, 
antiagainst, shauheen, rriddle, mehdi_amini, arphaman, steven_wu, hiraditya, 
mgorny, nhaehnle, jvesely.
Herald added a reviewer: bollu.
Herald added a reviewer: ldionne.
Herald added a reviewer: sscalpone.
Herald added a reviewer: awarzynski.
Herald added projects: libunwind, libc-project.
Herald added a reviewer: libunwind.
Ericson2314 requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, Sanitizers, LLDB, libc++, OpenMP, libc++abi, 
MLIR, LLVM, clang-tools-extra.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

This is a new draft of D28234 . I previously 
did the unorthodox thing of
pushing to it when I wasn't the original author, but since this version

- Uses `GNUInstallDirs`, rather than mimics it, as the original author was 
hesitant to do but others requested.
- Is much broader, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I am using this patch (and many back-ports) as the basis of
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It
looked like people were generally on board in D28234 
, but I make note of
this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM
already has some partial support for these sorts of things. Sometimes
GNUInstallDirs alone is more expressive, but sometimes the existing
stuff is, e.g. with the "utils" vs "tools" distinction or perhaps when
everything is being built together.

Another related tension was that the GNUInstallDirs variables may be
relative `CMAKE_INSTALL_PREFIX` *or* absolute paths that need not lead
within that directory. We in fact do the common case in Nixpkgs (and in
my PR), where the package and "-dev" package data (analogizing from
conventional distros) are installed in separate prefixes. Supporting
this fall range of the GNU variables means this patch can't always be a
simple "find and replace" of `bin/`, `lib/`, `include/`, etc., as we
sometimes need to get clever where a leading `CMAKE_INSTALL_PREFIX` was
previously mandatory.

I am not a frequent LLVM contributor, so I didn't want to broach the
topic of removing functionality / breaking changes, so I instead
implemented GNUInstallDirs along side the existing stuff. Existing
custom install dirs are derived from the GNUInstallDirs ones by default,
but may be separately sepcified. Existing prefixes come before
`CMAKE_CONFIGURE_PREFIX`. In a few cases that was a small breaking
change when the default per-project prefix was itself
`CMAKE_CONFIGURE_PREFIX` rather than the empty string, but the majority
aready had the empty string default.

I do think it would be wise for others to remove some of the old install
dir mechanisms, as the LLVM CMake is already quite complex, but I would
strongly prefer to leave that to others who are more familiar with the
project and its main users' needs re compat vs features of the build
system.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/lib/Headers/CMakeLists.txt
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/include/CMakeLists.txt
  compiler-rt/lib/dfsan/CMakeLists.txt
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libc/lib/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/src/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  

[Lldb-commits] [PATCH] D99426: [Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text

2021-03-29 Thread Abhina Sree via Phabricator via lldb-commits
abhina.sreeskantharajan created this revision.
Herald added subscribers: dexonsmith, wenlei, okura, kuter, cmtice, martong, 
steven_wu, gbedwell, hiraditya, qcolombet, MatzeB.
Herald added a reviewer: bollu.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: andreadb.
Herald added a reviewer: jhenderson.
abhina.sreeskantharajan requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, bbn, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added projects: clang, LLDB, LLVM, clang-tools-extra.

On SystemZ we need to open text files in text mode, but on Windows this may not 
be desirable if we want to suppress CRLF translation. This patch adds two new 
flags

- OF_CRLF which indicates that CRLF translation is used.
- OF_TextWithCRLF = OF_Text | OF_CRLF indicates that the file is text and uses 
CRLF translation.

Major change in llvm/lib/Support/Windows/Path.inc to only set text mode if the 
OF_CRLF is set.

  if (Flags & OF_CRLF)
CrtOpenFlags |= _O_TEXT;




Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99426

Files:
  clang-tools-extra/clang-move/tool/ClangMove.cpp
  clang-tools-extra/modularize/ModuleAssistant.cpp
  clang-tools-extra/pp-trace/PPTrace.cpp
  clang/lib/ARCMigrate/PlistReporter.cpp
  clang/lib/Driver/Compilation.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/DependencyFile.cpp
  clang/lib/Frontend/DependencyGraph.cpp
  clang/lib/Frontend/FrontendActions.cpp
  clang/lib/Frontend/HeaderIncludeGen.cpp
  clang/lib/Frontend/ModuleDependencyCollector.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp
  clang/tools/driver/cc1as_main.cpp
  flang/lib/Frontend/CompilerInstance.cpp
  lld/COFF/DriverUtils.cpp
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lldb/include/lldb/Utility/ReproducerProvider.h
  lldb/source/Utility/GDBRemote.cpp
  lldb/source/Utility/ReproducerProvider.cpp
  lldb/tools/lldb-server/LLDBServerUtilities.cpp
  llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/CodeGen/RegAllocPBQP.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/LLVMRemarkStreamer.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/MC/MCParser/DarwinAsmParser.cpp
  llvm/lib/ProfileData/GCOV.cpp
  llvm/lib/ProfileData/SampleProfWriter.cpp
  llvm/lib/Support/FileCollector.cpp
  llvm/lib/Support/MemoryBuffer.cpp
  llvm/lib/Support/TimeProfiler.cpp
  llvm/lib/Support/Timer.cpp
  llvm/lib/Support/Unix/Program.inc
  llvm/lib/Support/Windows/Path.inc
  llvm/lib/Support/Windows/Program.inc
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llc/llc.cpp
  llvm/tools/lli/lli.cpp
  llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
  llvm/tools/llvm-dis/llvm-dis.cpp
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
  llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
  llvm/tools/llvm-link/llvm-link.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-mca/llvm-mca.cpp
  llvm/tools/llvm-opt-report/OptReport.cpp
  llvm/tools/llvm-profdata/llvm-profdata.cpp
  llvm/tools/llvm-xray/xray-account.cpp
  llvm/tools/llvm-xray/xray-converter.cpp
  llvm/tools/llvm-xray/xray-extract.cpp
  llvm/tools/llvm-xray/xray-graph-diff.cpp
  llvm/tools/llvm-xray/xray-graph.cpp
  llvm/tools/opt/opt.cpp
  llvm/tools/verify-uselistorder/verify-uselistorder.cpp
  llvm/unittests/Support/Path.cpp
  polly/lib/Exchange/JSONExporter.cpp

Index: polly/lib/Exchange/JSONExporter.cpp
===
--- polly/lib/Exchange/JSONExporter.cpp
+++ polly/lib/Exchange/JSONExporter.cpp
@@ -178,7 +178,7 @@
 
   // Write to file.
   std::error_code EC;
-  ToolOutputFile F(FileName, EC, llvm::sys::fs::OF_Text);
+  ToolOutputFile F(FileName, EC, llvm::sys::fs::OF_TextWithCRLF);
 
   std::string FunctionName = S.getFunction().getName().str();
   errs() << "Writing JScop '" << S.getNameStr() << "' in function '"
Index: llvm/unittests/Support/Path.cpp
===
--- llvm/unittests/Support/Path.cpp
+++ llvm/unittests/Support/Path.cpp
@@ -1253,7 +1253,7 @@
   path::append(FilePathname, "test");
 
   {
-raw_fd_ostream File(FilePathname, EC, sys::fs::OF_Text);
+raw_fd_ostream File(FilePathname, EC, sys::fs::OF_TextWithCRLF);
 ASSERT_NO_ERROR(EC);
 File << '\n';
   }
Index: llvm/tools/verify-uselistorder/verify-uselistorder.cpp
===
--- llvm/tools/verify-uselistorder/verify-uselistorder.cpp
+++ llvm/tools/verify-

[Lldb-commits] [PATCH] D99331: [TESTS] Fix TestInlineStepping with ccac compiler

2021-03-29 Thread Alexey Vasilyev via Phabricator via lldb-commits
vasilyev added a comment.

Thanks for the comments! You are right, this is indeed fixed by 
https://github.com/llvm/llvm-project/commit/352f16db87f583ec7f55f8028647b5fd8616111f


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99331

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


[Lldb-commits] [PATCH] D99491: [LLDB] Fix cleanup error in TestVSCode_disconnect.test_launch

2021-03-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added reviewers: clayborg, labath.
omjavaid requested review of this revision.

TestVSCode_disconnect.test_launch fails with clean up error because disconnect 
gets called twice once from the test case and once from the tear down hook.

This patch disables disconnect after its been called from the test_launch


https://reviews.llvm.org/D99491

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py


Index: lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
===
--- lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
+++ lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
@@ -37,7 +37,7 @@
 created.
 """
 program = self.getBuildArtifact("a.out")
-self.build_and_launch(program)
+self.build_and_launch(program, disconnectAutomatically=False)
 
 # We set a breakpoint right before the side effect file is created
 self.set_source_breakpoints(self.source, [line_number(self.source, '// 
breakpoint')])
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -340,7 +340,8 @@
  trace=False, initCommands=None, preRunCommands=None,
  stopCommands=None, exitCommands=None,
  terminateCommands=None, sourcePath=None,
- debuggerRoot=None, runInTerminal=False):
+ debuggerRoot=None, runInTerminal=False,
+ disconnectAutomatically=True):
 '''Build the default Makefile target, create the VSCode debug adaptor,
and launch the process.
 '''
@@ -350,4 +351,5 @@
 return self.launch(program, args, cwd, env, stopOnEntry, disableASLR,
 disableSTDIO, shellExpandArguments, trace,
 initCommands, preRunCommands, stopCommands, exitCommands,
-terminateCommands, sourcePath, debuggerRoot, 
runInTerminal=runInTerminal)
+terminateCommands, sourcePath, debuggerRoot, 
runInTerminal=runInTerminal,
+disconnectAutomatically=disconnectAutomatically)


Index: lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
===
--- lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
+++ lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
@@ -37,7 +37,7 @@
 created.
 """
 program = self.getBuildArtifact("a.out")
-self.build_and_launch(program)
+self.build_and_launch(program, disconnectAutomatically=False)
 
 # We set a breakpoint right before the side effect file is created
 self.set_source_breakpoints(self.source, [line_number(self.source, '// breakpoint')])
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -340,7 +340,8 @@
  trace=False, initCommands=None, preRunCommands=None,
  stopCommands=None, exitCommands=None,
  terminateCommands=None, sourcePath=None,
- debuggerRoot=None, runInTerminal=False):
+ debuggerRoot=None, runInTerminal=False,
+ disconnectAutomatically=True):
 '''Build the default Makefile target, create the VSCode debug adaptor,
and launch the process.
 '''
@@ -350,4 +351,5 @@
 return self.launch(program, args, cwd, env, stopOnEntry, disableASLR,
 disableSTDIO, shellExpandArguments, trace,
 initCommands, preRunCommands, stopCommands, exitCommands,
-terminateCommands, sourcePath, debuggerRoot, runInTerminal=runInTerminal)
+terminateCommands, sourcePath, debuggerRoot, runInTerminal=runInTerminal,
+disconnectAutomatically=disconnectAutomatically)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 69e7b74 - [lldb][NFC] Add a test case for Objective-C properties with conflicting names

2021-03-29 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-03-29T12:33:07+02:00
New Revision: 69e7b7457809bac02f3e6f7d643c4fb516b31616

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

LOG: [lldb][NFC] Add a test case for Objective-C properties with conflicting 
names

This is an LLDB test for the ASTImporter crash that got fixed in D99077.
The test is using Clang modules for the properties as it seems the conflicting
names are not actually correctly handled when generating debug information
(only the first property is emitted and the second one is ignored in the current
clang ToT).

Added: 
lldb/test/API/lang/objc/modules-objc-property/Makefile
lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
lldb/test/API/lang/objc/modules-objc-property/main.m
lldb/test/API/lang/objc/modules-objc-property/module.modulemap
lldb/test/API/lang/objc/modules-objc-property/myModule.h

Modified: 


Removed: 




diff  --git a/lldb/test/API/lang/objc/modules-objc-property/Makefile 
b/lldb/test/API/lang/objc/modules-objc-property/Makefile
new file mode 100644
index ..c7c990e73158
--- /dev/null
+++ b/lldb/test/API/lang/objc/modules-objc-property/Makefile
@@ -0,0 +1,5 @@
+OBJC_SOURCES := main.m
+
+CFLAGS_EXTRAS = $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(BUILDDIR)
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py 
b/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
new file mode 100644
index ..d23949fe30b4
--- /dev/null
+++ b/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
@@ -0,0 +1,27 @@
+import unittest2
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_conflicting_properties(self):
+""" Tests receiving two properties with the same name from modules."""
+self.build()
+lldbutil.run_to_source_breakpoint(
+self, '// Set breakpoint here.', lldb.SBFileSpec('main.m'))
+
+self.runCmd(
+"settings set target.clang-module-search-paths \"" +
+self.getSourceDir() +
+"\"")
+
+self.runCmd("expr @import myModule")
+self.expect_expr("m.propConflict", result_value="5")
+self.expect_expr("MyClass.propConflict", result_value="6")

diff  --git a/lldb/test/API/lang/objc/modules-objc-property/main.m 
b/lldb/test/API/lang/objc/modules-objc-property/main.m
new file mode 100644
index ..c0f58f41b764
--- /dev/null
+++ b/lldb/test/API/lang/objc/modules-objc-property/main.m
@@ -0,0 +1,8 @@
+@import Foundation;
+@import myModule;
+
+int main() {
+MyClass *m = [[MyClass alloc] init];
+int i = m.propConflict + MyClass.propConflict;
+return i; // Set breakpoint here.
+}

diff  --git a/lldb/test/API/lang/objc/modules-objc-property/module.modulemap 
b/lldb/test/API/lang/objc/modules-objc-property/module.modulemap
new file mode 100644
index ..2ef8064d15b4
--- /dev/null
+++ b/lldb/test/API/lang/objc/modules-objc-property/module.modulemap
@@ -0,0 +1,4 @@
+module myModule {
+  header "myModule.h"
+  export *
+}

diff  --git a/lldb/test/API/lang/objc/modules-objc-property/myModule.h 
b/lldb/test/API/lang/objc/modules-objc-property/myModule.h
new file mode 100644
index ..07b40ccc2f65
--- /dev/null
+++ b/lldb/test/API/lang/objc/modules-objc-property/myModule.h
@@ -0,0 +1,24 @@
+#ifndef MYMODULE
+#define MYMODULE
+
+@import Foundation;
+
+@interface MyClass : NSObject
+- (int) propConflict;
++ (int) propConflict;
+@property(readonly) int propConflict;
+@property(readonly,class) int propConflict;
+@end
+
+@implementation MyClass
+- (int) propConflict
+{
+  return 5;
+}
++ (int) propConflict
+{
+  return 6;
+}
+@end
+
+#endif // MYMODULE



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


[Lldb-commits] [PATCH] D99331: [TESTS] Fix TestInlineStepping with ccac compiler

2021-03-29 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

So from what I understand this is resolved? If yes, can you abandon/close this 
revision (You can do this by selecting the "Abandon revision" action above the 
input field where you can comment).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99331

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


[Lldb-commits] [PATCH] D98822: [lldb] [Process] Watch for fork/vfork notifications

2021-03-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 333834.
mgorny added a comment.

Fix wrongly using the debugged process' TID instead of PID.


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

https://reviews.llvm.org/D98822

Files:
  lldb/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/include/lldb/Host/linux/Host.h
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Host/linux/Host.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h
  lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h
  lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h
  lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/test/Shell/Subprocess/Inputs/clone.c
  lldb/test/Shell/Subprocess/Inputs/fork.c
  lldb/test/Shell/Subprocess/Inputs/vfork.c
  lldb/test/Shell/Subprocess/clone-follow-parent-softbp.test
  lldb/test/Shell/Subprocess/clone-follow-parent-wp.test
  lldb/test/Shell/Subprocess/clone-follow-parent.test
  lldb/test/Shell/Subprocess/fork-follow-parent-softbp.test
  lldb/test/Shell/Subprocess/fork-follow-parent-wp.test
  lldb/test/Shell/Subprocess/fork-follow-parent.test
  lldb/test/Shell/Subprocess/vfork-follow-parent-softbp.test
  lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test
  lldb/test/Shell/Subprocess/vfork-follow-parent.test

Index: lldb/test/Shell/Subprocess/vfork-follow-parent.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/vfork-follow-parent.test
@@ -0,0 +1,10 @@
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/vfork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+b parent_func
+process launch
+# CHECK-NOT: function run in parent
+# CHECK: stop reason = breakpoint
+continue
+# CHECK: function run in parent
+# CHECK: child exited: 0
Index: lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/vfork-follow-parent-wp.test
@@ -0,0 +1,12 @@
+# REQUIRES: native && (target-x86 || target-x86_64 || target-aarch64) && dbregs-set
+# RUN: %clang_host -g %p/Inputs/vfork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch -s
+watchpoint set variable -w write g_val
+# CHECK: Watchpoint created:
+continue
+# CHECK-NOT: function run in parent
+# CHECK: stop reason = watchpoint
+continue
+# CHECK: function run in parent
+# CHECK: child exited: 0
Index: lldb/test/Shell/Subprocess/vfork-follow-parent-softbp.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/vfork-follow-parent-softbp.test
@@ -0,0 +1,11 @@
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/vfork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+b parent_func
+b child_func
+process launch
+# CHECK-NOT: function run in parent
+# CHECK: stop reason = breakpoint
+continue
+# CHECK: function run in parent
+# CHECK: child exited: 0
Index: lldb/test/Shell/Subprocess/fork-follow-parent.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/fork-follow-parent.test
@@ -0,0 +1,11 @@
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/fork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+b parent_func
+process launch
+# CHECK: function run in child
+# CHECK-NOT: function run in parent
+# CHECK: stop reason = breakpoint
+continue
+# CHECK: function run in parent
+# CHECK: child exited: 0
Index: lldb/test/Shell/Subprocess/fork-follow-parent-wp.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/fork-follow-parent-wp.test
@@ -0,0 +1,13 @@
+# REQUIRES: native && (target-x86 || target-x86_64 || target-aarch64) && dbregs-set
+# RUN: %clang_host -g %p/Inputs/fork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch -s
+watchpoint set variable -w write g_val
+# CHECK: Watchpoint created:
+continue
+# CHECK: function run in child
+# CHECK-NOT: function run in parent
+# CHECK: stop reason = watchpoint
+continue
+# CHECK: function run in parent
+# CHECK: child exited: 0
Index: lldb/test/Shell/Subprocess/fork-follow-parent-softbp.test
===
--- /dev/null
+++ lldb/test/Shell/Subprocess/fork-follow-parent-softbp.test
@@ -0,0 +1,12 @@
+# REQUIRES: native
+# RUN: %clang_host %p/Inputs/fork.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+b parent_func
+b child_func
+process launch
+

[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-03-29 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

@lebedev.ri Those are intentional. I changed `POLLY_INSTALL_PREFIX` and 
`COMPILER_RT_INSTALL_PATH` to be `""` instead of `${CMAKE_INSTALL_PREFIX}` by 
default. If if kept it more as it was, the GNU dir outside the prefix (as I 
needed to do) wouldn't work. I suppose I could instead use 
https://cmake.org/cmake/help/v3.16/command/get_filename_component.html to keep 
those prefix ones as is? But I would still need to use the `_FULL` variables in 
the calculation.

There is 
https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#command:gnuinstalldirs_get_absolute_install_dir
 which would be nice to use for this, except there is no parameter to make it 
expand relative something other than `CMAKE_INSTALL_PREFIX`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-03-29 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 333885.
Ericson2314 added a comment.



1. Updating D99484 : Use `GNUInstallDirs` to 
support custom installation dirs. #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

Fix lint by renaming path -> Path


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/lib/Headers/CMakeLists.txt
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/include/CMakeLists.txt
  compiler-rt/lib/dfsan/CMakeLists.txt
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libc/lib/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/src/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/tools/intel-features/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/AddOCaml.cmake
  llvm/cmake/modules/AddSphinxTarget.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/docs/CMake.rst
  llvm/examples/Bye/CMakeLists.txt
  llvm/include/llvm/CMakeLists.txt
  llvm/tools/llvm-config/BuildVariables.inc.in
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/tools/lto/CMakeLists.txt
  llvm/tools/opt-viewer/CMakeLists.txt
  llvm/tools/remarks-shlib/CMakeLists.txt
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins/ve/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/cmake/polly_macros.cmake
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -81,15 +83,15 @@
 install(EXPORT ParallelSTLTargets
 FILE ParallelSTLTargets.cmake
 NAMESPACE pstl::
-DESTINATION lib/cmake/ParallelSTL)
+DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ParallelSTL)
 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake"
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
-DESTINATION lib/cmake/ParallelSTL)
+DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -275,7 +275,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION ${CMA

[Lldb-commits] [PATCH] D99331: [TESTS] Fix TestInlineStepping with ccac compiler

2021-03-29 Thread Alexey Vasilyev via Phabricator via lldb-commits
vasilyev abandoned this revision.
vasilyev added a comment.

Resolved


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99331

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


[Lldb-commits] [lldb] 4d593ef - [lldb] Include llvm-config.h instead of config.h

2021-03-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-29T08:58:51-07:00
New Revision: 4d593efd7f930c42be8553a5ba347e2d87503ad4

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

LOG: [lldb] Include llvm-config.h instead of config.h

This distinction doesn't matter for an in-tree build, but when building
against an installed llvm, only the former is present.

This should fix the LLDB Standalone bot:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/

Added: 


Modified: 
lldb/source/Utility/LLDBAssert.cpp

Removed: 




diff  --git a/lldb/source/Utility/LLDBAssert.cpp 
b/lldb/source/Utility/LLDBAssert.cpp
index 532b56b6f59e3..a8d8ef65a9455 100644
--- a/lldb/source/Utility/LLDBAssert.cpp
+++ b/lldb/source/Utility/LLDBAssert.cpp
@@ -7,7 +7,7 @@
 
//===--===//
 
 #include "lldb/Utility/LLDBAssert.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/raw_ostream.h"



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


[Lldb-commits] [PATCH] D99448: [lldb] Move UpdateISAToDescriptorMap into ClassInfoExtractor

2021-03-29 Thread Jonas Devlieghere 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 rGbf8cbfa65fc5: [lldb] Move UpdateISAToDescriptorMap into 
ClassInfoExtractor (NFC) (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99448

Files:
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -318,6 +318,10 @@
 DynamicClassInfoExtractor(AppleObjCRuntimeV2 &runtime)
 : ClassInfoExtractor(runtime) {}
 
+DescriptorMapUpdateResult
+UpdateISAToDescriptorMap(RemoteNXMapTable &hash_table);
+
+  private:
 enum Helper { gdb_objc_realized_classes, objc_copyRealizedClassList };
 
 /// Compute which helper to use. Prefer objc_copyRealizedClassList if it's
@@ -329,7 +333,6 @@
  Helper helper);
 lldb::addr_t &GetClassInfoArgs(Helper helper);
 
-  private:
 std::unique_ptr
 GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx, std::string code,
 std::string name);
@@ -356,17 +359,16 @@
 SharedCacheClassInfoExtractor(AppleObjCRuntimeV2 &runtime)
 : ClassInfoExtractor(runtime) {}
 
-UtilityFunction *GetClassInfoUtilityFunction(ExecutionContext &exe_ctx);
-lldb::addr_t &GetClassInfoArgs() { return m_args; }
-std::mutex &GetMutex() { return m_mutex; }
+DescriptorMapUpdateResult UpdateISAToDescriptorMap();
 
   private:
+UtilityFunction *GetClassInfoUtilityFunction(ExecutionContext &exe_ctx);
+
 std::unique_ptr
 GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx);
 
 std::unique_ptr m_utility_function;
 lldb::addr_t m_args = LLDB_INVALID_ADDRESS;
-std::mutex m_mutex;
   };
 
   AppleObjCRuntimeV2(Process *process, const lldb::ModuleSP &objc_module_sp);
@@ -381,14 +383,9 @@
   /// change when lazily named classes get realized.
   bool RealizedClassGenerationCountChanged();
 
-  DescriptorMapUpdateResult
-  UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table);
-
   uint32_t ParseClassInfoArray(const lldb_private::DataExtractor &data,
uint32_t num_class_infos);
 
-  DescriptorMapUpdateResult UpdateISAToDescriptorMapSharedCache();
-
   enum class SharedCacheWarningReason {
 eExpressionExecutionFailure,
 eNotEnoughClassesRead
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1551,10 +1551,9 @@
 }
 
 AppleObjCRuntimeV2::DescriptorMapUpdateResult
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
+AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(
 RemoteNXMapTable &hash_table) {
-  Process *process = GetProcess();
-
+  Process *process = m_runtime.GetProcess();
   if (process == nullptr)
 return DescriptorMapUpdateResult::Fail();
 
@@ -1583,22 +1582,20 @@
   Status err;
 
   // Compute which helper we're going to use for this update.
-  const DynamicClassInfoExtractor::Helper helper =
-  m_dynamic_class_info_extractor.ComputeHelper();
+  const DynamicClassInfoExtractor::Helper helper = ComputeHelper();
 
   // Read the total number of classes from the hash table
   const uint32_t num_classes =
   helper == DynamicClassInfoExtractor::gdb_objc_realized_classes
   ? hash_table.GetCount()
-  : m_realized_class_generation_count;
+  : m_runtime.m_realized_class_generation_count;
   if (num_classes == 0) {
 LLDB_LOGF(log, "No dynamic classes found.");
 return DescriptorMapUpdateResult::Success(0);
   }
 
   UtilityFunction *get_class_info_code =
-  m_dynamic_class_info_extractor.GetClassInfoUtilityFunction(exe_ctx,
- helper);
+  GetClassInfoUtilityFunction(exe_ctx, helper);
   if (!get_class_info_code) {
 // The callee will have already logged a useful error message.
 return DescriptorMapUpdateResult::Fail();
@@ -1629,7 +1626,7 @@
 return DescriptorMapUpdateResult::Fail();
   }
 
-  std::lock_guard guard(m_dynamic_class_info_extractor.GetMutex());
+  std::lock_guard guard(m_mutex);
 
   // Fill in our function argument values
   arguments.GetValueAtIndex(0)->G

[Lldb-commits] [lldb] bf8cbfa - [lldb] Move UpdateISAToDescriptorMap into ClassInfoExtractor (NFC)

2021-03-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-29T09:23:44-07:00
New Revision: bf8cbfa65fc5eb484013c43b26754b4612d5c6ee

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

LOG: [lldb] Move UpdateISAToDescriptorMap into ClassInfoExtractor (NFC)

Move UpdateISAToDescriptorMap into ClassInfoExtractor so that all the
formerly public functions can be private and remain an implementation
detail of the extractor.

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

Added: 


Modified: 

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h

Removed: 




diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 31ddf83ba988..523b8e99a8ea 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1551,10 +1551,9 @@ 
AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::GetClassInfoUtilityFunction(
 }
 
 AppleObjCRuntimeV2::DescriptorMapUpdateResult
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
+AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(
 RemoteNXMapTable &hash_table) {
-  Process *process = GetProcess();
-
+  Process *process = m_runtime.GetProcess();
   if (process == nullptr)
 return DescriptorMapUpdateResult::Fail();
 
@@ -1583,22 +1582,20 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
   Status err;
 
   // Compute which helper we're going to use for this update.
-  const DynamicClassInfoExtractor::Helper helper =
-  m_dynamic_class_info_extractor.ComputeHelper();
+  const DynamicClassInfoExtractor::Helper helper = ComputeHelper();
 
   // Read the total number of classes from the hash table
   const uint32_t num_classes =
   helper == DynamicClassInfoExtractor::gdb_objc_realized_classes
   ? hash_table.GetCount()
-  : m_realized_class_generation_count;
+  : m_runtime.m_realized_class_generation_count;
   if (num_classes == 0) {
 LLDB_LOGF(log, "No dynamic classes found.");
 return DescriptorMapUpdateResult::Success(0);
   }
 
   UtilityFunction *get_class_info_code =
-  m_dynamic_class_info_extractor.GetClassInfoUtilityFunction(exe_ctx,
- helper);
+  GetClassInfoUtilityFunction(exe_ctx, helper);
   if (!get_class_info_code) {
 // The callee will have already logged a useful error message.
 return DescriptorMapUpdateResult::Fail();
@@ -1629,7 +1626,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
 return DescriptorMapUpdateResult::Fail();
   }
 
-  std::lock_guard guard(m_dynamic_class_info_extractor.GetMutex());
+  std::lock_guard guard(m_mutex);
 
   // Fill in our function argument values
   arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
@@ -1649,8 +1646,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
 
   // Write our function arguments into the process so we can run our function
   if (get_class_info_function->WriteFunctionArguments(
-  exe_ctx, m_dynamic_class_info_extractor.GetClassInfoArgs(helper),
-  arguments, diagnostics)) {
+  exe_ctx, GetClassInfoArgs(helper), arguments, diagnostics)) {
 EvaluateExpressionOptions options;
 options.SetUnwindOnError(true);
 options.SetTryAllThreads(false);
@@ -1671,8 +1667,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
 
 // Run the function
 ExpressionResults results = get_class_info_function->ExecuteFunction(
-exe_ctx, &m_dynamic_class_info_extractor.GetClassInfoArgs(helper),
-options, diagnostics, return_value);
+exe_ctx, &GetClassInfoArgs(helper), options, diagnostics, 
return_value);
 
 if (results == eExpressionCompleted) {
   // The result is the number of ClassInfo structures that were filled in
@@ -1687,7 +1682,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
   DataExtractor class_infos_data(buffer.GetBytes(),
  buffer.GetByteSize(),
  process->GetByteOrder(), addr_size);
-  ParseClassInfoArray(class_infos_data, num_class_infos);
+  m_runtime.ParseClassInfoArray(class_infos_data, num_class_infos);
 }
   }
   success = true;
@@ -1788,9 +1783,8 @@ bool AppleObjCRuntimeV2::HasSymbol(ConstString Name) {
 }
 
 AppleObjCRuntimeV2::DescriptorMapUpdateResult
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
-  Process *process = GetPro

[Lldb-commits] [PATCH] D98529: [lldb] Strip pointer authentication codes from aarch64 pc.

2021-03-29 Thread Justin Cohen via Phabricator via lldb-commits
justincohen added a comment.

Can we move comments over to --> https://reviews.llvm.org/D98886, which has 
these changes implemented?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98529

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


[Lldb-commits] [lldb] 32f252a - [lldb][NFC] Fix -Wdocumentation issue in ProcessMinidump

2021-03-29 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-03-29T19:40:41+02:00
New Revision: 32f252a765d5f76cd1c84c20d55482ab4c86dfe0

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

LOG: [lldb][NFC] Fix -Wdocumentation issue in ProcessMinidump

Added: 


Modified: 
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp 
b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index 05a48acc2f7a7..1ece75f04e3e5 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -138,10 +138,10 @@ class PlaceholderObjectFile : public ObjectFile {
 ///
 /// \param[in] module_sp The module to grab the .text section from.
 ///
-/// \param[in/out] breakpad_uuid A vector that will receive the calculated
+/// \param[in,out] breakpad_uuid A vector that will receive the calculated
 ///breakpad .text hash.
 ///
-/// \param[in/out] facebook_uuid A vector that will receive the calculated
+/// \param[in,out] facebook_uuid A vector that will receive the calculated
 ///facebook .text hash.
 ///
 void HashElfTextSection(ModuleSP module_sp, std::vector 
&breakpad_uuid,



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


[Lldb-commits] [lldb] 10d02fb - [lldb][NFC] Fix -Wdocumentation issue in ModuleSpec.h/ThreadTrace.h

2021-03-29 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-03-29T19:47:29+02:00
New Revision: 10d02fb15b2d03d7f7b5c372946f5cb0e74cb220

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

LOG: [lldb][NFC] Fix -Wdocumentation issue in ModuleSpec.h/ThreadTrace.h

Added: 


Modified: 
lldb/include/lldb/Core/ModuleSpec.h
lldb/include/lldb/Target/ThreadTrace.h

Removed: 




diff  --git a/lldb/include/lldb/Core/ModuleSpec.h 
b/lldb/include/lldb/Core/ModuleSpec.h
index 9dd398a05291..d159eaf6ff48 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -30,9 +30,9 @@ class ModuleSpec {
 m_object_name(), m_object_offset(0), m_object_size(0),
 m_source_mappings() {}
 
-  /// If the \param data argument is passed, its contents will be used
+  /// If the \c data argument is passed, its contents will be used
   /// as the module contents instead of trying to read them from
-  /// \param file_spec.
+  /// \c file_spec .
   ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID(),
  lldb::DataBufferSP data = lldb::DataBufferSP())
   : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),

diff  --git a/lldb/include/lldb/Target/ThreadTrace.h 
b/lldb/include/lldb/Target/ThreadTrace.h
index a32b33867c26..fee09a742a4e 100644
--- a/lldb/include/lldb/Target/ThreadTrace.h
+++ b/lldb/include/lldb/Target/ThreadTrace.h
@@ -28,7 +28,7 @@ class ThreadTrace : public Thread {
   /// \param[in] tid
   /// The tid of this thread.
   ///
-  /// \param[in] trace_file.
+  /// \param[in] trace_file
   /// The file that contains the list of instructions that were traced when
   /// this thread was being executed.
   ThreadTrace(Process &process, lldb::tid_t tid, const FileSpec &trace_file)



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


[Lldb-commits] [PATCH] D99491: [LLDB] Fix cleanup error in TestVSCode_disconnect.test_launch

2021-03-29 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.

Thanks for looking into this!


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

https://reviews.llvm.org/D99491

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


[Lldb-commits] [PATCH] D99497: [LLDB] Fix sync issue in TestVSCode_launch.test_progress_events

2021-03-29 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.

lgtm!


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

https://reviews.llvm.org/D99497

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


[Lldb-commits] [PATCH] D99497: [LLDB] Fix sync issue in TestVSCode_launch.test_progress_events

2021-03-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Isn't there a better way to ensure synchronization here? Maybe, executing some 
command (setting a breakpoint, for instance), that will ensure that all symbols 
have been parsed?


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

https://reviews.llvm.org/D99497

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


[Lldb-commits] [PATCH] D99497: [LLDB] Fix sync issue in TestVSCode_launch.test_progress_events

2021-03-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D99497#2656502 , @labath wrote:

> Isn't there a better way to ensure synchronization here? Maybe, executing 
> some command (setting a breakpoint, for instance), that will ensure that all 
> symbols have been parsed?

That is what I attempted do in the test: set a breakpoint at 'main' which 
should trigger all of the needed events. Then we run to a breakpoint and hit 
it. and after we hit this breakpoint, then we check the progress events.

One thing we could do to figure things out would be to dump the vscode.txt file 
for this test into the failing test. This would allow us to see what the 
packets looked like when a test fails. Is there a cleanup function or something 
we can do in the VS code tests that allows a test case to know it has an error 
and add some stuff to the test suite output??


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

https://reviews.llvm.org/D99497

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


[Lldb-commits] [PATCH] D99535: [lldb] Print stack trace when lldb-vscode crashes

2021-03-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: teemperor, clayborg, wallace.
JDevlieghere requested review of this revision.

Print LLVM's pretty stack trace when lldb-vscode crashes. Also removes the 
unnecessary call to `PrintStackTraceOnErrorSignal` in `lldb-server` as it's 
already part of `InitLLVM`.


https://reviews.llvm.org/D99535

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


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 047cbfe - [lldb] Print stack trace when lldb-vscode crashes

2021-03-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-29T14:20:59-07:00
New Revision: 047cbfe2bbf22a9da1bd27cafcee4eb1453965dc

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

LOG: [lldb] Print stack trace when lldb-vscode crashes

Print LLVM's pretty stack trace when lldb-vscode crashes. Also removes
the unnecessary call to PrintStackTraceOnErrorSignal in lldb-server as
it's already part of InitLLVM.

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

Added: 


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

Removed: 




diff  --git a/lldb/tools/lldb-server/lldb-server.cpp 
b/lldb/tools/lldb-server/lldb-server.cpp
index 749a381ebca0..acf6780524e2 100644
--- a/lldb/tools/lldb-server/lldb-server.cpp
+++ b/lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@ static void terminate_debugger() { 
g_debugger_lifetime->Terminate(); }
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 243461780cfd..9a6a0f5b69f0 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@ void LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg,
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();



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


[Lldb-commits] [PATCH] D99535: [lldb] Print stack trace when lldb-vscode crashes

2021-03-29 Thread Jonas Devlieghere 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 rG047cbfe2bbf2: [lldb] Print stack trace when lldb-vscode 
crashes (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99535

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


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,7 +49,9 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -3078,6 +3080,9 @@
 }
 
 int main(int argc, char *argv[]) {
+  llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::PrettyStackTraceProgram X(argc, argv);
+
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
   g_vsc.debug_adaptor_path = program_path.str().str();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -50,8 +50,6 @@
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::StringRef ToolName = argv[0];
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   int option_error = 0;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D91679: [trace][intel-pt] Implement trace start and trace stop

2021-03-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/docs/lldb-gdb-remote.txt:246-251
+//   {
+// "name": ,
+// Tracing technology name, e.g. intel-pt, arm-coresight.
+// "description": ,
+// Description for this technology.
+//   }

Do we want to return a list of types here in case we have more than one option?



Comment at: lldb/docs/lldb-gdb-remote.txt:278-279
+// THREAD TRACING
+//  This traces specific threads. This is a best effort request, which tries to
+//  trace as many threads as possible.
+//

Is this comment out of date now? If we are doing thread tracing they should be 
just specific threads not right? Not "This is a best effort request, which 
tries to trace as many threads as possible".



Comment at: lldb/docs/lldb-gdb-remote.txt:311
+// Trace buffer size per thread in bytes.
+// It's rounded down to the closest non-zero multiple of 4KB (a page),
+// with a minimum of 4KB.

Should we be rounding down or up? If someone specifies "1" for 
"threadBufferSize" it would round down to zero. Or maybe we specific this 
should be a multiple of 4K or we will fail?



Comment at: lldb/docs/lldb-gdb-remote.txt:426-433
+//  {
+//"cpuInfo": {
+//  "vendor": "intel" | "unknown",
+//  "family": ,
+//  "model": ,
+//  "stepping": ,
+//}

Should this "cpuInfo" be a process data type and sent as binary that we fetch 
with jLLDBTraceGetBinaryData? The JSON would look something like:
```
{
  "tracedThreads": [
{ "tid": 123, "data": [ { "kind": "thread-data", "size": 1024 } ] },
{ "tid": 234, "data": [ { "kind": "thread-data", "size": 1024 } ] }
  ],
  "process-data": [
{ "pid": 345, "data",  [ { "kind": "cpuInfo", "size": 16 } ] }
  ]
}
```



Comment at: lldb/include/lldb/lldb-enumerations.h:251
+  eStopReasonInstrumentation,
+  eStopReasonTracingError,
 };

We should have a processor trace specific stop reason so we should rename this 
to something like "eStopReasonProcessorTrace". We will use this for many things:
- max memory for process is being exceeded (what this is being used
- trace buffers are full and need to be emptied (for future use with fixed 
buffers that stop the process when they are full)
- anything else trace related

Then you can encode things into the the StopInfo class. See 
StopInfo::CreateStopReasonWithSignal(...) and other functions that encode 
additional data for stop reasons.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:649
+  case eStopReasonTracingError:
+return "tracing";
   case eStopReasonInstrumentation:

"process trace"?



Comment at: lldb/source/Target/Target.cpp:3060-3061
+  if (!m_trace_sp) {
+llvm::Expected trace_type =
+m_process_sp->TraceSupported();
+if (!trace_type)

This will crash if there is no process, so maybe above if statement should be:

```
if (!m_trace_sp && m_process_sp)
```



Comment at: lldb/source/Target/Thread.cpp:1689
+  case eStopReasonTracingError:
+return "tracing event";
   }

"processor trace"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91679

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


[Lldb-commits] [PATCH] D99401: Fix .debug_aranges parsing issues introduced with llvm error handling in LLDB

2021-03-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I'd love to get this in as this affects many of our clients. Does anyone else 
have an issues with this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99401

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


[Lldb-commits] [PATCH] D99401: Fix .debug_aranges parsing issues introduced with llvm error handling in LLDB

2021-03-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99401

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


[Lldb-commits] [lldb] eee3090 - Fix .debug_aranges parsing issues.

2021-03-29 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2021-03-29T15:34:36-07:00
New Revision: eee309068e6e02b6544b2c1809b3f672fa35b979

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

LOG: Fix .debug_aranges parsing issues.

When LLVM error handling was introduced to the parsing of the .debug_aranges it 
would cause major issues if any DWARFDebugArangeSet::extract() calls returned 
any errors. The code in DWARFDebugInfo::GetCompileUnitAranges() would end up 
calling DWARFDebugAranges::extract() which would return an error if _any_ 
DWARFDebugArangeSet had any errors, but it default constructed a 
DWARFDebugAranges object into DWARFDebugInfo::m_cu_aranges_up and populated it 
partially, and returned an error prior to finishing much needed functionality 
in the DWARFDebugInfo::GetCompileUnitAranges() function. Subsequent callers to 
this function would see that the DWARFDebugInfo::m_cu_aranges_up was actually 
valid and return this partially populated DWARFDebugAranges reference _and_ it 
would not be sorted or minimized.

This above bugs would cause an incomplete .debug_aranges parsing, it would skip 
manually parsing any compile units for ranges, and would not sort the 
DWARFDebugAranges in m_cu_aranges_up.

This bug would also cause breakpoints set by file and line to fail to set 
correctly if a symbol context for an address could not be resolved properly, 
which the incomplete and unsorted DWARFDebugAranges object that 
DWARFDebugInfo::GetCompileUnitAranges() returned would cause symbol context 
lookups resolved by address (breakpoint address) to fail to find any DWARF 
debug info for a given address.

This patch fixes all of the issues that I found:
- DWARFDebugInfo::GetCompileUnitAranges() no longer returns a 
"llvm::Expected", but just returns a "const 
DWARFDebugAranges &". Why? Because this code contained a fallback that would 
parse all of the valid DWARFDebugArangeSet objects, and would check which 
compile units had valid .debug_aranges set entries, and manually build an 
address ranges table using DWARFUnit::BuildAddressRangeTable(). If we return an 
error because any DWARFDebugArangeSet has any errors, then we don't do any of 
this code. Now we parse all DWARFDebugArangeSet objects that have no errors, if 
any calls to DWARFDebugArangeSet::extract() return errors, we skip that 
DWARFDebugArangeSet so that we can use the fallback call to 
DWARFUnit::BuildAddressRangeTable(). Since 
DWARFDebugInfo::GetCompileUnitAranges() needs to parse what it can from the 
.debug_aranges and build address ranges tables for any compile units that don't 
have any .debug_aranges sets, everything now works as expected.
- Fix an issue where a DWARFDebugArangeSet contains multiple terminator 
entries. The LLVM parser and llvm-dwarfdump properly warn about this because it 
happens with linux compilers and linkers and was the original cause of the bug 
I am fixing here. We now correctly warn about this issue if "log enable dwarf 
info" is enabled, but we continue to parse the DWARFDebugArangeSet correctly so 
we don't lose data that is contained in the .debug_aranges section.
- DWARFDebugAranges::extract() no longer returns a llvm::Error because we need 
to be able to parse all of the valid DWARFDebugArangeSet objects. It also will 
correctly skip a DWARFDebugArangeSet object that has errors in the middle of 
the stream by setting the start offsets of each DWARFDebugArangeSet to be 
calculated by the previous DWARFDebugArangeSet::extract() calculated offset 
that uses the header which contains the length of the DWARFDebugArangeSet. This 
means if do we run into real errors while parsing individual 
DWARFDebugArangeSet objects, we can continue to parse the rest of the validly 
encoded DWARFDebugArangeSet objects in the .debug_aranges section. This will 
allow LLDB to parse DWARF that contains a possibly newer .debug_aranges set 
format than LLDB currently supports because we will error out for the parsing 
of the DWARFDebugArangeSet, but be able to skip to the next DWARFDebugArangeSet 
object using the "DWARFDebugArangeSet.m_header.length" field to calculate the 
next starting offset.

Tests were added to cover all new functionality.

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Removed: 




diff  --git a

[Lldb-commits] [PATCH] D99401: Fix .debug_aranges parsing issues introduced with llvm error handling in LLDB

2021-03-29 Thread Greg Clayton 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 rGeee309068e6e: Fix .debug_aranges parsing issues. (authored 
by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99401

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Index: lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
===
--- lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -347,12 +347,101 @@
   EXPECT_EQ(off, 12U); // Parser should read no further than the segment size
 }
 
+TEST_F(SymbolFileDWARFTests, ParseArangesWithMultipleTerminators) {
+  // This .debug_aranges set has multiple terminator entries which appear in
+  // binaries produced by popular linux compilers and linker combinations. We
+  // must be able to parse all the way through the data for each
+  // DWARFDebugArangeSet. Previously the DWARFDebugArangeSet::extract()
+  // function would stop parsing as soon as we ran into a terminator even
+  // though the length field stated that there was more data that follows. This
+  // would cause the next DWARFDebugArangeSet to be parsed immediately
+  // following the first terminator and it would attempt to decode the
+  // DWARFDebugArangeSet header using the remaining segment + address pairs
+  // from the remaining bytes.
+  unsigned char binary_data[] = {
+  0, 0, 0, 0, // unit_length that will be set correctly after this
+  0, 2,   // DWARF version number (uint16_t)
+  0, 0, 0, 0, // CU offset (ignored for the purposes of this test)
+  4,  // address size
+  0,  // segment size
+  0, 0, 0, 0, // alignment for the first tuple
+  // BEGIN TUPLES
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // premature terminator
+  0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, // [0x1000-0x1100)
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // premature terminator
+  0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, // [0x2000-0x2010)
+  // END TUPLES
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // terminator
+  };
+  // Set the big endian length correctly.
+  const offset_t binary_data_size = sizeof(binary_data);
+  binary_data[3] = (uint8_t)binary_data_size - 4;
+  DWARFDataExtractor data;
+  data.SetData(static_cast(binary_data), sizeof binary_data,
+   lldb::ByteOrder::eByteOrderBig);
+  DWARFDebugArangeSet set;
+  offset_t off = 0;
+  llvm::Error error = set.extract(data, &off);
+  // Multiple terminators are not fatal as they do appear in binaries.
+  EXPECT_FALSE(bool(error));
+  // Parser should read all terminators to the end of the length specified.
+  EXPECT_EQ(off, binary_data_size);
+  ASSERT_EQ(set.NumDescriptors(), 2U);
+  ASSERT_EQ(set.GetDescriptorRef(0).address, (dw_addr_t)0x1000);
+  ASSERT_EQ(set.GetDescriptorRef(0).length, (dw_addr_t)0x100);
+  ASSERT_EQ(set.GetDescriptorRef(1).address, (dw_addr_t)0x2000);
+  ASSERT_EQ(set.GetDescriptorRef(1).length, (dw_addr_t)0x10);
+}
+
+TEST_F(SymbolFileDWARFTests, ParseArangesIgnoreEmpty) {
+  // This .debug_aranges set has some address ranges which have zero length
+  // and we ensure that these are ignored by our DWARFDebugArangeSet parser
+  // and not included in the descriptors that are returned.
+  unsigned char binary_data[] = {
+  0, 0, 0, 0, // unit_length that will be set correctly after this
+  0, 2,   // DWARF version number (uint16_t)
+  0, 0, 0, 0, // CU offset (ignored for the purposes of this test)
+  4,  // address size
+  0,  // segment size
+  0, 0, 0, 0, // alignment for the first tuple
+  // BEGIN TUPLES
+  0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, // [0x1000-0x1100)
+  0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, // [0x1100-0x1100)
+  0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, // [0x2000-0x2010)
+  0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // [0x2010-0x2010)
+  // END TUPLES
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // terminator
+  };
+  // Set the big endian length correctly.
+  const offset_t binary_data_size = sizeof(binary_data);
+  binary_data[3] = (uint8_t)binary_data_size - 4;
+  DWARFDataExtractor data;
+  data.SetData(static_cast(binary_data), sizeof binary_data,
+   lldb::ByteOrder::eByteOrderBig

[Lldb-commits] [lldb] 984e2f4 - [lldb] Prints error using WithColor::error in lldb-platform

2021-03-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-29T15:45:33-07:00
New Revision: 984e2f440aa4c9c3603840e4f8f09073a54e4849

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

LOG: [lldb] Prints error using WithColor::error in lldb-platform

Added: 


Modified: 
lldb/tools/lldb-server/lldb-platform.cpp

Removed: 




diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index a5d4ecfa3f29..131387c662eb 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -22,6 +22,7 @@
 
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "Acceptor.h"
@@ -202,14 +203,15 @@ int main_platform(int argc, char *argv[]) {
 
 case 'p': {
   if (!llvm::to_integer(optarg, port_offset)) {
-llvm::errs() << "error: invalid port offset string " << optarg << "\n";
+WithColor::error() << "invalid port offset string " << optarg << "\n";
 option_error = 4;
 break;
   }
   if (port_offset < LOW_PORT || port_offset > HIGH_PORT) {
-llvm::errs() << llvm::formatv("error: port offset {0} is not in the "
-  "valid user port range of {1} - {2}\n",
-  port_offset, LOW_PORT, HIGH_PORT);
+WithColor::error() << llvm::formatv(
+"port offset {0} is not in the "
+"valid user port range of {1} - {2}\n",
+port_offset, LOW_PORT, HIGH_PORT);
 option_error = 5;
   }
 } break;
@@ -219,14 +221,15 @@ int main_platform(int argc, char *argv[]) {
 case 'M': {
   uint16_t portnum;
   if (!llvm::to_integer(optarg, portnum)) {
-llvm::errs() << "error: invalid port number string " << optarg << "\n";
+WithColor::error() << "invalid port number string " << optarg << "\n";
 option_error = 2;
 break;
   }
   if (portnum < LOW_PORT || portnum > HIGH_PORT) {
-llvm::errs() << llvm::formatv("error: port number {0} is not in the "
-  "valid user port range of {1} - {2}\n",
-  portnum, LOW_PORT, HIGH_PORT);
+WithColor::error() << llvm::formatv(
+"port number {0} is not in the "
+"valid user port range of {1} - {2}\n",
+portnum, LOW_PORT, HIGH_PORT);
 option_error = 1;
 break;
   }
@@ -253,9 +256,10 @@ int main_platform(int argc, char *argv[]) {
 gdbserver_portmap = GDBRemoteCommunicationServerPlatform::PortMap(
 min_gdbserver_port, max_gdbserver_port);
   } else if (min_gdbserver_port || max_gdbserver_port) {
-fprintf(stderr, "error: --min-gdbserver-port (%u) is not lower than "
-"--max-gdbserver-port (%u)\n",
-min_gdbserver_port, max_gdbserver_port);
+WithColor::error() << llvm::formatv(
+"--min-gdbserver-port ({0}) is not lower than "
+"--max-gdbserver-port ({1})\n",
+min_gdbserver_port, max_gdbserver_port);
 option_error = 3;
   }
 
@@ -317,7 +321,7 @@ int main_platform(int argc, char *argv[]) {
 Connection *conn = nullptr;
 error = acceptor_up->Accept(children_inherit_accept_socket, conn);
 if (error.Fail()) {
-  printf("error: %s\n", error.AsCString());
+  WithColor::error() << error.AsCString() << '\n';
   exit(socket_error);
 }
 printf("Connection established.\n");
@@ -372,10 +376,10 @@ int main_platform(int argc, char *argv[]) {
 }
 
 if (error.Fail()) {
-  fprintf(stderr, "error: %s\n", error.AsCString());
+  WithColor::error() << error.AsCString() << '\n';
 }
   } else {
-fprintf(stderr, "error: handshake with client failed\n");
+WithColor::error() << "handshake with client failed\n";
   }
 }
   } while (g_server);



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


[Lldb-commits] [PATCH] D99401: Fix .debug_aranges parsing issues introduced with llvm error handling in LLDB

2021-03-29 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:96
   const uint32_t header_size = *offset_ptr - m_offset;
   const uint32_t tuple_size = m_header.addr_size << 1;
   uint32_t first_tuple_offset = 0;

Unrelated, but I think `2 * m_header.addr_size` is more readable considering 
compiler would optimize it into bit shifting anyway.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:98-99
   uint32_t first_tuple_offset = 0;
   while (first_tuple_offset < header_size)
 first_tuple_offset += tuple_size;
 

Unrelated to this diff, but I find this simple round up can be shorten to:
```
first_tuple_offset = ((header_size + tuple_size - 1) / tuple_size) * tuple_size;
```



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:134-135
+  // Some linkers will zero out the length field for some .debug_aranges
+  // entries if they were stripped. We also could watch out for multiple
+  // entries at address zero and remove those as well.
+  if (arangeDescriptor.length > 0)

Maybe add a TODO for "We also could watch out for multiple entries at address 
zero and remove those as well" since we did not do it here?



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h:61
+  dw_offset_t m_offset;
+  dw_offset_t m_next_offset;
   Header m_header;

Do you mind add comment to explain this field? It is not very clear that it 
points to the section offset after this .debug_aranges set. Also, maybe it is 
more meaningful rename it to `m_set_end_offset`? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99401

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


[Lldb-commits] [PATCH] D99401: Fix .debug_aranges parsing issues introduced with llvm error handling in LLDB

2021-03-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:96
   const uint32_t header_size = *offset_ptr - m_offset;
   const uint32_t tuple_size = m_header.addr_size << 1;
   uint32_t first_tuple_offset = 0;

yinghuitan wrote:
> Unrelated, but I think `2 * m_header.addr_size` is more readable considering 
> compiler would optimize it into bit shifting anyway.
I agree and these kinds of NFC fixes can easily be checked in without review if 
you want to commit them. 



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:99
   while (first_tuple_offset < header_size)
 first_tuple_offset += tuple_size;
 

True, and an NFC commit can be made if you want to take that on.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:135
+  // entries if they were stripped. We also could watch out for multiple
+  // entries at address zero and remove those as well.
+  if (arangeDescriptor.length > 0)

The problem is that we might have a .o file that does have a valid function at 
address zero. Since these descriptors are not sorted it would be inefficient to 
check for multiple entries with address zero. The problem is that linkers 
really shouldn't be picking address zero as the tombstone value for "I didn't 
have a location for this address". An address of UINT64_MAX (-1) would be 
better and would be easier to see if this is incorrect. The way that GSYM does 
this is it figures out what the valid section ranges are for executable 
sections and only accepts address ranges that are in those valid executable 
ranges. We have some patches to the DWARF parser that tried to go this from 
Antonio I believe, but I am not sure they ever got resolved and checked in. It 
is quite a problem though, but should be solved in a separate patch.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h:61
+  dw_offset_t m_offset;
+  dw_offset_t m_next_offset;
   Header m_header;

yinghuitan wrote:
> Do you mind add comment to explain this field? It is not very clear that it 
> points to the section offset after this .debug_aranges set. Also, maybe it is 
> more meaningful rename it to `m_set_end_offset`? 
It is the offset of the next DWARFDebugArangeSet. I can add a comment in a 
follow up patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99401

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


[Lldb-commits] [lldb] 1b96e13 - [lldb/DWARF] Simplify DIE extraction code slightly

2021-03-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-03-30T08:44:17+02:00
New Revision: 1b96e133cf5215cb9ebfe7f14630f479c1611f22

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

LOG: [lldb/DWARF] Simplify DIE extraction code slightly

Remove the "depth" variable, as the same information can be obtained
through die_index_stack.size().

Also add a test case for a one tricky case I noticed -- a unit
containing only a null unit die.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 86b18615da7d..e501bb9af7fb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -153,17 +153,15 @@ void DWARFUnit::ExtractDIEsRWLocked() {
 
   DWARFDebugInfoEntry die;
 
-  uint32_t depth = 0;
   // We are in our compile unit, parse starting at the offset we were told to
   // parse
   const DWARFDataExtractor &data = GetData();
   std::vector die_index_stack;
   die_index_stack.reserve(32);
-  die_index_stack.push_back(0);
   bool prev_die_had_children = false;
   while (offset < next_cu_offset && die.Extract(data, this, &offset)) {
 const bool null_die = die.IsNULL();
-if (depth == 0) {
+if (die_index_stack.size() == 0) {
   assert(m_die_array.empty() && "Compile unit DIE already added");
 
   // The average bytes per DIE entry has been seen to be around 14-20 so
@@ -201,11 +199,12 @@ void DWARFUnit::ExtractDIEsRWLocked() {
 m_die_array.back().SetHasChildren(false);
 }
   } else {
-die.SetParentIndex(m_die_array.size() - die_index_stack[depth - 1]);
+die.SetParentIndex(m_die_array.size() - die_index_stack.rbegin()[1]);
 
 if (die_index_stack.back())
   m_die_array[die_index_stack.back()].SetSiblingIndex(
   m_die_array.size() - die_index_stack.back());
+die_index_stack.back() = m_die_array.size();
 
 // Only push the DIE if it isn't a NULL DIE
 m_die_array.push_back(die);
@@ -214,24 +213,19 @@ void DWARFUnit::ExtractDIEsRWLocked() {
 
 if (null_die) {
   // NULL DIE.
-  if (!die_index_stack.empty())
+  if (!die_index_stack.empty()) {
 die_index_stack.pop_back();
-
-  if (depth > 0)
---depth;
-  prev_die_had_children = false;
+prev_die_had_children = false;
+  }
 } else {
-  die_index_stack.back() = m_die_array.size() - 1;
   // Normal DIE
   const bool die_has_children = die.HasChildren();
-  if (die_has_children) {
+  if (die_has_children)
 die_index_stack.push_back(0);
-++depth;
-  }
   prev_die_had_children = die_has_children;
 }
 
-if (depth == 0)
+if (die_index_stack.size() == 0)
   break; // We are done with this compile unit!
   }
 



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


[Lldb-commits] [lldb] 5978912 - [lldb] Add a dwarf unit test for null unit dies

2021-03-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-03-30T08:46:36+02:00
New Revision: 5978912da00acc610e4e1379bde815b28252944c

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

LOG: [lldb] Add a dwarf unit test for null unit dies

This is the test I mentioned in the previous commit (1b96e133), but
forgot to add.

Added: 
lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp

Modified: 
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt

Removed: 




diff  --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index 30620a61dc5f..982ac935794f 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_lldb_unittest(SymbolFileDWARFTests
   DWARFASTParserClangTests.cpp
+  DWARFUnitTest.cpp
   SymbolFileDWARFTests.cpp
   XcodeSDKModuleTests.cpp
 

diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp
new file mode 100644
index ..3a4b1cfd8ba7
--- /dev/null
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp
@@ -0,0 +1,49 @@
+//===-- DWARFUnitTest.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/SymbolFile/DWARF/DWARFUnit.h"
+#include "TestingSupport/Symbol/YAMLModuleTester.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+TEST(DWARFUnitTest, NullUnitDie) {
+  // Make sure we don't crash parsing a null unit DIE.
+  const char *yamldata = R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_386
+DWARF:
+  debug_abbrev:
+- Table:
+- Code:0x0001
+  Tag: DW_TAG_compile_unit
+  Children:DW_CHILDREN_yes
+  Attributes:
+- Attribute:   DW_AT_language
+  Form:DW_FORM_data2
+  debug_info:
+- Version: 4
+  AddrSize:8
+  Entries:
+- AbbrCode:0x
+)";
+
+  YAMLModuleTester t(yamldata);
+  ASSERT_TRUE((bool)t.GetDwarfUnit());
+
+  DWARFUnit *unit = t.GetDwarfUnit();
+  const DWARFDebugInfoEntry *die_first = unit->DIE().GetDIE();
+  ASSERT_NE(die_first, nullptr);
+  EXPECT_TRUE(die_first->IsNULL());
+}



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


[Lldb-commits] [lldb] ea08d4b - [lldb] Remove ScriptInterpreterLuaTest.Plugin unittest

2021-03-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-03-30T08:48:56+02:00
New Revision: ea08d4ba37362506ebd30957a9473467df6f00b9

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

LOG: [lldb] Remove ScriptInterpreterLuaTest.Plugin unittest

This test is not useful as the functions it's testing are just returning
a constant. It also fails in unoptimized builds as it's comparing
character strings by address.

Added: 


Modified: 
lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp

Removed: 




diff  --git a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp 
b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
index 3b7fbebdd98d..e4aebfb650c0 100644
--- a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
@@ -43,12 +43,6 @@ class ScriptInterpreterTest : public ::testing::Test {
 };
 } // namespace
 
-TEST_F(ScriptInterpreterTest, Plugin) {
-  EXPECT_EQ(ScriptInterpreterLua::GetPluginNameStatic(), "script-lua");
-  EXPECT_EQ(ScriptInterpreterLua::GetPluginDescriptionStatic(),
-"Lua script interpreter");
-}
-
 TEST_F(ScriptInterpreterTest, ExecuteOneLine) {
   DebuggerSP debugger_sp = Debugger::CreateInstance();
   ASSERT_TRUE(debugger_sp);



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