[Lldb-commits] [clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)
Michael137 wrote: > It's not that hard to compute "no-data": non-RecordDecls are never no-data, > RecordDecls are no-data if they don't have a vtable pointer > (isDynamicClass()), and all fields are no-data. We can save it in the > CGRecordLayout. > > Assuming that's the route we want to go, of course, as opposed to just making > LLDB add no_unique_address markings to fields. Turns out there's `CodeGen::isEmptyField` which seems usable for this purpose. Created a draft PR here: https://github.com/llvm/llvm-project/pull/96422 for now https://github.com/llvm/llvm-project/pull/93809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] fix(lldb/**.py): fix comparison to None (PR #94017)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94017 >From a10dbbe288bdb115df56ef60c48f9efbf6642bd3 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 23:57:11 +0900 Subject: [PATCH] fix(lldb/**.py): fix comparison to None from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- lldb/bindings/interface/SBBreakpointDocstrings.i | 2 +- lldb/bindings/interface/SBDataExtensions.i| 8 lldb/docs/use/python.rst | 4 ++-- lldb/examples/python/armv7_cortex_m_target_defintion.py | 2 +- lldb/packages/Python/lldbsuite/test/dotest.py | 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 +++--- lldb/packages/Python/lldbsuite/test/lldbutil.py | 6 +++--- .../lldbsuite/test/tools/intelpt/intelpt_testcase.py | 2 +- .../address_breakpoints/TestBadAddressBreakpoints.py | 2 +- .../API/functionalities/step_scripted/TestStepScripted.py | 2 +- .../TestStopOnSharedlibraryEvents.py | 2 +- lldb/test/API/lua_api/TestLuaAPI.py | 2 +- .../macosx/thread_suspend/TestInternalThreadSuspension.py | 2 +- lldb/test/API/python_api/event/TestEvents.py | 2 +- .../process/read-mem-cstring/TestReadMemCString.py| 2 +- lldb/test/API/python_api/type/TestTypeList.py | 2 +- lldb/test/API/python_api/was_interrupted/interruptible.py | 2 +- lldb/test/Shell/lit.cfg.py| 2 +- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lldb/bindings/interface/SBBreakpointDocstrings.i b/lldb/bindings/interface/SBBreakpointDocstrings.i index 74c139d5d9fb6..dca2819a9927b 100644 --- a/lldb/bindings/interface/SBBreakpointDocstrings.i +++ b/lldb/bindings/interface/SBBreakpointDocstrings.i @@ -39,7 +39,7 @@ TestBreakpointIgnoreCount.py),:: #lldbutil.print_stacktraces(process) from lldbutil import get_stopped_thread thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) -self.assertTrue(thread != None, 'There should be a thread stopped due to breakpoint') +self.assertTrue(thread is not None, 'There should be a thread stopped due to breakpoint') frame0 = thread.GetFrameAtIndex(0) frame1 = thread.GetFrameAtIndex(1) frame2 = thread.GetFrameAtIndex(2) diff --git a/lldb/bindings/interface/SBDataExtensions.i b/lldb/bindings/interface/SBDataExtensions.i index d980e79221c6d..ddea77a088dfa 100644 --- a/lldb/bindings/interface/SBDataExtensions.i +++ b/lldb/bindings/interface/SBDataExtensions.i @@ -40,19 +40,19 @@ STRING_EXTENSION_OUTSIDE(SBData) lldbtarget = lldbdict['target'] else: lldbtarget = None -if target == None and lldbtarget != None and lldbtarget.IsValid(): +if target is None and lldbtarget is not None and lldbtarget.IsValid(): target = lldbtarget -if ptr_size == None: +if ptr_size is None: if target and target.IsValid(): ptr_size = target.addr_size else: ptr_size = 8 -if endian == None: +if endian is None: if target and target.IsValid(): endian = target.byte_order else: endian = lldbdict['eByteOrderLittle'] -if size == None: +if size is None: if value > 2147483647: size = 8 elif value < -2147483648: diff --git a/lldb/docs/use/python.rst b/lldb/docs/use/python.rst index 6183d6935d80e..d9c29d95708c1 100644 --- a/lldb/docs/use/python.rst +++ b/lldb/docs/use/python.rst @@ -75,13 +75,13 @@ later explanations: 12: if root_word == word: 13: return cur_path 14: elif word < root_word: - 15: if left_child_ptr.GetValue() == None: + 15: if left_child_ptr.GetValue() is None: 16: return "" 17: else: 18: cur_path = cur_path + "L" 19: return DFS (left_child_ptr, word, cur_path) 20: else: - 21: if right_child_ptr.GetValue() == None: + 21: if right_child_ptr.GetValue() is None: 22: return "" 23: else: 24: cur_path = cur_path + "R" diff --git a/lldb/examples/python/armv7_cortex_m_target_defintion.py b/lldb/examples/python/armv7_cortex_m_target_defintion.py index 42eaa39993dae..8225670f33e6b 100755 --- a/lldb/examples/python/armv7_cortex_m_target_defintion.py +++ b/lldb/examples/python/armv7_cortex_m_target_defintion.py @@ -222,7 +222,7 @@ def get_reg_num(reg_num_dict, reg_name): def get_target_definition(): global g_target_defini
[Lldb-commits] [lldb] [lldb] fix(lldb/**.py): fix comparison to True/False (PR #94039)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94039 >From f0db39bec2499964d0af619148c453d526b6fde4 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 12 May 2024 00:06:53 +0900 Subject: [PATCH] fix(lldb/**.py): fix comparison to True/False from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators. --- lldb/examples/python/crashlog.py| 2 +- lldb/examples/python/disasm-stress-test.py | 4 ++-- lldb/examples/summaries/cocoa/CFString.py | 6 +++--- lldb/examples/summaries/pysummary.py| 2 +- lldb/examples/synthetic/bitfield/example.py | 2 +- lldb/packages/Python/lldbsuite/test/lldbtest.py | 2 +- lldb/test/API/commands/command/script/welcome.py| 2 +- .../commands/expression/call-throws/TestCallThatThrows.py | 6 +++--- .../disassemble/aarch64-adrp-add/TestAArch64AdrpAdd.py | 2 +- .../gdb_remote_client/TestNoWatchpointSupportInfo.py| 2 +- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py | 2 +- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py| 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 1c0d717ce455c..368437ed63e46 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -166,7 +166,7 @@ def dump_symbolicated(self, crash_log, options): this_thread_crashed = self.app_specific_backtrace if not this_thread_crashed: this_thread_crashed = self.did_crash() -if options.crashed_only and this_thread_crashed == False: +if options.crashed_only and not this_thread_crashed: return print("%s" % self) diff --git a/lldb/examples/python/disasm-stress-test.py b/lldb/examples/python/disasm-stress-test.py index 2d3314ee8e8ff..62b2b90a2860a 100755 --- a/lldb/examples/python/disasm-stress-test.py +++ b/lldb/examples/python/disasm-stress-test.py @@ -95,13 +95,13 @@ def GetLLDBFrameworkPath(): debugger = lldb.SBDebugger.Create() -if debugger.IsValid() == False: +if not debugger.IsValid(): print("Couldn't create an SBDebugger") sys.exit(-1) target = debugger.CreateTargetWithFileAndArch(None, arg_ns.arch) -if target.IsValid() == False: +if not target.IsValid(): print("Couldn't create an SBTarget for architecture " + arg_ns.arch) sys.exit(-1) diff --git a/lldb/examples/summaries/cocoa/CFString.py b/lldb/examples/summaries/cocoa/CFString.py index 13c294ca34122..74bd927e9db21 100644 --- a/lldb/examples/summaries/cocoa/CFString.py +++ b/lldb/examples/summaries/cocoa/CFString.py @@ -253,9 +253,9 @@ def get_child_at_index(self, index): elif ( self.inline and self.explicit -and self.unicode == False -and self.special == False -and self.mutable == False +and not self.unicode +and not self.special +and not self.mutable ): return self.handle_inline_explicit() elif self.unicode: diff --git a/lldb/examples/summaries/pysummary.py b/lldb/examples/summaries/pysummary.py index e63a0bff56a13..2a05c1cbf8f28 100644 --- a/lldb/examples/summaries/pysummary.py +++ b/lldb/examples/summaries/pysummary.py @@ -2,7 +2,7 @@ def pyobj_summary(value, unused): -if value is None or value.IsValid() == False or value.GetValueAsUnsigned(0) == 0: +if value is None or not value.IsValid() or value.GetValueAsUnsigned(0) == 0: return "" refcnt = value.GetChildMemberWithName("ob_refcnt") expr = "(char*)PyString_AsString( (PyObject*)PyObject_Str( (PyObject*)0x%x) )" % ( diff --git a/lldb/examples/synthetic/bitfield/example.py b/lldb/examples/synthetic/bitfield/example.py index 2f58123268aa1..45416477bfef2 100644 --- a/lldb/examples/synthetic/bitfield/example.py +++ b/lldb/examples/synthetic/bitfield/example.py @@ -51,7 +51,7 @@ def get_child_at_index(self, index): return None if index > self.num_children(): return None -if self.valobj.IsValid() == False: +if not self.valobj.IsValid(): return None if index == 0: return self.valobj.GetChildMemberWithName("value") diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 1ad8ab6e6e462..1854f6c2c2e7b 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -2446,7 +2446,7 @@ def found_str(matched): log_lines.append(pattern_line) # Convert to bool because match object
[Lldb-commits] [lldb] [lldb] fix(lldb/**.py): fix invalid escape sequences (PR #94034)
https://github.com/e-kwsm updated https://github.com/llvm/llvm-project/pull/94034 >From 0fed01ab57c06cf3b601539a4a9259973eb5031d Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 11 May 2024 02:39:21 +0900 Subject: [PATCH] fix(lldb/**.py): fix invalid escape sequences --- lldb/examples/python/crashlog.py | 8 +- lldb/examples/python/delta.py | 2 +- lldb/examples/python/gdbremote.py | 4 +- lldb/examples/python/jump.py | 6 +- lldb/examples/python/performance.py | 2 +- lldb/examples/python/symbolication.py | 6 +- .../Python/lldbsuite/test/lldbpexpect.py | 2 +- .../test/test_runner/process_control.py | 2 +- .../command/backticks/TestBackticksInAlias.py | 4 +- .../TestMemoryAllocSettings.py| 2 +- .../API/commands/expression/test/TestExprs.py | 2 +- .../TestGuiExpandThreadsTree.py | 2 +- lldb/test/API/commands/help/TestHelp.py | 6 +- .../TestLaunchWithShellExpand.py | 2 +- .../register/TestRegistersUnavailable.py | 4 +- .../API/commands/settings/TestSettings.py | 12 +- .../target/basic/TestTargetCommand.py | 2 +- .../dwo/TestDumpDwo.py| 16 +- .../oso/TestDumpOso.py| 16 +- .../API/commands/trace/TestTraceDumpInfo.py | 2 +- .../API/commands/trace/TestTraceEvents.py | 4 +- .../API/commands/trace/TestTraceStartStop.py | 12 +- lldb/test/API/commands/trace/TestTraceTSC.py | 10 +- .../driver/quit_speed/TestQuitWithProcess.py | 2 +- .../TestBreakpointByLineAndColumn.py | 2 +- .../TestBreakpointLocations.py| 2 +- .../TestDataFormatterAdv.py | 6 +- .../TestDataFormatterCpp.py | 6 +- .../TestDataFormatterObjCNSContainer.py | 16 +- .../TestDataFormatterSkipSummary.py | 2 +- .../TestDataFormatterGenericUnordered.py | 22 +-- .../libcxx/atomic/TestLibCxxAtomic.py | 2 +- .../initializerlist/TestInitializerList.py| 2 +- .../TestTypeSummaryListArg.py | 4 +- .../memory-region/TestMemoryRegion.py | 2 +- .../target_var/TestTargetVar.py | 2 +- .../completion/TestIOHandlerCompletion.py | 2 +- .../c/function_types/TestFunctionTypes.py | 2 +- .../TestRegisterVariables.py | 2 +- .../API/lang/c/set_values/TestSetValues.py| 4 +- lldb/test/API/lang/c/strings/TestCStrings.py | 2 +- .../API/lang/c/tls_globals/TestTlsGlobals.py | 8 +- .../API/lang/cpp/char1632_t/TestChar1632T.py | 8 +- .../cpp/class_static/TestStaticVariables.py | 4 +- .../lang/cpp/class_types/TestClassTypes.py| 2 +- .../cpp/dynamic-value/TestDynamicValue.py | 2 +- .../API/lang/cpp/namespace/TestNamespace.py | 4 +- .../lang/cpp/signed_types/TestSignedTypes.py | 4 +- .../cpp/unsigned_types/TestUnsignedTypes.py | 2 +- .../test/API/lang/mixed/TestMixedLanguages.py | 4 +- .../lang/objc/foundation/TestObjCMethods.py | 2 +- .../objc/foundation/TestObjCMethodsNSArray.py | 10 +- .../objc/foundation/TestObjCMethodsNSError.py | 2 +- .../objc/foundation/TestObjCMethodsString.py | 10 +- .../TestObjCDynamicValue.py | 2 +- .../TestObjCBuiltinTypes.py | 4 +- .../TestAArch64LinuxMTEMemoryTagCoreFile.py | 44 ++--- .../TestAArch64LinuxMTEMemoryTagAccess.py | 160 +- .../TestAArch64LinuxMTEMemoryTagFaults.py | 6 +- .../TestAArch64LinuxTaggedMemoryRegion.py | 4 +- .../macosx/add-dsym/TestAddDsymDownload.py| 2 +- .../TestFirmwareCorefiles.py | 2 +- .../kern-ver-str/TestKernVerStrLCNOTE.py | 2 +- .../TestMultipleBinaryCorefile.py | 2 +- .../macosx/simulator/TestSimulatorPlatform.py | 2 +- .../skinny-corefile/TestSkinnyCorefile.py | 2 +- .../TestTargetArchFromModule.py | 2 +- .../API/source-manager/TestSourceManager.py | 2 +- .../lldb-server/TestGdbRemoteModuleInfo.py| 6 +- .../API/tools/lldb-server/TestPtyServer.py| 2 +- .../TestGdbRemoteTargetXmlPacket.py | 2 +- lldb/test/API/types/AbstractBase.py | 6 +- lldb/utils/lui/sourcewin.py | 2 +- 73 files changed, 263 insertions(+), 263 deletions(-) diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 1c0d717ce455c..2db9857006b0a 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -296,7 +296,7 @@ class DarwinImage(symbolication.Image): except: dsymForUUIDBinary = "" -dwarfdump_uuid_regex = re.compile("UUID: ([-0-9a-fA-F]+) \(([^\(]+)\) .*") +dwarfdump_uuid_regex = re.compile(r"UUID: ([-0-9a-fA-F]+) \(([^\(]+)\) .*") def __init__( self, text_addr
[Lldb-commits] [lldb] [lldb][API] Add Find(Ranges)InMemory() to Process SB API (PR #95007)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/95007 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Merge CompilerContextKind::{Class, Struct} (PR #96145)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/96145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 599ca71 - [lldb] Merge CompilerContextKind::{Class, Struct} (#96145)
Author: Pavel Labath Date: 2024-06-24T08:56:21+02:00 New Revision: 599ca7165edcf7d226bd658c450801044b46ce7c URL: https://github.com/llvm/llvm-project/commit/599ca7165edcf7d226bd658c450801044b46ce7c DIFF: https://github.com/llvm/llvm-project/commit/599ca7165edcf7d226bd658c450801044b46ce7c.diff LOG: [lldb] Merge CompilerContextKind::{Class,Struct} (#96145) Our dwarf parsing code treats structures and classes as interchangable. CompilerContextKind is used when looking DIEs for types. This makes sure we always they're treated the same way. See also [#95905#discussion_r1645686628](https://github.com/llvm/llvm-project/pull/95905#discussion_r1645686628). Added: Modified: lldb/include/lldb/lldb-private-enumerations.h lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Symbol/Type.cpp lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c lldb/test/Shell/SymbolFile/DWARF/x86/compilercontext.ll lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm lldb/tools/lldb-test/lldb-test.cpp lldb/unittests/Symbol/TestType.cpp lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp Removed: diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h index 68e060f2393f7..9d18316dcea25 100644 --- a/lldb/include/lldb/lldb-private-enumerations.h +++ b/lldb/include/lldb/lldb-private-enumerations.h @@ -10,6 +10,7 @@ #define LLDB_LLDB_PRIVATE_ENUMERATIONS_H #include "lldb/lldb-enumerations.h" +#include "llvm/ADT/BitmaskEnum.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/FormatProviders.h" #include "llvm/Support/raw_ostream.h" @@ -197,8 +198,7 @@ enum class CompilerContextKind : uint16_t { TranslationUnit = 1, Module = 1 << 1, Namespace = 1 << 2, - Class = 1 << 3, - Struct = 1 << 4, + ClassOrStruct = 1 << 3, Union = 1 << 5, Function = 1 << 6, Variable = 1 << 7, @@ -210,10 +210,12 @@ enum class CompilerContextKind : uint16_t { /// Match 0..n nested modules. AnyModule = Any | Module, /// Match any type. - AnyType = Any | Class | Struct | Union | Enum | Typedef | Builtin, + AnyType = Any | ClassOrStruct | Union | Enum | Typedef | Builtin, /// Math any declaration context. - AnyDeclContext = Any | Namespace | Class | Struct | Union | Enum | Function + AnyDeclContext = Any | Namespace | ClassOrStruct | Union | Enum | Function, + LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/AnyDeclContext), }; +LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); // Enumerations that can be used to specify the kind of metric we're looking at // when collecting stats. diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index ada3da85112fe..fb32e2adeb3fe 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -394,15 +394,13 @@ static void GetDeclContextImpl(DWARFDIE die, case DW_TAG_namespace: push_ctx(CompilerContextKind::Namespace, die.GetName()); break; +case DW_TAG_class_type: case DW_TAG_structure_type: - push_ctx(CompilerContextKind::Struct, die.GetName()); + push_ctx(CompilerContextKind::ClassOrStruct, die.GetName()); break; case DW_TAG_union_type: push_ctx(CompilerContextKind::Union, die.GetName()); break; -case DW_TAG_class_type: - push_ctx(CompilerContextKind::Class, die.GetName()); - break; case DW_TAG_enumeration_type: push_ctx(CompilerContextKind::Enum, die.GetName()); break; @@ -456,15 +454,13 @@ static void GetTypeLookupContextImpl(DWARFDIE die, case DW_TAG_namespace: push_ctx(CompilerContextKind::Namespace, die.GetName()); break; +case DW_TAG_class_type: case DW_TAG_structure_type: - push_ctx(CompilerContextKind::Struct, die.GetName()); + push_ctx(CompilerContextKind::ClassOrStruct, die.GetName()); break; case DW_TAG_union_type: push_ctx(CompilerContextKind::Union, die.GetName()); break; -case DW_TAG_class_type: - push_ctx(CompilerContextKind::Class, die.GetName()); - break; case DW_TAG_enumeration_type: push_ctx(CompilerContextKind::Enum, die.GetName()); break; diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index eb7f6232ac981..cd1c500d9aa29 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9173,10 +9173,8 @@ static CompilerContextKind GetCompilerKind(clang::Decl::Kind clang_kind, if (decl_ctx) { if (decl_ctx->isFunctionOrMethod()) return CompilerContextKind::F