[Lldb-commits] [lldb] e29b315 - [lldb] Remove xfail aarch64/linux from TestBuiltinTrap.py
Author: Muhammad Omair Javaid Date: 2020-06-17T15:48:59+05:00 New Revision: e29b31513ff6ec2f55ddac002e937239ca80afaa URL: https://github.com/llvm/llvm-project/commit/e29b31513ff6ec2f55ddac002e937239ca80afaa DIFF: https://github.com/llvm/llvm-project/commit/e29b31513ff6ec2f55ddac002e937239ca80afaa.diff LOG: [lldb] Remove xfail aarch64/linux from TestBuiltinTrap.py The underlying clang bug seems to have been fixed in and test is consistently passing on aarch64-linux buildbot. Added: Modified: lldb/test/API/linux/builtin_trap/TestBuiltinTrap.py Removed: diff --git a/lldb/test/API/linux/builtin_trap/TestBuiltinTrap.py b/lldb/test/API/linux/builtin_trap/TestBuiltinTrap.py index 2a9ec4f7617a..604b84605fbc 100644 --- a/lldb/test/API/linux/builtin_trap/TestBuiltinTrap.py +++ b/lldb/test/API/linux/builtin_trap/TestBuiltinTrap.py @@ -23,7 +23,7 @@ def setUp(self): # gcc generates incorrect linetable @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android") -@expectedFailureAll(archs=['aarch64']) +@expectedFailureAll(archs=['aarch64'], oslist=no_match(['linux'])) @skipIfWindows def test_with_run_command(self): """Test that LLDB handles a function with __builtin_trap correctly.""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D81980: Repair support for launching iphone/tv/watch simulator binaries through platform
aprantl updated this revision to Diff 271393. aprantl added a comment. Fix decorator usage. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81980/new/ https://reviews.llvm.org/D81980 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py lldb/packages/Python/lldbsuite/test/make/Makefile.rules lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm lldb/test/API/macosx/simulator/Makefile lldb/test/API/macosx/simulator/TestSimulatorPlatform.py lldb/test/API/macosx/simulator/hello.c Index: lldb/test/API/macosx/simulator/hello.c === --- /dev/null +++ lldb/test/API/macosx/simulator/hello.c @@ -0,0 +1,5 @@ +void puts(char *); +int main(int argc, char **argv) { + puts("break here\n"); + return 0; +} Index: lldb/test/API/macosx/simulator/TestSimulatorPlatform.py === --- /dev/null +++ lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -0,0 +1,46 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil +import json +import unittest2 + + +class TestSimulatorPlatformLaunching(TestBase): + +mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True + +def run_with(self, arch, platform, os, env): +self.build(dictionary={'TRIPLE': arch+'-apple-'+os+'-'+env, 'ARCH': arch}) +lldbutil.run_to_source_breakpoint(self, "break here", + lldb.SBFileSpec("hello.c")) +self.expect('image list -b -t', +patterns=['a\.out '+arch+'-apple-'+os+'.*-'+env]) + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('iphone') +def test_ios(self): +"""Test running an iOS simulator binary""" +self.run_with(arch=self.getArchitecture(), + os='ios', env='simulator', + platform='iphonesimulator') + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('appletv') +def test_tvos(self): +"""Test running an tvOS simulator binary""" +self.run_with(arch=self.getArchitecture(), + os='tvos', env='simulator', + platform='appletvsimulator') + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('watch') +def test_watchos(self): +"""Test running a 32-bit watchOS simulator binary""" +self.run_with(arch='i386', + os='watchos', env='simulator', + platform='watchsimulator') Index: lldb/test/API/macosx/simulator/Makefile === --- /dev/null +++ lldb/test/API/macosx/simulator/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := hello.c + +include Makefile.rules Index: lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm === --- lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -1,5 +1,4 @@ -//===-- PlatformiOSSimulatorCoreSimulatorSupport.cpp ---*- C++ -//-*-===// +//===-- PlatformiOSSimulatorCoreSimulatorSupport.cpp --===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -51,10 +50,12 @@ - (NSUInteger)state; - (BOOL)shutdownWithError:(NSError **)error; - (NSUUID *)UDID; -- (pid_t)spawnWithPath:(NSString *)path - options:(NSDictionary *)options -terminationHandler:(void (^)(int status))terminationHandler - error:(NSError **)error; +- (BOOL)spawnWithPath:(NSString *)path + options:(nullable NSDictionary *)options + terminationQueue:(nullable dispatch_queue_t)terminationQueue +terminationHandler:(nullable void (^)(int status))terminationHandler + pid:(pid_t *_Nullable)pid + error:(NSError *__autoreleasing _Nullable *_Nullable)error; @end CoreSimulatorSupport::Process::Process(lldb::pid_t p) : m_pid(p), m_error() {} @@ -468,9 +469,12 @@ provided, path will be
[Lldb-commits] [lldb] 64c87a9 - [lldb/Test] Fix tests that rely on logfiles with reproducers.
Author: Jonas Devlieghere Date: 2020-06-17T10:09:06-07:00 New Revision: 64c87a94caadc4a6351ab138dd2ca99975441b60 URL: https://github.com/llvm/llvm-project/commit/64c87a94caadc4a6351ab138dd2ca99975441b60 DIFF: https://github.com/llvm/llvm-project/commit/64c87a94caadc4a6351ab138dd2ca99975441b60.diff LOG: [lldb/Test] Fix tests that rely on logfiles with reproducers. Now that the log file is included in the reproducers, the path needs to be remapped for the test to find the new file in the reproducer. Added: Modified: lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/test/API/api/log/TestAPILog.py lldb/test/API/commands/log/basic/TestLogging.py lldb/test/API/lang/c/modules/TestCModules.py lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py lldb/test/API/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py lldb/test/API/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index c5373479e48f..481c23671228 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -699,6 +699,12 @@ def getReproducerArtifact(self, name): lldbutil.mkdir_p(self.getReproducerDir()) return os.path.join(self.getReproducerDir(), name) +def getReproducerRemappedPath(self, path): +assert configuration.replay_path +assert os.path.isabs(path) +path = os.path.relpath(path, '/') +return os.path.join(configuration.replay_path, 'root', path) + @classmethod def setUpCommands(cls): commands = [ diff --git a/lldb/test/API/api/log/TestAPILog.py b/lldb/test/API/api/log/TestAPILog.py index c0ffa2c6f509..72df276b06c3 100644 --- a/lldb/test/API/api/log/TestAPILog.py +++ b/lldb/test/API/api/log/TestAPILog.py @@ -17,12 +17,15 @@ class APILogTestCase(TestBase): def test_api_log(self): """Test API logging""" -logfile = os.path.join(self.getBuildDir(), "api-log.txt") +logfile = self.getBuildArtifact("api-log.txt") def cleanup(): if os.path.exists(logfile): os.unlink(logfile) +if configuration.is_reproducer_replay(): +logfile = self.getReproducerRemappedPath(logfile) + self.addTearDownHook(cleanup) self.expect("log enable lldb api -f {}".format(logfile)) @@ -30,7 +33,7 @@ def cleanup(): self.dbg.GetScriptingLanguage(None) target = self.dbg.CreateTarget(None) -print(logfile) +self.assertTrue(os.path.isfile(logfile)) with open(logfile, 'r') as f: log = f.read() diff --git a/lldb/test/API/commands/log/basic/TestLogging.py b/lldb/test/API/commands/log/basic/TestLogging.py index 16321dca86fd..4ba67f8794b6 100644 --- a/lldb/test/API/commands/log/basic/TestLogging.py +++ b/lldb/test/API/commands/log/basic/TestLogging.py @@ -20,6 +20,9 @@ def setUp(self): super(LogTestCase, self).setUp() self.log_file = self.getBuildArtifact("log-file.txt") +if configuration.is_reproducer_replay(): +self.log_file = self.getReproducerRemappedPath(self.log_file) + def test_file_writing(self): self.build() exe = self.getBuildArtifact("a.out") @@ -44,9 +47,8 @@ def test_file_writing(self): self.assertTrue(os.path.isfile(self.log_file)) -f = open(self.log_file) -log_lines = f.readlines() -f.close() +with open(self.log_file, 'r') as f: +log_lines = f.read() os.remove(self.log_file) self.assertGreater( @@ -83,7 +85,7 @@ def test_log_append(self): self.runCmd("log disable lldb") self.assertTrue(os.path.isfile(self.log_file)) -with open(self.log_file, "r") as f: +with open(self.log_file, 'r') as f: contents = f.read() # check that it is still there diff --git a/lldb/test/API/lang/c/modules/TestCModules.py b/lldb/test/API/lang/c/modules/TestCModules.py index 948e8bed7862..7dd073e600f7 100644 --- a/lldb/test/API/lang/c/modules/TestCModules.py +++ b/lldb/test/API/lang/c/modules/TestCModules.py @@ -44,7 +44,9 @@ def test_expr(self): substrs=[' resolved, hit count = 1']) # Enable logging of the imported AST. -log_file = os.path.join(self.getBuildDir(), "lldb-ast-log.txt") +log_file = self.getBuildArtifact("lldb-ast-log.txt") +if configuration.is_reproducer_replay(): +log_file = self.getReproducerRemappedPath(log_file) self.runCmd("log enable lldb ast -f '%s'" % log_file) self.expect( diff --git a/lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py b/lldb/test/API/lang/cpp/accelerator
[Lldb-commits] [PATCH] D81980: Repair support for launching iphone/tv/watch simulator binaries through platform
aprantl updated this revision to Diff 271425. aprantl added a comment. Fix fallout from the Makefile.rules change by adapting a handful of manually written Makefiles. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81980/new/ https://reviews.llvm.org/D81980 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py lldb/packages/Python/lldbsuite/test/make/Makefile.rules lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm lldb/test/API/functionalities/fat_archives/Makefile lldb/test/API/lang/objcxx/class-name-clash/Makefile lldb/test/API/macosx/find-app-in-bundle/Makefile lldb/test/API/macosx/find-app-in-bundle/TestFindAppInBundle.py lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/Makefile lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py lldb/test/API/macosx/find-dsym/deep-bundle/Makefile lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py lldb/test/API/macosx/simulator/Makefile lldb/test/API/macosx/simulator/TestSimulatorPlatform.py lldb/test/API/macosx/simulator/hello.c lldb/test/API/macosx/universal/Makefile Index: lldb/test/API/macosx/universal/Makefile === --- lldb/test/API/macosx/universal/Makefile +++ lldb/test/API/macosx/universal/Makefile @@ -8,13 +8,13 @@ lipo -create -o testit $^ testit.x86_64h: testit.x86_64h.o - $(CC) -arch x86_64h -o testit.x86_64h $< + $(CC) -isysroot $(SDKROOT) -arch x86_64h -o testit.x86_64h $< testit.x86_64: testit.x86_64.o - $(CC) -arch x86_64 -o testit.x86_64 $< + $(CC) -isysroot $(SDKROOT) -arch x86_64 -o testit.x86_64 $< testit.x86_64h.o: main.c - $(CC) -g -O0 -arch x86_64h -c -o testit.x86_64h.o $< + $(CC) -isysroot $(SDKROOT) -g -O0 -arch x86_64h -c -o testit.x86_64h.o $< testit.x86_64.o: main.c - $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $< + $(CC) -isysroot $(SDKROOT) -g -O0 -arch x86_64 -c -o testit.x86_64.o $< Index: lldb/test/API/macosx/simulator/hello.c === --- /dev/null +++ lldb/test/API/macosx/simulator/hello.c @@ -0,0 +1,5 @@ +void puts(char *); +int main(int argc, char **argv) { + puts("break here\n"); + return 0; +} Index: lldb/test/API/macosx/simulator/TestSimulatorPlatform.py === --- /dev/null +++ lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -0,0 +1,46 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil +import json +import unittest2 + + +class TestSimulatorPlatformLaunching(TestBase): + +mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True + +def run_with(self, arch, platform, os, env): +self.build(dictionary={'TRIPLE': arch+'-apple-'+os+'-'+env, 'ARCH': arch}) +lldbutil.run_to_source_breakpoint(self, "break here", + lldb.SBFileSpec("hello.c")) +self.expect('image list -b -t', +patterns=['a\.out '+arch+'-apple-'+os+'.*-'+env]) + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('iphone') +def test_ios(self): +"""Test running an iOS simulator binary""" +self.run_with(arch=self.getArchitecture(), + os='ios', env='simulator', + platform='iphonesimulator') + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('appletv') +def test_tvos(self): +"""Test running an tvOS simulator binary""" +self.run_with(arch=self.getArchitecture(), + os='tvos', env='simulator', + platform='appletvsimulator') + +@skipUnlessDarwin +@skipIfDarwinEmbedded +@apple_simulator_test('watch') +def test_watchos(self): +"""Test running a 32-bit watchOS simulator binary""" +self.run_with(arch='i386', + os='watchos', env='simulator', + platform='watchsimulator') Index: lldb/test/API/macosx/simulator/Makefile === --- /dev/null +++ lldb/test/API/macosx/simulator/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := hello.c + +include Makefile.rules Index: lldb/test/API/macosx/fin
[Lldb-commits] [lldb] 6c45532 - Remove code duplication from RegisterContextPOSIX_*
Author: Muhammad Omair Javaid Date: 2020-06-18T01:02:46+05:00 New Revision: 6c45532908bacc0cf569bcad74f6e04e1e2a6c61 URL: https://github.com/llvm/llvm-project/commit/6c45532908bacc0cf569bcad74f6e04e1e2a6c61 DIFF: https://github.com/llvm/llvm-project/commit/6c45532908bacc0cf569bcad74f6e04e1e2a6c61.diff LOG: Remove code duplication from RegisterContextPOSIX_* Summary: This patch aims to remove multiple copies of GetByteOrder() and ConvertRegisterKindToRegisterNumber used in various versions of RegisterContextPOSIX_*. Both register implementations are move to RegisterContext class which is parent of RegisterContextPOSIX_* classes. Built and tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabihf targets. Reviewers: labath Reviewed By: labath Subscribers: wuzish, nemanjai, kristof.beyls, kbarton, atanasyan, lldb-commits Differential Revision: https://reviews.llvm.org/D80104 Added: Modified: lldb/include/lldb/Target/RegisterContext.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h lldb/source/Target/RegisterContext.cpp Removed: diff --git a/lldb/include/lldb/Target/RegisterContext.h b/lldb/include/lldb/Target/RegisterContext.h index 651973de64bf..5e795e59f941 100644 --- a/lldb/include/lldb/Target/RegisterContext.h +++ b/lldb/include/lldb/Target/RegisterContext.h @@ -39,6 +39,8 @@ class RegisterContext : public std::enable_shared_from_this, virtual const RegisterSet *GetRegisterSet(size_t reg_set) = 0; + virtual lldb::ByteOrder GetByteOrder(); + virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) = 0; @@ -105,7 +107,7 @@ class RegisterContext : public std::enable_shared_from_this, /// The equivalent register number in the eRegisterKindLLDB /// numbering scheme, if possible, else LLDB_INVALID_REGNUM. virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, - uint32_t num) = 0; + uint32_t num); // Subclasses can override these functions if desired virtual uint32_t NumSupportedHardwareBreakpoints(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp index 66a352910633..617893b6b3b0 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp @@ -178,35 +178,6 @@ const char *RegisterContextPOSIX_arm::GetRegisterName(unsigned reg) { return GetRegisterInfo()[reg].name; } -lldb::ByteOrder RegisterContextPOSIX_arm::GetByteOrder() { - // Get the target process whose privileged thread was used for the register - // read. - lldb::ByteOrder byte_order = lldb::eByteOrderInvalid; - lldb_private::Process *process = CalculateProcess().get(); - - if (process) -byte_order = process->GetByteOrder(); - return byte_order; -} - bool RegisterContextPOSIX_arm::IsRegisterSetAvailable(size_t set_index) { return set_index < k_num_register_sets; } - -// Used when parsing DWARF and EH frame information and any other object file -// sections that contain register numbers in them. -uint32_t RegisterContextPOSIX_arm::ConvertRegisterKindToRegisterNumber( -lldb::RegisterKind kind, uint32_t num) { - const uint32_t num_regs = GetRegisterCount(); - - assert(kind < lldb::kNumRegisterKinds); - for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) { -const lldb_private::RegisterInfo *reg_info = -GetRegisterInfoAtIndex(reg_idx); - -if (reg_info->kinds[kind] == num) - return reg_idx; - } - - return LLDB_INVALID_REGNUM; -} diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h index 4400d94f7f7b..d6967f05ed48 100644 --- a/lldb/source/Plugins/Process/Utility/
[Lldb-commits] [PATCH] D80104: [LLDB] Remove code duplication from RegisterContextPOSIX_*
This revision was automatically updated to reflect the committed changes. Closed by commit rG6c45532908ba: Remove code duplication from RegisterContextPOSIX_* (authored by omjavaid). Herald added a subscriber: jrtc27. Herald added a project: LLDB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80104/new/ https://reviews.llvm.org/D80104 Files: lldb/include/lldb/Target/RegisterContext.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h lldb/source/Target/RegisterContext.cpp Index: lldb/source/Target/RegisterContext.cpp === --- lldb/source/Target/RegisterContext.cpp +++ lldb/source/Target/RegisterContext.cpp @@ -274,6 +274,24 @@ return LLDB_INVALID_INDEX32; } +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. +uint32_t +RegisterContext::ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, + uint32_t num) { + const uint32_t num_regs = GetRegisterCount(); + + assert(kind < kNumRegisterKinds); + for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) { +const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx); + +if (reg_info->kinds[kind] == num) + return reg_idx; + } + + return LLDB_INVALID_REGNUM; +} + bool RegisterContext::ClearHardwareBreakpoint(uint32_t hw_idx) { return false; } uint32_t RegisterContext::NumSupportedHardwareWatchpoints() { return 0; } @@ -397,6 +415,17 @@ return error; } +lldb::ByteOrder RegisterContext::GetByteOrder() { + // Get the target process whose privileged thread was used for the register + // read. + lldb::ByteOrder byte_order = lldb::eByteOrderInvalid; + lldb_private::Process *process = CalculateProcess().get(); + + if (process) +byte_order = process->GetByteOrder(); + return byte_order; +} + bool RegisterContext::ReadAllRegisterValues( lldb_private::RegisterCheckpoint ®_checkpoint) { return ReadAllRegisterValues(reg_checkpoint.GetData()); Index: lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h === --- lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h +++ lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h @@ -47,9 +47,6 @@ const char *GetRegisterName(unsigned reg); - uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, - uint32_t num) override; - // Note: prefer kernel definitions over user-land enum FPRType { eNotValid = 0, @@ -160,8 +157,6 @@ bool IsAVX(unsigned reg); - lldb::ByteOrder GetByteOrder(); - bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order); bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order); bool IsFPR(unsigned reg, FPRType fpr_type); Index: lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp === --- lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -456,17 +456,6 @@ return GetRegisterInfo()[reg].name; } -lldb::ByteOrder RegisterContextPOSIX_x86::GetByteOrder() { - // Get the target process whose privileged thread was used for the register - // read. - lldb::ByteOrder byte_order = eByteOrderInvalid; - Process *process = CalculateProcess().get(); - - if (process) -byte_order = process->GetByteOrder(); - return byte_order; -} - // Parse ymm registers and into xmm.bytes and ymmh.bytes. bool RegisterContextPOSIX_x86::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order) { @@ -509,20 +498,3 @@ ++num_sets; return (set_index < num_sets); } - -// Used when parsing DWARF and EH frame information and any other object file -// sections that contain register numbers in them. -uint32_t RegisterContextPOSIX_x86::Conve
[Lldb-commits] [PATCH] D81978: Redo of Add terminateCommands to lldb-vscode protocol
clayborg added inline comments. Comment at: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py:221-223 +elif packet_type == 'response': +if packet['command'] == 'disconnect': +keepGoing = False revert whitespace only change? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81978/new/ https://reviews.llvm.org/D81978 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D77047: AArch64 SVE register infos and core file support
omjavaid updated this revision to Diff 271532. omjavaid added a comment. This update remove skipping over register infos requirement by overlapping sve register numbers with debug register numbers which are not required by Linux register context. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77047/new/ https://reviews.llvm.org/D77047 Files: lldb/include/lldb/Target/RegisterContext.h lldb/source/Plugins/Process/Linux/LinuxPTraceDefines_arm64sve.h lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h lldb/source/Plugins/Process/Utility/RegisterInfoInterface.h lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h lldb/source/Plugins/Process/Utility/lldb-arm64-register-enums.h lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h lldb/source/Plugins/Process/elf-core/RegisterUtilities.h lldb/source/Utility/ARM64_DWARF_Registers.h lldb/source/Utility/ARM64_ehframe_Registers.h lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.core Index: lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c === --- /dev/null +++ lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c @@ -0,0 +1,24 @@ +// compile with -march=armv8-a+sve on compatible aarch64 compiler +// linux-aarch64-sve.core was generated by: aarch64-linux-gnu-gcc-8 +// commandline: -march=armv8-a+sve -nostdlib -static -g linux-aarch64-sve.c +static void bar(char *boom) { + char F = 'b'; + asm volatile("ptrue p0.s\n\t"); + asm volatile("fcpy z0.s, p0/m, #7.5\n\t"); + asm volatile("ptrue p1.s\n\t"); + asm volatile("fcpy z1.s, p1/m, #11.5\n\t"); + asm volatile("ptrue p3.s\n\t"); + asm volatile("fcpy z3.s, p3/m, #15.5\n\t"); + + *boom = 47; // Frame bar +} + +static void foo(char *boom, void (*boomer)(char *)) { + char F = 'f'; + boomer(boom); // Frame foo +} + +void _start(void) { + char F = '_'; + foo(0, bar); // Frame _start +} Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py === --- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -269,7 +269,7 @@ self.dbg.DeleteTarget(target) @skipIf(triple='^mips') -@skipIfLLVMTargetMissing("AArch64") +#@skipIfLLVMTargetMissing("AArch64") def test_aarch64_regs(self): # check 64 bit ARM core files target = self.dbg.CreateTarget(None) @@ -323,6 +323,47 @@ self.expect("register read --all") +#@skipIf(triple='^mips') +#@skipIfLLVMTargetMissing("AArch64") +def test_aarch64_sve_regs(self): +# check 64 bit ARM core files +target = self.dbg.CreateTarget(None) +self.assertTrue(target, VALID_TARGET) +process = target.LoadCore("linux-aarch64-sve.core") + +values = {} +values["fp"] = "0xfc1ff4f0" +values["lr"] = "0x00400170" +values["sp"] = "0xfc1ff4d0" +values["pc"] = "0x0040013c" +values["v0"] = "{0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40}" +values["v1"] = "{0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41}" +values["v2"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}" +values["v3"] = "{0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41}" +values["s0"] = "7.5" +values["s1"] = "11.5" +values["s2"] = "0" +values["s3"] = "15.5" +values["d0"] = "65536.0158538818" +values["d1"] = "1572864.25476074" +values["d2"] = "0" +values["d3"] = "25165828.0917969" +values["vg"] = "0x0004" +values["z0"] = "{0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40}" +values["z1"] = "{0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41}" +values["z2"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0
[Lldb-commits] [PATCH] D79699: Add ptrace register access for AArch64 SVE registers
omjavaid updated this revision to Diff 271528. omjavaid added a comment. This update remove skipping over register infos requirement by overlapping sve register numbers with debug register numbers which are not required by Linux register context. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79699/new/ https://reviews.llvm.org/D79699 Files: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h lldb/source/Plugins/Process/Linux/NativeThreadLinux.h lldb/test/API/commands/register/register/aarch64_sve_registers/Makefile lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py lldb/test/API/commands/register/register/aarch64_sve_registers/main.c Index: lldb/test/API/commands/register/register/aarch64_sve_registers/main.c === --- /dev/null +++ lldb/test/API/commands/register/register/aarch64_sve_registers/main.c @@ -0,0 +1,5 @@ +int main() { + asm volatile("ptrue p0.s\n\t"); + asm volatile("fcpy z0.s, p0/m, #5.\n\t"); + return 0; // Set a break point here. +} \ No newline at end of file Index: lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py === --- /dev/null +++ lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py @@ -0,0 +1,129 @@ +""" +Test the AArch64 SVE registers. +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class RegisterCommandsTestCase(TestBase): + +def check_sve_register_size(self, set, name, expected): +reg_value = set.GetChildMemberWithName(name) +self.assertTrue(reg_value.IsValid(), +'Verify we have a register named "%s"' % (name)) +self.assertEqual(reg_value.GetByteSize(), expected, + 'Verify "%s" == %i' % (name, expected)) + +mydir = TestBase.compute_mydir(__file__) +@skipIf +def test_sve_registers_configuration(self): +"""Test AArch64 SVE registers size configuration.""" +self.build() +self.line = line_number('main.c', '// Set a break point here.') + +exe = self.getBuildArtifact("a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +lldbutil.run_break_set_by_file_and_line(self, "main.c", self.line, num_expected_locations=1) +self.runCmd("run", RUN_SUCCEEDED) + +self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, +substrs = ["stop reason = breakpoint 1."]) + +target = self.dbg.GetSelectedTarget() +process = target.GetProcess() +thread = process.GetThreadAtIndex(0) +currentFrame = thread.GetFrameAtIndex(0) + +has_sve = False +for registerSet in currentFrame.GetRegisters(): +if 'sve registers' in registerSet.GetName().lower(): +has_sve = True + +if not has_sve: +self.skipTest('SVE registers must be supported.') + +registerSets = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetRegisters() + +sve_registers = registerSets.GetValueAtIndex(2) + +vg_reg = sve_registers.GetChildMemberWithName("vg") + +vg_reg_value = sve_registers.GetChildMemberWithName("vg").GetValueAsUnsigned() + +z_reg_size = vg_reg_value * 8 + +p_reg_size = z_reg_size / 8 + +for i in range(32): +self.check_sve_register_size(sve_registers, 'z%i' % (i), z_reg_size) + +for i in range(16): +self.check_sve_register_size(sve_registers, 'p%i' % (i), p_reg_size) + +self.check_sve_register_size(sve_registers, 'ffr', p_reg_size) + +mydir = TestBase.compute_mydir(__file__) +@no_debug_info_test +@skipIf +def test_sve_registers_read_write(self): +"""Test AArch64 SVE registers read and write.""" +self.build() +self.line = line_number('main.c', '// Set a break point here.') + +exe = self.getBuildArtifact("a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +lldbutil.run_break_set_by_file_and_line(self, "main.c", self.line, num_expected_locations=1) +self.runCmd("run", RUN_SUCCEEDED) + +self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, +substrs = ["stop reason = breakpoint 1."]) + +target = self.dbg.GetSelectedTarget() +process = target.GetProcess() +thread = process.GetThreadAtIndex(0) +currentFrame = thread.GetFrameAtIndex(0) + +has_sve = False +for registerSet in currentFrame.GetRegisters(): +if 'sve registers' in registerSet.GetName().lower(): +has_sve =
[Lldb-commits] [PATCH] D77045: Minor fixups to LLDB AArch64 register infos macros for SVE register infos
omjavaid updated this revision to Diff 271533. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77045/new/ https://reviews.llvm.org/D77045 Files: lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h Index: lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h === --- lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h +++ lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h @@ -456,37 +456,26 @@ static uint32_t g_d30_invalidates[] = {fpu_v30, fpu_s30, LLDB_INVALID_REGNUM}; static uint32_t g_d31_invalidates[] = {fpu_v31, fpu_s31, LLDB_INVALID_REGNUM}; -// Generates register kinds array for 64-bit general purpose registers -#define GPR64_KIND(reg, generic_kind) \ +// Generates register kinds array with DWARF, EH frame and generic kind +#define MISC_KIND(reg, type, generic_kind) \ { \ arm64_ehframe::reg, arm64_dwarf::reg, generic_kind, LLDB_INVALID_REGNUM, \ -gpr_##reg \ +type##_##reg \ } -// Generates register kinds array for registers with lldb kind -#define MISC_KIND(lldb_kind) \ +// Generates register kinds array for registers with only lldb kind +#define LLDB_KIND(lldb_kind) \ { \ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \ LLDB_INVALID_REGNUM, lldb_kind \ } // Generates register kinds array for vector registers -#define VREG_KIND(reg) \ - { \ -LLDB_INVALID_REGNUM, arm64_dwarf::reg, LLDB_INVALID_REGNUM, \ -LLDB_INVALID_REGNUM, fpu_##reg \ - } - -// Generates register kinds array for cpsr -#define CPSR_KIND(lldb_kind) \ - { \ -arm64_ehframe::cpsr, arm64_dwarf::cpsr, LLDB_REGNUM_GENERIC_FLAGS, \ -LLDB_INVALID_REGNUM, lldb_kind \ - } - -#define MISC_GPR_KIND(lldb_kind) CPSR_KIND(lldb_kind) -#define MISC_FPU_KIND(lldb_kind) MISC_KIND(lldb_kind) -#define MISC_EXC_KIND(lldb_kind) MISC_KIND(lldb_kind) +#define GPR64_KIND(reg, generic_kind) MISC_KIND(reg, gpr, generic_kind) +#define VREG_KIND(reg) MISC_KIND(reg, fpu, LLDB_INVALID_REGNUM) +#define MISC_GPR_KIND(lldb_kind) MISC_KIND(cpsr, gpr, LLDB_REGNUM_GENERIC_FLAGS) +#define MISC_FPU_KIND(lldb_kind) LLDB_KIND(lldb_kind) +#define MISC_EXC_KIND(lldb_kind) LLDB_KIND(lldb_kind) // Defines a 64-bit general purpose register #define DEFINE_GPR64(reg, generic_kind) \ @@ -509,7 +498,7 @@ { \ #wreg, nullptr, 4, \ GPR_OFFSET(gpr_##xreg) + GPR_W_PSEUDO_REG_ENDIAN_OFFSET, \ -lldb::eEncodingUint, lldb::eFormatHex, MISC_KIND(gpr_##wreg), \ +lldb::eEncodingUint, lldb::eFormatHex, LLDB_KIND(gpr_##wreg), \ g_contained_##xreg, g_##wreg##_invalidates, nullptr, 0 \ } @@ -525,7 +514,7 @@ #define DEFINE_FPU_PSEUDO(reg, size, offset, vreg) \ { \ #reg, nullptr, size, FPU_OFFSET(fpu_##vreg - fpu_v0) + offset, \ -lldb::eEncodingIEEE754, lldb::eFormatFloat, MISC_KIND(fpu_##reg), \ +lldb::eEncodingIEEE754, lldb::eFormatFloat, LLDB_KIND(fpu_##reg), \ g_contained_##vreg, g_##reg##_invalidates, nullptr, 0 \ } Index: lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h === --- lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h +++ lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h @@ -456,37 +456,26 @@ static uint32_t g_d30_invalidates[] = {fpu_v30, fpu_s30, LLDB_INVALID_REGNUM}; static uint32_t g_d31_invalidates[] = {fpu_v31, fpu_s31, LLDB_INVALID_REGNUM}; -// Generates register kinds array for 64-bit general purpose registers -#define GPR64_KIND(reg, generic_kind) \ +// Generates register kinds array with DWARF, EH frame and generic kind +#define MIS
[Lldb-commits] [PATCH] D82064: [ARM64] Add QEMU testing environment setup guide for SVE testing
omjavaid created this revision. omjavaid added a reviewer: labath. omjavaid added a project: LLDB. Herald added subscribers: aaron.ballman, danielkiss, kristof.beyls, tschuett. This patch adds a HowTo document to lldb docs which gives instruction on how to setup QEMU environment for modern Arm64 features not released in publicly available hardware till date. More generally this howto can be applied to other architecture types supported by QEMU emulator. This may help setup a lldb test environment for all supported architecture/platform types. https://reviews.llvm.org/D82064 Files: lldb/docs/lldb-qemu-aarch64-sve-howto.txt Index: lldb/docs/lldb-qemu-aarch64-sve-howto.txt === --- /dev/null +++ lldb/docs/lldb-qemu-aarch64-sve-howto.txt @@ -0,0 +1,219 @@ + +LLDB Testing on AArch64 SVE Linux using QEMU system mode emulation + + +QEMU can be used to test LLDB in emulation environment in absence of actual +hardware. This write up will help setup an QEMU environment for testing LLDB +patches supporting AArch64 features like SVE, MTE, Pointer Authentication etc. + +Ubuntu Bionic/Focal x86_64 host machine was used to test all instruction in this +document. Please update it according to your host distribution/architecture. + +# STEP 1 + +# Bash script for creating Debian/Ubuntu Linux RootFS for QEMU system emulation +# Example usage: +# To create an img file of size 8 GB containing Ubuntu Bionic arm64 rootFS +# > bash create-qemu-rootfs.sh bionic-arm64 8G bionic arm64 + +#!/bin/bash + +# Prerequisites: +sudo apt-get install debootstrap qemu-user-static schroot qemu-utils + +if [ $# -gt 3 ]; then + echo "Your command line contains $# arguments" +else + echo "Invalid or no arguments" + echo "Usage example: create-rootfs-qemu.sh focal-arm64 8G focal arm64" + echo "focal-arm64 is image name" + echo "8G is image size in Gigabytes" + echo "focal is distro name" + echo "arm64 is rootFS architecture" + exit +fi + +RFS_IMG_NAME=$1 +shift +RFS_IMG_SIZE_GB=$1 +shift +BOOTSTRAP_DISTRO=$1 +shift +BOOTSTRAP_ARCH=$1 + +echo "Root FS image name ... $RFS_IMG_NAME" +echo "Root FS size in GB ... $RFS_IMG_SIZE_GB" +echo "Root FS bootstrap distro name ... $BOOTSTRAP_DISTRO" +echo "Root FS bootstrap distro architecture... $BOOTSTRAP_ARCH" + +qemu-img create $RFS_IMG_NAME.img $RFS_IMG_SIZE_GB + +mkfs.ext4 $RFS_IMG_NAME.img +mkdir $RFS_IMG_NAME.dir +sudo mount -o loop $RFS_IMG_NAME.img $RFS_IMG_NAME.dir + +sudo qemu-debootstrap --arch $BOOTSTRAP_ARCH $BOOTSTRAP_DISTRO $RFS_IMG_NAME.dir + +sudo chroot $RFS_IMG_NAME.dir locale-gen en_US.UTF-8 + +sudo chroot $RFS_IMG_NAME.dir sed -i \ +'s/main/main restricted multiverse universe/g' /etc/apt/sources.list + +sudo chroot $RFS_IMG_NAME.dir sed -i '$ a\nameserver 8.8.8.8' /etc/resolv.conf + +sudo chroot $RFS_IMG_NAME.dir apt update +sudo chroot $RFS_IMG_NAME.dir apt -y install ssh bash-completion +sudo chroot $RFS_IMG_NAME.dir adduser --gecos "" $USER +sudo chroot $RFS_IMG_NAME.dir adduser $USER sudo +sudo umount $RFS_IMG_NAME.dir +rmdir $RFS_IMG_NAME.dir + + +# End of STEP 1 + + + +# STEP 2 +# +# Build QEMU from source for AArch64 system-mode emulation + + +# Install dependencies +sudo apt-get build-dep qemu +sudo apt install libsdl2-dev + +# Checkout source code +git clone git://git.qemu.org/qemu.git qemu.git + +# Configure and build +cd qemu.git +./configure --target-list=aarch64-softmmu +make + + +# STEP 3 +# +# Cross compile Linux kernel + + +# Install dependencies +sudo apt install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu + +# Checkout source code, select branch and clean up source directory +git clone \ +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux.git + +cd linux.git +make mrproper + +# kernel_branch=master arch=arm64 config=defconfig +make O=../linux.build/master/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ +defconfig + +make O=../linux.build/master/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- + + + +# STEP 4 +# +# AArc
[Lldb-commits] [PATCH] D77043: Fix process gdb-remote usage of value_regs/invalidate_regs
omjavaid updated this revision to Diff 271534. omjavaid added a comment. This patch is now independent of SVE register support and is only a requirement for the case of where remote stub utilizes xml register description and sends register nos which are not consecutively placed. This patch ensures eRegisterKindProcessPlugin is used while referring to value_regs/invalidate_regs. This is needed because remote stubs may send target xml packets with stub specific register numbering scheme. Thus value_regs and invalidate_regs may have been populated based on a foreign register numbering scheme. We fix this by converting value_reg/invalidate_reg number to lldb register number before querying appropriate register info. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77043/new/ https://reviews.llvm.org/D77043 Files: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp === --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -242,11 +242,15 @@ // Index of the primordial register. bool success = true; for (uint32_t idx = 0; success; ++idx) { -const uint32_t prim_reg = reg_info->value_regs[idx]; +uint32_t prim_reg = reg_info->value_regs[idx]; if (prim_reg == LLDB_INVALID_REGNUM) break; // We have a valid primordial register as our constituent. Grab the // corresponding register info. +uint32_t regnum = ConvertRegisterKindToRegisterNumber( +eRegisterKindProcessPlugin, prim_reg); +if (regnum != LLDB_INVALID_REGNUM) + prim_reg = regnum; const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg); if (prim_reg_info == nullptr) success = false; @@ -375,11 +379,15 @@ // Invalidate this composite register first. for (uint32_t idx = 0; success; ++idx) { -const uint32_t reg = reg_info->value_regs[idx]; +uint32_t reg = reg_info->value_regs[idx]; if (reg == LLDB_INVALID_REGNUM) break; // We have a valid primordial register as our constituent. Grab the // corresponding register info. +uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber( +eRegisterKindProcessPlugin, reg); +if (lldb_regnum != LLDB_INVALID_REGNUM) + reg = lldb_regnum; const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg); if (value_reg_info == nullptr) success = false; @@ -397,6 +405,10 @@ for (uint32_t idx = 0, reg = reg_info->invalidate_regs[0]; reg != LLDB_INVALID_REGNUM; reg = reg_info->invalidate_regs[++idx]) { +uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber( +eRegisterKindProcessPlugin, reg); +if (lldb_regnum != LLDB_INVALID_REGNUM) + reg = lldb_regnum; SetRegisterIsValid(reg, false); } } Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp === --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -242,11 +242,15 @@ // Index of the primordial register. bool success = true; for (uint32_t idx = 0; success; ++idx) { -const uint32_t prim_reg = reg_info->value_regs[idx]; +uint32_t prim_reg = reg_info->value_regs[idx]; if (prim_reg == LLDB_INVALID_REGNUM) break; // We have a valid primordial register as our constituent. Grab the // corresponding register info. +uint32_t regnum = ConvertRegisterKindToRegisterNumber( +eRegisterKindProcessPlugin, prim_reg); +if (regnum != LLDB_INVALID_REGNUM) + prim_reg = regnum; const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg); if (prim_reg_info == nullptr) success = false; @@ -375,11 +379,15 @@ // Invalidate this composite register first. for (uint32_t idx = 0; success; ++idx) { -const uint32_t reg = reg_info->value_regs[idx]; +uint32_t reg = reg_info->value_regs[idx]; if (reg == LLDB_INVALID_REGNUM) break; // We have a valid primordial register as our constituent. Grab the // corresponding register info. +uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber( +eRegisterKindProcessPlugin, reg); +if (lldb_regnum != LLDB_INVALID_REGNUM) + reg = lldb_regnum; const Regis
[Lldb-commits] [PATCH] D81978: Redo of Add terminateCommands to lldb-vscode protocol
wallace updated this revision to Diff 271542. wallace added a comment. . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81978/new/ https://reviews.llvm.org/D81978 Files: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py lldb/tools/lldb-vscode/README.md lldb/tools/lldb-vscode/VSCode.cpp lldb/tools/lldb-vscode/VSCode.h lldb/tools/lldb-vscode/lldb-vscode.cpp Index: lldb/tools/lldb-vscode/lldb-vscode.cpp === --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -174,6 +174,7 @@ void SendTerminatedEvent() { if (!g_vsc.sent_terminated_event) { g_vsc.sent_terminated_event = true; +g_vsc.RunTerminateCommands(); // Send a "terminated" event llvm::json::Object event(CreateEventObject("terminated")); g_vsc.SendJSON(llvm::json::Value(std::move(event))); @@ -530,6 +531,7 @@ g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); + g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands"); auto attachCommands = GetStrings(arguments, "attachCommands"); llvm::StringRef core_file = GetString(arguments, "coreFile"); g_vsc.stop_at_entry = @@ -775,7 +777,6 @@ GetBoolean(arguments, "terminateDebuggee", defaultTerminateDebuggee); lldb::SBProcess process = g_vsc.target.GetProcess(); auto state = process.GetState(); - switch (state) { case lldb::eStateInvalid: case lldb::eStateUnloaded: @@ -797,8 +798,8 @@ g_vsc.debugger.SetAsync(true); break; } - g_vsc.SendJSON(llvm::json::Value(std::move(response))); SendTerminatedEvent(); + g_vsc.SendJSON(llvm::json::Value(std::move(response))); if (g_vsc.event_thread.joinable()) { g_vsc.broadcaster.BroadcastEventByType(eBroadcastBitStopEventThread); g_vsc.event_thread.join(); @@ -1368,6 +1369,7 @@ g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); + g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands"); auto launchCommands = GetStrings(arguments, "launchCommands"); g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false); const llvm::StringRef debuggerRoot = GetString(arguments, "debuggerRoot"); Index: lldb/tools/lldb-vscode/VSCode.h === --- lldb/tools/lldb-vscode/VSCode.h +++ lldb/tools/lldb-vscode/VSCode.h @@ -86,6 +86,7 @@ std::vector pre_run_commands; std::vector exit_commands; std::vector stop_commands; + std::vector terminate_commands; lldb::tid_t focus_tid; bool sent_terminated_event; bool stop_at_entry; @@ -133,6 +134,7 @@ void RunPreRunCommands(); void RunStopCommands(); void RunExitCommands(); + void RunTerminateCommands(); /// Create a new SBTarget object from the given request arguments. /// \param[in] arguments Index: lldb/tools/lldb-vscode/VSCode.cpp === --- lldb/tools/lldb-vscode/VSCode.cpp +++ lldb/tools/lldb-vscode/VSCode.cpp @@ -309,6 +309,10 @@ RunLLDBCommands("Running exitCommands:", exit_commands); } +void VSCode::RunTerminateCommands() { + RunLLDBCommands("Running terminateCommands:", terminate_commands); +} + lldb::SBTarget VSCode::CreateTargetFromArguments( const llvm::json::Object &arguments, lldb::SBError &error) { Index: lldb/tools/lldb-vscode/README.md === --- lldb/tools/lldb-vscode/README.md +++ lldb/tools/lldb-vscode/README.md @@ -16,14 +16,14 @@ The `lldb-vscode` tool creates a command line tool that implements the [Visual Studio Code Debug API](https://code.visualstudio.com/docs/extensionAPI/api-debugging). -It can be installed as an extension for the Visual Studio Code and Nuclide IDE. +It can be installed as an extension for the Visual Studio Code and Nuclide IDE. The protocol is easy to run remotely and also can allow other tools and IDEs to -get a full featured debugger with a well defined protocol. +get a full featured debugger with a well defined protocol. # Installation for Visual Studio Code Installing the plug-in involves creating a directory in the `~/.vscode/extensions` folder and copying the package.json file that is in the same directory as this -documentation into it, and copying to symlinking a lldb-vscode binary into +documentation into it, and copying to symlinking a lldb-vscode binary into the `bin`
[Lldb-commits] [PATCH] D81978: Redo of Add terminateCommands to lldb-vscode protocol
wallace updated this revision to Diff 271541. wallace added a comment. remove unwanted changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81978/new/ https://reviews.llvm.org/D81978 Files: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py lldb/tools/lldb-vscode/README.md lldb/tools/lldb-vscode/VSCode.cpp lldb/tools/lldb-vscode/VSCode.h lldb/tools/lldb-vscode/lldb-vscode.cpp Index: lldb/tools/lldb-vscode/lldb-vscode.cpp === --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -174,6 +174,7 @@ void SendTerminatedEvent() { if (!g_vsc.sent_terminated_event) { g_vsc.sent_terminated_event = true; +g_vsc.RunTerminateCommands(); // Send a "terminated" event llvm::json::Object event(CreateEventObject("terminated")); g_vsc.SendJSON(llvm::json::Value(std::move(event))); @@ -530,6 +531,7 @@ g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); + g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands"); auto attachCommands = GetStrings(arguments, "attachCommands"); llvm::StringRef core_file = GetString(arguments, "coreFile"); g_vsc.stop_at_entry = @@ -775,7 +777,6 @@ GetBoolean(arguments, "terminateDebuggee", defaultTerminateDebuggee); lldb::SBProcess process = g_vsc.target.GetProcess(); auto state = process.GetState(); - switch (state) { case lldb::eStateInvalid: case lldb::eStateUnloaded: @@ -797,8 +798,8 @@ g_vsc.debugger.SetAsync(true); break; } - g_vsc.SendJSON(llvm::json::Value(std::move(response))); SendTerminatedEvent(); + g_vsc.SendJSON(llvm::json::Value(std::move(response))); if (g_vsc.event_thread.joinable()) { g_vsc.broadcaster.BroadcastEventByType(eBroadcastBitStopEventThread); g_vsc.event_thread.join(); @@ -1368,6 +1369,7 @@ g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); + g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands"); auto launchCommands = GetStrings(arguments, "launchCommands"); g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false); const llvm::StringRef debuggerRoot = GetString(arguments, "debuggerRoot"); Index: lldb/tools/lldb-vscode/VSCode.h === --- lldb/tools/lldb-vscode/VSCode.h +++ lldb/tools/lldb-vscode/VSCode.h @@ -86,6 +86,7 @@ std::vector pre_run_commands; std::vector exit_commands; std::vector stop_commands; + std::vector terminate_commands; lldb::tid_t focus_tid; bool sent_terminated_event; bool stop_at_entry; @@ -133,6 +134,7 @@ void RunPreRunCommands(); void RunStopCommands(); void RunExitCommands(); + void RunTerminateCommands(); /// Create a new SBTarget object from the given request arguments. /// \param[in] arguments Index: lldb/tools/lldb-vscode/VSCode.cpp === --- lldb/tools/lldb-vscode/VSCode.cpp +++ lldb/tools/lldb-vscode/VSCode.cpp @@ -309,6 +309,10 @@ RunLLDBCommands("Running exitCommands:", exit_commands); } +void VSCode::RunTerminateCommands() { + RunLLDBCommands("Running terminateCommands:", terminate_commands); +} + lldb::SBTarget VSCode::CreateTargetFromArguments( const llvm::json::Object &arguments, lldb::SBError &error) { Index: lldb/tools/lldb-vscode/README.md === --- lldb/tools/lldb-vscode/README.md +++ lldb/tools/lldb-vscode/README.md @@ -16,14 +16,14 @@ The `lldb-vscode` tool creates a command line tool that implements the [Visual Studio Code Debug API](https://code.visualstudio.com/docs/extensionAPI/api-debugging). -It can be installed as an extension for the Visual Studio Code and Nuclide IDE. +It can be installed as an extension for the Visual Studio Code and Nuclide IDE. The protocol is easy to run remotely and also can allow other tools and IDEs to -get a full featured debugger with a well defined protocol. +get a full featured debugger with a well defined protocol. # Installation for Visual Studio Code Installing the plug-in involves creating a directory in the `~/.vscode/extensions` folder and copying the package.json file that is in the same directory as this -documentation into it, and copying to symlinking a lldb-vscode binary into +documentation into it, and copying to symlinking a lldb-vscode
[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Follow DW_AT_decl_file when setting breakpoint
kwk updated this revision to Diff 271583. kwk added a comment. - Align tests with reviewer expectations Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74136/new/ https://reviews.llvm.org/D74136 Files: lldb/include/lldb/Core/SearchFilter.h lldb/include/lldb/Target/Target.h lldb/source/Breakpoint/BreakpointResolverName.cpp lldb/source/Core/SearchFilter.cpp lldb/source/Target/Target.cpp lldb/test/Shell/Breakpoint/Inputs/search-support-files-func.cpp lldb/test/Shell/Breakpoint/Inputs/search-support-files.cpp lldb/test/Shell/Breakpoint/Inputs/search-support-files.h lldb/test/Shell/Breakpoint/search-support-files.test Index: lldb/test/Shell/Breakpoint/search-support-files.test === --- /dev/null +++ lldb/test/Shell/Breakpoint/search-support-files.test @@ -0,0 +1,123 @@ +# In these tests we will set breakpoints on a function by name with the +# target.inline-breakpoint-strategy setting alternating between set "always" and +# "headers". + +# RUN: %build %p/Inputs/search-support-files.cpp -o %t.out +# RUN: %lldb -b -s %s %t.out | FileCheck %s + + +#Set breakpoint by function name. + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n function_in_header +# CHECK: (lldb) breakpoint set -n function_in_header +# CHECK-NEXT: Breakpoint 1: where = {{.*}}.out`function_in_header(){{.*}} at search-support-files.h + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n function_in_header +# CHECK: (lldb) breakpoint set -n function_in_header +# CHECK-NEXT: Breakpoint 2: where = {{.*}}.out`function_in_header(){{.*}} at search-support-files.h + + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n main +# CHECK: (lldb) breakpoint set -n main +# CHECK-NEXT: Breakpoint 3: where = {{.*}}.out`main{{.*}} at search-support-files.cpp + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n main +# CHECK: (lldb) breakpoint set -n main +# CHECK-NEXT: Breakpoint 4: where = {{.*}}.out`main{{.*}} at search-support-files.cpp + + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n func +# CHECK: (lldb) breakpoint set -n func +# CHECK-NEXT: Breakpoint 5: where = {{.*}}.out`func{{.*}} at search-support-files-func.cpp + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n func +# CHECK: (lldb) breakpoint set -n func +# CHECK-NEXT: Breakpoint 6: where = {{.*}}.out`func{{.*}} at search-support-files-func.cpp + + + +# Set breakpoint by function name and filename (here: the compilation unit). + + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n function_in_header -f search-support-files.cpp +# CHECK: (lldb) breakpoint set -n function_in_header -f search-support-files.cpp +# CHECK-NEXT: Breakpoint 7: no locations (pending). + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n function_in_header -f search-support-files.cpp +# CHECK: (lldb) breakpoint set -n function_in_header -f search-support-files.cpp +# CHECK-NEXT: Breakpoint 8: no locations (pending). + + + +# Set breakpoint by function name and source filename (the file in which the +# function is defined). +# +# NOTE: This test is the really interesting one as it shows that we can +# search by source files that are themselves no compilation units. + + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n function_in_header -f search-support-files.h +# CHECK: (lldb) breakpoint set -n function_in_header -f search-support-files.h +# CHECK-NEXT: Breakpoint 9: where = {{.*}}.out`function_in_header(){{.*}} at search-support-files.h + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n function_in_header -f search-support-files.h +# CHECK: (lldb) breakpoint set -n function_in_header -f search-support-files.h +# CHECK-NEXT: Breakpoint 10: where = {{.*}}.out`function_in_header(){{.*}} at search-support-files.h + + +settings set target.inline-breakpoint-strategy always +breakpoint set -n func -f search-support-files-func.cpp +# CHECK: (lldb) breakpoint set -n func -f search-support-files-func.cpp +# CHECK-NEXT: Breakpoint 11: where = {{.*}}.out`func(){{.*}} at search-support-files-func.cpp + +settings set target.inline-breakpoint-strategy headers +breakpoint set -n func -f search-support-files-func.cpp +# CHECK: (lldb) breakpoint set -n func -f search-support-files-func.cpp +# CHECK-NEXT: Breakpoint 12: no locations (pending). + + + +# Set breakpoint by function name and source filename. This time the file +# doesn't exist or is not the file in which the function is declared or +# defined. This is to prove that we haven't widen the search space too much. +# When we search for a function in a file that doesn't exist, we should get no +# results. + + + +settings set target.inline-breakpoint-strategy always +breakpoint
[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Follow DW_AT_decl_file when setting breakpoint
kwk added a comment. @labath @jingham @jankratochvil The test change suggested by @labath is now in place and it works. @jankratochvil, I've removed the logic that checks seomthing with the CU from `AddressPasses`. That logic now lives in `FunctionPasses` where it logically makes more sense to me. The whole filtering by CU logic from `AddressPasses` is gone now and I wonder if @jingham has some thoughts on this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74136/new/ https://reviews.llvm.org/D74136 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Follow DW_AT_decl_file when setting breakpoint
kwk marked 6 inline comments as done. kwk added inline comments. Comment at: lldb/source/Core/SearchFilter.cpp:713 + if (!type) +return SearchFilterByModuleList::FunctionPasses(function); + jankratochvil wrote: > If we cannot determine which file the function is from then rather ignore it > (the current call returns `true`): > ``` > return false; > ``` @jankratochvil so far I haven't addressed this on purpose to give @labath and @jingham time to say what they think about this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74136/new/ https://reviews.llvm.org/D74136 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits