[Lldb-commits] [lldb] bed4d71 - [lldb] Fix racing issue when loading inlined symbols from crash report

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T22:18:35-07:00
New Revision: bed4d7155b81619d403b1f85ece56f33275b30ac

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

LOG: [lldb] Fix racing issue when loading inlined symbols from crash report

Following abba5de72466, some tests started failing on green-dragon:

https://green.lab.llvm.org/green/job/lldb-cmake/55460/console

Looking at the backtrace, there seems to be a racing issue when deleting
the temporary directory containing all the JSON object files:

```
Traceback (most recent call last):
  File 
"/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py",
 line 1115, in __call__
SymbolicateCrashLogs(debugger, shlex.split(command), result)
  File 
"/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py",
 line 1457, in SymbolicateCrashLogs
SymbolicateCrashLog(crash_log, options)
  File 
"/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py",
 line 1158, in SymbolicateCrashLog
with tempfile.TemporaryDirectory() as obj_dir:
  File 
"/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py",
 line 869, in __exit__
self.cleanup()
  File 
"/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py",
 line 873, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
  File 
"/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py",
 line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
  File 
"/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py",
 line 731, in rmtree
onerror(os.rmdir, path, sys.exc_info())
  File 
"/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py",
 line 729, in rmtree
os.rmdir(path)
OSError: [Errno 66] Directory not empty: 
'/var/folders/09/r4vw4v8n5kb67jl66zvlbljwgn/T/tmp6qfifxk7'
```

This patch should fix that issue since it won't delete the object file
directory until we're sure that the modules adding tasks completed.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index 7bfa4021f49d..92e2a6248c94 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1154,8 +1154,8 @@ def SymbolicateCrashLog(crash_log, options):
 
 futures = []
 loaded_images = []
-with concurrent.futures.ThreadPoolExecutor() as executor:
-with tempfile.TemporaryDirectory() as obj_dir:
+with tempfile.TemporaryDirectory() as obj_dir:
+with concurrent.futures.ThreadPoolExecutor() as executor:
 
 def add_module(image, target, obj_dir):
 return image, image.add_module(target, obj_dir)
@@ -1166,12 +1166,12 @@ def add_module(image, target, obj_dir):
 add_module, image=image, target=target, obj_dir=obj_dir
 )
 )
-for future in concurrent.futures.as_completed(futures):
-image, err = future.result()
-if err:
-print(err)
-else:
-loaded_images.append(image)
+for future in concurrent.futures.as_completed(futures):
+image, err = future.result()
+if err:
+print(err)
+else:
+loaded_images.append(image)
 
 if crash_log.backtraces:
 for thread in crash_log.backtraces:



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


[Lldb-commits] [lldb] f6938ff - [lldb][test] Fix -Wsign-compare in GDBRemoteCommunicationClientTest.cpp (NFC)

2023-05-22 Thread Jie Fu via lldb-commits

Author: Jie Fu
Date: 2023-05-23T09:09:07+08:00
New Revision: f6938ffd4c56d270af62296e405a6b8bddf7955f

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

LOG: [lldb][test] Fix -Wsign-compare in GDBRemoteCommunicationClientTest.cpp 
(NFC)

/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11:
 error: comparison of integers of different signs: 'const int' and 'const 
unsigned long' [-Werror,-Wsign-compare]
  if (lhs == rhs) {
  ~~~ ^  ~~~
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12:
 note: in instantiation of function template specialization 
'testing::internal::CmpHelperEQ' requested here
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
   ^
/data/llvm-project/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp:303:3:
 note: in instantiation of function template specialization 
'testing::internal::EqHelper::Compare' requested 
here
  ASSERT_EQ(10, num_packets);
  ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2056:32:
 note: expanded from macro 'ASSERT_EQ'
   ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2040:54:
 note: expanded from macro 'GTEST_ASSERT_EQ'
  ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
 ^
1 error generated.

Added: 


Modified: 
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Removed: 




diff  --git 
a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index eec494f6759ff..f93cf8ce679c5 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -300,7 +300,7 @@ TEST_F(GDBRemoteCommunicationClientTest, 
TestPacketSpeedJSON) {
   size_t num_packets;
   ASSERT_TRUE(dict_sp->GetValueForKeyAsInteger("num_packets", num_packets))
   << ss.GetString();
-  ASSERT_EQ(10, num_packets);
+  ASSERT_EQ(10, (int)num_packets);
 }
 
 TEST_F(GDBRemoteCommunicationClientTest, SendSignalsToIgnore) {



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


[Lldb-commits] [PATCH] D151043: [lldb] Add "Trace" stop reason in Scripted Thread

2023-05-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

If a Scripted process is able to provide private events and enough info to 
lldb's lower level calls (read memory, registers) to work the thread-plan 
machinery then it won't need to generate the inferred stop reasons like 
PlanComplete and Instrumentation.  But the scripted threads might just be 
producing public stops w/o the underlying model that would allow lldb to 
generate them.  In that case, the scripted thread will also need to be able to 
produce the inferred stop reasons.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151043

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


[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGabba5de72466: [lldb/crashlog] Remove tempfile prefix from 
inlined symbol object file (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151045

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/symbolication.py

Index: lldb/examples/python/symbolication.py
===
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -368,7 +368,7 @@
 else:
 return 'error: no section infos'
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=None):
 '''Add the Image described in this object to "target" and load the sections if "load" is True.'''
 if target:
 # Try and find using UUID only first so that paths need not match
@@ -384,7 +384,7 @@
 resolved_path, None, uuid_str, self.symfile)
 if not self.module and self.section_infos:
 name = os.path.basename(self.path)
-with tempfile.NamedTemporaryFile(suffix='.' + name) as tf:
+if obj_dir and os.path.isdir(obj_dir):
 data = {
 'triple': target.triple,
 'uuid': uuid_str,
@@ -398,9 +398,10 @@
 'size': section.end_addr - section.start_addr
 })
 data['symbols'] = list(self.symbols.values())
-with open(tf.name, 'w') as f:
+obj_file = os.path.join(obj_dir, name)
+with open(obj_file, "w") as f:
 f.write(json.dumps(data, indent=4))
-self.module = target.AddModule(tf.name, None, uuid_str)
+self.module = target.AddModule(obj_file, None, uuid_str)
 if self.module:
 # If we were able to add the module with inlined
 # symbols, we should mark it as available so load_module
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -1,4 +1,4 @@
-import os,json,struct,signal,uuid
+import os, json, struct, signal, uuid, tempfile
 
 from typing import Any, Dict
 
@@ -38,16 +38,17 @@
 for image in self.crashlog.find_images_with_identifier(ident):
 image.resolve = True
 
-for image in self.crashlog.images:
-if image not in self.loaded_images:
-if image.uuid == uuid.UUID(int=0):
-continue
-err = image.add_module(self.target)
-if err:
-# Append to SBCommandReturnObject
-print(err)
-else:
-self.loaded_images.append(image)
+with tempfile.TemporaryDirectory() as obj_dir:
+for image in self.crashlog.images:
+if image not in self.loaded_images:
+if image.uuid == uuid.UUID(int=0):
+continue
+err = image.add_module(self.target, obj_dir)
+if err:
+# Append to SBCommandReturnObject
+print(err)
+else:
+self.loaded_images.append(image)
 
 for thread in self.crashlog.threads:
 if hasattr(thread, 'app_specific_backtrace') and thread.app_specific_backtrace:
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -40,6 +40,7 @@
 import string
 import subprocess
 import sys
+import tempfile
 import threading
 import time
 import uuid
@@ -1154,12 +1155,17 @@
 futures = []
 loaded_images = []
 with concurrent.futures.ThreadPoolExecutor() as executor:
-def add_module(image, target):
-return image, image.add_module(target)
+with tempfile.TemporaryDirectory() as obj_dir:
 
-for image in crash_log.images:
-futures.append(executor.submit(add_module, image=image, target=target))
+def add_module(image, target, obj_dir):
+return image, image.add_module(target, obj_dir)
 
+for image in crash_log.images:
+futures.append(
+executor.submit(
+add_module, image=image, target=target, obj_dir=obj_dir
+)
+ 

[Lldb-commits] [lldb] abba5de - [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T16:14:00-07:00
New Revision: abba5de724665362db707d4cfab598cfbf5a475e

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

LOG: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

This patch changes the way we generate the ObjectFileJSON files
containing the inlined symbols from the crash report to remove the
tempfile prefix from the object file name.

To do so, instead of creating a new tempfile for each module, we create a
temporary directory that contains each module object file with the same
name as the module.

This makes the backtraces only contain the module name without the
temfile prefix which makes it look like a regular stackframe.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py
lldb/examples/python/scripted_process/crashlog_scripted_process.py
lldb/examples/python/symbolication.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index d207af10f36f2..7bfa4021f49df 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -40,6 +40,7 @@
 import string
 import subprocess
 import sys
+import tempfile
 import threading
 import time
 import uuid
@@ -1154,12 +1155,17 @@ def SymbolicateCrashLog(crash_log, options):
 futures = []
 loaded_images = []
 with concurrent.futures.ThreadPoolExecutor() as executor:
-def add_module(image, target):
-return image, image.add_module(target)
+with tempfile.TemporaryDirectory() as obj_dir:
 
-for image in crash_log.images:
-futures.append(executor.submit(add_module, image=image, 
target=target))
+def add_module(image, target, obj_dir):
+return image, image.add_module(target, obj_dir)
 
+for image in crash_log.images:
+futures.append(
+executor.submit(
+add_module, image=image, target=target, obj_dir=obj_dir
+)
+)
 for future in concurrent.futures.as_completed(futures):
 image, err = future.result()
 if err:

diff  --git 
a/lldb/examples/python/scripted_process/crashlog_scripted_process.py 
b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index 46b2816032a59..43e307bbe69b5 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -1,4 +1,4 @@
-import os,json,struct,signal,uuid
+import os, json, struct, signal, uuid, tempfile
 
 from typing import Any, Dict
 
@@ -38,16 +38,17 @@ def set_crashlog(self, crashlog):
 for image in 
self.crashlog.find_images_with_identifier(ident):
 image.resolve = True
 
-for image in self.crashlog.images:
-if image not in self.loaded_images:
-if image.uuid == uuid.UUID(int=0):
-continue
-err = image.add_module(self.target)
-if err:
-# Append to SBCommandReturnObject
-print(err)
-else:
-self.loaded_images.append(image)
+with tempfile.TemporaryDirectory() as obj_dir:
+for image in self.crashlog.images:
+if image not in self.loaded_images:
+if image.uuid == uuid.UUID(int=0):
+continue
+err = image.add_module(self.target, obj_dir)
+if err:
+# Append to SBCommandReturnObject
+print(err)
+else:
+self.loaded_images.append(image)
 
 for thread in self.crashlog.threads:
 if hasattr(thread, 'app_specific_backtrace') and 
thread.app_specific_backtrace:

diff  --git a/lldb/examples/python/symbolication.py 
b/lldb/examples/python/symbolication.py
index 3a42f340ea578..74de7dda8e4a3 100755
--- a/lldb/examples/python/symbolication.py
+++ b/lldb/examples/python/symbolication.py
@@ -368,7 +368,7 @@ def load_module(self, target):
 else:
 return 'error: no section infos'
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=None):
 '''Add the Image described in this object to "target" and load the 
sections if "load" is True.'''
 if target:
 # Try and find using UUID only first so that paths need not match
@@ -384,7 +384,7 @@ def add_module(self, target):
 resolved_path, None, uuid_str, self.symfile)
 

[Lldb-commits] [PATCH] D151044: [lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG273a2d337f67: [lldb] Move PassthroughScriptedProcess to 
`lldb.scripted_process` module (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151044

Files:
  lldb/examples/python/scripted_process/scripted_process.py
  
lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py

Index: lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py
===
--- lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py
+++ lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py
@@ -12,102 +12,10 @@
 from typing import Any, Dict
 
 import lldb
-from lldb.plugins.scripted_process import ScriptedProcess
-from lldb.plugins.scripted_process import ScriptedThread
+from lldb.plugins.scripted_process import PassthroughScriptedProcess
+from lldb.plugins.scripted_process import PassthroughScriptedThread
 
-
-class PassthruScriptedProcess(ScriptedProcess):
-driving_target = None
-driving_process = None
-
-def __init__(
-self,
-exe_ctx: lldb.SBExecutionContext,
-args: lldb.SBStructuredData,
-launched_driving_process: bool = True,
-):
-super().__init__(exe_ctx, args)
-
-self.driving_target = None
-self.driving_process = None
-
-self.driving_target_idx = args.GetValueForKey("driving_target_idx")
-if self.driving_target_idx and self.driving_target_idx.IsValid():
-if self.driving_target_idx.GetType() == lldb.eStructuredDataTypeInteger:
-idx = self.driving_target_idx.GetIntegerValue(42)
-if self.driving_target_idx.GetType() == lldb.eStructuredDataTypeString:
-idx = int(self.driving_target_idx.GetStringValue(100))
-self.driving_target = self.target.GetDebugger().GetTargetAtIndex(idx)
-
-if launched_driving_process:
-self.driving_process = self.driving_target.GetProcess()
-for driving_thread in self.driving_process:
-structured_data = lldb.SBStructuredData()
-structured_data.SetFromJSON(
-json.dumps(
-{
-"driving_target_idx": idx,
-"thread_idx": driving_thread.GetIndexID(),
-}
-)
-)
-
-self.threads[driving_thread.GetThreadID()] = PassthruScriptedThread(
-self, structured_data
-)
-
-for module in self.driving_target.modules:
-path = module.file.fullpath
-load_addr = module.GetObjectFileHeaderAddress().GetLoadAddress(
-self.driving_target
-)
-self.loaded_images.append({"path": path, "load_addr": load_addr})
-
-def get_memory_region_containing_address(
-self, addr: int
-) -> lldb.SBMemoryRegionInfo:
-mem_region = lldb.SBMemoryRegionInfo()
-error = self.driving_process.GetMemoryRegionInfo(addr, mem_region)
-if error.Fail():
-return None
-return mem_region
-
-def read_memory_at_address(
-self, addr: int, size: int, error: lldb.SBError
-) -> lldb.SBData:
-data = lldb.SBData()
-bytes_read = self.driving_process.ReadMemory(addr, size, error)
-
-if error.Fail():
-return data
-
-data.SetDataWithOwnership(
-error,
-bytes_read,
-self.driving_target.GetByteOrder(),
-self.driving_target.GetAddressByteSize(),
-)
-
-return data
-
-def write_memory_at_address(
-self, addr: int, data: lldb.SBData, error: lldb.SBError
-) -> int:
-return self.driving_process.WriteMemory(
-addr, bytearray(data.uint8.all()), error
-)
-
-def get_process_id(self) -> int:
-return 42
-
-def is_alive(self) -> bool:
-return True
-
-def get_scripted_thread_plugin(self) -> str:
-return f"{PassthruScriptedThread.__module__}.{PassthruScriptedThread.__name__}"
-
-
-class MultiplexedScriptedProcess(PassthruScriptedProcess):
+class MultiplexedScriptedProcess(PassthroughScriptedProcess):
 def __init__(self, exe_ctx: lldb.SBExecutionContext, args: lldb.SBStructuredData):
 super().__init__(exe_ctx, args)
 self.multiplexer = None
@@ -115,11 +23,11 @@
 parity = args.GetValueForKey("parity")
 # TODO: Change to Walrus operator (:=) with oneline if assignment
 # Requires python 3.8
-val = 

[Lldb-commits] [lldb] 273a2d3 - [lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T16:14:00-07:00
New Revision: 273a2d337f675f3ee050f281b1fecc3e806b9a3c

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

LOG: [lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module

This patch moves the `PassthroughScriptedProcess` & `PassthroughScriptedThread`
classes from the `interactive_scripted_process.py` test implementation
to the `lldb.scripted_process` python module.

This class is very versatile so it makes more sense to ship it with the
python module to make it easier for our adopters to derive their class
from it instead of copying it.

During the "migration", I've also noticed some bugs in the
`PassthroughScriptedThread` creation and update, so I also fixed that as
part of this patch.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/scripted_process/scripted_process.py

lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py

Removed: 




diff  --git a/lldb/examples/python/scripted_process/scripted_process.py 
b/lldb/examples/python/scripted_process/scripted_process.py
index a0880fbb6268f..b809f6c8224c3 100644
--- a/lldb/examples/python/scripted_process/scripted_process.py
+++ b/lldb/examples/python/scripted_process/scripted_process.py
@@ -1,6 +1,7 @@
 from abc import ABCMeta, abstractmethod
 
 import lldb
+import json, struct, signal
 
 class ScriptedProcess(metaclass=ABCMeta):
 
@@ -225,7 +226,6 @@ def create_breakpoint(self, addr, error):
  % self.__class__.__name__)
 return False
 
-
 class ScriptedThread(metaclass=ABCMeta):
 
 """
@@ -376,6 +376,162 @@ def get_extended_info(self):
 """
 return self.extended_info
 
+
+class PassthroughScriptedProcess(ScriptedProcess):
+driving_target = None
+driving_process = None
+
+def __init__(self, exe_ctx, args, launched_driving_process=True):
+super().__init__(exe_ctx, args)
+
+self.driving_target = None
+self.driving_process = None
+
+self.driving_target_idx = args.GetValueForKey("driving_target_idx")
+if self.driving_target_idx and self.driving_target_idx.IsValid():
+idx = self.driving_target_idx.GetUnsignedIntegerValue(42)
+self.driving_target = 
self.target.GetDebugger().GetTargetAtIndex(idx)
+
+if launched_driving_process:
+self.driving_process = self.driving_target.GetProcess()
+for driving_thread in self.driving_process:
+structured_data = lldb.SBStructuredData()
+structured_data.SetFromJSON(
+json.dumps(
+{
+"driving_target_idx": idx,
+"thread_idx": driving_thread.GetIndexID(),
+}
+)
+)
+
+self.threads[
+driving_thread.GetThreadID()
+] = PassthroughScriptedThread(self, structured_data)
+
+for module in self.driving_target.modules:
+path = module.file.fullpath
+load_addr = 
module.GetObjectFileHeaderAddress().GetLoadAddress(
+self.driving_target
+)
+self.loaded_images.append({"path": path, "load_addr": 
load_addr})
+
+def get_memory_region_containing_address(self, addr):
+mem_region = lldb.SBMemoryRegionInfo()
+error = self.driving_process.GetMemoryRegionInfo(addr, mem_region)
+if error.Fail():
+return None
+return mem_region
+
+def read_memory_at_address(self, addr, size, error):
+data = lldb.SBData()
+bytes_read = self.driving_process.ReadMemory(addr, size, error)
+
+if error.Fail():
+return data
+
+data.SetDataWithOwnership(
+error,
+bytes_read,
+self.driving_target.GetByteOrder(),
+self.driving_target.GetAddressByteSize(),
+)
+
+return data
+
+def write_memory_at_address(self, addr, data, error):
+return self.driving_process.WriteMemory(
+addr, bytearray(data.uint8.all()), error
+)
+
+def get_process_id(self):
+return self.driving_process.GetProcessID()
+
+def is_alive(self):
+return True
+
+def get_scripted_thread_plugin(self):
+return 
f"{PassthroughScriptedThread.__module__}.{PassthroughScriptedThread.__name__}"
+
+
+class PassthroughScriptedThread(ScriptedThread):
+def __init__(self, process, args):
+

[Lldb-commits] [lldb] 8f407b8 - [lldb] Add "Trace" stop reason in Scripted Thread

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T16:14:00-07:00
New Revision: 8f407b8e632956816e49d1ac0ffd6ff5245252a6

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

LOG: [lldb] Add "Trace" stop reason in Scripted Thread

This patch adds support to eStopReasonTrace to Scripted Threads.

This is necessary when using a Scrited Process with a Scripted Thread
Plan to report a special thread stop reason to the thread plan.

rdar://109425542

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py

Removed: 




diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index 2c1516f3085e9..ac707ffb21711 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -258,6 +258,9 @@ bool ScriptedThread::CalculateStopInfo() {
 stop_info_sp =
 StopInfo::CreateStopReasonWithSignal(*this, signal, 
description.data());
   } break;
+  case lldb::eStopReasonTrace: {
+stop_info_sp = StopInfo::CreateStopReasonToTrace(*this);
+  } break;
   case lldb::eStopReasonException: {
 #if defined(__APPLE__)
 StructuredData::Dictionary *mach_exception;

diff  --git 
a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py 
b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index b5a14a9cd63de..8cbd76a85396b 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -186,7 +186,7 @@ def cleanup():
 self.assertTrue(thread, "Invalid thread.")
 self.assertEqual(thread.GetThreadID(), 0x19)
 self.assertEqual(thread.GetName(), "DummyScriptedThread.thread-1")
-self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
+self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonTrace)
 
 self.assertGreater(thread.GetNumFrames(), 0)
 

diff  --git 
a/lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py 
b/lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
index 3f6ce6c1f9feb..f2b385fb84abe 100644
--- a/lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ b/lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -67,9 +67,7 @@ def get_state(self) -> int:
 return lldb.eStateStopped
 
 def get_stop_reason(self) -> Dict[str, Any]:
-return { "type": lldb.eStopReasonSignal, "data": {
-"signal": signal.SIGINT
-} }
+return { "type": lldb.eStopReasonTrace, "data": {} }
 
 def get_register_context(self) -> str:
 return struct.pack(



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


[Lldb-commits] [lldb] ac09a0e - [lldb] Fix process LLDB_LOG typo (nfci)

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T16:14:00-07:00
New Revision: ac09a0e192e357a37d183f26f1063d18d6babf72

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

LOG: [lldb] Fix process LLDB_LOG typo (nfci)

This patch fixes the log commands by replacing the LLDB_LOG macro by the
LLDB_LOGF macro. This is necessary in order to format argument with printf.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9e9b1da948f7..0aefeebbc07b 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1056,13 +1056,13 @@ bool Process::SetExitStatus(int status, const char 
*cstr) {
   std::lock_guard guard(m_exit_status_mutex);
 
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s status=%i (0x%8.8x), description=%s%s%s)",
+  LLDB_LOGF(log, "(plugin = %s status=%i (0x%8.8x), description=%s%s%s)",
GetPluginName().data(), status, status, cstr ? "\"" : "",
cstr ? cstr : "NULL", cstr ? "\"" : "");
 
   // We were already in the exited state
   if (m_private_state.GetValue() == eStateExited) {
-LLDB_LOG(log,
+LLDB_LOGF(log,
  "(plugin = %s) ignoring exit status because state was already set 
"
  "to eStateExited",
  GetPluginName().data());
@@ -1317,7 +1317,7 @@ void Process::SetPublicState(StateType new_state, bool 
restarted) {
   }
 
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s, state = %s, restarted = %i)",
+  LLDB_LOGF(log, "(plugin = %s, state = %s, restarted = %i)",
GetPluginName().data(), StateAsCString(new_state), restarted);
   const StateType old_state = m_public_state.GetValue();
   m_public_state.SetValue(new_state);
@@ -1327,7 +1327,7 @@ void Process::SetPublicState(StateType new_state, bool 
restarted) {
   // program to run.
   if (!StateChangedIsExternallyHijacked()) {
 if (new_state == eStateDetached) {
-  LLDB_LOG(log,
+  LLDB_LOGF(log,
"(plugin = %s, state = %s) -- unlocking run lock for detach",
GetPluginName().data(), StateAsCString(new_state));
   m_public_run_lock.SetStopped();
@@ -1335,7 +1335,7 @@ void Process::SetPublicState(StateType new_state, bool 
restarted) {
   const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
   if ((old_state_is_stopped != new_state_is_stopped)) {
 if (new_state_is_stopped && !restarted) {
-  LLDB_LOG(log, "(plugin = %s, state = %s) -- unlocking run lock",
+  LLDB_LOGF(log, "(plugin = %s, state = %s) -- unlocking run lock",
GetPluginName().data(), StateAsCString(new_state));
   m_public_run_lock.SetStopped();
 }
@@ -1346,10 +1346,10 @@ void Process::SetPublicState(StateType new_state, bool 
restarted) {
 
 Status Process::Resume() {
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
-  LLDB_LOG(log, "(plugin = %s) -- locking run lock", GetPluginName().data());
+  LLDB_LOGF(log, "(plugin = %s) -- locking run lock", GetPluginName().data());
   if (!m_public_run_lock.TrySetRunning()) {
 Status error("Resume request failed - process still running.");
-LLDB_LOG(log, "(plugin = %s) -- TrySetRunning failed, not resuming.",
+LLDB_LOGF(log, "(plugin = %s) -- TrySetRunning failed, not resuming.",
  GetPluginName().data());
 return error;
   }
@@ -1423,7 +1423,7 @@ void Process::SetPrivateState(StateType new_state) {
   Log *log(GetLog(LLDBLog::State | LLDBLog::Process | LLDBLog::Unwind));
   bool state_changed = false;
 
-  LLDB_LOG(log, "(plugin = %s, state = %s)", GetPluginName().data(),
+  LLDB_LOGF(log, "(plugin = %s, state = %s)", GetPluginName().data(),
StateAsCString(new_state));
 
   std::lock_guard thread_guard(m_thread_list.GetMutex());
@@ -1465,14 +1465,14 @@ void Process::SetPrivateState(StateType new_state) {
   if (!m_mod_id.IsLastResumeForUserExpression())
 m_mod_id.SetStopEventForLastNaturalStopID(event_sp);
   m_memory_cache.Clear();
-  LLDB_LOG(log, "(plugin = %s, state = %s, stop_id = %u",
+  LLDB_LOGF(log, "(plugin = %s, state = %s, stop_id = %u",
GetPluginName().data(), StateAsCString(new_state),
m_mod_id.GetStopID());
 }
 
 m_private_state_broadcaster.BroadcastEvent(event_sp);
   } else {
-LLDB_LOG(log, "(plugin = %s, state = %s) state didn't change. Ignoring...",
+LLDB_LOGF(log, "(plugin = %s, state = %s) state didn't change. 
Ignoring...",
  GetPluginName().data(), StateAsCString(new_state));
   }
 }




[Lldb-commits] [PATCH] D151043: [lldb] Add "Trace" stop reason in Scripted Thread

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f407b8e6329: [lldb] Add Trace stop reason in 
Scripted Thread (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151043

Files:
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
  lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py


Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -67,9 +67,7 @@
 return lldb.eStateStopped
 
 def get_stop_reason(self) -> Dict[str, Any]:
-return { "type": lldb.eStopReasonSignal, "data": {
-"signal": signal.SIGINT
-} }
+return { "type": lldb.eStopReasonTrace, "data": {} }
 
 def get_register_context(self) -> str:
 return struct.pack(
Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -186,7 +186,7 @@
 self.assertTrue(thread, "Invalid thread.")
 self.assertEqual(thread.GetThreadID(), 0x19)
 self.assertEqual(thread.GetName(), "DummyScriptedThread.thread-1")
-self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
+self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonTrace)
 
 self.assertGreater(thread.GetNumFrames(), 0)
 
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -258,6 +258,9 @@
 stop_info_sp =
 StopInfo::CreateStopReasonWithSignal(*this, signal, 
description.data());
   } break;
+  case lldb::eStopReasonTrace: {
+stop_info_sp = StopInfo::CreateStopReasonToTrace(*this);
+  } break;
   case lldb::eStopReasonException: {
 #if defined(__APPLE__)
 StructuredData::Dictionary *mach_exception;


Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -67,9 +67,7 @@
 return lldb.eStateStopped
 
 def get_stop_reason(self) -> Dict[str, Any]:
-return { "type": lldb.eStopReasonSignal, "data": {
-"signal": signal.SIGINT
-} }
+return { "type": lldb.eStopReasonTrace, "data": {} }
 
 def get_register_context(self) -> str:
 return struct.pack(
Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -186,7 +186,7 @@
 self.assertTrue(thread, "Invalid thread.")
 self.assertEqual(thread.GetThreadID(), 0x19)
 self.assertEqual(thread.GetName(), "DummyScriptedThread.thread-1")
-self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
+self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonTrace)
 
 self.assertGreater(thread.GetNumFrames(), 0)
 
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -258,6 +258,9 @@
 stop_info_sp =
 StopInfo::CreateStopReasonWithSignal(*this, signal, description.data());
   } break;
+  case lldb::eStopReasonTrace: {
+stop_info_sp = StopInfo::CreateStopReasonToTrace(*this);
+  } break;
   case lldb::eStopReasonException: {
 #if defined(__APPLE__)
 StructuredData::Dictionary *mach_exception;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1370a1c - [lldb] Add support for negative integer to {SB, }StructuredData

2023-05-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-22T16:14:00-07:00
New Revision: 1370a1cb5b97ecfc4fd2cb550159db9c9ebd3a68

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

LOG: [lldb] Add support for negative integer to {SB,}StructuredData

This patch refactors the `StructuredData::Integer` class to make it
templated, makes it private and adds 2 public specialization for both
`int64_t` & `uint64_t` with a public type aliases, respectively
`SignedInteger` & `UnsignedInteger`.

It adds new getter for signed and unsigned interger values to the
`StructuredData::Object` base class and changes the implementation of
`StructuredData::Array::GetItemAtIndexAsInteger` and
`StructuredData::Dictionary::GetValueForKeyAsInteger` to support signed
and unsigned integers.

This patch also adds 2 new `Get{Signed,Unsigned}IntegerValue` to the
`SBStructuredData` class and marks `GetIntegerValue` as deprecated.

Finally, this patch audits all the caller of `StructuredData::Integer`
or `StructuredData::GetIntegerValue` to use the proper type as well the
various tests that uses `SBStructuredData.GetIntegerValue`.

rdar://105575764

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/API/SBStructuredData.h
lldb/include/lldb/Core/StructuredDataImpl.h
lldb/include/lldb/Utility/StructuredData.h
lldb/include/lldb/lldb-enumerations.h
lldb/source/API/SBStructuredData.cpp
lldb/source/API/SBThread.cpp
lldb/source/Breakpoint/BreakpointOptions.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Host/common/XML.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp

lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp

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

lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
lldb/source/Target/DynamicRegisterInfo.cpp
lldb/source/Target/Thread.cpp
lldb/source/Utility/StructuredData.cpp
lldb/test/API/commands/target/stop-hooks/stop_hook.py
lldb/test/API/functionalities/step_scripted/Steps.py
lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/API/SBStructuredData.h 
b/lldb/include/lldb/API/SBStructuredData.h
index 75f8ebb7c9e75..2f6263843ba28 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -57,7 +57,7 @@ class SBStructuredData {
 
   /// Fill keys with the keys in this object and return true if this data
   /// structure is a dictionary.  Returns false otherwise.
-   bool GetKeys(lldb::SBStringList ) const;
+  bool GetKeys(lldb::SBStringList ) const;
 
   /// Return the value corresponding to a key if this data structure
   /// is a dictionary type.
@@ -68,6 +68,12 @@ class SBStructuredData {
   lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
 
   /// Return the integer value if this data structure is an integer type.
+  uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0) const;
+  /// Return the integer value if this data structure is an integer type.
+  int64_t GetSignedIntegerValue(int64_t fail_value = 0) const;
+
+  LLDB_DEPRECATED("Specify if the value is signed or unsigned",
+  "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
   uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
 
   /// Return the floating point value if this data structure is 

[Lldb-commits] [PATCH] D150485: [lldb] Add support for negative integer to {SB, }StructuredData

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1370a1cb5b97: [lldb] Add support for negative integer to 
{SB,}StructuredData (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150485

Files:
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/Core/StructuredDataImpl.h
  lldb/include/lldb/Utility/StructuredData.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBStructuredData.cpp
  lldb/source/API/SBThread.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointResolver.cpp
  lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Host/common/XML.cpp
  lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  
lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
  
lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
  lldb/source/Target/DynamicRegisterInfo.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/test/API/commands/target/stop-hooks/stop_hook.py
  lldb/test/API/functionalities/step_scripted/Steps.py
  lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
  lldb/tools/lldb-vscode/JSONUtils.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -19,6 +19,8 @@
 
 #include "PythonTestSuite.h"
 
+#include 
+
 using namespace lldb_private;
 using namespace lldb_private::python;
 using llvm::Error;
@@ -266,10 +268,23 @@
 
 TEST_F(PythonDataObjectsTest, TestPythonIntegerToStr) {}
 
-TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredInteger) {
+TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredUnsignedInteger) {
   PythonInteger integer(7);
   auto int_sp = integer.CreateStructuredInteger();
-  EXPECT_EQ(7U, int_sp->GetValue());
+  EXPECT_TRUE(
+  std::holds_alternative(int_sp));
+  StructuredData::UnsignedIntegerSP uint_sp =
+  std::get(int_sp);
+  EXPECT_EQ(7U, uint_sp->GetValue());
+}
+
+TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredSignedInteger) {
+  PythonInteger integer(-42);
+  auto int_sp = integer.CreateStructuredInteger();
+  EXPECT_TRUE(std::holds_alternative(int_sp));
+  StructuredData::SignedIntegerSP sint_sp =
+  std::get(int_sp);
+  EXPECT_EQ(-42, sint_sp->GetValue());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonStringToStructuredString) {
@@ -358,7 +373,7 @@
   EXPECT_EQ(lldb::eStructuredDataTypeString,
 array_sp->GetItemAtIndex(1)->GetType());
 
-  auto int_sp = array_sp->GetItemAtIndex(0)->GetAsInteger();
+  auto int_sp = array_sp->GetItemAtIndex(0)->GetAsUnsignedInteger();
   auto string_sp = array_sp->GetItemAtIndex(1)->GetAsString();
 
   EXPECT_EQ(long_value0, long(int_sp->GetValue()));
@@ -522,7 +537,7 @@
   EXPECT_TRUE(dict_sp->HasKey(string_key1));
 
   auto string_sp = dict_sp->GetValueForKey(string_key0)->GetAsString();
-  auto int_sp = dict_sp->GetValueForKey(string_key1)->GetAsInteger();
+  auto int_sp = dict_sp->GetValueForKey(string_key1)->GetAsUnsignedInteger();
 
   EXPECT_EQ(string_value0, string_sp->GetValue());
   EXPECT_EQ(int_value1, long(int_sp->GetValue()));
@@ -592,7 +607,7 @@
   structured_dict_ptr->GetValueForKey(key_name);
   EXPECT_TRUE((bool)structured_addr_value_sp);
   const uint64_t extracted_value =
-  structured_addr_value_sp->GetIntegerValue(123);
+  structured_addr_value_sp->GetUnsignedIntegerValue(123);
   EXPECT_TRUE(extracted_value == value);
 }
   }

[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D151045

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


[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 524521.
mib added a comment.

More refactoring


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

https://reviews.llvm.org/D151045

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/symbolication.py

Index: lldb/examples/python/symbolication.py
===
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -368,7 +368,7 @@
 else:
 return 'error: no section infos'
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=None):
 '''Add the Image described in this object to "target" and load the sections if "load" is True.'''
 if target:
 # Try and find using UUID only first so that paths need not match
@@ -384,7 +384,7 @@
 resolved_path, None, uuid_str, self.symfile)
 if not self.module and self.section_infos:
 name = os.path.basename(self.path)
-with tempfile.NamedTemporaryFile(suffix='.' + name) as tf:
+if obj_dir and os.path.isdir(obj_dir):
 data = {
 'triple': target.triple,
 'uuid': uuid_str,
@@ -398,9 +398,10 @@
 'size': section.end_addr - section.start_addr
 })
 data['symbols'] = list(self.symbols.values())
-with open(tf.name, 'w') as f:
+obj_file = os.path.join(obj_dir, name)
+with open(obj_file, "w") as f:
 f.write(json.dumps(data, indent=4))
-self.module = target.AddModule(tf.name, None, uuid_str)
+self.module = target.AddModule(obj_file, None, uuid_str)
 if self.module:
 # If we were able to add the module with inlined
 # symbols, we should mark it as available so load_module
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -1,4 +1,4 @@
-import os,json,struct,signal,uuid
+import os, json, struct, signal, uuid, tempfile
 
 from typing import Any, Dict
 
@@ -38,16 +38,17 @@
 for image in self.crashlog.find_images_with_identifier(ident):
 image.resolve = True
 
-for image in self.crashlog.images:
-if image not in self.loaded_images:
-if image.uuid == uuid.UUID(int=0):
-continue
-err = image.add_module(self.target)
-if err:
-# Append to SBCommandReturnObject
-print(err)
-else:
-self.loaded_images.append(image)
+with tempfile.TemporaryDirectory() as obj_dir:
+for image in self.crashlog.images:
+if image not in self.loaded_images:
+if image.uuid == uuid.UUID(int=0):
+continue
+err = image.add_module(self.target, obj_dir)
+if err:
+# Append to SBCommandReturnObject
+print(err)
+else:
+self.loaded_images.append(image)
 
 for thread in self.crashlog.threads:
 if hasattr(thread, 'app_specific_backtrace') and thread.app_specific_backtrace:
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -40,6 +40,7 @@
 import string
 import subprocess
 import sys
+import tempfile
 import threading
 import time
 import uuid
@@ -1154,12 +1155,17 @@
 futures = []
 loaded_images = []
 with concurrent.futures.ThreadPoolExecutor() as executor:
-def add_module(image, target):
-return image, image.add_module(target)
+with tempfile.TemporaryDirectory() as obj_dir:
 
-for image in crash_log.images:
-futures.append(executor.submit(add_module, image=image, target=target))
+def add_module(image, target, obj_dir):
+return image, image.add_module(target, obj_dir)
 
+for image in crash_log.images:
+futures.append(
+executor.submit(
+add_module, image=image, target=target, obj_dir=obj_dir
+)
+)
 for future in concurrent.futures.as_completed(futures):
 image, err = future.result()
 if err:

[Lldb-commits] [PATCH] D151120: [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion and ObjectFileMachO::GetSDKVersion

2023-05-22 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.  I spent some time trying to see if there was a clear 
reason for the duplicated code; it was added in `llvm-svn: 193380` in 2013 and 
they were very clearly identical back then.  I don't see/can't think of any 
reason for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151120

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


[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 524502.
mib added a reviewer: bulbazord.
mib added a comment.

Address @JDevlieghere & @bulbazord comments.


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

https://reviews.llvm.org/D151045

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/symbolication.py

Index: lldb/examples/python/symbolication.py
===
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -368,7 +368,7 @@
 else:
 return 'error: no section infos'
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=None):
 '''Add the Image described in this object to "target" and load the sections if "load" is True.'''
 if target:
 # Try and find using UUID only first so that paths need not match
@@ -384,7 +384,7 @@
 resolved_path, None, uuid_str, self.symfile)
 if not self.module and self.section_infos:
 name = os.path.basename(self.path)
-with tempfile.NamedTemporaryFile(suffix='.' + name) as tf:
+if obj_dir and os.path.isdir(obj_dir):
 data = {
 'triple': target.triple,
 'uuid': uuid_str,
@@ -398,9 +398,10 @@
 'size': section.end_addr - section.start_addr
 })
 data['symbols'] = list(self.symbols.values())
-with open(tf.name, 'w') as f:
+obj_file = os.path.join(obj_dir, name)
+with open(obj_file, "w") as f:
 f.write(json.dumps(data, indent=4))
-self.module = target.AddModule(tf.name, None, uuid_str)
+self.module = target.AddModule(obj_file, None, uuid_str)
 if self.module:
 # If we were able to add the module with inlined
 # symbols, we should mark it as available so load_module
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -1,4 +1,4 @@
-import os,json,struct,signal,uuid
+import os, json, struct, signal, uuid, tempfile
 
 from typing import Any, Dict
 
@@ -38,16 +38,17 @@
 for image in self.crashlog.find_images_with_identifier(ident):
 image.resolve = True
 
-for image in self.crashlog.images:
-if image not in self.loaded_images:
-if image.uuid == uuid.UUID(int=0):
-continue
-err = image.add_module(self.target)
-if err:
-# Append to SBCommandReturnObject
-print(err)
-else:
-self.loaded_images.append(image)
+with tempfile.TemporaryDirectory() as obj_dir:
+for image in self.crashlog.images:
+if image not in self.loaded_images:
+if image.uuid == uuid.UUID(int=0):
+continue
+err = image.add_module(self.target, obj_dir)
+if err:
+# Append to SBCommandReturnObject
+print(err)
+else:
+self.loaded_images.append(image)
 
 for thread in self.crashlog.threads:
 if hasattr(thread, 'app_specific_backtrace') and thread.app_specific_backtrace:
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -40,6 +40,7 @@
 import string
 import subprocess
 import sys
+import tempfile
 import threading
 import time
 import uuid
@@ -1153,19 +1154,24 @@
 
 futures = []
 loaded_images = []
-with concurrent.futures.ThreadPoolExecutor() as executor:
-def add_module(image, target):
-return image, image.add_module(target)
-
-for image in crash_log.images:
-futures.append(executor.submit(add_module, image=image, target=target))
-
-for future in concurrent.futures.as_completed(futures):
-image, err = future.result()
-if err:
-print(err)
-else:
-loaded_images.append(image)
+with tempfile.TemporaryDirectory() as obj_dir:
+with concurrent.futures.ThreadPoolExecutor() as executor:
+
+def add_module(image, target, obj_dir):
+return image, image.add_module(target, obj_dir)
+
+for image in 

[Lldb-commits] [PATCH] D150485: [lldb] Add support for negative integer to {SB, }StructuredData

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

Alright, looks good to me. Let's see what the bots think!


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

https://reviews.llvm.org/D150485

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


[Lldb-commits] [PATCH] D150485: [lldb] Add support for negative integer to {SB, }StructuredData

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 524476.
mib marked 2 inline comments as done.
mib added a comment.

Address @bulbazord comments.


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

https://reviews.llvm.org/D150485

Files:
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/Core/StructuredDataImpl.h
  lldb/include/lldb/Utility/StructuredData.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBStructuredData.cpp
  lldb/source/API/SBThread.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointResolver.cpp
  lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Host/common/XML.cpp
  lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  
lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
  
lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
  lldb/source/Target/DynamicRegisterInfo.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/test/API/commands/target/stop-hooks/stop_hook.py
  lldb/test/API/functionalities/step_scripted/Steps.py
  lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
  lldb/tools/lldb-vscode/JSONUtils.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -19,6 +19,8 @@
 
 #include "PythonTestSuite.h"
 
+#include 
+
 using namespace lldb_private;
 using namespace lldb_private::python;
 using llvm::Error;
@@ -266,10 +268,23 @@
 
 TEST_F(PythonDataObjectsTest, TestPythonIntegerToStr) {}
 
-TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredInteger) {
+TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredUnsignedInteger) {
   PythonInteger integer(7);
   auto int_sp = integer.CreateStructuredInteger();
-  EXPECT_EQ(7U, int_sp->GetValue());
+  EXPECT_TRUE(
+  std::holds_alternative(int_sp));
+  StructuredData::UnsignedIntegerSP uint_sp =
+  std::get(int_sp);
+  EXPECT_EQ(7U, uint_sp->GetValue());
+}
+
+TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredSignedInteger) {
+  PythonInteger integer(-42);
+  auto int_sp = integer.CreateStructuredInteger();
+  EXPECT_TRUE(std::holds_alternative(int_sp));
+  StructuredData::SignedIntegerSP sint_sp =
+  std::get(int_sp);
+  EXPECT_EQ(-42, sint_sp->GetValue());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonStringToStructuredString) {
@@ -358,7 +373,7 @@
   EXPECT_EQ(lldb::eStructuredDataTypeString,
 array_sp->GetItemAtIndex(1)->GetType());
 
-  auto int_sp = array_sp->GetItemAtIndex(0)->GetAsInteger();
+  auto int_sp = array_sp->GetItemAtIndex(0)->GetAsUnsignedInteger();
   auto string_sp = array_sp->GetItemAtIndex(1)->GetAsString();
 
   EXPECT_EQ(long_value0, long(int_sp->GetValue()));
@@ -522,7 +537,7 @@
   EXPECT_TRUE(dict_sp->HasKey(string_key1));
 
   auto string_sp = dict_sp->GetValueForKey(string_key0)->GetAsString();
-  auto int_sp = dict_sp->GetValueForKey(string_key1)->GetAsInteger();
+  auto int_sp = dict_sp->GetValueForKey(string_key1)->GetAsUnsignedInteger();
 
   EXPECT_EQ(string_value0, string_sp->GetValue());
   EXPECT_EQ(int_value1, long(int_sp->GetValue()));
@@ -592,7 +607,7 @@
   structured_dict_ptr->GetValueForKey(key_name);
   EXPECT_TRUE((bool)structured_addr_value_sp);
   const uint64_t extracted_value =
-  structured_addr_value_sp->GetIntegerValue(123);
+  structured_addr_value_sp->GetUnsignedIntegerValue(123);
   EXPECT_TRUE(extracted_value == value);
 }
   }
Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

[Lldb-commits] [PATCH] D150485: [lldb] Add support for negative integer to {SB, }StructuredData

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

Ok, this is a pretty big patch so we probably don't want to leave it in review 
for a long time or it just gets harder to land correctly.

I've looked over most of this patch and it looks fine to me. A lot of is rather 
mechanical: Changing things like `GetIntegerValue` to `GetUnsignedIntegerValue` 
and using `GetSignedIntegerValue` where it makes sense. There are lots of 
little cleanups as well, like correcting the type of some variables (e.g. 
`addr_t` -> `offset_t`) and these are fine too. I don't have much of a problem 
with any of that.

2 small things though and I think this should probably be good after that.




Comment at: lldb/include/lldb/API/SBStructuredData.h:75-78
+  //  LLDB_DEPRECATED("Specify if the value is signed or unsigned",
+  //  "uint64_t GetUnsignedIntegerValue(uint64_t fail_value =
+  //  0)")
+  [[deprecated("Specify if the value is signed or unsigned")]] uint64_t

Did you mean to remove the deprecated attribute and use `LLDB_DEPRECATED` 
directly?



Comment at: lldb/include/lldb/Utility/StructuredData.h:105-106
+UnsignedInteger *GetAsUnsignedInteger() {
+  return ((m_type == lldb::eStructuredDataTypeInteger ||
+   m_type == lldb::eStructuredDataTypeUnsignedInteger)
+  ? static_cast(this)

Could you add a small note here specifying why `eStructuredDataTypeInteger` 
corresponds to UnsignedInteger and not SignedInteger?


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

https://reviews.llvm.org/D150485

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


[Lldb-commits] [PATCH] D151044: [lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D151044#4362084 , @bulbazord wrote:

> The bug that you're fixing is with thread handling in 
> `MultiplexerScriptedProcess` right? That looks fine to me too.

Yep! Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151044

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


[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread Aman LaChapelle via Phabricator via lldb-commits
bzcheeseman accepted this revision.
bzcheeseman 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/D150303/new/

https://reviews.llvm.org/D150303

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


[Lldb-commits] [PATCH] D151044: [lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

Looks like you're mostly moving things around which is fine. The bug that 
you're fixing is with thread handling in `MultiplexerScriptedProcess` right? 
That looks fine to me too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151044

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


[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added inline comments.



Comment at: lldb/examples/python/crashlog.py:1165-1168
+if os.path.isdir(obj_dir.name):
+for file in os.listdir(obj_dir.name):
+os.unlink(os.path.join(obj_dir.name, file))
+os.rmdir(obj_dir.name)

JDevlieghere wrote:
> Can you call `obj_dir.cleanup()`, or better, can you wrap this in a `with 
> tempfile.TemporaryDirectory() as obj_dir:`?
+1



Comment at: lldb/examples/python/symbolication.py:371
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=tempfile.TemporaryDirectory()):
 '''Add the Image described in this object to "target" and load the 
sections if "load" is True.'''

JDevlieghere wrote:
> If the `obj_dir` is created this way, it will never be removed. Is anyone 
> relying on the default argument? If not I would make it `None` and change the 
> check on line 387 to `if obj_dir:`. 
+1 on this, we need to cleanup resources.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151045

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


[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 524449.
wallace added a comment.

nit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

Files:
  lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Expression/CMakeLists.txt
  lldb/source/Expression/ExpressionTypeSystemHelper.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
  lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.h

Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -14,8 +14,11 @@
 namespace lldb_private {
 /// Implements a Clang-based REPL for C languages on top of LLDB's REPL
 /// framework.
-class ClangREPL : public REPL {
+class ClangREPL : public llvm::RTTIExtends {
 public:
+  // LLVM RTTI support
+  static char ID;
+
   ClangREPL(lldb::LanguageType language, Target );
 
   ~ClangREPL() override;
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
@@ -15,8 +15,10 @@
 
 LLDB_PLUGIN_DEFINE(ClangREPL)
 
+char ClangREPL::ID;
+
 ClangREPL::ClangREPL(lldb::LanguageType language, Target )
-: REPL(eKindClang, target), m_language(language),
+: llvm::RTTIExtends(target), m_language(language),
   m_implicit_expr_result_regex("\\$[0-9]+") {}
 
 ClangREPL::~ClangREPL() = default;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -72,11 +72,12 @@
ExecutionContext _ctx) override;
 
 private:
-  class ClangUtilityFunctionHelper : public ClangExpressionHelper {
+  class ClangUtilityFunctionHelper
+  : public llvm::RTTIExtends {
   public:
-ClangUtilityFunctionHelper() = default;
-
-~ClangUtilityFunctionHelper() override = default;
+// LLVM RTTI support
+static char ID;
 
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -176,6 +176,8 @@
   }
 }
 
+char ClangUtilityFunction::ClangUtilityFunctionHelper::ID;
+
 void ClangUtilityFunction::ClangUtilityFunctionHelper::ResetDeclMap(
 ExecutionContext _ctx, bool keep_result_in_memory) {
   std::shared_ptr ast_importer;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -51,13 +51,16 @@
 
   enum { kDefaultTimeout = 50u };
 
-  class ClangUserExpressionHelper : public ClangExpressionHelper {
+  class ClangUserExpressionHelper
+  : public llvm::RTTIExtends {
   public:
+// LLVM RTTI support
+static char ID;
+
 ClangUserExpressionHelper(Target , bool top_level)
 : m_target(target), m_top_level(top_level) {}
 
-~ClangUserExpressionHelper() override = default;
-
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
 ClangExpressionDeclMap *DeclMap() override {
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 524448.
wallace added a comment.

Use RTTIExtends


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

Files:
  lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Expression/CMakeLists.txt
  lldb/source/Expression/ExpressionTypeSystemHelper.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
  lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.h

Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -14,8 +14,11 @@
 namespace lldb_private {
 /// Implements a Clang-based REPL for C languages on top of LLDB's REPL
 /// framework.
-class ClangREPL : public REPL {
+class ClangREPL : public llvm::RTTIExtends {
 public:
+  // LLVM RTTI support
+  static char ID;
+
   ClangREPL(lldb::LanguageType language, Target );
 
   ~ClangREPL() override;
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
@@ -15,8 +15,10 @@
 
 LLDB_PLUGIN_DEFINE(ClangREPL)
 
+char ClangREPL::ID;
+
 ClangREPL::ClangREPL(lldb::LanguageType language, Target )
-: REPL(eKindClang, target), m_language(language),
+: llvm::RTTIExtends(target), m_language(language),
   m_implicit_expr_result_regex("\\$[0-9]+") {}
 
 ClangREPL::~ClangREPL() = default;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -72,11 +72,12 @@
ExecutionContext _ctx) override;
 
 private:
-  class ClangUtilityFunctionHelper : public ClangExpressionHelper {
+  class ClangUtilityFunctionHelper
+  : public llvm::RTTIExtends {
   public:
-ClangUtilityFunctionHelper() = default;
-
-~ClangUtilityFunctionHelper() override = default;
+// LLVM RTTI support
+static char ID;
 
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -176,6 +176,8 @@
   }
 }
 
+char ClangUtilityFunction::ClangUtilityFunctionHelper::ID;
+
 void ClangUtilityFunction::ClangUtilityFunctionHelper::ResetDeclMap(
 ExecutionContext _ctx, bool keep_result_in_memory) {
   std::shared_ptr ast_importer;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -51,13 +51,16 @@
 
   enum { kDefaultTimeout = 50u };
 
-  class ClangUserExpressionHelper : public ClangExpressionHelper {
+  class ClangUserExpressionHelper
+  : public llvm::RTTIExtends {
   public:
+// LLVM RTTI support
+static char ID;
+
 ClangUserExpressionHelper(Target , bool top_level)
 : m_target(target), m_top_level(top_level) {}
 
-~ClangUserExpressionHelper() override = default;
-
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
 ClangExpressionDeclMap *DeclMap() override {
Index: 

[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

Sure, I can use it. I just didn't know it exists :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

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


[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread Aman LaChapelle via Phabricator via lldb-commits
bzcheeseman added inline comments.



Comment at: lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h:30
 
-  LLVMCastKind getKind() const { return m_kind; }
-
-  ExpressionTypeSystemHelper(LLVMCastKind kind) : m_kind(kind) {}
-
-  ~ExpressionTypeSystemHelper() = default;
-
-protected:
-  LLVMCastKind m_kind;
+  virtual bool isA(const void *ClassID) const = 0;
 };

I was expecting you'd just use `RTTIExtends` from Support/ExtensibleRTTI.h, any 
reason not to use that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

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


[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 524398.
wallace added a comment.

address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

Files:
  lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
  lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.h

Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -15,6 +15,9 @@
 /// Implements a Clang-based REPL for C languages on top of LLDB's REPL
 /// framework.
 class ClangREPL : public REPL {
+  // LLVM RTTI support
+  static char ID;
+
 public:
   ClangREPL(lldb::LanguageType language, Target );
 
@@ -30,6 +33,9 @@
 
   static llvm::StringRef GetPluginNameStatic() { return "ClangREPL"; }
 
+  // LLVM casting support
+  bool isA(const void *ClassID) const override { return ClassID ==  }
+
 protected:
   Status DoInitialization() override;
 
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
@@ -15,8 +15,10 @@
 
 LLDB_PLUGIN_DEFINE(ClangREPL)
 
+char ClangREPL::ID;
+
 ClangREPL::ClangREPL(lldb::LanguageType language, Target )
-: REPL(eKindClang, target), m_language(language),
+: REPL(target), m_language(language),
   m_implicit_expr_result_regex("\\$[0-9]+") {}
 
 ClangREPL::~ClangREPL() = default;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -74,10 +74,6 @@
 private:
   class ClangUtilityFunctionHelper : public ClangExpressionHelper {
   public:
-ClangUtilityFunctionHelper() = default;
-
-~ClangUtilityFunctionHelper() override = default;
-
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
 ClangExpressionDeclMap *DeclMap() override {
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -56,8 +56,6 @@
 ClangUserExpressionHelper(Target , bool top_level)
 : m_target(target), m_top_level(top_level) {}
 
-~ClangUserExpressionHelper() override = default;
-
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
 ClangExpressionDeclMap *DeclMap() override {
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
@@ -32,14 +32,19 @@
 /// ClangPersistentVariable for more discussion.  Also provides an increasing,
 /// 0-based counter for naming result variables.
 class ClangPersistentVariables : public PersistentExpressionState {
+  // LLVM RTTI support
+  static char ID;
+
 public:
   ClangPersistentVariables(std::shared_ptr target_sp);
 
   ~ClangPersistentVariables() override = default;
 
-  // llvm casting support
-  static bool classof(const PersistentExpressionState *pv) {
-return pv->getKind() == PersistentExpressionState::eKindClang;
+  // LLVM casting support
+  bool isA(const void *ClassID) const override { return ClassID ==  }
+
+  static bool classof(const PersistentExpressionState *state) {
+return state->isA();
   }
 
   std::shared_ptr GetClangASTImporter();
Index: 

[Lldb-commits] [PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

2023-05-22 Thread Tom Stellard via Phabricator via lldb-commits
tstellar added a comment.

In D141907#4355229 , @paperchalice 
wrote:

> In D141907#4355228 , @tstellar 
> wrote:
>
>> @paperchalice Do you need someone to commit this for you?
>
> Sure, I don't have the commit access.

What name / email address do you want me to use for the commit author field?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141907

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


[Lldb-commits] [lldb] d25fb4e - [lldb-vscode] Make tests not wait for 'launch' process events if launch fails.

2023-05-22 Thread Jorge Gorbe Moya via lldb-commits

Author: Jorge Gorbe Moya
Date: 2023-05-22T10:41:11-07:00
New Revision: d25fb4e90c96f8fcb22fbed9009295026f1d20cf

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

LOG: [lldb-vscode] Make tests not wait for 'launch' process events if launch 
fails.

After https://reviews.llvm.org/D147831, lldb-vscode doesn't send a
process event after launch/attach in case of failure. I believe this is
the right interpretation of the spec, because the description of the
event says:

> The event indicates that the debugger has begun debugging a new
> process.

and we haven't started debugging a process if there's no process because
we failed to launch it. This is also supported by the fact that
`request_launch` in vscode.py doesn't wait for the event if passed
`expectFailure=True`. However, this doesn't take into account
*unexpected* launch failures. In that case, `request_launch` will hang
indefinitely waiting for the process event.

This patch changes it so we'll only wait for these events if
`request["success"]` is true, independently of whether any failure was
expected or not.

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index d87c95b152a55..d6ed0ee737d4d 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -322,7 +322,6 @@ def cleanup():
 launchCommands=launchCommands,
 sourceMap=sourceMap,
 runInTerminal=runInTerminal,
-expectFailure=expectFailure,
 postRunCommands=postRunCommands)
 
 if expectFailure:

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index d3b7867359b39..3cfc88871ede8 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -661,8 +661,7 @@ def request_launch(self, program, args=None, cwd=None, 
env=None,
stopCommands=None, exitCommands=None,
terminateCommands=None ,sourcePath=None,
debuggerRoot=None, launchCommands=None, sourceMap=None,
-   runInTerminal=False, expectFailure=False,
-   postRunCommands=None):
+   runInTerminal=False, postRunCommands=None):
 args_dict = {
 'program': program
 }
@@ -712,7 +711,7 @@ def request_launch(self, program, args=None, cwd=None, 
env=None,
 }
 response = self.send_recv(command_dict)
 
-if not expectFailure:
+if response['success']:
 # Wait for a 'process' and 'initialized' event in any order
 self.wait_for_event(filter=['process', 'initialized'])
 self.wait_for_event(filter=['process', 'initialized'])



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


[Lldb-commits] [PATCH] D150470: [lldb-vscode] Make tests not wait for 'launch' process events if launch fails.

2023-05-22 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd25fb4e90c96: [lldb-vscode] Make tests not wait for 
launch process events if launch fails. (authored by jgorbe).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150470

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


Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -661,8 +661,7 @@
stopCommands=None, exitCommands=None,
terminateCommands=None ,sourcePath=None,
debuggerRoot=None, launchCommands=None, sourceMap=None,
-   runInTerminal=False, expectFailure=False,
-   postRunCommands=None):
+   runInTerminal=False, postRunCommands=None):
 args_dict = {
 'program': program
 }
@@ -712,7 +711,7 @@
 }
 response = self.send_recv(command_dict)
 
-if not expectFailure:
+if response['success']:
 # Wait for a 'process' and 'initialized' event in any order
 self.wait_for_event(filter=['process', 'initialized'])
 self.wait_for_event(filter=['process', 'initialized'])
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -322,7 +322,6 @@
 launchCommands=launchCommands,
 sourceMap=sourceMap,
 runInTerminal=runInTerminal,
-expectFailure=expectFailure,
 postRunCommands=postRunCommands)
 
 if expectFailure:


Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -661,8 +661,7 @@
stopCommands=None, exitCommands=None,
terminateCommands=None ,sourcePath=None,
debuggerRoot=None, launchCommands=None, sourceMap=None,
-   runInTerminal=False, expectFailure=False,
-   postRunCommands=None):
+   runInTerminal=False, postRunCommands=None):
 args_dict = {
 'program': program
 }
@@ -712,7 +711,7 @@
 }
 response = self.send_recv(command_dict)
 
-if not expectFailure:
+if response['success']:
 # Wait for a 'process' and 'initialized' event in any order
 self.wait_for_event(filter=['process', 'initialized'])
 self.wait_for_event(filter=['process', 'initialized'])
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -322,7 +322,6 @@
 launchCommands=launchCommands,
 sourceMap=sourceMap,
 runInTerminal=runInTerminal,
-expectFailure=expectFailure,
 postRunCommands=postRunCommands)
 
 if expectFailure:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151043: [lldb] Add "Trace" stop reason in Scripted Thread

2023-05-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D151043#4360968 , @JDevlieghere 
wrote:

> LGTM. Are there other stop reasons that are currently not supported by 
> scripted threads that we should consider supporting?

Scripted Threads still don't support `eStopReasonWatchpoint` as well as all of 
these stop reasons :

  eStopReasonExec,
  eStopReasonPlanComplete,
  eStopReasonThreadExiting,
  eStopReasonInstrumentation,
  eStopReasonProcessorTrace,
  eStopReasonFork,
  eStopReasonVFork,
  eStopReasonVForkDone,

I'll implement the watchpoint stop info in a follow-up (should very similar to 
the breakpoint stop info), but I'm not sure if need to implement support to any 
of the other ... @jingham, what do you think ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151043

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


[Lldb-commits] [PATCH] D145183: [libc++] Implement `stop_token`

2023-05-22 Thread Valentin Clement via Phabricator via lldb-commits
clementval added a comment.
Herald added a subscriber: JDevlieghere.

Something seems wrong with this patch. It contains multiple unrelated changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145183

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


[Lldb-commits] [PATCH] D145183: [libc++] Implement `stop_token`

2023-05-22 Thread Hui via Phabricator via lldb-commits
huixie90 updated this revision to Diff 524387.
huixie90 added a comment.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, Sanitizers, 
TinaAMD, hoy, bviyer, wlei, jplehr, mgehre-amd, luke, hanchung, jsetoain, 
Moerafaat, zero9178, pcwang-thead, anlunx, Enna1, bzcheeseman, mattd, 
gchakrabarti, ThomasRaoux, awarzynski, sdasgup3, wenzhicui, wrengr, snehasish, 
armkevincheng, ormris, foad, jsmolens, sjarus, eric-k256, cota, mravishankar, 
teijeong, frasercrmck, rdzhabarov, tatianashp, wenlei, mehdi_amini, okura, 
jdoerfert, msifontes, sstefan1, jurahul, kuter, Kayjukh, vkmr, grosul1, 
jvesely, Joonsoo, stephenneuendorffer, kerbowa, liufengdb, aartbik, mgester, 
arpith-jacob, csigg, nicolasvasilache, antiagainst, shauheen, rriddle, 
luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, asbirlea, 
kadircet, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, 
steven_wu, mgrang, edward-jones, zzheng, MaskRay, jrtc27, gbedwell, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, fedor.sergeev, hiraditya, nemanjai, 
arsenm, jholewinski.
Herald added a reviewer: andreadb.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: herhut.
Herald added a reviewer: rriddle.
Herald added a reviewer: aartbik.
Herald added a reviewer: sscalpone.
Herald added a reviewer: ftynse.
Herald added a reviewer: aartbik.
Herald added a reviewer: clementval.
Herald added a reviewer: ThomasRaoux.
Herald added a reviewer: NoQ.
Herald added a reviewer: dcaballe.
Herald added a reviewer: ftynse.
Herald added a reviewer: dcaballe.
Herald added a reviewer: kiranchandramohan.
Herald added projects: clang, Sanitizers, LLDB, MLIR, LLVM, clang-tools-extra, 
Flang.

- [libc++] Implement `stop_token`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145183

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp
  clang/docs/ControlFlowIntegrity.rst
  clang/docs/LanguageExtensions.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/UndefinedBehaviorSanitizer.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/RISCVVTypes.def
  clang/include/clang/Basic/riscv_vector.td
  clang/include/clang/Basic/riscv_vector_common.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
  clang/lib/Analysis/FlowSensitive/Transfer.cpp
  clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  clang/test/AST/ast-dump-decl.cpp
  clang/test/CodeGen/RISCV/rvb-intrinsics/riscv64-zbb.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vset_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/rvv-tuple-type.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vget-index-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vset-index-out-of-range.c
  clang/test/CodeGen/assignment-tracking/flag.cpp
  clang/test/CodeGen/ubsan-function.c
  clang/test/PCH/asm-label.cpp
  clang/test/Sema/flexible-array-in-union.c
  clang/test/Sema/riscv-types.c
  clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
  clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
  

[Lldb-commits] [PATCH] D150470: [lldb-vscode] Make tests not wait for 'launch' process events if launch fails.

2023-05-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

makes sense


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150470

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


[Lldb-commits] [PATCH] D150709: [lldb][NFCI] Change return type of Language::GetInstanceVariableName

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef73ea6cf691: [lldb][NFCI] Change return type of 
Language::GetInstanceVariableName (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150709

Files:
  lldb/include/lldb/Symbol/SymbolContext.h
  lldb/include/lldb/Target/Language.h
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
  lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Target/StackFrame.cpp


Index: lldb/source/Target/StackFrame.cpp
===
--- lldb/source/Target/StackFrame.cpp
+++ lldb/source/Target/StackFrame.cpp
@@ -567,8 +567,9 @@
 // Check for direct ivars access which helps us with implicit access to
 // ivars using "this" or "self".
 GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock);
-if (auto instance_var_name = m_sc.GetInstanceVariableName()) {
-  var_sp = variable_list->FindVariable(instance_var_name);
+llvm::StringRef instance_var_name = m_sc.GetInstanceVariableName();
+if (!instance_var_name.empty()) {
+  var_sp = variable_list->FindVariable(ConstString(instance_var_name));
   if (var_sp) {
 separator_idx = 0;
 if (Type *var_type = var_sp->GetType())
Index: lldb/source/Symbol/SymbolContext.cpp
===
--- lldb/source/Symbol/SymbolContext.cpp
+++ lldb/source/Symbol/SymbolContext.cpp
@@ -541,7 +541,7 @@
   return nullptr;
 }
 
-ConstString SymbolContext::GetInstanceVariableName() {
+llvm::StringRef SymbolContext::GetInstanceVariableName() {
   LanguageType lang_type = eLanguageTypeUnknown;
 
   if (Block *function_block = GetFunctionBlock())
Index: lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
===
--- lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
+++ lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
@@ -40,7 +40,7 @@
 
   static lldb_private::Language *CreateInstance(lldb::LanguageType language);
 
-  ConstString GetInstanceVariableName() override { return ConstString("self"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "self"; }
 
   static llvm::StringRef GetPluginNameStatic() { return "objcplusplus"; }
 
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -191,7 +191,7 @@
   return false;
   }
 
-  ConstString GetInstanceVariableName() override { return ConstString("self"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "self"; }
 
   // PluginInterface protocol
   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -165,7 +165,7 @@
   ConstString FindBestAlternateFunctionMangledName(
   const Mangled mangled, const SymbolContext _ctx) const override;
 
-  ConstString GetInstanceVariableName() override { return ConstString("this"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "this"; }
 
   // PluginInterface protocol
   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
Index: lldb/include/lldb/Target/Language.h
===
--- lldb/include/lldb/Target/Language.h
+++ lldb/include/lldb/Target/Language.h
@@ -326,7 +326,7 @@
 return ConstString();
   }
 
-  virtual ConstString GetInstanceVariableName() { return {}; }
+  virtual llvm::StringRef GetInstanceVariableName() { return {}; }
 
 protected:
   // Classes that inherit from Language can see and modify these
Index: lldb/include/lldb/Symbol/SymbolContext.h
===
--- lldb/include/lldb/Symbol/SymbolContext.h
+++ lldb/include/lldb/Symbol/SymbolContext.h
@@ -250,8 +250,8 @@
   /// For C++ the name is "this", for Objective-C the name is "self".
   ///
   /// \return
-  /// Returns a string for the name of the instance variable.
-  ConstString GetInstanceVariableName();
+  /// Returns a StringRef for the name of the instance variable.
+  llvm::StringRef GetInstanceVariableName();
 
   /// Sorts the types in TypeMap according to SymbolContext to TypeList
   ///


Index: lldb/source/Target/StackFrame.cpp
===
--- 

[Lldb-commits] [lldb] ef73ea6 - [lldb][NFCI] Change return type of Language::GetInstanceVariableName

2023-05-22 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-05-22T10:16:20-07:00
New Revision: ef73ea6cf691f08459dd33116ace45c946d05b54

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

LOG: [lldb][NFCI] Change return type of Language::GetInstanceVariableName

I don't think this needs to be a ConstString.

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

Added: 


Modified: 
lldb/include/lldb/Symbol/SymbolContext.h
lldb/include/lldb/Target/Language.h
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Target/StackFrame.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index 68bef70f3bcfe..b0f5ffead2a16 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -250,8 +250,8 @@ class SymbolContext {
   /// For C++ the name is "this", for Objective-C the name is "self".
   ///
   /// \return
-  /// Returns a string for the name of the instance variable.
-  ConstString GetInstanceVariableName();
+  /// Returns a StringRef for the name of the instance variable.
+  llvm::StringRef GetInstanceVariableName();
 
   /// Sorts the types in TypeMap according to SymbolContext to TypeList
   ///

diff  --git a/lldb/include/lldb/Target/Language.h 
b/lldb/include/lldb/Target/Language.h
index 59ea17bcefb26..bbb3e7c0cc8d1 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -326,7 +326,7 @@ class Language : public PluginInterface {
 return ConstString();
   }
 
-  virtual ConstString GetInstanceVariableName() { return {}; }
+  virtual llvm::StringRef GetInstanceVariableName() { return {}; }
 
 protected:
   // Classes that inherit from Language can see and modify these

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
index a3e78c39044aa..7712a60b77959 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -165,7 +165,7 @@ class CPlusPlusLanguage : public Language {
   ConstString FindBestAlternateFunctionMangledName(
   const Mangled mangled, const SymbolContext _ctx) const override;
 
-  ConstString GetInstanceVariableName() override { return ConstString("this"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "this"; }
 
   // PluginInterface protocol
   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }

diff  --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h 
b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
index c37fd3d2257bb..3b74e79254936 100644
--- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -191,7 +191,7 @@ class ObjCLanguage : public Language {
   return false;
   }
 
-  ConstString GetInstanceVariableName() override { return ConstString("self"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "self"; }
 
   // PluginInterface protocol
   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }

diff  --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h 
b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
index 5fb256db46481..b7c71b5dbb1c9 100644
--- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
+++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
@@ -40,7 +40,7 @@ class ObjCPlusPlusLanguage : public Language {
 
   static lldb_private::Language *CreateInstance(lldb::LanguageType language);
 
-  ConstString GetInstanceVariableName() override { return ConstString("self"); 
}
+  llvm::StringRef GetInstanceVariableName() override { return "self"; }
 
   static llvm::StringRef GetPluginNameStatic() { return "objcplusplus"; }
 

diff  --git a/lldb/source/Symbol/SymbolContext.cpp 
b/lldb/source/Symbol/SymbolContext.cpp
index f2d88b6dc46be..63968ec2d1506 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -541,7 +541,7 @@ Block *SymbolContext::GetFunctionBlock() {
   return nullptr;
 }
 
-ConstString SymbolContext::GetInstanceVariableName() {
+llvm::StringRef SymbolContext::GetInstanceVariableName() {
   LanguageType lang_type = eLanguageTypeUnknown;
 
   if (Block *function_block = GetFunctionBlock())

diff  --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index f828539057cbf..7ba84b1c5c149 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ 

[Lldb-commits] [PATCH] D151120: [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion and ObjectFileMachO::GetSDKVersion

2023-05-22 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: jasonmolenda, JDevlieghere.
Herald added a subscriber: tschuett.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

These functions do the exact same thing (even if they look slightly
different). I yanked the common implementation, cleaned it up, and
shoved it into its own function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151120

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5899,138 +5899,65 @@
 #endif
 }
 
-llvm::VersionTuple ObjectFileMachO::GetMinimumOSVersion() {
-  if (!m_min_os_version) {
-lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
-for (uint32_t i = 0; i < m_header.ncmds; ++i) {
-  const lldb::offset_t load_cmd_offset = offset;
-
-  llvm::MachO::version_min_command lc = {};
-  if (m_data.GetU32(, , 2) == nullptr)
-break;
-  if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
-if (m_data.GetU32(, ,
-  (sizeof(lc) / sizeof(uint32_t)) - 2)) {
-  const uint32_t  = lc.version >> 16;
-  const uint32_t yy = (lc.version >> 8) & 0xffu;
-  const uint32_t zz = lc.version & 0xffu;
-  if () {
-m_min_os_version = llvm::VersionTuple(, yy, zz);
-break;
-  }
-}
-  } else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
-// struct build_version_command {
-// uint32_tcmd;/* LC_BUILD_VERSION */
-// uint32_tcmdsize;/* sizeof(struct
-// build_version_command) plus */
-// /* ntools * sizeof(struct
-// build_tool_version) */
-// uint32_tplatform;   /* platform */
-// uint32_tminos;  /* X.Y.Z is encoded in nibbles
-// .yy.zz */ uint32_tsdk;/* X.Y.Z is encoded in
-// nibbles .yy.zz */ uint32_tntools; /* number of
-// tool entries following this */
-// };
-
-offset += 4; // skip platform
-uint32_t minos = m_data.GetU32();
-
-const uint32_t  = minos >> 16;
-const uint32_t yy = (minos >> 8) & 0xffu;
-const uint32_t zz = minos & 0xffu;
-if () {
-  m_min_os_version = llvm::VersionTuple(, yy, zz);
-  break;
-}
-  }
+static llvm::VersionTuple FindMinimumVersionInfo(DataExtractor ,
+ lldb::offset_t offset,
+ size_t ncmds) {
+  for (size_t i = 0; i < ncmds; i++) {
+const lldb::offset_t load_cmd_offset = offset;
+llvm::MachO::load_command lc = {};
+if (data.GetU32(, , 2) == nullptr)
+  break;
 
-  offset = load_cmd_offset + lc.cmdsize;
+uint32_t version = 0;
+if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
+  // struct version_min_command {
+  //   uint32_t cmd; // LC_VERSION_MIN_*
+  //   uint32_t cmdsize;
+  //   uint32_t version; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  // };
+  // We want to read version.
+  version = data.GetU32();
+} else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
+  // struct build_version_command {
+  //   uint32_t cmd; // LC_BUILD_VERSION
+  //   uint32_t cmdsize;
+  //   uint32_t platform;
+  //   uint32_t minos; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  //   uint32_t ntools;
+  // };
+  // We want to read minos.
+  offset += sizeof(uint32_t); // Skip over platform
+  version = data.GetU32(); // Extract minos
 }
 
-if (!m_min_os_version) {
-  // Set version to an empty value so we don't keep trying to
-  m_min_os_version = llvm::VersionTuple();
+if (version) {
+  const uint32_t  = version >> 16;
+  const uint32_t yy = (version >> 8) & 0xffu;
+  const uint32_t zz = version & 0xffu;
+  if ()
+return llvm::VersionTuple(, yy, zz);
 }
+offset = load_cmd_offset + lc.cmdsize;
   }
+  return llvm::VersionTuple();
+}
 
+llvm::VersionTuple 

[Lldb-commits] [PATCH] D151043: [lldb] Add "Trace" stop reason in Scripted Thread

2023-05-22 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. Are there other stop reasons that are currently not supported by scripted 
threads that we should consider supporting?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151043

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


[Lldb-commits] [PATCH] D151045: [lldb/crashlog] Remove tempfile prefix from inlined symbol object file

2023-05-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/examples/python/crashlog.py:1165-1168
+if os.path.isdir(obj_dir.name):
+for file in os.listdir(obj_dir.name):
+os.unlink(os.path.join(obj_dir.name, file))
+os.rmdir(obj_dir.name)

Can you call `obj_dir.cleanup()`, or better, can you wrap this in a `with 
tempfile.TemporaryDirectory() as obj_dir:`?



Comment at: 
lldb/examples/python/scripted_process/crashlog_scripted_process.py:41
 
+obj_dir = tempfile.TemporaryDirectory()
 for image in self.crashlog.images:

Same comment/question here.



Comment at: lldb/examples/python/symbolication.py:371
 
-def add_module(self, target):
+def add_module(self, target, obj_dir=tempfile.TemporaryDirectory()):
 '''Add the Image described in this object to "target" and load the 
sections if "load" is True.'''

If the `obj_dir` is created this way, it will never be removed. Is anyone 
relying on the default argument? If not I would make it `None` and change the 
check on line 387 to `if obj_dir:`. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151045

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


[Lldb-commits] [lldb] a7c7c61 - [LLDB] Fix missing import in TestInterruptBacktrace.py

2023-05-22 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2023-05-22T15:47:05+04:00
New Revision: a7c7c61af63188a66bd1ad67f9f25b48e5722b58

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

LOG: [LLDB] Fix missing import in TestInterruptBacktrace.py

This fixed missing import of lldbsuite.test.decorators in 
TestInterruptBacktrace.py.

Added: 


Modified: 
lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py 
b/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
index 8d4161355122..ae2863c28f46 100644
--- a/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
+++ b/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
@@ -6,7 +6,7 @@
 import lldb
 import lldbsuite.test.lldbutil as lldbutil
 from lldbsuite.test.lldbtest import *
-
+from lldbsuite.test.decorators import *
 
 class TestInterruptingBacktrace(TestBase):
 



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


[Lldb-commits] [PATCH] D144509: [CMake] Bumps minimum version to 3.20.0.

2023-05-22 Thread Hans Wennborg via Phabricator via lldb-commits
hans added a comment.

>>> Do you have a suggestion how we can move this patch forward?
>>
>> IIRC, D150688  + the diff in 
>> https://github.com/llvm/llvm-project/issues/62719#issuecomment-1552903385 + 
>> upgrading the pre-merge linux bot should take care of all known issues.
>
> Would it make sense to put all these patches in one new review and then test 
> that on Chromium and ask @glandium to test that too. Then we know whether it 
> solves the issues. Do you want me to make a patch or do you want to do it?

I tested 
https://github.com/llvm/llvm-project/issues/62719#issuecomment-1552903385 on 
Chromium already, and that looks good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144509

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


[Lldb-commits] [lldb] 5dfec67 - [LLDB] Skip TestInterruptBacktrace.py on Arm/Linux

2023-05-22 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2023-05-22T14:53:35+04:00
New Revision: 5dfec676c3ab4fa2b7ea95d203f97faf7768b77f

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

LOG: [LLDB] Skip TestInterruptBacktrace.py on Arm/Linux

TestInterruptBacktrace.py started randonmly failing on Arm/Linux
buildbot since e19387e6936c. This patch marks it skipped.

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

Added: 


Modified: 
lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py 
b/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
index 57a994d11035d..8d4161355122c 100644
--- a/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
+++ b/lldb/test/API/functionalities/bt-interrupt/TestInterruptBacktrace.py
@@ -12,6 +12,7 @@ class TestInterruptingBacktrace(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIf(oslist=["linux"], archs=["arm"])
 def test_backtrace_interrupt(self):
 """Use RequestInterrupt followed by stack operations
to ensure correct interrupt behavior for stacks."""



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


[Lldb-commits] [lldb] 7b0e548 - [lldb] Fix enumeration value 'RvvInt32m1x2' not handled in switch (NFC)

2023-05-22 Thread Jie Fu via lldb-commits

Author: Jie Fu
Date: 2023-05-22T16:28:40+08:00
New Revision: 7b0e5485762b9fbbf81419aa67575c38e922e0a5

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

LOG: [lldb] Fix enumeration value 'RvvInt32m1x2' not handled in switch (NFC)

/data/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4851:13:
 error: enumeration value 'RvvInt32m1x2' not handled in switch 
[-Werror,-Wswitch]
switch (llvm::cast(qual_type)->getKind()) {
^~~~
1 error generated.
ninja: build stopped: subcommand failed.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 1a648de721eaa..fa6ab9b2f86b5 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5115,6 +5115,7 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::RvvBool16:
 case clang::BuiltinType::RvvBool32:
 case clang::BuiltinType::RvvBool64:
+case clang::BuiltinType::RvvInt32m1x2:
   break;
 
 // WebAssembly builtin types.



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