[Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5
clayborg added a comment. In https://reviews.llvm.org/D32167#1020032, @labath wrote: > In https://reviews.llvm.org/D32167#1019702, @clayborg wrote: > > > I am afraid of the opposite: we test what we think we need to test and our > > simple tests cases don't adequately test the feature we are adding. I can > > certainly limit the testing to very simple test cases with a one test for a > > class and one for a enum, but that wouldn't have caught the issues I ran > > into with static variables in classes that I fixed before submitting this. > > My point is it is hard to figure out what a compiler, or debugger might > > hose up without testing all possible cases. Please chime in with opinions > > as I will go with the flow on this. > > > I don't think anyone here is suggesting to test less. The question we are > asking is if running all 1000 or so tests doesn't just giv a false sense of > security (and makes the testing process longer). A specially crafted test can > trigger more corner cases and make it easier to debug future failures that a > generic test. If the case of a static variable in a class is interesting, > then maybe a test where you have two static variables from the same class > defined in two different compilation units (and maybe referenced from a third > one) is interesting as well. I'm pretty sure we don't have a test like that > right now. Another interesting case which would not be tested in the > "separate flavour" mode is the mixed-flags case: have part of your module > compiled with type units, part without (and maybe a third part with type > units and fission).. > > Running the entire dotest test suite in -fdebug-types-section is certainly a > good way to catch problems, but it's not the way to write regression tests. > FWIW, the way I plan to test the new accelerator tables when I get to the > lldb part is to run dotest with the new flags locally during development, use > the failures to identify interesting test vectors, and then write regular > tests to trigger these. For the accelerator tables you could always just manually index the DWARF and compare the results to the new accelerator tables as a unit test. No further testing needed? https://reviews.llvm.org/D32167 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
clayborg added a comment. I agree with Pavel, thanks for taking the time to get this done right and listening to the feedback that was offered. The patch is better for it. https://reviews.llvm.org/D42145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5
On 27 February 2018 at 07:11, Greg Clayton via Phabricator wrote: > clayborg added a comment. > > In https://reviews.llvm.org/D32167#1020032, @labath wrote: > >> In https://reviews.llvm.org/D32167#1019702, @clayborg wrote: >> >> > I am afraid of the opposite: we test what we think we need to test and our >> > simple tests cases don't adequately test the feature we are adding. I can >> > certainly limit the testing to very simple test cases with a one test for >> > a class and one for a enum, but that wouldn't have caught the issues I ran >> > into with static variables in classes that I fixed before submitting this. >> > My point is it is hard to figure out what a compiler, or debugger might >> > hose up without testing all possible cases. Please chime in with opinions >> > as I will go with the flow on this. >> >> >> I don't think anyone here is suggesting to test less. The question we are >> asking is if running all 1000 or so tests doesn't just giv a false sense of >> security (and makes the testing process longer). A specially crafted test >> can trigger more corner cases and make it easier to debug future failures >> that a generic test. If the case of a static variable in a class is >> interesting, then maybe a test where you have two static variables from the >> same class defined in two different compilation units (and maybe referenced >> from a third one) is interesting as well. I'm pretty sure we don't have a >> test like that right now. Another interesting case which would not be tested >> in the "separate flavour" mode is the mixed-flags case: have part of your >> module compiled with type units, part without (and maybe a third part with >> type units and fission).. >> >> Running the entire dotest test suite in -fdebug-types-section is certainly a >> good way to catch problems, but it's not the way to write regression tests. >> FWIW, the way I plan to test the new accelerator tables when I get to the >> lldb part is to run dotest with the new flags locally during development, >> use the failures to identify interesting test vectors, and then write >> regular tests to trigger these. > > > For the accelerator tables you could always just manually index the DWARF and > compare the results to the new accelerator tables as a unit test. No further > testing needed? Intend to do something like that, but as a test for the generator side of this. And there is still the question of where to get the inputs to dest (i'll probably try to do this comparison on the full llvm codebase, and then reduce any interesting cases I discover). However, there will still be a nontrivial amount of code on the consumer side (particularly when you start indexing type units :D, dwo files etc.) which should be tested separately. If the whole world suddenly started using these tables, we could just say that the existing end-to-end tests cover that, but they are not even going to be the default mode for a long time, so some separate tests seem appropriate (I don't know how many, as I haven't written that code yet). ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5
clayborg added a comment. Would everyone be ok with a solution where we leave the .debug_types tests in as a flavor, but we check the binary after creating it to ensure it has a .debug_types section. If it doesn't, then we skip the test (or pass it?), and if it does, then we go ahead and test it? The only overhead that is added then is some building. Many of the tests don't have types that go into the .debug_types section, so this would be an easy way for us to test .debug_types when it is present and just build and skip if it doesn't. No maintenance needed on any tests, we will just detect and enable if needed? https://reviews.llvm.org/D32167 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326213 - Got rid of weak imports of libpenergy and libpsample because we are already requiring a modern macOS (at least 10.11)
Author: hanming Date: Tue Feb 27 09:53:38 2018 New Revision: 326213 URL: http://llvm.org/viewvc/llvm-project?rev=326213&view=rev Log: Got rid of weak imports of libpenergy and libpsample because we are already requiring a modern macOS (at least 10.11) Reviewer: Jason Molenda Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=326213&r1=326212&r2=326213&view=diff == --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Feb 27 09:53:38 2018 @@ -855,7 +855,7 @@ LLDB_ENERGY_CFLAGS = ""; "LLDB_ENERGY_CFLAGS[sdk=macosx*]" = "-DLLDB_ENERGY"; LLDB_ENERGY_LFLAGS = ""; - "LLDB_ENERGY_LFLAGS[sdk=macosx*]" = "-weak-lpmenergy -weak-lpmsample"; + "LLDB_ENERGY_LFLAGS[sdk=macosx*]" = "-lpmenergy -lpmsample"; LLDB_ZLIB_CFLAGS = "-DHAVE_LIBZ=1"; LLDB_ZLIB_LDFLAGS = "-lz"; OTHER_CFLAGS = ( @@ -909,12 +909,7 @@ SKIP_INSTALL = YES; "SKIP_INSTALL[sdk=iphoneos*]" = NO; STRIP_INSTALLED_PRODUCT = YES; - USER_HEADER_SEARCH_PATHS = ( - ./source, - ../../source, - "$(DERIVED_SOURCES_DIR)", - ../../include, - ); + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR) ../../include"; ZERO_LINK = NO; }; name = BuildAndIntegration; @@ -958,7 +953,7 @@ LLDB_ENERGY_CFLAGS = ""; "LLDB_ENERGY_CFLAGS[sdk=macosx.internal]" = "-DLLDB_ENERGY"; LLDB_ENERGY_LFLAGS = ""; - "LLDB_ENERGY_LFLAGS[sdk=macosx.internal]" = "-weak-lpmenergy -weak-lpmsample"; + "LLDB_ENERGY_LFLAGS[sdk=macosx.internal]" = "-lpmenergy -lpmsample"; LLDB_ZLIB_CFLAGS = "-DHAVE_LIBZ=1"; LLDB_ZLIB_LDFLAGS = "-lz"; OTHER_CFLAGS = ( @@ -1012,12 +1007,7 @@ "SDKROOT[arch=x86_64]" = macosx; "SDKROOT[arch=x86_64h]" = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ( - ./source, - ../../source, - "$(DERIVED_SOURCES_DIR)", - ../../include, - ); + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR) ../../include"; ZERO_LINK = NO; }; name = Debug; @@ -1060,7 +1050,7 @@ LLDB_ENERGY_CFLAGS = ""; "LLDB_ENERGY_CFLAGS[sdk=macosx.internal]" = "-DLLDB_ENERGY"; LLDB_ENERGY_LFLAGS = ""; - "LLDB_ENERGY_LFLAGS[sdk=macosx.internal]" = "-weak-lpmenergy -weak-lpmsample"; + "LLDB_ENERGY_LFLAGS[sdk=macosx.internal]" = "-lpmenergy -lpmsample"; LLDB_ZLIB_CFLAGS = "-DHAVE_LIBZ=1"; LLDB_ZLIB_LDFLAGS = "-lz"; OTHER_CFLAGS = ( @@ -1114,12 +1104,7 @@ "SDKROOT[arch=x86_64]" = macosx; "SDKROOT[arch=x86_64h]" = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ( - ./source, - ../../source, - "$(DERIVED_SOURCES_DIR)", - ../../include, - ); + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR) ../../include"; ZERO_LINK = NO; };
[Lldb-commits] [lldb] r326214 - Removed accidentally committed code from previous commit.
Author: hanming Date: Tue Feb 27 10:02:15 2018 New Revision: 326214 URL: http://llvm.org/viewvc/llvm-project?rev=326214&view=rev Log: Removed accidentally committed code from previous commit. Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm?rev=326214&r1=326213&r2=326214&view=diff == --- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm Tue Feb 27 10:02:15 2018 @@ -418,11 +418,7 @@ std::string MachTask::GetProfileData(DNB profile_data_stream << "phys_footprint:" << phys_footprint << ';'; } - -if (scanType & eProfileMemoryCap) { - profile_data_stream << "mem_cap:" << memory_cap << ';'; -} - + #ifdef LLDB_ENERGY if (scanType & eProfileEnergy) { struct rusage_info_v2 info; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326218 - Move TestGdbRemoteExitCode next to the other llgs tests
Author: labath Date: Tue Feb 27 10:07:53 2018 New Revision: 326218 URL: http://llvm.org/viewvc/llvm-project?rev=326218&view=rev Log: Move TestGdbRemoteExitCode next to the other llgs tests This test contained a copy of the inferior used by most of llgs test. This was done to enable better paralelization, but now it's irrelevant. Added: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExitCode.py - copied, changed from r326159, lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/Makefile lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp Copied: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExitCode.py (from r326159, lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExitCode.py?p2=lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExitCode.py&p1=lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py&r1=326159&r2=326218&rev=326218&view=diff == (empty) Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/Makefile?rev=326217&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/Makefile (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/Makefile (removed) @@ -1,8 +0,0 @@ -LEVEL = ../../../make - -override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp -MAKE_DSYM :=NO - -include $(LEVEL)/Makefile.rules Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py?rev=326217&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py (removed) @@ -1,127 +0,0 @@ -from __future__ import print_function - -# lldb test suite imports -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import TestBase - -# gdb-remote-specific imports -import lldbgdbserverutils -from gdbremote_testcase import GdbRemoteTestCaseBase - - -class TestGdbRemoteExitCode(GdbRemoteTestCaseBase): - -mydir = TestBase.compute_mydir(__file__) - -FAILED_LAUNCH_CODE = "E08" - -def get_launch_fail_reason(self): -self.reset_test_sequence() -self.test_sequence.add_log_lines( -["read packet: $qLaunchSuccess#00"], -True) -self.test_sequence.add_log_lines( -[{"direction": "send", "regex": r"^\$(.+)#[0-9a-fA-F]{2}$", - "capture": {1: "launch_result"}}], -True) -context = self.expect_gdbremote_sequence() -self.assertIsNotNone(context) -return context.get("launch_result")[1:] - -def start_inferior(self): -launch_args = self.install_and_create_launch_args() - -server = self.connect_to_debug_monitor() -self.assertIsNotNone(server) - -self.add_no_ack_remote_stream() -self.test_sequence.add_log_lines( -["read packet: %s" % lldbgdbserverutils.build_gdbremote_A_packet( -launch_args)], -True) -self.test_sequence.add_log_lines( -[{"direction": "send", "regex": r"^\$(.+)#[0-9a-fA-F]{2}$", - "capture": {1: "A_result"}}], -True) -context = self.expect_gdbremote_sequence() -self.assertIsNotNone(context) - -launch_result = context.get("A_result") -self.assertIsNotNone(launch_result) -if launch_result == self.FAILED_LAUNCH_CODE: -fail_reason = self.get_launch_fail_reason() -self.fail("failed to launch inferior: " + fail_reason) - -@debugserver_test -@skipIfDarwinEmbedded # lldb-server tests not updated to work on ios etc yet -def test_start_inferior_debugserver(self): -self.init_debugserver_test() -self.build() -self.start_inferior() - -@llgs_test -def test_start_inferior_llgs(self): -self.init_llgs_test()
[Lldb-commits] [lldb] r326224 - [LLDB] Initial version of PPC64 InstEmulation
Author: labath Date: Tue Feb 27 10:42:46 2018 New Revision: 326224 URL: http://llvm.org/viewvc/llvm-project?rev=326224&view=rev Log: [LLDB] Initial version of PPC64 InstEmulation Summary: Supports common prologue/epilogue instructions. Reviewers: clayborg, labath Reviewed By: clayborg, labath Subscribers: davide, anajuliapc, alexandreyy, lbianc, nemanjai, mgorny, kbarton Differential Revision: https://reviews.llvm.org/D43345 Author: Leandro Lupori Added: lldb/trunk/source/Plugins/Instruction/PPC64/ lldb/trunk/source/Plugins/Instruction/PPC64/CMakeLists.txt lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h lldb/trunk/unittests/UnwindAssembly/ARM64/ lldb/trunk/unittests/UnwindAssembly/ARM64/CMakeLists.txt lldb/trunk/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp - copied, changed from r326218, lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp lldb/trunk/unittests/UnwindAssembly/PPC64/ lldb/trunk/unittests/UnwindAssembly/PPC64/CMakeLists.txt lldb/trunk/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp Removed: lldb/trunk/unittests/UnwindAssembly/InstEmulation/CMakeLists.txt lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp Modified: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Instruction/CMakeLists.txt lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp lldb/trunk/unittests/UnwindAssembly/CMakeLists.txt Modified: lldb/trunk/source/API/SystemInitializerFull.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=326224&r1=326223&r2=326224&view=diff == --- lldb/trunk/source/API/SystemInitializerFull.cpp (original) +++ lldb/trunk/source/API/SystemInitializerFull.cpp Tue Feb 27 10:42:46 2018 @@ -50,6 +50,7 @@ #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h" #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" +#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h" #include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h" #include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h" @@ -326,6 +327,7 @@ void SystemInitializerFull::Initialize() UnwindAssemblyInstEmulation::Initialize(); UnwindAssembly_x86::Initialize(); EmulateInstructionARM64::Initialize(); + EmulateInstructionPPC64::Initialize(); SymbolFileDWARFDebugMap::Initialize(); ItaniumABILanguageRuntime::Initialize(); AppleObjCRuntimeV2::Initialize(); @@ -451,6 +453,7 @@ void SystemInitializerFull::Terminate() UnwindAssembly_x86::Terminate(); UnwindAssemblyInstEmulation::Terminate(); EmulateInstructionARM64::Terminate(); + EmulateInstructionPPC64::Terminate(); SymbolFileDWARFDebugMap::Terminate(); ItaniumABILanguageRuntime::Terminate(); AppleObjCRuntimeV2::Terminate(); Modified: lldb/trunk/source/Plugins/Instruction/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/CMakeLists.txt?rev=326224&r1=326223&r2=326224&view=diff == --- lldb/trunk/source/Plugins/Instruction/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Instruction/CMakeLists.txt Tue Feb 27 10:42:46 2018 @@ -2,3 +2,4 @@ add_subdirectory(ARM) add_subdirectory(ARM64) add_subdirectory(MIPS) add_subdirectory(MIPS64) +add_subdirectory(PPC64) Added: lldb/trunk/source/Plugins/Instruction/PPC64/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/PPC64/CMakeLists.txt?rev=326224&view=auto == --- lldb/trunk/source/Plugins/Instruction/PPC64/CMakeLists.txt (added) +++ lldb/trunk/source/Plugins/Instruction/PPC64/CMakeLists.txt Tue Feb 27 10:42:46 2018 @@ -0,0 +1,11 @@ +add_lldb_library(lldbPluginInstructionPPC64 PLUGIN + EmulateInstructionPPC64.cpp + + LINK_LIBS +lldbCore +lldbInterpreter +lldbSymbol +lldbPluginProcessUtility + LINK_COMPONENTS +Support + ) Added: lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp?rev=326224&view=auto == --- lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp (added) +++ lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp Tue Feb 27 10:42:46 2018 @@ -0,0 +1,406 @@ +//===-- EmulateInstructionPPC64.cpp --*- C++-
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL326261: [lldb] Use vFlash commands when writing to target's flash memory regions (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D42145?vs=135087&id=136156#toc Repository: rL LLVM https://reviews.llvm.org/D42145 Files: lldb/trunk/include/lldb/Host/XML.h lldb/trunk/include/lldb/Target/MemoryRegionInfo.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py lldb/trunk/source/Host/common/XML.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/Process.cpp Index: lldb/trunk/source/Target/Process.cpp === --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -2533,6 +2533,17 @@ return 0; } +Status Process::WriteObjectFile(std::vector entries) { + Status error; + for (const auto &Entry : entries) { +WriteMemory(Entry.Dest, Entry.Contents.data(), Entry.Contents.size(), +error); +if (!error.Success()) + break; + } + return error; +} + #define USE_ALLOCATE_MEMORY_CACHE 1 addr_t Process::AllocateMemory(size_t size, uint32_t permissions, Status &error) { Index: lldb/trunk/source/Symbol/ObjectFile.cpp === --- lldb/trunk/source/Symbol/ObjectFile.cpp +++ lldb/trunk/source/Symbol/ObjectFile.cpp @@ -659,22 +659,31 @@ SectionList *section_list = GetSectionList(); if (!section_list) return Status("No section in object file"); + + std::vector writeEntries; + + // Create a list of write entries from loadable sections size_t section_count = section_list->GetNumSections(0); for (size_t i = 0; i < section_count; ++i) { +Process::WriteEntry entry; SectionSP section_sp = section_list->GetSectionAtIndex(i); -addr_t addr = target.GetSectionLoadList().GetSectionLoadAddress(section_sp); -if (addr != LLDB_INVALID_ADDRESS) { - DataExtractor section_data; - // We can skip sections like bss - if (section_sp->GetFileSize() == 0) -continue; - section_sp->GetSectionData(section_data); - lldb::offset_t written = process->WriteMemory( - addr, section_data.GetDataStart(), section_data.GetByteSize(), error); - if (written != section_data.GetByteSize()) -return error; -} - } +entry.Dest = target.GetSectionLoadList().GetSectionLoadAddress(section_sp); +if (entry.Dest == LLDB_INVALID_ADDRESS) + continue; +// We can skip sections like bss +if (section_sp->GetFileSize() == 0) + continue; +DataExtractor section_data; +section_sp->GetSectionData(section_data); +entry.Contents = llvm::ArrayRef(section_data.GetDataStart(), + section_data.GetByteSize()); +writeEntries.push_back(entry); + } + + error = process->WriteObjectFile(std::move(writeEntries)); + if (!error.Success()) +return error; + if (set_pc) { ThreadList &thread_list = process->GetThreadList(); ThreadSP curr_thread(thread_list.GetSelectedThread()); Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -383,6 +383,12 @@ RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid); + + bool AnySegmentHasPhysicalAddress(); + + const elf::ELFProgramHeader *GetSectionSegment(lldb::SectionSP section_sp); + + lldb::addr_t GetSectionPhysicalAddress(lldb::SectionSP section_sp); }; #endif // liblldb_ObjectFileELF_h_ Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -827,7 +827,7 @@ // of the sections that have SHF_ALLOC in their flag bits. SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->T
[Lldb-commits] [lldb] r326261 - [lldb] Use vFlash commands when writing to target's flash memory regions
Author: labath Date: Tue Feb 27 14:14:33 2018 New Revision: 326261 URL: http://llvm.org/viewvc/llvm-project?rev=326261&view=rev Log: [lldb] Use vFlash commands when writing to target's flash memory regions Summary: When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup. - Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address. - Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications - Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html Reviewers: clayborg, labath Reviewed By: labath Subscribers: arichardson, emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D42145 Patch by Owen Shaw Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py Modified: lldb/trunk/include/lldb/Host/XML.h lldb/trunk/include/lldb/Target/MemoryRegionInfo.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Host/common/XML.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Host/XML.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/XML.h?rev=326261&r1=326260&r2=326261&view=diff == --- lldb/trunk/include/lldb/Host/XML.h (original) +++ lldb/trunk/include/lldb/Host/XML.h Tue Feb 27 14:14:33 2018 @@ -82,6 +82,9 @@ public: llvm::StringRef GetAttributeValue(const char *name, const char *fail_value = nullptr) const; + bool GetAttributeValueAsUnsigned(const char *name, uint64_t &value, + uint64_t fail_value = 0, int base = 0) const; + XMLNode FindFirstChildElementWithName(const char *name) const; XMLNode GetElementForPath(const NamePath &path); Modified: lldb/trunk/include/lldb/Target/MemoryRegionInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/MemoryRegionInfo.h?rev=326261&r1=326260&r2=326261&view=diff == --- lldb/trunk/include/lldb/Target/MemoryRegionInfo.h (original) +++ lldb/trunk/include/lldb/Target/MemoryRegionInfo.h Tue Feb 27 14:14:33 2018 @@ -25,7 +25,7 @@ public: MemoryRegionInfo() : m_range(), m_read(eDontKnow), m_write(eDontKnow), m_execute(eDontKnow), -m_mapped(eDontKnow) {} +m_mapped(eDontKnow), m_flash(eDontKnow), m_blocksize(0) {} ~MemoryRegionInfo() {} @@ -58,6 +58,14 @@ public: void SetName(const char *name) { m_name = ConstString(name); } + OptionalBool GetFlash() const { return m_flash; } + + void SetFlash(OptionalBool val) { m_flash = val; } + + lldb::offset_t GetBlocksize() const { return m_blocksize; } + + void SetBlocksize(lldb::offset_t blocksize) { m_blocksize = blocksize; } + //-- // Get permissions as a uint32_t that is a mask of one or more bits from // the lldb::Permissions @@ -98,6 +106,8 @@ protected: OptionalBool m_execute; OptionalBool m_mapped; ConstString m_name; + OptionalBool m_flash; + lldb::offset_t m_blocksize; }; } Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=326261&r1=326260&r2=326261&view=diff == --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Tue Feb 27 14:14:33 2018 @@ -556,6 +556,11 @@ public: return GetStaticBroadcasterClass(); } + struct WriteEntry { +lldb::addr_t Dest; +llvm::ArrayRef Contents; + }; + //-- /// A notification structure that can be used by clients to listen /// for changes in a process's lifetime. @@ -1950,6 +1955,8 @@ public: return LLDB_INVALID_ADDRESS; } + virtual Sta
[Lldb-commits] [lldb] r326264 - Fix lldbinline tests for remote targets
Author: labath Date: Tue Feb 27 14:45:49 2018 New Revision: 326264 URL: http://llvm.org/viewvc/llvm-project?rev=326264&view=rev Log: Fix lldbinline tests for remote targets r326140 exposed the fact that we are not actually running inline tests on remote targets. The tests fail to launch the inferior in the first place because they passed an invalid working directory to the launch function. This should fix that. Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=326264&r1=326263&r2=326264&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Tue Feb 27 14:45:49 2018 @@ -181,7 +181,7 @@ class InlineTest(TestBase): parser.parse_source_files(source_files) parser.set_breakpoints(target) -process = target.LaunchSimple(None, None, self.getBuildDir()) +process = target.LaunchSimple(None, None, self.get_process_working_directory()) hit_breakpoints = 0 while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint): ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43837: Move option parsing out of the Args class
labath created this revision. labath added reviewers: davide, jingham, zturner. The args class is used in plenty of places (a lot of them in the lower lldb layers) for representing a list of arguments, and most of these places don't care about option parsing. Moving the option parsing out of the class removes the largest external dependency (there are a couple more, but these are in static functions), and brings us closer to being able to move it to the Utility module). The new home for these functions is the Options class, which was already used as an argument to the parse calls, so this just inverts the dependency between the two. The functions are themselves are mainly just copied -- the biggest functional change I've made to them is to avoid modifying the input Args argument (getopt likes to permute the argument vector), as it was weird to have another class reorder the entries in Args class. So now the functions don't modify the input arguments, and (for those where it makes sense) return a new Args vector instead. I've also made the addition of a "fake arg0" (required for getopt compatibility) an implementation detail rather than a part of interface. While doing that I noticed that ParseForCompletion function was recording the option indexes in the shuffled vector, but then the consumer was looking up the entries in the unshuffled one. This manifested itself as us not being able to complete "watchpoint set variable foo --" (because getopt would move "foo" to the end). Surprisingly all other completions (e.g. "watchpoint set variable foo --w") were not affected by this. However, I couldn't find a comprehensive test for command argument completion, so I consolidated the existing tests and added a bunch of new ones. https://reviews.llvm.org/D43837 Files: include/lldb/Interpreter/Args.h include/lldb/Interpreter/Options.h packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py source/Commands/CommandObjectSettings.cpp source/Interpreter/Args.cpp source/Interpreter/CommandAlias.cpp source/Interpreter/CommandObject.cpp source/Interpreter/Options.cpp source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Index: source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp === --- source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -1013,6 +1013,7 @@ }; EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) { + Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); // We are abusing the options data model here so that we can parse // options without requiring the Debugger instance. @@ -1051,15 +1052,16 @@ args.Shift(); } - // ParseOptions calls getopt_long_only, which always skips the zero'th item in - // the array and starts at position 1, - // so we need to push a dummy value into position zero. - args.Unshift(llvm::StringRef("dummy_string")); bool require_validation = false; - error = args.ParseOptions(*options_sp.get(), &exe_ctx, PlatformSP(), -require_validation); - if (!error.Success()) + llvm::Expected args_or = + options_sp->Parse(args, &exe_ctx, PlatformSP(), require_validation); + if (!args_or) { +LLDB_LOG_ERROR( +log, args_or.takeError(), +"Parsing plugin.structured-data.darwin-log.auto-enable-options value " +"failed: {0}"); return EnableOptionsSP(); + } if (!options_sp->VerifyOptions(result)) return EnableOptionsSP(); Index: source/Interpreter/Options.cpp === --- source/Interpreter/Options.cpp +++ source/Interpreter/Options.cpp @@ -951,3 +951,527 @@ } return error; } + +// OptionParser permutes the arguments while processing them, so we create a +// temporary array holding to avoid modification of the input arguments. The +// options themselves are never modified, but the API expects a char * anyway, +// hence the const_cast. +static std::vector GetArgvForParsing(const Args &args) { + std::vector result; + // OptionParser always skips the first argument as it is based on getopt(). + result.push_back(const_cast("")); + for (const Args::ArgEntry &entry : args) +result.push_back(const_cast(entry.c_str())); + return result; +} + +// Given a permuted argument, find it's position in the original Args vector. +static Args::const_iterator FindOriginalIter(const char *arg, + const Args &original) { + return llvm::find_if( + original, [arg](const Args::ArgEntry &D) { return D.c_str() == arg; }); +} + +// Given a permuted argument, find it's index in the original Args vector. +static size_t FindOriginalIndex(const char *arg, const Args &original) { + return std::distance(original.begin(), FindOriginalIter(arg, original)); +} + +//
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
labath added a comment. It seems this messed up the computation of load addresses for symbols in the androids vdso: Symtab, num_symbols = 5: Debug symbol |Synthetic symbol ||Externally Visible ||| Index UserID DSX TypeFile Address/Value Load Address Size Flags Name --- -- --- --- -- -- -- -- -- [0] 1 X Code0xe410 0x0410 0x0008 0x0012 __kernel_rt_sigreturn [1] 2 X Code0xe400 0x0400 0x0009 0x0012 __kernel_sigreturn [2] 3 X Code0xe420 0x0420 0x0014 0x0012 __kernel_vsyscall [3] 4 X Data0x 0x 0x0011 LINUX_2.5 [4] 4 SX Code0xe40f 0x040f 0x0001 0x ___lldb_unnamed_symbol1$$[vdso] (the load address is obviously wrong, and maybe file address as well, although I'm not sure what did we put as a file address for files that are loaded from memory) I'm going to try to investigate more, but I'm writing here in case you have any idea what could be wrong. Repository: rL LLVM https://reviews.llvm.org/D42145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
labath added a comment. Ok, so this is what seems to be happening: The vdso "file" has the following program headers: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x00 0xe000 0x 0x00434 0x00434 R E 0x1000 DYNAMIC0x000324 0xe324 0x0324 0x00090 0x00090 R 0x4 NOTE 0x0001c4 0xe1c4 0x01c4 0x00034 0x00034 R 0x4 GNU_EH_FRAME 0x0001f8 0xe1f8 0x01f8 0x00024 0x00024 R 0x4 Your patch makes the makes us use the physical addresses (because some of the physical addresses are non-null), but in this case that is incorrect. For this file the VirtAddr describes the correct address of the file/section/segment in memory. Also the addresses in the section headers (which is what we were using previously are correct. Going back to your patch, it's not clear to me whether using physical addresses as load addresses is a correct thing to do in general. I mean, generally, we care about the places where the object file is located in virtual memory, and in physical, so maybe we should keep use virtual addresses here, and have ObjectFile::LoadInMemory use physical addresses through some other api? What do you think? That said, on my desktop machine I get the following program headers from the vdso: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x00 0x 0x 0x00d1a 0x00d1a R E 0x1000 DYNAMIC0x0002bc 0x02bc 0x02bc 0x00090 0x00090 R 0x4 NOTE 0x000560 0x0560 0x0560 0x00060 0x00060 R 0x4 GNU_EH_FRAME 0x0005c0 0x05c0 0x05c0 0x00024 0x00024 R 0x4 and things still work fine, so it may be possible to make this work by just changing how we compute the load bias (I have to look up where we do that). (However, I am still not sure about using physical addresses being the right thing here). Repository: rL LLVM https://reviews.llvm.org/D42145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
labath added inline comments. Comment at: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:814 value = value - header->p_vaddr; found_offset = true; Ok so the issue is that here we use the virtual address to compute the load bias, but at line 830 we add the bias to the physical address. This breaks as soon as these two addresses start to differ. Changing this to use the physical address as well fixes things, but as I said before, I'm not sure we should be using physical addresses here. Repository: rL LLVM https://reviews.llvm.org/D42145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326302 - Add EmulateInstructionPPC64.cpp to xcode project file.
Author: jmolenda Date: Tue Feb 27 20:11:37 2018 New Revision: 326302 URL: http://llvm.org/viewvc/llvm-project?rev=326302&view=rev Log: Add EmulateInstructionPPC64.cpp to xcode project file. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=326302&r1=326301&r2=326302&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Feb 27 20:11:37 2018 @@ -1015,6 +1015,7 @@ AFCB2BBE1BF577F40018B553 /* PythonExceptionState.h in Headers */ = {isa = PBXBuildFile; fileRef = AFCB2BBC1BF577F40018B553 /* PythonExceptionState.h */; }; AFD65C811D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFD65C7F1D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp */; }; AFD65C821D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = AFD65C801D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.h */; }; + AFDBC36E204663AF00B9C8F2 /* EmulateInstructionPPC64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFDBC36C204663AF00B9C8F2 /* EmulateInstructionPPC64.cpp */; }; AFDCDBCB19DD0F42005EA55E /* SBExecutionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 940B02F419DC96CB00AD0F52 /* SBExecutionContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; AFDFDFD119E34D3400EAE509 /* ConnectionFileDescriptorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFDFDFD019E34D3400EAE509 /* ConnectionFileDescriptorPosix.cpp */; }; AFEC3362194A8ABA00FF05C6 /* StructuredData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFEC3361194A8ABA00FF05C6 /* StructuredData.cpp */; }; @@ -3136,6 +3137,8 @@ AFCB2BBC1BF577F40018B553 /* PythonExceptionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonExceptionState.h; path = ScriptInterpreter/Python/PythonExceptionState.h; sourceTree = ""; }; AFD65C7F1D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_64.cpp; sourceTree = ""; }; AFD65C801D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterContextMinidump_x86_64.h; sourceTree = ""; }; + AFDBC36B204663AF00B9C8F2 /* EmulateInstructionPPC64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EmulateInstructionPPC64.h; path = source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h; sourceTree = SOURCE_ROOT; }; + AFDBC36C204663AF00B9C8F2 /* EmulateInstructionPPC64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EmulateInstructionPPC64.cpp; path = source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp; sourceTree = SOURCE_ROOT; }; AFDFDFD019E34D3400EAE509 /* ConnectionFileDescriptorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionFileDescriptorPosix.cpp; sourceTree = ""; }; AFEC3361194A8ABA00FF05C6 /* StructuredData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StructuredData.cpp; path = source/Utility/StructuredData.cpp; sourceTree = ""; }; AFEC5FD51D94F9380076A480 /* Testx86AssemblyInspectionEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Testx86AssemblyInspectionEngine.cpp; path = UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp; sourceTree = ""; }; @@ -5611,6 +5614,7 @@ 26D9FDCA12F785120003F2EE /* Instruction */ = { isa = PBXGroup; children = ( + AFDBC36A2046638D00B9C8F2 /* PPC64 */, E778E99D1B062D1700247609 /* MIPS */, 26D9FDCB12F785270003F2EE /* ARM */, 264A12F91372522000875C42 /* ARM64 */, @@ -6636,6 +6640,16 @@ name = Target; sourceTree = ""; }; + AFDBC36A2046638D00B9C8F2 /* PPC64 */ = { + isa = PBXGroup; + children = ( + AFDBC36C204663AF00B9C8F2 /* EmulateInstructionPPC64.cpp */, + AFDBC36B204663AF00B9C8F2 /* EmulateInstructionPPC64.h */, + ); +
[Lldb-commits] [PATCH] D43857: Speed up TestWatchpointMultipleThreads
labath created this revision. labath added reviewers: davide, jingham. Herald added a subscriber: aprantl. The inferior was sleeping before doing any interesting work. I remove that to make the test faster. While looking at the purpose of the test (to check that watchpoints are propagated to all existing threads - r140757) I noticed that the test has diverged from the original intention and now it creates the threads *after* the watchpoint is set (this probably happened during the std::thread refactor), so I reorganize the test to be closer to the original intention. The watchpoint propagation functionality is not really debug info depenent, so I also stop replication of this test. This brings the test's time from ~108s down to 4s. https://reviews.llvm.org/D43857 Files: packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp Index: packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp === --- packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp +++ packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp @@ -10,13 +10,11 @@ #include #include #include -#include #include - -std::default_random_engine g_random_engine{std::random_device{}()}; -std::uniform_int_distribution<> g_distribution{0, 300}; +#include "pseudo_barrier.h" uint32_t g_val = 0; +pseudo_barrier_t g_barrier; uint32_t @@ -39,17 +37,13 @@ void thread_func (uint32_t thread_index) { +pseudo_barrier_wait(g_barrier); printf ("%s (thread index = %u) starting...\n", __FUNCTION__, thread_index); uint32_t count = 0; uint32_t val; while (count++ < 15) { -// random micro second sleep from zero to 3 seconds -int usec = g_distribution(g_random_engine); -printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec); -std::this_thread::sleep_for(std::chrono::microseconds{usec}); - if (count < 7) val = access_pool (); else @@ -63,14 +57,16 @@ int main (int argc, char const *argv[]) { +pseudo_barrier_init(g_barrier, 4); std::thread threads[3]; - -printf ("Before turning all three threads loose...\n"); // Set break point at this line, -// in order to set our watchpoint. // Create 3 threads for (auto &thread : threads) thread = std::thread{thread_func, std::distance(threads, &thread)}; +printf ("Before turning all three threads loose...\n"); // Set break point at this line, +// in order to set our watchpoint. +pseudo_barrier_wait(g_barrier); + // Join all of our threads for (auto &thread : threads) thread.join(); Index: packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py @@ -17,6 +17,7 @@ class WatchpointForMultipleThreadsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True @expectedFailureAll( oslist=["windows"], @@ -77,16 +78,14 @@ self.expect("watchpoint list -v", substrs=['hit_count = 0']) -while True: -self.runCmd("process continue") + self.runCmd("process continue") -self.runCmd("thread list") -if "stop reason = watchpoint" in self.res.GetOutput(): -# Good, we verified that the watchpoint works! -self.runCmd("thread backtrace all") -break -else: -self.fail("The stop reason should be either break or watchpoint") + self.runCmd("thread list") + if "stop reason = watchpoint" in self.res.GetOutput(): + # Good, we verified that the watchpoint works! + self.runCmd("thread backtrace all") + else: + self.fail("The stop reason should be either break or watchpoint") # Use the '-v' option to do verbose listing of the watchpoint. # The hit count should now be 1. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp === --- packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp +++ packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp @@ -10,13 +10,11
[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions
owenpshaw added inline comments. Comment at: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:814 value = value - header->p_vaddr; found_offset = true; labath wrote: > Ok so the issue is that here we use the virtual address to compute the load > bias, but at line 830 we add the bias to the physical address. This breaks as > soon as these two addresses start to differ. > > Changing this to use the physical address as well fixes things, but as I said > before, I'm not sure we should be using physical addresses here. I don't know if there's another use case besides flash load that should definitely use the physical address, so I can't be much help answering that question. I was mainly relying on tests to catch any issue caused by using physical addresses. Could the value_is_offset flag be a tell here? Looks like that load bias is only calculated if value_is_offset == false. Would it make sense to always use virtual address in such a case? It wouldn't affect the "target modules load" case, which always sets value_is_offset to true. Repository: rL LLVM https://reviews.llvm.org/D42145 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits