[Lldb-commits] [lldb] 4025a8a - [NFC][trace][intel pt] add simple documentation line

2022-08-15 Thread Walter Erquinigo via lldb-commits

Author: Walter Erquinigo
Date: 2022-08-15T00:56:12-07:00
New Revision: 4025a8ae934f77ec21558c40aa82937bfe74a7c3

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

LOG: [NFC][trace][intel pt] add simple documentation line

Added: 


Modified: 
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp 
b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
index 8d621c1438307..9526ad84ab328 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
@@ -295,7 +295,9 @@ class PSBBlockDecoder {
 break;
   case ptev_overflow:
 // The CPU internal buffer had an overflow error and some instructions
-// were lost.
+// were lost. A OVF packet comes with an FUP packet (harcoded address)
+// according to the documentation, so we'll continue seeing 
instructions
+// after this event.
 m_decoded_thread.AppendError(IntelPTError(-pte_overflow));
 break;
   default:



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


[Lldb-commits] [lldb] 193259c - [LLDB] Remove __future__ imports from tests

2022-08-15 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2022-08-15T08:54:06Z
New Revision: 193259cbcec77add8e189c4dedeefb15fef50d5e

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

LOG: [LLDB] Remove __future__ imports from tests

Not needed now that we require python 3.

Reviewed By: kastiglione, JDevlieghere

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

Added: 


Modified: 
lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py
lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
lldb/test/API/api/multiple-targets/TestMultipleTargets.py
lldb/test/API/api/multithreaded/TestMultithreaded.py
lldb/test/API/arm/emulation/TestEmulations.py
lldb/test/API/benchmarks/continue/TestBenchmarkContinue.py
lldb/test/API/benchmarks/expression/TestExpressionCmd.py
lldb/test/API/benchmarks/expression/TestRepeatedExprs.py
lldb/test/API/benchmarks/frame_variable/TestFrameVariableResponse.py
lldb/test/API/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
lldb/test/API/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
lldb/test/API/benchmarks/startup/TestStartupDelays.py
lldb/test/API/benchmarks/stepping/TestSteppingSpeed.py
lldb/test/API/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
lldb/test/API/commands/command/container/welcome.py
lldb/test/API/commands/command/script/decorated.py
lldb/test/API/commands/command/script/import/bar/bar.py
lldb/test/API/commands/command/script/import/foo/bar/foobar.py
lldb/test/API/commands/command/script/import/foo/foo.py
lldb/test/API/commands/command/script/import/foo/foo2.py
lldb/test/API/commands/command/script/import/thepackage/__init__.py
lldb/test/API/commands/command/script/mysto.py
lldb/test/API/commands/command/script/welcome.py
lldb/test/API/commands/command/script_alias/tcsacmd.py
lldb/test/API/commands/command/source/my.py
lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
lldb/test/API/commands/process/launch/TestProcessLaunch.py
lldb/test/API/commands/register/register/register_command/TestRegisters.py

lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py

lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
lldb/test/API/functionalities/breakpoint/breakpoint_command/bktptcmd.py

lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
lldb/test/API/functionalities/breakpoint/move_nearest/TestMoveNearest.py
lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py

lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSNumber.py

lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py

lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
lldb/test/API/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py

lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
lldb/test/API/functionalities/exec/TestExec.py
lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
lldb/test/API/functionalities/gdb_remote_client/TestFork.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBServerNoTargetXML.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py

lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py

lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
lldb/test/API/functionalities/inferior-assert/TestInferiorAssert.py
lldb/test/API/functionalities/load_unload/TestLoadUnload.py

lldb/test/API/functionalities/multidebugg

[Lldb-commits] [PATCH] D131761: [LLDB] Remove __future__ imports from tests

2022-08-15 Thread David Spickett via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG193259cbcec7: [LLDB] Remove __future__ imports from tests 
(authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131761

Files:
  lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py
  lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
  lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
  lldb/test/API/api/multiple-targets/TestMultipleTargets.py
  lldb/test/API/api/multithreaded/TestMultithreaded.py
  lldb/test/API/arm/emulation/TestEmulations.py
  lldb/test/API/benchmarks/continue/TestBenchmarkContinue.py
  lldb/test/API/benchmarks/expression/TestExpressionCmd.py
  lldb/test/API/benchmarks/expression/TestRepeatedExprs.py
  lldb/test/API/benchmarks/frame_variable/TestFrameVariableResponse.py
  lldb/test/API/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
  lldb/test/API/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
  lldb/test/API/benchmarks/startup/TestStartupDelays.py
  lldb/test/API/benchmarks/stepping/TestSteppingSpeed.py
  lldb/test/API/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
  lldb/test/API/commands/command/container/welcome.py
  lldb/test/API/commands/command/script/decorated.py
  lldb/test/API/commands/command/script/import/bar/bar.py
  lldb/test/API/commands/command/script/import/foo/bar/foobar.py
  lldb/test/API/commands/command/script/import/foo/foo.py
  lldb/test/API/commands/command/script/import/foo/foo2.py
  lldb/test/API/commands/command/script/import/thepackage/__init__.py
  lldb/test/API/commands/command/script/mysto.py
  lldb/test/API/commands/command/script/welcome.py
  lldb/test/API/commands/command/script_alias/tcsacmd.py
  lldb/test/API/commands/command/source/my.py
  lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
  lldb/test/API/commands/process/launch/TestProcessLaunch.py
  lldb/test/API/commands/register/register/register_command/TestRegisters.py
  
lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
  lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
  
lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
  lldb/test/API/functionalities/breakpoint/breakpoint_command/bktptcmd.py
  
lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
  lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
  lldb/test/API/functionalities/breakpoint/move_nearest/TestMoveNearest.py
  lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSNumber.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
  lldb/test/API/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py
  
lldb/test/API/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
  lldb/test/API/functionalities/exec/TestExec.py
  lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
  lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
  lldb/test/API/functionalities/gdb_remote_client/TestFork.py
  lldb/test/API/functionalities/gdb_remote_client/TestGDBServerNoTargetXML.py
  lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py
  
lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
  lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
  lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
  lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py
  lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
  lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
  lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
  lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
  lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
  lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
  lldb/test/API/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/test/API/functionalities/load_unload/TestLoadUnload.py
  
lldb/test/API/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py
  lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
  
lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
  lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb/te

[Lldb-commits] [PATCH] D131335: WIP: [lldb] abi_tag support 3/3 - Use mangle tree API to determine approximate mangled matches

2022-08-15 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

As @labath mentioned, we do force clang to preserve the linkage name via 
`asm()`, but only for class member functions. This was added in 
`675767a5910d2ec77ef8b51c78fe312cf9022896` (https://reviews.llvm.org/D40283) to 
also support `abi_tag`! But that didn't cover templates functions:

  Use the DWARF linkage name when importing C++ methods.
  When importing C++ methods into clang AST nodes from the DWARF symbol
  table, preserve the DW_AT_linkage_name and use it as the linker
  ("asm") name for the symbol.
  
  Concretely, this enables `expression` to call into names that use the
  GNU `abi_tag` extension

I tried adding an `AsmLabelAttr` to the `FunctionDecl`s we create when parsing 
DWARF and it does fix the ABI-tag problem on my small test case. But this only 
works because the way we create `FunctionTemplateDecl`s is incorrect (as I've 
described in my previous comments).

So the options are any combination of the following:

1. carry this patch forward (and possibly remove the `asm()` hack for C++ 
member functions)
2. Add the `asm()` attribute hack to all function declarations
3. Fix the way we generate `FunctionTemplateDecl`s when parsing DWARF (this 
likely needs a change to DWARF generation)

@aprantl @labath Any preference? I think a 1 and 3 are the more "proper" way to 
fix this issue


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131335

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


[Lldb-commits] [lldb] 9f947ab - [LLDB] Remove __future__ imports from examples

2022-08-15 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2022-08-15T09:04:25Z
New Revision: 9f947abf94e16fa7c759ab56a4fb030d6ef25961

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

LOG: [LLDB] Remove __future__ imports from examples

Not needed now that we require python 3.

Reviewed By: kastiglione, JDevlieghere

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

Added: 


Modified: 
lldb/examples/customization/bin-utils/binutils.py
lldb/examples/customization/import-python/importcmd.py
lldb/examples/customization/pwd-cd-and-system/utils.py
lldb/examples/darwin/heap_find/heap.py
lldb/examples/python/bsd.py
lldb/examples/python/cmdtemplate.py
lldb/examples/python/delta.py
lldb/examples/python/diagnose_nsstring.py
lldb/examples/python/diagnose_unwind.py
lldb/examples/python/gdbremote.py
lldb/examples/python/globals.py
lldb/examples/python/jump.py
lldb/examples/python/lldb_module_utils.py
lldb/examples/python/lldbtk.py
lldb/examples/python/mach_o.py
lldb/examples/python/memory.py
lldb/examples/python/performance.py
lldb/examples/python/process_events.py
lldb/examples/python/pytracer.py
lldb/examples/python/scripted_step.py
lldb/examples/python/shadow.py
lldb/examples/python/sources.py
lldb/examples/python/stacks.py
lldb/examples/python/symbolication.py
lldb/examples/python/types.py
lldb/examples/scripting/tree_utils.py
lldb/examples/summaries/cocoa/CFBitVector.py
lldb/examples/summaries/cocoa/Logger.py
lldb/examples/summaries/cocoa/NSNumber.py
lldb/examples/synthetic/gnu_libstdcpp.py

Removed: 




diff  --git a/lldb/examples/customization/bin-utils/binutils.py 
b/lldb/examples/customization/bin-utils/binutils.py
index f1aa48fa26db1..4237ab6525005 100644
--- a/lldb/examples/customization/bin-utils/binutils.py
+++ b/lldb/examples/customization/bin-utils/binutils.py
@@ -1,7 +1,5 @@
 "Collection of tools for displaying bit representation of numbers."""
 
-from __future__ import print_function
-
 def binary(n, width=None):
 """
 Return a list of (0|1)'s for the binary representation of n where n >= 0.

diff  --git a/lldb/examples/customization/import-python/importcmd.py 
b/lldb/examples/customization/import-python/importcmd.py
index cf7ac979966da..e355a09c7a3f9 100644
--- a/lldb/examples/customization/import-python/importcmd.py
+++ b/lldb/examples/customization/import-python/importcmd.py
@@ -1,4 +1,3 @@
-from __future__ import print_function
 import sys
 import os
 import lldb

diff  --git a/lldb/examples/customization/pwd-cd-and-system/utils.py 
b/lldb/examples/customization/pwd-cd-and-system/utils.py
index 6c3c2540f3dc6..75dcb1a0db757 100644
--- a/lldb/examples/customization/pwd-cd-and-system/utils.py
+++ b/lldb/examples/customization/pwd-cd-and-system/utils.py
@@ -1,5 +1,4 @@
 """Utility for changing directories and execution of commands in a subshell."""
-from __future__ import print_function
 
 import os
 import shlex

diff  --git a/lldb/examples/darwin/heap_find/heap.py 
b/lldb/examples/darwin/heap_find/heap.py
index b04f69008b68e..2021b9ebc8e23 100644
--- a/lldb/examples/darwin/heap_find/heap.py
+++ b/lldb/examples/darwin/heap_find/heap.py
@@ -8,7 +8,6 @@
 #   (lldb) script import lldb.macosx.heap
 #--
 
-from __future__ import print_function
 import lldb
 import optparse
 import os

diff  --git a/lldb/examples/python/bsd.py b/lldb/examples/python/bsd.py
index fdf5455fe69e3..34716a3d9003b 100755
--- a/lldb/examples/python/bsd.py
+++ b/lldb/examples/python/bsd.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-from __future__ import print_function
 
 import cmd
 import optparse

diff  --git a/lldb/examples/python/cmdtemplate.py 
b/lldb/examples/python/cmdtemplate.py
index aa99e4c03beb8..9ce930d4ef76d 100644
--- a/lldb/examples/python/cmdtemplate.py
+++ b/lldb/examples/python/cmdtemplate.py
@@ -9,8 +9,6 @@
 #   (lldb) command script import /path/to/cmdtemplate.py
 # -
 
-from __future__ import print_function
-
 import inspect
 import lldb
 import optparse

diff  --git a/lldb/examples/python/delta.py b/lldb/examples/python/delta.py
index 3f14fb1e152b9..3e8ece2141314 100755
--- a/lldb/examples/python/delta.py
+++ b/lldb/examples/python/delta.py
@@ -16,8 +16,6 @@
 # available.
 #--
 
-from __future__ import print_function
-
 import optparse
 import os
 import shlex

diff  --git a/lldb/examples/python/diagnose_nsstring.py 
b/lldb/examples/python/diagnose_nsstring.py
index 4a8eee3c2dd4e..1e91e860894f4 100644
--- a/lldb/examples/python/diagnose_nsstring.py
+++ b/lldb/examples/python/diagnos

[Lldb-commits] [PATCH] D131772: [LLDB] Remove __future__ imports from examples

2022-08-15 Thread David Spickett via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f947abf94e1: [LLDB] Remove __future__ imports from examples 
(authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131772

Files:
  lldb/examples/customization/bin-utils/binutils.py
  lldb/examples/customization/import-python/importcmd.py
  lldb/examples/customization/pwd-cd-and-system/utils.py
  lldb/examples/darwin/heap_find/heap.py
  lldb/examples/python/bsd.py
  lldb/examples/python/cmdtemplate.py
  lldb/examples/python/delta.py
  lldb/examples/python/diagnose_nsstring.py
  lldb/examples/python/diagnose_unwind.py
  lldb/examples/python/gdbremote.py
  lldb/examples/python/globals.py
  lldb/examples/python/jump.py
  lldb/examples/python/lldb_module_utils.py
  lldb/examples/python/lldbtk.py
  lldb/examples/python/mach_o.py
  lldb/examples/python/memory.py
  lldb/examples/python/performance.py
  lldb/examples/python/process_events.py
  lldb/examples/python/pytracer.py
  lldb/examples/python/scripted_step.py
  lldb/examples/python/shadow.py
  lldb/examples/python/sources.py
  lldb/examples/python/stacks.py
  lldb/examples/python/symbolication.py
  lldb/examples/python/types.py
  lldb/examples/scripting/tree_utils.py
  lldb/examples/summaries/cocoa/CFBitVector.py
  lldb/examples/summaries/cocoa/Logger.py
  lldb/examples/summaries/cocoa/NSNumber.py
  lldb/examples/synthetic/gnu_libstdcpp.py

Index: lldb/examples/synthetic/gnu_libstdcpp.py
===
--- lldb/examples/synthetic/gnu_libstdcpp.py
+++ lldb/examples/synthetic/gnu_libstdcpp.py
@@ -1,4 +1,3 @@
-from __future__ import division
 import lldb.formatters.Logger
 
 # C++ STL formatters for LLDB
Index: lldb/examples/summaries/cocoa/NSNumber.py
===
--- lldb/examples/summaries/cocoa/NSNumber.py
+++ lldb/examples/summaries/cocoa/NSNumber.py
@@ -8,8 +8,6 @@
 # example summary provider for NSNumber
 # the real summary is now C++ code built into LLDB
 
-from __future__ import print_function
-
 import lldb
 import ctypes
 import lldb.runtime.objc.objc_runtime
Index: lldb/examples/summaries/cocoa/Logger.py
===
--- lldb/examples/summaries/cocoa/Logger.py
+++ lldb/examples/summaries/cocoa/Logger.py
@@ -1,4 +1,3 @@
-from __future__ import print_function
 import sys
 import os.path
 import inspect
Index: lldb/examples/summaries/cocoa/CFBitVector.py
===
--- lldb/examples/summaries/cocoa/CFBitVector.py
+++ lldb/examples/summaries/cocoa/CFBitVector.py
@@ -5,7 +5,6 @@
 See https://llvm.org/LICENSE.txt for license information.
 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 """
-from __future__ import print_function
 
 # summary provider for CF(Mutable)BitVector
 import lldb
Index: lldb/examples/scripting/tree_utils.py
===
--- lldb/examples/scripting/tree_utils.py
+++ lldb/examples/scripting/tree_utils.py
@@ -18,8 +18,6 @@
 http://lldb.llvm.org/scripting.html
 """
 
-from __future__ import print_function
-
 
 def DFS(root, word, cur_path):
 """
Index: lldb/examples/python/types.py
===
--- lldb/examples/python/types.py
+++ lldb/examples/python/types.py
@@ -9,8 +9,6 @@
 #   (lldb) command script import /path/to/cmdtemplate.py
 #--
 
-from __future__ import print_function
-
 import platform
 import os
 import re
Index: lldb/examples/python/symbolication.py
===
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -26,7 +26,6 @@
 #   PYTHONPATH=/path/to/LLDB.framework/Resources/Python ./crashlog.py ~/Library/Logs/DiagnosticReports/a.crash
 #--
 
-from __future__ import print_function
 import lldb
 import optparse
 import os
Index: lldb/examples/python/stacks.py
===
--- lldb/examples/python/stacks.py
+++ lldb/examples/python/stacks.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-from __future__ import print_function
 import lldb
 import optparse
 import shlex
Index: lldb/examples/python/sources.py
===
--- lldb/examples/python/sources.py
+++ lldb/examples/python/sources.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-from __future__ import print_function
 
 import lldb
 import shlex
Index: lldb/examples/python/shadow.py
===
--- lldb/examples/python/shadow.py
+++ lldb/examples/python/shadow.

[Lldb-commits] [PATCH] D131783: [LLDB][JIT] Set processor for ARM architecture

2022-08-15 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett accepted this revision.
DavidSpickett added a comment.
This revision is now accepted and ready to land.

Thanks! LGTM.

You might see some test failures for TestFPEval if anyone is testing on 
AIX/PPC/etc. but I think it's fine to go ahead and wait for the buildbots to 
complain if that is the case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131783

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


[Lldb-commits] [PATCH] D131850: [LLDB][NFC] Reliability Fixes for FormatEntity

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon created this revision.
fixathon added reviewers: clayborg, JDevlieghere, DavidSpickett, jasonmolenda.
Herald added a project: All.
fixathon published this revision for review.
fixathon added inline comments.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.



Comment at: lldb/source/Core/FormatEntity.cpp:714-715
 
-  if (valobj == nullptr)
-return false;
-

This null-check is unreachable and redundant. valobj is already completely 
null-checked at lines 675 and 705. 



Comment at: lldb/source/Core/FormatEntity.cpp:1695
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =

Checking var_value_sp for null here is moot; it's already dereferenced in the 
preceding line. However, exe_scope does require a null-check here, and from the 
context, it appears that was the original intent thwarted by a typo.


- Remove dead code
- Fix incorrect null-reference check


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131850

Files:
  lldb/source/Core/FormatEntity.cpp


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -711,9 +711,6 @@
 return false;
   }
 
-  if (valobj == nullptr)
-return false;
-
   ValueObject::ExpressionPathAftermath what_next =
   (do_deref_pointer ? ValueObject::eExpressionPathAftermathDereference
 : ValueObject::eExpressionPathAftermathNothing);
@@ -1695,7 +1692,7 @@
   llvm::StringRef var_representation;
   const char *var_name = var_value_sp->GetName().GetCString();
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =
   var_value_sp->GetQualifiedRepresentationIfAvailable(
   exe_scope->CalculateTarget()


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -711,9 +711,6 @@
 return false;
   }
 
-  if (valobj == nullptr)
-return false;
-
   ValueObject::ExpressionPathAftermath what_next =
   (do_deref_pointer ? ValueObject::eExpressionPathAftermathDereference
 : ValueObject::eExpressionPathAftermathNothing);
@@ -1695,7 +1692,7 @@
   llvm::StringRef var_representation;
   const char *var_name = var_value_sp->GetName().GetCString();
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =
   var_value_sp->GetQualifiedRepresentationIfAvailable(
   exe_scope->CalculateTarget()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131821: Add test that shows the problem with D118814

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I applied your patch and ran the test and for me it's passing:

  lldb version 16.0.0git (g...@github.com:llvm/llvm-project.git revision 
0c90d5f7e967aee8ab6e5e971e25921e631a40ac)
clang revision 0c90d5f7e967aee8ab6e5e971e25921e631a40ac
llvm revision 0c90d5f7e967aee8ab6e5e971e25921e631a40ac
  Skipping the following test categories: ['libstdcxx', 'dwo', 'llgs', 'fork']
  
  --
  Command Output (stderr):
  --
  PASS: LLDB (/Users/jonas/llvm/build-ra/bin/clang-arm64) :: 
test_and_python_api_dsym (TestStepAndBreakpointsCpp.TestCppStepping)
  PASS: LLDB (/Users/jonas/llvm/build-ra/bin/clang-arm64) :: 
test_and_python_api_dwarf (TestStepAndBreakpointsCpp.TestCppStepping)
  UNSUPPORTED: LLDB (/Users/jonas/llvm/build-ra/bin/clang-arm64) :: 
test_and_python_api_dwo (TestStepAndBreakpointsCpp.TestCppStepping) (test case 
does not fall in any category of interest for this run)
  PASS: LLDB (/Users/jonas/llvm/build-ra/bin/clang-arm64) :: 
test_and_python_api_gmodules (TestStepAndBreakpointsCpp.TestCppStepping)
  --
  Ran 4 tests in 5.234s
  
  RESULT: PASSED (3 passes, 0 failures, 0 errors, 1 skipped, 0 expected 
failures, 0 unexpected successes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131821

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


[Lldb-commits] [PATCH] D131664: [LLDB][ARM] Remove unused LoadPseudoRegistersFromFrame function

2022-08-15 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

@JDevlieghere ping!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131664

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


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Commit 6d9cd9199a6fdeab0412117bcefc28f625510b61 
 added a 
dependency on llvm to debugserver.
This breaks the build. Since we don't want to add a dependency on llvm, this
patch reverts the offending commit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131901

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version,
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version,
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 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/D131901/new/

https://reviews.llvm.org/D131901

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


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve accepted this revision.
fdeazeve added a comment.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131901

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


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 452704.
Michael137 added a comment.

- Fix parameters


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131901

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(),
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(),
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon created this revision.
fixathon added reviewers: clayborg, JDevlieghere, DavidSpickett, jasonmolenda.
Herald added a project: All.
fixathon published this revision for review.
fixathon added inline comments.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:227
 
 static StructuredData::Array *ConvertToStructuredArray(
 ValueObjectSP return_value_sp, const std::string &items_name,

Function creating heap-based allocation



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:232
 &callback) {
   StructuredData::Array *array = new StructuredData::Array();
   unsigned int count =

Allocation of the leaked entity



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:264
std::map &thread_id_map) {
-  ConvertToStructuredArray(
+  std::unique_ptr cleanup(ConvertToStructuredArray(
   data, ".threads", ".thread_count",

Delete the heap-allocated resource via RAII on function exit.



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:287
 
 thread_id_map[thread_id] = lldb_user_id;
+  }));

Result is set here. Note, at this point, there's no continued dependency on the 
StructuredData::Array object returned by the call to 
ConvertToStructuredArray(), and that object does not need to persist.


ConvertToStructuredArray() relies on its caller to deallocate the 
heap-allocated object pointer it returns. One of its call-sites, in 
GetRenumberedThreadIds(), fails to deallocate causing a memory/resource leak. 
This fix aims to fix this issue via RAII-style clean up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131900

Files:
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp


Index: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
===
--- 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -261,7 +261,7 @@
 static void
 GetRenumberedThreadIds(ProcessSP process_sp, ValueObjectSP data,
std::map &thread_id_map) {
-  ConvertToStructuredArray(
+  std::unique_ptr cleanup(ConvertToStructuredArray(
   data, ".threads", ".thread_count",
   [process_sp, &thread_id_map](ValueObjectSP o,
StructuredData::Dictionary *dict) {
@@ -285,7 +285,7 @@
 }
 
 thread_id_map[thread_id] = lldb_user_id;
-  });
+  }));
 }
 
 static user_id_t Renumber(uint64_t id,


Index: lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
===
--- lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -261,7 +261,7 @@
 static void
 GetRenumberedThreadIds(ProcessSP process_sp, ValueObjectSP data,
std::map &thread_id_map) {
-  ConvertToStructuredArray(
+  std::unique_ptr cleanup(ConvertToStructuredArray(
   data, ".threads", ".thread_count",
   [process_sp, &thread_id_map](ValueObjectSP o,
StructuredData::Dictionary *dict) {
@@ -285,7 +285,7 @@
 }
 
 thread_id_map[thread_id] = lldb_user_id;
-  });
+  }));
 }
 
 static user_id_t Renumber(uint64_t id,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131795: [LLDB] Fix the 'default' switch case in GetCompatibleArchs()

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon planned changes to this revision.
fixathon added inline comments.



Comment at: 
lldb/test/API/functionalities/gdb_remote_client/TestPlatformMacOSX.py:22
 def qHostInfo(self):
-return 
"cputype:16777223;cpusubtype:2;ostype:%s;vendor:apple;os_version:10.15.4;maccatalyst_version:13.4;endian:little;ptrsize:8;"
 % self.host_ostype
+return 
"cputype:16777228;cpusubtype:2;ostype:%s;vendor:apple;os_version:10.15.4;maccatalyst_version:13.4;endian:little;ptrsize:8;"
 % self.host_ostype
 

clayborg wrote:
> I believe that Jonas stated in the other diff that this was intentional.
I will undo. This file is included here mostly for context as I moved the 
discussion into this separate new diff. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131795

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


[Lldb-commits] [lldb] ac1bedd - [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2022-08-15T17:35:39+01:00
New Revision: ac1bedd584359567266b1c41ac26734556031b9f

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

LOG: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

Commit 
[6d9cd9199a6fdeab0412117bcefc28f625510b61](https://reviews.llvm.org/rG6d9cd9199a6fdeab0412117bcefc28f625510b61)
 added a dependency on llvm to debugserver.
This breaks the build. Since we don't want to add a dependency on llvm, this
patch reverts the offending commit.

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

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index ee5d93cb94506..ebb2125524e9c 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@ rnb_err_t RNBRemote::HandlePacket_qHostInfo(const char 
*p) {
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(),
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)



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


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Michael Buch via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGac1bedd58435: [lldb][debugserver] Revert "Use 
llvm::all_of (NFC)" for debugserver (authored by Michael137).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131901

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(),
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4861,8 +4861,8 @@
 
   std::string maccatalyst_version = DNBGetMacCatalystVersionString();
   if (!maccatalyst_version.empty() &&
-  llvm::all_of(maccatalyst_version,
-   [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
+  std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(),
+  [](char c) { return (c >= '0' && c <= '9') || c == '.'; }))
 strm << "maccatalyst_version:" << maccatalyst_version << ";";
 
 #if defined(__LITTLE_ENDIAN__)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131160: [WIP][lldb] Add "event" capability to the MainLoop class

2022-08-15 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 452714.
mgorny added a comment.

Rebase on top of D131159  and partially 
implement the Linux counterpart.

Note that I have only covered `sys/event.h` for now and that I haven't tested 
the updated Windows code.


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

https://reviews.llvm.org/D131160

Files:
  lldb/include/lldb/Host/MainLoopBase.h
  lldb/include/lldb/Host/posix/MainLoopPosix.h
  lldb/include/lldb/Host/windows/MainLoopWindows.h
  lldb/source/Host/common/MainLoopBase.cpp
  lldb/source/Host/posix/MainLoopPosix.cpp
  lldb/source/Host/windows/MainLoopWindows.cpp
  lldb/unittests/Host/MainLoopTest.cpp

Index: lldb/unittests/Host/MainLoopTest.cpp
===
--- lldb/unittests/Host/MainLoopTest.cpp
+++ lldb/unittests/Host/MainLoopTest.cpp
@@ -148,6 +148,18 @@
   ASSERT_EQ(3u, callback_count);
 }
 
+TEST_F(MainLoopTest, Event) {
+  MainLoop loop;
+  bool event_called = false;
+  auto handle = loop.RegisterEvent([&](MainLoopBase &loop) {
+event_called = true;
+loop.RequestTermination();
+  });
+  handle->Notify();
+  ASSERT_THAT_ERROR(loop.Run().ToError(), llvm::Succeeded());
+  ASSERT_TRUE(event_called);
+}
+
 #ifdef LLVM_ON_UNIX
 TEST_F(MainLoopTest, DetectsEOF) {
 
Index: lldb/source/Host/windows/MainLoopWindows.cpp
===
--- lldb/source/Host/windows/MainLoopWindows.cpp
+++ lldb/source/Host/windows/MainLoopWindows.cpp
@@ -21,9 +21,19 @@
 using namespace lldb;
 using namespace lldb_private;
 
+MainLoopWindows::MainLoopWindows() {
+  m_event_event = WSACreateEvent();
+  assert(m_event_event != WSA_INVALID_EVENT);
+}
+
+MainLoopWindows::~MainLoopWindows() {
+  BOOL result = WSACloseEvent(m_event_event);
+  assert(result == TRUE);
+}
+
 llvm::Expected MainLoopWindows::Poll() {
-  std::vector read_events;
-  read_events.reserve(m_read_fds.size());
+  std::vector events;
+  events.reserve(m_read_fds.size() + 1);
   for (auto &fd : m_read_fds) {
 WSAEVENT event = WSACreateEvent();
 assert(event != WSA_INVALID_EVENT);
@@ -32,24 +42,25 @@
 WSAEventSelect(fd.first, event, FD_READ | FD_ACCEPT | FD_CLOSE);
 assert(result == 0);
 
-read_events.push_back(event);
+events.push_back(event);
   }
+  events.push_back(loop.m_event_event);
 
-  DWORD result = WSAWaitForMultipleEvents(
-  read_events.size(), read_events.data(), FALSE, WSA_INFINITE, FALSE);
+  DWORD result = WSAWaitForMultipleEvents(events.size(), events.data(), FALSE,
+  WSA_INFINITE, FALSE);
 
   for (auto &fd : m_read_fds) {
 int result = WSAEventSelect(fd.first, WSA_INVALID_EVENT, 0);
 assert(result == 0);
   }
 
-  for (auto &event : read_events) {
+  events.pop_back();
+  for (auto &event : events) {
 BOOL result = WSACloseEvent(event);
 assert(result == TRUE);
   }
 
-  if (result >= WSA_WAIT_EVENT_0 &&
-  result < WSA_WAIT_EVENT_0 + read_events.size())
+  if (result >= WSA_WAIT_EVENT_0 && result <= WSA_WAIT_EVENT_0 + events.size())
 return result - WSA_WAIT_EVENT_0;
 
   return llvm::createStringError(llvm::inconvertibleErrorCode(),
@@ -73,16 +84,29 @@
   Status error;
 
   // run until termination or until we run out of things to listen to
-  while (!m_terminate_request && !m_read_fds.empty()) {
+  while (!m_terminate_request && (!m_read_fds.empty() || !m_events.empty())) {
 
 llvm::Expected signaled_event = Poll();
 if (!signaled_event)
   return Status(signaled_event.takeError());
 
-auto &fd_info = *std::next(m_read_fds.begin(), *signaled_event);
+if (*signaled_event < m_read_fds.size()) {
+  auto &fd_info = *std::next(m_read_fds.begin(), *signaled_event);
+  ProcessReadObject(fd_info.first);
+} else {
+  assert(*signaled_event == m_read_fds.size());
+  // Must be called before events are processed.
+  WSAResetEvent(m_event_event);
+  ProcessEvents();
+}
 
-ProcessReadObject(fd_info.first);
 ProcessPendingCallbacks();
   }
   return Status();
 }
+
+void MainLoopWindows::NotifyEvent(std::list::iterator info_it) {
+  // This must be set before we notify the event.
+  info_it->notified.store(true, std::memory_order_release);
+  WSASetEvent(m_event_event);
+}
Index: lldb/source/Host/posix/MainLoopPosix.cpp
===
--- lldb/source/Host/posix/MainLoopPosix.cpp
+++ lldb/source/Host/posix/MainLoopPosix.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "lldb/Host/posix/MainLoopPosix.h"
+
 #include "lldb/Host/Config.h"
 #include "lldb/Host/PosixApi.h"
 #include "lldb/Utility/Status.h"
@@ -70,14 +71,15 @@
 
 #if HAVE_SYS_EVENT_H
 MainLoopPosix::RunImpl::RunImpl(MainLoopPosix &loop) : loop(loop) {
-  in_events.reserve(loop.m_read_fds.size());
+  in_events.reserve(loop.m_

[Lldb-commits] [PATCH] D131160: [WIP][lldb] Add "event" capability to the MainLoop class

2022-08-15 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments.



Comment at: lldb/source/Host/posix/MainLoopPosix.cpp:74-82
+  in_events.reserve(loop.m_read_fds.size() + 1);
 }
 
 Status MainLoopPosix::RunImpl::Poll() {
-  in_events.resize(loop.m_read_fds.size());
+  in_events.resize(loop.m_read_fds.size() + 1);
   unsigned i = 0;
   for (auto &fd : loop.m_read_fds)

I'm wondering whether I should be repeating this all over the place or perhaps 
just adding `m_event_pipe` to `m_read_fds`.



Comment at: lldb/source/Host/posix/MainLoopPosix.cpp:108-112
+char c;
+ssize_t bytes_read =
+llvm::sys::RetryAfterSignal(-1, ::read, event_pipe_fd, &c, 1);
+assert(bytes_read == 1);
+UNUSED_IF_ASSERT_DISABLED(bytes_read);

Also I'm wondering about adding a `ProcessEvents()` wrapper that would take 
care of this.


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

https://reviews.llvm.org/D131160

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


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:227
 
 static StructuredData::Array *ConvertToStructuredArray(
 ValueObjectSP return_value_sp, const std::string &items_name,

fixathon wrote:
> Function creating heap-based allocation
Could this return a unique_ptr instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

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


[Lldb-commits] [PATCH] D131664: [LLDB][ARM] Remove unused LoadPseudoRegistersFromFrame function

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

In D131664#3715513 , @DavidSpickett 
wrote:

> @JDevlieghere Unless this is still used in your downstream?

Thanks for checking. It's not used downstream, so this LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131664

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


[Lldb-commits] [PATCH] D131850: [LLDB][NFC] Reliability Fixes for FormatEntity

2022-08-15 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/D131850/new/

https://reviews.llvm.org/D131850

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


[Lldb-commits] [PATCH] D124314: lldb: Disable unittests if llvm_gtest target does not exist

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG350755d94d6b: [llvm] Include utils/unittest before projects 
and runtimes (authored by JDevlieghere).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D124314?vs=451684&id=452722#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124314

Files:
  llvm/CMakeLists.txt


Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1147,6 +1147,9 @@
   add_subdirectory(utils/UnicodeData)
   add_subdirectory(utils/yaml-bench)
   add_subdirectory(utils/split-file)
+  if( LLVM_INCLUDE_TESTS )
+add_subdirectory(utils/unittest)
+  endif()
 else()
   if ( LLVM_INCLUDE_TESTS )
 message(FATAL_ERROR "Including tests when not building utils will not work.
@@ -1191,9 +1194,6 @@
   add_subdirectory(utils/lit)
   add_subdirectory(test)
   add_subdirectory(unittests)
-  if( LLVM_INCLUDE_UTILS )
-add_subdirectory(utils/unittest)
-  endif()
 
   if (WIN32)
 # This utility is used to prevent crashing tests from calling Dr. Watson on


Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1147,6 +1147,9 @@
   add_subdirectory(utils/UnicodeData)
   add_subdirectory(utils/yaml-bench)
   add_subdirectory(utils/split-file)
+  if( LLVM_INCLUDE_TESTS )
+add_subdirectory(utils/unittest)
+  endif()
 else()
   if ( LLVM_INCLUDE_TESTS )
 message(FATAL_ERROR "Including tests when not building utils will not work.
@@ -1191,9 +1194,6 @@
   add_subdirectory(utils/lit)
   add_subdirectory(test)
   add_subdirectory(unittests)
-  if( LLVM_INCLUDE_UTILS )
-add_subdirectory(utils/unittest)
-  endif()
 
   if (WIN32)
 # This utility is used to prevent crashing tests from calling Dr. Watson on
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131335: WIP: [lldb] abi_tag support 3/3 - Use mangle tree API to determine approximate mangled matches

2022-08-15 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In D131335#3722595 , @Michael137 
wrote:

> As @labath mentioned, we do force clang to preserve the linkage name via 
> `asm()`, but only for class member functions. This was added in 
> `675767a5910d2ec77ef8b51c78fe312cf9022896` (https://reviews.llvm.org/D40283) 
> to also support `abi_tag`! But that didn't cover templates functions:
>
>   Use the DWARF linkage name when importing C++ methods.
>   When importing C++ methods into clang AST nodes from the DWARF symbol
>   table, preserve the DW_AT_linkage_name and use it as the linker
>   ("asm") name for the symbol.
>   
>   Concretely, this enables `expression` to call into names that use the
>   GNU `abi_tag` extension
>
> I tried adding an `AsmLabelAttr` to the `FunctionDecl`s we create when 
> parsing DWARF and it does fix the ABI-tag problem on my small test case. But 
> this only works because the way we create `FunctionTemplateDecl`s is 
> incorrect (as I've described in my previous comments).
>
> So the options are any combination of the following:
>
> 1. carry this patch forward (and possibly remove the `asm()` hack for C++ 
> member functions)
> 2. Add the `asm()` attribute hack to all function declarations (or just when 
> we are dealing with template functions)
> 3. Fix the way we generate `FunctionTemplateDecl`s when parsing DWARF (this 
> likely needs a change to DWARF generation)
>
> @aprantl @labath Any preference? To me it seems 1 and 3 are the more "proper" 
> way to fix this issue. And once we fix 3 (which we should do anyway) #2 may 
> break. The good thing about #2 is that we avoid searching object files, 
> improving performance.

I think this sounds like a decent plan forward. I would suggest to start with 
(1) and then start a discussion about (3). Conceivably we could change the 
DWARF representation of function signatures to refer to `the 
DW_TAG_template_type_parameter` DIEs as types inside the `DW_AT_type`s of the 
other parameters. This is probably something we'd need to prototype in the LLDB 
debugger tuning first because it would confuse other consumers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131335

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


[Lldb-commits] [lldb] fa51243 - [LLDB][NFC] Reliability Fixes for FormatEntity

2022-08-15 Thread Slava Gurevich via lldb-commits

Author: Slava Gurevich
Date: 2022-08-15T10:16:47-07:00
New Revision: fa5124327a01ef060f2c5a301e9600892bb63280

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

LOG: [LLDB][NFC] Reliability Fixes for FormatEntity

 - Remove dead code
 - Fix incorrect null-reference check

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

Added: 


Modified: 
lldb/source/Core/FormatEntity.cpp

Removed: 




diff  --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index 0ac8fcabc61b..41c4aba63825 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -711,9 +711,6 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
 return false;
   }
 
-  if (valobj == nullptr)
-return false;
-
   ValueObject::ExpressionPathAftermath what_next =
   (do_deref_pointer ? ValueObject::eExpressionPathAftermathDereference
 : ValueObject::eExpressionPathAftermathNothing);
@@ -1695,7 +1692,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
   llvm::StringRef var_representation;
   const char *var_name = var_value_sp->GetName().GetCString();
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =
   var_value_sp->GetQualifiedRepresentationIfAvailable(
   exe_scope->CalculateTarget()



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


[Lldb-commits] [PATCH] D131850: [LLDB][NFC] Reliability Fixes for FormatEntity

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfa5124327a01: [LLDB][NFC] Reliability Fixes for FormatEntity 
(authored by fixathon).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131850

Files:
  lldb/source/Core/FormatEntity.cpp


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -711,9 +711,6 @@
 return false;
   }
 
-  if (valobj == nullptr)
-return false;
-
   ValueObject::ExpressionPathAftermath what_next =
   (do_deref_pointer ? ValueObject::eExpressionPathAftermathDereference
 : ValueObject::eExpressionPathAftermathNothing);
@@ -1695,7 +1692,7 @@
   llvm::StringRef var_representation;
   const char *var_name = var_value_sp->GetName().GetCString();
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =
   var_value_sp->GetQualifiedRepresentationIfAvailable(
   exe_scope->CalculateTarget()


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -711,9 +711,6 @@
 return false;
   }
 
-  if (valobj == nullptr)
-return false;
-
   ValueObject::ExpressionPathAftermath what_next =
   (do_deref_pointer ? ValueObject::eExpressionPathAftermathDereference
 : ValueObject::eExpressionPathAftermathNothing);
@@ -1695,7 +1692,7 @@
   llvm::StringRef var_representation;
   const char *var_name = var_value_sp->GetName().GetCString();
   if (var_value_sp->GetCompilerType().IsValid()) {
-if (var_value_sp && exe_scope->CalculateTarget())
+if (exe_scope && exe_scope->CalculateTarget())
   var_value_sp =
   var_value_sp->GetQualifiedRepresentationIfAvailable(
   exe_scope->CalculateTarget()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131605: [lldb][tests] Test queue-specific breakpoints

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/test/API/macosx/queues/TestQueues.py:133
+"The breakpoint for queue %s has not been hit" % 
(queue_breakpoint.GetQueueName()))
+self.assertEqual(queue1_thread.GetStopReason(), 
lldb.eStopReasonBreakpoint,
+ "Queue %s is not stopped at breakpoint %d" %

This should use `self.assertStopReason` for a better error message.



Comment at: lldb/test/API/macosx/queues/TestQueues.py:201-206
+# Run the executable until the stopper function and get the breakpoint
+# that's created from that. Then set the queue name of the breakpoint
+# to be the name of the main thread
+target, process, main_thread, queue_breakpoint = 
lldbutil.run_to_name_breakpoint(self, "stopper", only_one_thread=False)
+queue_breakpoint.SetQueueName(main_thread.GetQueue().GetName())
+self.check_queue_breakpoints(main_thread.GetQueue(), 
queue_submittor_1, queue_breakpoint)

This seems like it should be its own test. Right now this is reassigning the 
target and process, which seems suspicious, and also changes the meaning of 
everything that comes after it. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131605

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


[Lldb-commits] [PATCH] D131901: [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver

2022-08-15 Thread Kazu Hirata via Phabricator via lldb-commits
kazu added a comment.

Oops, sorry about the breakage.  Thank you for fixing this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131901

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


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

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

So any functions that are "StructureData:: *" raw pointers in this 
source code should switch over to returning on of the StruturedData definitions 
from StructuredData.h:

  class StructuredData {
typedef std::shared_ptr ObjectSP;
typedef std::shared_ptr ArraySP;
typedef std::shared_ptr IntegerSP;
typedef std::shared_ptr FloatSP;
typedef std::shared_ptr BooleanSP;
typedef std::shared_ptr StringSP;
typedef std::shared_ptr DictionarySP;
typedef std::shared_ptr GenericSP;




Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:227
 
 static StructuredData::Array *ConvertToStructuredArray(
 ValueObjectSP return_value_sp, const std::string &items_name,

JDevlieghere wrote:
> fixathon wrote:
> > Function creating heap-based allocation
> Could this return a unique_ptr instead?
This should return StructureData::ArraySP. Look at the other usages of this 
function where they will eventually put the result into a dictionary



Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:351
 
   StructuredData::Array *stacks = ConvertToStructuredArray(
   main_value, ".stacks", ".stack_count",

If we make ConvertToStructuredArray return a ArraySP, then this code would 
change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

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


[Lldb-commits] [lldb] 570e10c - [lldb] Fix warning: comparison of integers of different signs

2022-08-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-08-15T11:25:46-07:00
New Revision: 570e10cb9def153812f13ef1945f9ef388ab3e3e

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

LOG: [lldb] Fix warning: comparison of integers of different signs

Fixes a warning about comparison of integers of different signs
'wchar_t' and 'int' in Editline.cpp:

  return out != (int)WEOF;
 ~~~ ^  ~

Added: 


Modified: 
lldb/source/Host/common/Editline.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index ea0f06f637071..cee7a3655046a 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1609,7 +1609,7 @@ bool Editline::CompleteCharacter(char ch, 
EditLineGetCharType &out) {
 switch (cvt.in(state, input.begin(), input.end(), from_next, &out, &out + 
1,
to_next)) {
 case std::codecvt_base::ok:
-  return out != (int)WEOF;
+  return out != (EditLineGetCharType)WEOF;
 
 case std::codecvt_base::error:
 case std::codecvt_base::noconv:



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


[Lldb-commits] [PATCH] D131821: Add test that shows the problem with D118814

2022-08-15 Thread Emre Kultursay via Phabricator via lldb-commits
emrekultursay added a comment.

In D131821#3723474 , @JDevlieghere 
wrote:

> I applied your patch and ran the test and for me it's passing:

Thanks Jonas, I believe https://reviews.llvm.org/D127999 (and follow-ups) fixed 
the bug I was observing. I was sync'ed to a version older than that patch, 
that's why I didn't notice it was fixed.  I synced to head and I don't 
reproduce it either.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131821

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


[Lldb-commits] [PATCH] D131328: [lldb] Support fetching symbols with dsymForUUID in the background

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 452786.
JDevlieghere added a comment.

Rebase on top of D131303 


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

https://reviews.llvm.org/D131328

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/DebuggerEvents.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Symbol/LocateSymbolFile.h
  lldb/include/lldb/Target/Target.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/DebuggerEvents.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp

Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -554,7 +554,8 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-  Status &error, bool force_lookup) {
+  Status &error, bool force_lookup,
+  bool copy_executable) {
   const UUID *uuid_ptr = module_spec.GetUUIDPtr();
   const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
 
@@ -584,18 +585,19 @@
 
   // Create the dsymForUUID command.
   StreamString command;
+  const char *copy_executable_arg = copy_executable ? "--copyExecutable " : "";
   if (!uuid_str.empty()) {
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
+command.Printf("%s --ignoreNegativeCache %s%s",
dsymForUUID_exe_path.c_str(), uuid_str.c_str());
 LLDB_LOGF(log, "Calling %s with UUID %s to find dSYM: %s",
-  dsymForUUID_exe_path.c_str(), uuid_str.c_str(),
-  command.GetString().data());
+  dsymForUUID_exe_path.c_str(), copy_executable_arg,
+  uuid_str.c_str(), command.GetString().data());
   } else if (!file_path_str.empty()) {
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
+command.Printf("%s --ignoreNegativeCache %s%s",
dsymForUUID_exe_path.c_str(), file_path_str.c_str());
 LLDB_LOGF(log, "Calling %s with file %s to find dSYM: %s",
-  dsymForUUID_exe_path.c_str(), file_path_str.c_str(),
-  command.GetString().data());
+  dsymForUUID_exe_path.c_str(), copy_executable_arg,
+  file_path_str.c_str(), command.GetString().data());
   } else {
 return false;
   }
Index: lldb/source/Symbol/LocateSymbolFile.cpp
===
--- lldb/source/Symbol/LocateSymbolFile.cpp
+++ lldb/source/Symbol/LocateSymbolFile.cpp
@@ -8,6 +8,8 @@
 
 #include "lldb/Symbol/LocateSymbolFile.h"
 
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Progress.h"
@@ -23,7 +25,9 @@
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/ThreadPool.h"
 
 // From MacOSX system header "mach/machine.h"
 typedef int cpu_type_t;
@@ -397,6 +401,35 @@
   return LocateExecutableSymbolFileDsym(module_spec);
 }
 
+void Symbols::DownloadSymbolFileAsync(const UUID &uuid) {
+  if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup())
+return;
+
+  static llvm::SmallSet g_seen_uuids;
+  static std::mutex g_mutex;
+  Debugger::GetThreadPool().async([=]() {
+{
+  std::lock_guard guard(g_mutex);
+  if (g_seen_uuids.count(uuid))
+return;
+  g_seen_uuids.insert(uuid);
+}
+
+Status error;
+ModuleSpec module_spec;
+module_spec.GetUUID() = uuid;
+if (!Symbols::DownloadObjectAndSymbolFile(module_spec, error,
+  /*force_lookup=*/true,
+  /*copy_executable=*/false))
+  return;
+
+if (error.Fail())
+  return;
+
+Debugger::ReportSymbolChange(module_spec);
+  });
+}
+
 #if !defined(__APPLE__)
 
 FileSpec Symbols::FindSymbolFileInBundle(const FileSpec &symfile_bundle,
@@ -407,7 +440,8 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-  Status &error, bool force_lookup) {
+  Status &error, bool force_lookup,
+  bool copy_executable) {
   // Fill in the module_spec.GetFileSpec() for the object file and/or the
   // module_spec.GetSymbolFileSpec() for the debug symbols file.
   return false;
Index: lldb/source/Core/ModuleList.cpp
===
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -106,6

[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Tom Stellard via Phabricator via lldb-commits
tstellar created this revision.
tstellar added reviewers: stellaraccident, rnk, lattner, probinson, jyknight, 
phosek.
Herald added subscribers: Enna1, bzcheeseman, sdasgup3, wenzhicui, wrengr, 
mstorsjo, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, 
grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, 
shauheen, rriddle, mehdi_amini, mgrang, fedor.sergeev, krytarowski, mgorny, 
dschuff.
Herald added a reviewer: bollu.
Herald added a project: All.
tstellar requested review of this revision.
Herald added subscribers: lldb-commits, Sanitizers, cfe-commits, 
stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, Sanitizers, LLDB, MLIR, LLVM.

This will help improve the project's layering, so that sub-projects
that don't actually need any llvm code can still use googletest
without having to reference code in the llvm directory.

This will also make it easier to consolidate and simplify the standalone
build configurations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131919

Files:
  clang/CMakeLists.txt
  compiler-rt/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/utils/unittest/CMakeLists.txt
  llvm/utils/unittest/UnitTestMain/CMakeLists.txt
  llvm/utils/unittest/UnitTestMain/TestMain.cpp
  llvm/utils/unittest/googlemock/LICENSE.txt
  llvm/utils/unittest/googlemock/README.LLVM
  llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-generated-actions.h
  
llvm/utils/unittest/googlemock/include/gmock/gmock-generated-function-mockers.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-generated-matchers.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h
  llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h
  llvm/utils/unittest/googlemock/include/gmock/gmock.h
  
llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h
  llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h
  llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h
  llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h
  llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h
  llvm/utils/unittest/googlemock/include/gmock/internal/gmock-pp.h
  llvm/utils/unittest/googlemock/src/gmock-all.cc
  llvm/utils/unittest/googlemock/src/gmock-cardinalities.cc
  llvm/utils/unittest/googlemock/src/gmock-internal-utils.cc
  llvm/utils/unittest/googlemock/src/gmock-matchers.cc
  llvm/utils/unittest/googlemock/src/gmock-spec-builders.cc
  llvm/utils/unittest/googlemock/src/gmock.cc
  llvm/utils/unittest/googletest/LICENSE.TXT
  llvm/utils/unittest/googletest/README.LLVM
  llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h
  llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h
  llvm/utils/unittest/googletest/include/gtest/gtest-message.h
  llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h
  llvm/utils/unittest/googletest/include/gtest/gtest-printers.h
  llvm/utils/unittest/googletest/include/gtest/gtest-spi.h
  llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h
  llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h
  llvm/utils/unittest/googletest/include/gtest/gtest.h
  llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h
  llvm/utils/unittest/googletest/include/gtest/gtest_prod.h
  llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-port.h
  llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
  llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest.h
  llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h
  
llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h
  llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h
  llvm/utils/unittest/googletest/src/gtest-all.cc
  llvm/utils/unittest/googletest/src/gtest-death-test.cc
  llvm/utils/unittest/googletest/src/gtest-filepath.cc
  llvm/utils/unittest/googletest/src/gtest-internal-inl.h

[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Chris Lattner via Phabricator via lldb-commits
lattner accepted this revision.
lattner added a comment.
This revision is now accepted and ready to land.

I didn't review the patch in detail, but +1 this is a great step forward to 
reorganize the repo!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131919

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


[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Petr Hosek via Phabricator via lldb-commits
phosek accepted this revision.
phosek added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131919

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


[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Stella Laurenzo via Phabricator via lldb-commits
stellaraccident added inline comments.



Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:1257
+
+set(LLVM_THIRD_PARTY_DIR  ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE 
STRING
+"Directory containing third party software used by LLVM (e.g. googletest)")

Is the implication that this file should only ever be included by top-level 
sub-projects (i.e. clang, mlir, llvm, etc)? If included from elsewhere, it 
seems like it won't do the right thing.

Also, having this as a cache entry is going to make it harder for out of tree 
projects to define it reliably (requiring various FORCE heroics) -- but I know 
why you are doing it if trying to define it here.

As is, this file is included from most of the top-levels and making it a cache 
variable will have them racing to set it. Why not make it a regular variable? 
And why not derive it from LLVM_MAIN_SRC_DIR?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131919

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


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon planned changes to this revision.
fixathon marked 2 inline comments as done.
fixathon added a comment.

I am going to clean up the code in the entire file where **raw pointers** 
should be **shared_ptr** (because they get cast to shared_ptr anyways). Also 
planning to convert the **naked new** and the 2-step **shared_ptr** creation to 
**make_shared<>** ; the former is less-safe for potential leaks, and the latter 
is strictly better.

@JDevlieghere Yes, some of these planned raw pointer changes could be 
**unique_ptr**, but these types are already typedef-ed in StructuredData.h as 
**shared_ptr** and I'd like to preserve the style in the absence of specific 
know performance issues in this code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

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


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon updated this revision to Diff 452809.
fixathon marked an inline comment as done.
fixathon added a comment.

Convert raw pointers to shared_ptr


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

Files:
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp

Index: lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
===
--- lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -35,6 +35,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+using std::make_shared;
+
 LLDB_PLUGIN_DEFINE(InstrumentationRuntimeTSan)
 
 lldb::InstrumentationRuntimeSP
@@ -206,10 +208,10 @@
 t;
 )";
 
-static StructuredData::Array *
+static StructuredData::ArraySP
 CreateStackTrace(ValueObjectSP o,
  const std::string &trace_item_name = ".trace") {
-  StructuredData::Array *trace = new StructuredData::Array();
+  auto trace_sp = make_shared();
   ValueObjectSP trace_value_object =
   o->GetValueForExpressionPath(trace_item_name.c_str());
   size_t count = trace_value_object->GetNumChildren();
@@ -218,18 +220,17 @@
 trace_value_object->GetChildAtIndex(j, true)->GetValueAsUnsigned(0);
 if (trace_addr == 0)
   break;
-trace->AddItem(
-StructuredData::ObjectSP(new StructuredData::Integer(trace_addr)));
+trace_sp->AddItem(make_shared(trace_addr));
   }
-  return trace;
+  return trace_sp;
 }
 
-static StructuredData::Array *ConvertToStructuredArray(
+static StructuredData::ArraySP ConvertToStructuredArray(
 ValueObjectSP return_value_sp, const std::string &items_name,
 const std::string &count_name,
-std::function const
-&callback) {
-  StructuredData::Array *array = new StructuredData::Array();
+std::function const &callback) {
+  auto array_sp = make_shared();
   unsigned int count =
   return_value_sp->GetValueForExpressionPath(count_name.c_str())
   ->GetValueAsUnsigned(0);
@@ -237,13 +238,13 @@
   return_value_sp->GetValueForExpressionPath(items_name.c_str());
   for (unsigned int i = 0; i < count; i++) {
 ValueObjectSP o = objects->GetChildAtIndex(i, true);
-StructuredData::Dictionary *dict = new StructuredData::Dictionary();
+auto dict_sp = make_shared();
 
-callback(o, dict);
+callback(o, dict_sp);
 
-array->AddItem(StructuredData::ObjectSP(dict));
+array_sp->AddItem(dict_sp);
   }
-  return array;
+  return array_sp;
 }
 
 static std::string RetrieveString(ValueObjectSP return_value_sp,
@@ -264,7 +265,7 @@
   ConvertToStructuredArray(
   data, ".threads", ".thread_count",
   [process_sp, &thread_id_map](ValueObjectSP o,
-   StructuredData::Dictionary *dict) {
+   StructuredData::DictionarySP dict) {
 uint64_t thread_id =
 o->GetValueForExpressionPath(".tid")->GetValueAsUnsigned(0);
 uint64_t thread_os_id =
@@ -338,31 +339,31 @@
   std::map thread_id_map;
   GetRenumberedThreadIds(process_sp, main_value, thread_id_map);
 
-  StructuredData::Dictionary *dict = new StructuredData::Dictionary();
+  auto dict = make_shared();
   dict->AddStringItem("instrumentation_class", "ThreadSanitizer");
   dict->AddStringItem("issue_type",
   RetrieveString(main_value, process_sp, ".description"));
   dict->AddIntegerItem("report_count",
main_value->GetValueForExpressionPath(".report_count")
->GetValueAsUnsigned(0));
-  dict->AddItem("sleep_trace", StructuredData::ObjectSP(CreateStackTrace(
-   main_value, ".sleep_trace")));
+  dict->AddItem("sleep_trace", CreateStackTrace(
+   main_value, ".sleep_trace"));
 
-  StructuredData::Array *stacks = ConvertToStructuredArray(
+  StructuredData::ArraySP stacks = ConvertToStructuredArray(
   main_value, ".stacks", ".stack_count",
-  [thread_sp](ValueObjectSP o, StructuredData::Dictionary *dict) {
+  [thread_sp](ValueObjectSP o, StructuredData::DictionarySP dict) {
 dict->AddIntegerItem(
 "index",
 o->GetValueForExpressionPath(".idx")->GetValueAsUnsigned(0));
-dict->AddItem("trace", StructuredData::ObjectSP(CreateStackTrace(o)));
+dict->AddItem("trace", CreateStackTrace(o));
 // "stacks" happen on the current thread
 dict->AddIntegerItem("thread_id", thread_sp->GetIndexID());
   });
-  dict->AddItem("stacks", StructuredData::ObjectSP(stacks));
+  dict->AddItem("stacks", stacks);
 
-  StructuredData::Array *mops = ConvertToStructuredArray(
+  StructuredData::ArraySP mops = ConvertToStructuredArray(
   main_value, ".mops", ".mop_count",
-  

[Lldb-commits] [PATCH] D131821: Add test that shows the problem with D118814

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Great. Thanks for closing the loop on this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131821

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


[Lldb-commits] [PATCH] D131605: [lldb][tests] Test queue-specific breakpoints

2022-08-15 Thread Chelsea Cassanova via Phabricator via lldb-commits
cassanova added inline comments.



Comment at: lldb/test/API/macosx/queues/TestQueues.py:201-206
+# Run the executable until the stopper function and get the breakpoint
+# that's created from that. Then set the queue name of the breakpoint
+# to be the name of the main thread
+target, process, main_thread, queue_breakpoint = 
lldbutil.run_to_name_breakpoint(self, "stopper", only_one_thread=False)
+queue_breakpoint.SetQueueName(main_thread.GetQueue().GetName())
+self.check_queue_breakpoints(main_thread.GetQueue(), 
queue_submittor_1, queue_breakpoint)

JDevlieghere wrote:
> This seems like it should be its own test. Right now this is reassigning the 
> target and process, which seems suspicious, and also changes the meaning of 
> everything that comes after it. 
Good point, I'm placing the queue specific tests into their own test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131605

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


[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Tom Stellard via Phabricator via lldb-commits
tstellar added inline comments.



Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:1257
+
+set(LLVM_THIRD_PARTY_DIR  ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE 
STRING
+"Directory containing third party software used by LLVM (e.g. googletest)")

stellaraccident wrote:
> Is the implication that this file should only ever be included by top-level 
> sub-projects (i.e. clang, mlir, llvm, etc)? If included from elsewhere, it 
> seems like it won't do the right thing.
> 
> Also, having this as a cache entry is going to make it harder for out of tree 
> projects to define it reliably (requiring various FORCE heroics) -- but I 
> know why you are doing it if trying to define it here.
> 
> As is, this file is included from most of the top-levels and making it a 
> cache variable will have them racing to set it. Why not make it a regular 
> variable? And why not derive it from LLVM_MAIN_SRC_DIR?
I put it in this file so that this variable would be available for stand-alone 
builds and made it a cache variable so it could be overridden by standalone 
builds too.

The alternative would be to define this variable in llvm/CMakeLists.txt and 
then in the stand-alone build handling for each sub-project.  It's a lot of 
code duplication that way, but we already have a lot of similar duplication in 
the CMakeLists.txt today (this is something I would like to clean up in the 
future).

Using LLVM_MAIN_SRC_DIR here breaks stand-alone builds, because 
LLVM_MAIN_SRC_DIR expands to ../llvm/../, so if I try to build lld, with a 
directory layout of:

```
lld/ cmake/ third-party/
```

Then CMake won't be able to find the third-party/ directory even though it is 
in the right place (because llvm/ is missing).  I also think in general, it's 
cleaner to only use LLVM_MAIN_SRC_DIR when we want to use files in llvm/ and 
not for finding the root of the monorepo.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131919

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


[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D131900#3724366 , @fixathon wrote:

> I am going to clean up the code in the entire file where **raw pointers** 
> should be **shared_ptr** (because they get cast to shared_ptr anyways). Also 
> planning to convert the **naked new** and the 2-step **shared_ptr** creation 
> to **make_shared<>** ; the former is less-safe for potential leaks, and the 
> latter is strictly better.
>
> @JDevlieghere Yes, some of these planned raw pointer changes could be 
> **unique_ptr**, but these types are already typedef-ed in StructuredData.h as 
> **shared_ptr** and I'd like to preserve the style in the absence of specific 
> know performance issues in this code.

Yup, any smart pointer works for me 👍




Comment at: 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:38
 
+using std::make_shared;
+

We don't do this anywhere in LLVM, and the coding guidelines explicitly state 
that "we prefer to explicitly prefix all identifiers from the standard 
namespace with an “std::” prefix". [1] This isn't exactly the same as `using 
namespace std` but I would argue the sentiment still holds.

[1] https://llvm.org/docs/CodingStandards.html#do-not-use-using-namespace-std


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

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


[Lldb-commits] [PATCH] D131328: [lldb] Support fetching symbols with dsymForUUID in the background

2022-08-15 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.


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

https://reviews.llvm.org/D131328

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


[Lldb-commits] [PATCH] D131407: [lldb] Flush the global thread pool in Debugger::Terminate

2022-08-15 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

This looks good to me.


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

https://reviews.llvm.org/D131407

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


[Lldb-commits] [PATCH] D131605: [lldb][tests] Test queue-specific breakpoints

2022-08-15 Thread Chelsea Cassanova via Phabricator via lldb-commits
cassanova updated this revision to Diff 452853.
cassanova added a comment.

Added the queue-specific breakpoints to their own test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131605

Files:
  lldb/test/API/macosx/queues/TestQueues.py


Index: lldb/test/API/macosx/queues/TestQueues.py
===
--- lldb/test/API/macosx/queues/TestQueues.py
+++ lldb/test/API/macosx/queues/TestQueues.py
@@ -20,6 +20,12 @@
 self.build()
 self.queues()
 
+@skipUnlessDarwin
+@add_test_categories(['pyapi'])
+def test_queue_specific_breakpoints(self):
+self.build()
+self.queue_specific_breakpoints()
+
 @skipUnlessDarwin
 @add_test_categories(['pyapi'])
 def test_with_python_api_queues_with_backtrace(self):
@@ -122,6 +128,21 @@
  t.GetQueue().GetQueueID(),
 queue.GetQueueID()))
 
+def check_queue_breakpoints(self, queue1, queue2, queue_breakpoint):
+queue1_thread = queue1.GetThreadAtIndex(0)
+queue2_thread = queue2.GetThreadAtIndex(0)
+
+self.assertEqual(queue_breakpoint.GetQueueName(), queue1.GetName(),
+ "The breakpoint was set for queue %s, but the 
breakpoint's queue name is %s" % (queue_breakpoint.GetQueueName(), 
queue1.GetName()))
+self.assertEqual(queue_breakpoint.GetHitCount(), 1,
+"The breakpoint for queue %s has not been hit" % 
(queue_breakpoint.GetQueueName()))
+self.assertStopReason(queue1_thread.GetStopReason(), 
lldb.eStopReasonBreakpoint,
+ "Queue %s is not stopped at breakpoint %d" %
+ (queue1.GetName(), queue_breakpoint.GetID()))
+self.assertNotEqual(queue2_thread.GetStopReason(), 
lldb.eStopReasonBreakpoint,
+"Queue %s is stopped at breakpoint %d, but this 
breakpoint should only be hit for queue %s" %
+(queue2.GetName(), queue_breakpoint.GetID(), 
queue_breakpoint.GetQueueName()))
+
 def queues(self):
 """Test queues inspection SB APIs without libBacktraceRecording."""
 exe = self.getBuildArtifact("a.out")
@@ -371,3 +392,21 @@
 ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should 
be doing_the_work_2")
 self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
 ).IsValid() == False, "queue 2's pending item # is 
invalid")
+
+def queue_specific_breakpoints(self):
+# Run the executable until the stopper function and get the breakpoint
+# that's created from that. Then set the queue name of the breakpoint
+# to be the name of the main thread
+target, process, main_thread, queue_breakpoint = 
lldbutil.run_to_name_breakpoint(self, "stopper", only_one_thread=False)
+queue_breakpoint.SetQueueName(main_thread.GetQueue().GetName())
+
+# Create a submittor queue
+queue_submittor_1 = lldb.SBQueue()
+for idx in range(0, process.GetNumQueues()):
+q = process.GetQueueAtIndex(idx)
+if q.GetName() == "com.apple.work_submittor_1":
+queue_submittor_1 = q
+
+self.assertTrue(queue_submittor_1.IsValid(), "Unable to get expected 
queue com.apple.work_submittor_1, instead got queue %s" % 
(queue_submittor_1.GetName()))
+
+self.check_queue_breakpoints(main_thread.GetQueue(), 
queue_submittor_1, queue_breakpoint)


Index: lldb/test/API/macosx/queues/TestQueues.py
===
--- lldb/test/API/macosx/queues/TestQueues.py
+++ lldb/test/API/macosx/queues/TestQueues.py
@@ -20,6 +20,12 @@
 self.build()
 self.queues()
 
+@skipUnlessDarwin
+@add_test_categories(['pyapi'])
+def test_queue_specific_breakpoints(self):
+self.build()
+self.queue_specific_breakpoints()
+
 @skipUnlessDarwin
 @add_test_categories(['pyapi'])
 def test_with_python_api_queues_with_backtrace(self):
@@ -122,6 +128,21 @@
  t.GetQueue().GetQueueID(),
 queue.GetQueueID()))
 
+def check_queue_breakpoints(self, queue1, queue2, queue_breakpoint):
+queue1_thread = queue1.GetThreadAtIndex(0)
+queue2_thread = queue2.GetThreadAtIndex(0)
+
+self.assertEqual(queue_breakpoint.GetQueueName(), queue1.GetName(),
+ "The breakpoint was set for queue %s, but the breakpoint's queue name is %s" % (queue_breakpoint.GetQueueName(), queue1.GetName()))
+self.assertEqual(queue_breakpoint.GetHitCount(), 1,
+"The breakpoint for queue %s has not been hit" % (queue_breakpoint.GetQueueName()))
+self.assertStopReason(queue1_thread.GetStopReason(), lldb.eStopReasonBreakpoint,
+ "Queue %s is not stopped at breakpoint %

[Lldb-commits] [lldb] 8d36a82 - [lldb] Flush the global thread pool in Debugger::Terminate

2022-08-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-08-15T17:57:23-07:00
New Revision: 8d36a82d0a3d118329b9f24b33e58d0a28360891

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

LOG: [lldb] Flush the global thread pool in Debugger::Terminate

Use the Initialize/Terminate pattern for the global thread pool to make
sure it gets flushed during teardown.

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

Added: 


Modified: 
lldb/source/Core/Debugger.cpp

Removed: 




diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 5d8db6b4e5e64..a131416cef4a8 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -104,6 +104,7 @@ static std::recursive_mutex *g_debugger_list_mutex_ptr =
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor 
chain
 static DebuggerList *g_debugger_list_ptr =
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor 
chain
+static llvm::ThreadPool *g_thread_pool = nullptr;
 
 static constexpr OptionEnumValueElement g_show_disassembly_enum_values[] = {
 {
@@ -538,6 +539,7 @@ void Debugger::Initialize(LoadPluginCallbackType 
load_plugin_callback) {
  "Debugger::Initialize called more than once!");
   g_debugger_list_mutex_ptr = new std::recursive_mutex();
   g_debugger_list_ptr = new DebuggerList();
+  g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
   g_load_plugin_callback = load_plugin_callback;
 }
 
@@ -545,6 +547,11 @@ void Debugger::Terminate() {
   assert(g_debugger_list_ptr &&
  "Debugger::Terminate called without a matching 
Debugger::Initialize!");
 
+  if (g_thread_pool) {
+// The destructor will wait for all the threads to complete.
+delete g_thread_pool;
+  }
+
   if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
 // Clear our global list of debugger objects
 {
@@ -2005,11 +2012,7 @@ Status Debugger::RunREPL(LanguageType language, const 
char *repl_options) {
 }
 
 llvm::ThreadPool &Debugger::GetThreadPool() {
-  // NOTE: intentional leak to avoid issues with C++ destructor chain
-  static llvm::ThreadPool *g_thread_pool = nullptr;
-  static llvm::once_flag g_once_flag;
-  llvm::call_once(g_once_flag, []() {
-g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
-  });
+  assert(g_thread_pool &&
+ "Debugger::GetThreadPool called before Debugger::Initialize");
   return *g_thread_pool;
 }



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


[Lldb-commits] [lldb] 11f45f3 - [lldb] Fetching symbols in the background with dsymForUUID

2022-08-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-08-15T17:57:24-07:00
New Revision: 11f45f36dcf54b0fe8e54ce5e410e24f3b9b5a1e

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

LOG: [lldb] Fetching symbols in the background with dsymForUUID

On macOS, LLDB uses the DebugSymbols.framework to locate symbol rich
dSYM bundles. [1] The framework uses a variety of methods, one of them
calling into a binary or shell script to locate (and download) dSYMs.
Internally at Apple, that tool is called dsymForUUID and for simplicity
I'm just going to refer to it that way here too, even though it can be
be an arbitrary executable.

The most common use case for dsymForUUID is to fetch symbols from the
network. This can take a long time, and because the calls to the
DebugSymbols.framework are blocking, it takes a while to launch the
process. This is expected and therefore many people don't use this
functionality, but instead use add-dsym when they want symbols for a
given frame, backtrace or module. This is a little faster because you're
only fetching symbols for the module you care about, but it's still a
slow, blocking operation.

This patch introduces a hybrid approach between the two. When
symbols.enable-background-lookup is enabled, lldb will do the equivalent
of add-dsym in the background for every module that shows up in the
backtrace but doesn't have symbols for. From the user's perspective
there is no slowdown, because the process launches immediately, with
whatever symbols are available. Meanwhile, more symbol information is
added over time as the background fetching completes.

[1] https://lldb.llvm.org/use/symbols.html

rdar://76241471

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

Added: 


Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Core/DebuggerEvents.h
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Symbol/LocateSymbolFile.h
lldb/include/lldb/Target/Target.h
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/source/Core/DebuggerEvents.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Symbol/LocateSymbolFile.cpp
lldb/source/Symbol/LocateSymbolFileMacOSX.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 031c9a9674d7e..e02787bbd1f0c 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -82,6 +82,7 @@ class Debugger : public 
std::enable_shared_from_this,
 eBroadcastBitProgress = (1 << 0),
 eBroadcastBitWarning = (1 << 1),
 eBroadcastBitError = (1 << 2),
+eBroadcastSymbolChange = (1 << 3),
   };
 
   static ConstString GetStaticBroadcasterClass();
@@ -430,6 +431,8 @@ class Debugger : public 
std::enable_shared_from_this,
   llvm::Optional debugger_id = llvm::None,
   std::once_flag *once = nullptr);
 
+  static void ReportSymbolChange(const ModuleSpec &module_spec);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;

diff  --git a/lldb/include/lldb/Core/DebuggerEvents.h 
b/lldb/include/lldb/Core/DebuggerEvents.h
index b584b6285af80..e1203dcf38c8c 100644
--- a/lldb/include/lldb/Core/DebuggerEvents.h
+++ b/lldb/include/lldb/Core/DebuggerEvents.h
@@ -6,6 +6,7 @@
 //
 
//===--===//
 
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Event.h"
 
@@ -82,6 +83,28 @@ class DiagnosticEventData : public EventData {
   const DiagnosticEventData &operator=(const DiagnosticEventData &) = delete;
 };
 
+class SymbolChangeEventData : public EventData {
+public:
+  SymbolChangeEventData(lldb::DebuggerWP debugger_wp, ModuleSpec module_spec)
+  : m_debugger_wp(debugger_wp), m_module_spec(std::move(module_spec)) {}
+
+  static ConstString GetFlavorString();
+  ConstString GetFlavor() const override;
+
+  static const SymbolChangeEventData *
+  GetEventDataFromEvent(const Event *event_ptr);
+
+  void DoOnRemoval(Event *event_ptr) override;
+
+private:
+  lldb::DebuggerWP m_debugger_wp;
+  ModuleSpec m_module_spec;
+
+  SymbolChangeEventData(const SymbolChangeEventData &) = delete;
+  const SymbolChangeEventData &
+  operator=(const SymbolChangeEventData &) = delete;
+};
+
 } // namespace lldb_private
 
 #endif // LLDB_CORE_DEBUGGER_EVENTS_H

diff  --git a/lldb/include/lldb/Core/ModuleList.h 
b/lldb/include/lldb/Core/ModuleList.h
index 67205ca27e800..1630a6d58c570 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -60,6 +60,7 @@ class ModuleListProperties : public Properties {
   bool SetClangModulesCachePath(const FileSpec &path);
   bool GetEnableExternalLookup() const;
   bool Se

[Lldb-commits] [PATCH] D131407: [lldb] Flush the global thread pool in Debugger::Terminate

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d36a82d0a3d: [lldb] Flush the global thread pool in 
Debugger::Terminate (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131407

Files:
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -104,6 +104,7 @@
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor 
chain
 static DebuggerList *g_debugger_list_ptr =
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor 
chain
+static llvm::ThreadPool *g_thread_pool = nullptr;
 
 static constexpr OptionEnumValueElement g_show_disassembly_enum_values[] = {
 {
@@ -538,6 +539,7 @@
  "Debugger::Initialize called more than once!");
   g_debugger_list_mutex_ptr = new std::recursive_mutex();
   g_debugger_list_ptr = new DebuggerList();
+  g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
   g_load_plugin_callback = load_plugin_callback;
 }
 
@@ -545,6 +547,11 @@
   assert(g_debugger_list_ptr &&
  "Debugger::Terminate called without a matching 
Debugger::Initialize!");
 
+  if (g_thread_pool) {
+// The destructor will wait for all the threads to complete.
+delete g_thread_pool;
+  }
+
   if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
 // Clear our global list of debugger objects
 {
@@ -2005,11 +2012,7 @@
 }
 
 llvm::ThreadPool &Debugger::GetThreadPool() {
-  // NOTE: intentional leak to avoid issues with C++ destructor chain
-  static llvm::ThreadPool *g_thread_pool = nullptr;
-  static llvm::once_flag g_once_flag;
-  llvm::call_once(g_once_flag, []() {
-g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
-  });
+  assert(g_thread_pool &&
+ "Debugger::GetThreadPool called before Debugger::Initialize");
   return *g_thread_pool;
 }


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -104,6 +104,7 @@
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor chain
 static DebuggerList *g_debugger_list_ptr =
 nullptr; // NOTE: intentional leak to avoid issues with C++ destructor chain
+static llvm::ThreadPool *g_thread_pool = nullptr;
 
 static constexpr OptionEnumValueElement g_show_disassembly_enum_values[] = {
 {
@@ -538,6 +539,7 @@
  "Debugger::Initialize called more than once!");
   g_debugger_list_mutex_ptr = new std::recursive_mutex();
   g_debugger_list_ptr = new DebuggerList();
+  g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
   g_load_plugin_callback = load_plugin_callback;
 }
 
@@ -545,6 +547,11 @@
   assert(g_debugger_list_ptr &&
  "Debugger::Terminate called without a matching Debugger::Initialize!");
 
+  if (g_thread_pool) {
+// The destructor will wait for all the threads to complete.
+delete g_thread_pool;
+  }
+
   if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
 // Clear our global list of debugger objects
 {
@@ -2005,11 +2012,7 @@
 }
 
 llvm::ThreadPool &Debugger::GetThreadPool() {
-  // NOTE: intentional leak to avoid issues with C++ destructor chain
-  static llvm::ThreadPool *g_thread_pool = nullptr;
-  static llvm::once_flag g_once_flag;
-  llvm::call_once(g_once_flag, []() {
-g_thread_pool = new llvm::ThreadPool(llvm::optimal_concurrency());
-  });
+  assert(g_thread_pool &&
+ "Debugger::GetThreadPool called before Debugger::Initialize");
   return *g_thread_pool;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131328: [lldb] Support fetching symbols with dsymForUUID in the background

2022-08-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11f45f36dcf5: [lldb] Fetching symbols in the background with 
dsymForUUID (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D131328?vs=452786&id=452861#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131328

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/DebuggerEvents.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Symbol/LocateSymbolFile.h
  lldb/include/lldb/Target/Target.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/DebuggerEvents.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp

Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -554,7 +554,8 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-  Status &error, bool force_lookup) {
+  Status &error, bool force_lookup,
+  bool copy_executable) {
   const UUID *uuid_ptr = module_spec.GetUUIDPtr();
   const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
 
@@ -584,15 +585,18 @@
 
   // Create the dsymForUUID command.
   StreamString command;
+  const char *copy_executable_arg = copy_executable ? "--copyExecutable " : "";
   if (!uuid_str.empty()) {
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
-   dsymForUUID_exe_path.c_str(), uuid_str.c_str());
+command.Printf("%s --ignoreNegativeCache %s%s",
+   dsymForUUID_exe_path.c_str(), copy_executable_arg,
+   uuid_str.c_str());
 LLDB_LOGF(log, "Calling %s with UUID %s to find dSYM: %s",
   dsymForUUID_exe_path.c_str(), uuid_str.c_str(),
   command.GetString().data());
   } else if (!file_path_str.empty()) {
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
-   dsymForUUID_exe_path.c_str(), file_path_str.c_str());
+command.Printf("%s --ignoreNegativeCache %s%s",
+   dsymForUUID_exe_path.c_str(), copy_executable_arg,
+   file_path_str.c_str());
 LLDB_LOGF(log, "Calling %s with file %s to find dSYM: %s",
   dsymForUUID_exe_path.c_str(), file_path_str.c_str(),
   command.GetString().data());
Index: lldb/source/Symbol/LocateSymbolFile.cpp
===
--- lldb/source/Symbol/LocateSymbolFile.cpp
+++ lldb/source/Symbol/LocateSymbolFile.cpp
@@ -8,6 +8,8 @@
 
 #include "lldb/Symbol/LocateSymbolFile.h"
 
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Progress.h"
@@ -23,7 +25,9 @@
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/ThreadPool.h"
 
 // From MacOSX system header "mach/machine.h"
 typedef int cpu_type_t;
@@ -397,6 +401,35 @@
   return LocateExecutableSymbolFileDsym(module_spec);
 }
 
+void Symbols::DownloadSymbolFileAsync(const UUID &uuid) {
+  if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup())
+return;
+
+  static llvm::SmallSet g_seen_uuids;
+  static std::mutex g_mutex;
+  Debugger::GetThreadPool().async([=]() {
+{
+  std::lock_guard guard(g_mutex);
+  if (g_seen_uuids.count(uuid))
+return;
+  g_seen_uuids.insert(uuid);
+}
+
+Status error;
+ModuleSpec module_spec;
+module_spec.GetUUID() = uuid;
+if (!Symbols::DownloadObjectAndSymbolFile(module_spec, error,
+  /*force_lookup=*/true,
+  /*copy_executable=*/false))
+  return;
+
+if (error.Fail())
+  return;
+
+Debugger::ReportSymbolChange(module_spec);
+  });
+}
+
 #if !defined(__APPLE__)
 
 FileSpec Symbols::FindSymbolFileInBundle(const FileSpec &symfile_bundle,
@@ -407,7 +440,8 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-  Status &error, bool force_lookup) {
+  Status &error, bool force_lookup,
+  bool copy_executable) {
   // Fill in the module_spec.GetFileSpec() for the object file and/or the
   // module_spec.GetSymbolFileSpec() for the debug symbols file.
   return false;
Index: lldb/source/Core/ModuleList.cpp
===

[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

2022-08-15 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon updated this revision to Diff 452884.
fixathon added a comment.

Address the style issue by removing "using", and specifying std:: namespace 
explicitly.

Note, lldb style guide does not appear to prohibit the import of individual 
members from another namespace in a non-header file. Nevertheless, fixing the 
style for consistency.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131900

Files:
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp

Index: lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
===
--- lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -206,10 +206,10 @@
 t;
 )";
 
-static StructuredData::Array *
+static StructuredData::ArraySP
 CreateStackTrace(ValueObjectSP o,
  const std::string &trace_item_name = ".trace") {
-  StructuredData::Array *trace = new StructuredData::Array();
+  auto trace_sp = std::make_shared();
   ValueObjectSP trace_value_object =
   o->GetValueForExpressionPath(trace_item_name.c_str());
   size_t count = trace_value_object->GetNumChildren();
@@ -218,18 +218,17 @@
 trace_value_object->GetChildAtIndex(j, true)->GetValueAsUnsigned(0);
 if (trace_addr == 0)
   break;
-trace->AddItem(
-StructuredData::ObjectSP(new StructuredData::Integer(trace_addr)));
+trace_sp->AddItem(std::make_shared(trace_addr));
   }
-  return trace;
+  return trace_sp;
 }
 
-static StructuredData::Array *ConvertToStructuredArray(
+static StructuredData::ArraySP ConvertToStructuredArray(
 ValueObjectSP return_value_sp, const std::string &items_name,
 const std::string &count_name,
-std::function const
-&callback) {
-  StructuredData::Array *array = new StructuredData::Array();
+std::function const &callback) {
+  auto array_sp = std::make_shared();
   unsigned int count =
   return_value_sp->GetValueForExpressionPath(count_name.c_str())
   ->GetValueAsUnsigned(0);
@@ -237,13 +236,13 @@
   return_value_sp->GetValueForExpressionPath(items_name.c_str());
   for (unsigned int i = 0; i < count; i++) {
 ValueObjectSP o = objects->GetChildAtIndex(i, true);
-StructuredData::Dictionary *dict = new StructuredData::Dictionary();
+auto dict_sp = std::make_shared();
 
-callback(o, dict);
+callback(o, dict_sp);
 
-array->AddItem(StructuredData::ObjectSP(dict));
+array_sp->AddItem(dict_sp);
   }
-  return array;
+  return array_sp;
 }
 
 static std::string RetrieveString(ValueObjectSP return_value_sp,
@@ -264,7 +263,7 @@
   ConvertToStructuredArray(
   data, ".threads", ".thread_count",
   [process_sp, &thread_id_map](ValueObjectSP o,
-   StructuredData::Dictionary *dict) {
+   StructuredData::DictionarySP dict) {
 uint64_t thread_id =
 o->GetValueForExpressionPath(".tid")->GetValueAsUnsigned(0);
 uint64_t thread_os_id =
@@ -338,31 +337,31 @@
   std::map thread_id_map;
   GetRenumberedThreadIds(process_sp, main_value, thread_id_map);
 
-  StructuredData::Dictionary *dict = new StructuredData::Dictionary();
+  auto dict = std::make_shared();
   dict->AddStringItem("instrumentation_class", "ThreadSanitizer");
   dict->AddStringItem("issue_type",
   RetrieveString(main_value, process_sp, ".description"));
   dict->AddIntegerItem("report_count",
main_value->GetValueForExpressionPath(".report_count")
->GetValueAsUnsigned(0));
-  dict->AddItem("sleep_trace", StructuredData::ObjectSP(CreateStackTrace(
-   main_value, ".sleep_trace")));
+  dict->AddItem("sleep_trace", CreateStackTrace(
+   main_value, ".sleep_trace"));
 
-  StructuredData::Array *stacks = ConvertToStructuredArray(
+  StructuredData::ArraySP stacks = ConvertToStructuredArray(
   main_value, ".stacks", ".stack_count",
-  [thread_sp](ValueObjectSP o, StructuredData::Dictionary *dict) {
+  [thread_sp](ValueObjectSP o, StructuredData::DictionarySP dict) {
 dict->AddIntegerItem(
 "index",
 o->GetValueForExpressionPath(".idx")->GetValueAsUnsigned(0));
-dict->AddItem("trace", StructuredData::ObjectSP(CreateStackTrace(o)));
+dict->AddItem("trace", CreateStackTrace(o));
 // "stacks" happen on the current thread
 dict->AddIntegerItem("thread_id", thread_sp->GetIndexID());
   });
-  dict->AddItem("stacks", StructuredData::ObjectSP(stacks));
+  dict->AddItem("stacks", stacks);
 
-  StructuredData::Array *mops = ConvertToStructuredArray(
+  StructuredData::ArraySP mops = ConvertToStructuredArray(
   main_valu

[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-15 Thread Stella Laurenzo via Phabricator via lldb-commits
stellaraccident accepted this revision.
stellaraccident added inline comments.



Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:1257
+
+set(LLVM_THIRD_PARTY_DIR  ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE 
STRING
+"Directory containing third party software used by LLVM (e.g. googletest)")

tstellar wrote:
> stellaraccident wrote:
> > Is the implication that this file should only ever be included by top-level 
> > sub-projects (i.e. clang, mlir, llvm, etc)? If included from elsewhere, it 
> > seems like it won't do the right thing.
> > 
> > Also, having this as a cache entry is going to make it harder for out of 
> > tree projects to define it reliably (requiring various FORCE heroics) -- 
> > but I know why you are doing it if trying to define it here.
> > 
> > As is, this file is included from most of the top-levels and making it a 
> > cache variable will have them racing to set it. Why not make it a regular 
> > variable? And why not derive it from LLVM_MAIN_SRC_DIR?
> I put it in this file so that this variable would be available for 
> stand-alone builds and made it a cache variable so it could be overridden by 
> standalone builds too.
> 
> The alternative would be to define this variable in llvm/CMakeLists.txt and 
> then in the stand-alone build handling for each sub-project.  It's a lot of 
> code duplication that way, but we already have a lot of similar duplication 
> in the CMakeLists.txt today (this is something I would like to clean up in 
> the future).
> 
> Using LLVM_MAIN_SRC_DIR here breaks stand-alone builds, because 
> LLVM_MAIN_SRC_DIR expands to ../llvm/../, so if I try to build lld, with a 
> directory layout of:
> 
> ```
> lld/ cmake/ third-party/
> ```
> 
> Then CMake won't be able to find the third-party/ directory even though it is 
> in the right place (because llvm/ is missing).  I also think in general, it's 
> cleaner to only use LLVM_MAIN_SRC_DIR when we want to use files in llvm/ and 
> not for finding the root of the monorepo.
Thanks - I think I understand why you are doing it this way. I'm just trying to 
think of a way that has fewer thorns... And not being successful (without major 
surgery on the way this cmake setup is layered). I'm fine with how you have it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131919

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