[Lldb-commits] [lldb] 66ba4e3 - Revert "[lldb] Assert filecache and live memory match on debug under a setting"
Stella Stamenova via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 29 10:49:37 PDT 2021
Author: Stella Stamenova
Date: 2021-07-29T10:48:57-07:00
New Revision: 66ba4e3dc608156797df8f863d61fa106608e45c
URL: https://github.com/llvm/llvm-project/commit/66ba4e3dc608156797df8f863d61fa106608e45c
DIFF: https://github.com/llvm/llvm-project/commit/66ba4e3dc608156797df8f863d61fa106608e45c.diff
LOG: Revert "[lldb] Assert filecache and live memory match on debug under a setting"
This reverts commit 77e9d10f0fbfe04a14e6ce61753376dd78e0c2f0.
This change broke the Windows LLDB bot:
https://lab.llvm.org/buildbot/#/builders/83/builds/8784/steps/7/logs/stdio
Added:
Modified:
lldb/include/lldb/Core/Section.h
lldb/include/lldb/Target/Target.h
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Core/Section.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetProperties.td
lldb/test/Shell/lit-lldb-init.in
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Section.h b/lldb/include/lldb/Core/Section.h
index 3914469aafc1a..3d4ab154e743f 100644
--- a/lldb/include/lldb/Core/Section.h
+++ b/lldb/include/lldb/Core/Section.h
@@ -236,8 +236,6 @@ class Section : public std::enable_shared_from_this<Section>,
void SetIsRelocated(bool b) { m_relocated = b; }
- bool IsReadOnly();
-
protected:
ObjectFile *m_obj_file; // The object file that data for this section should
// be read from
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index d15370259f467..ac8d002b09a12 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -229,10 +229,6 @@ class TargetProperties : public Properties {
bool GetDebugUtilityExpression() const;
- void SetVerifyFileCacheMemoryReads(bool debug);
-
- bool GetVerifyFileCacheMemoryReads() const;
-
private:
// Callbacks for m_launch_info.
void Arg0ValueChangedCallback();
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 366c40db81507..7e1fdce36ede6 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -798,9 +798,6 @@ def setUpCommands(cls):
'settings set symbols.clang-modules-cache-path "{}"'.format(
configuration.lldb_module_cache_dir),
"settings set use-color false",
-
- # Verify that file cache and live memory always match.
- "settings set target.verify-file-cache-memory-reads true",
]
# Set any user-overridden settings.
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index af5cee2f9b9b9..a5a10141aa649 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -599,9 +599,3 @@ size_t SectionList::Slide(addr_t slide_amount, bool slide_children) {
}
return count;
}
-
-bool Section::IsReadOnly() {
- auto permissions = Flags(GetPermissions());
- return !permissions.Test(ePermissionsWritable) &&
- permissions.Test(ePermissionsReadable);
-}
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 33691e8e97856..1f8e8c54fa9e1 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1763,34 +1763,21 @@ size_t Target::ReadMemory(const Address &addr, void *dst, size_t dst_len,
// Read from file cache if read-only section.
if (!force_live_memory && resolved_addr.IsSectionOffset()) {
SectionSP section_sp(resolved_addr.GetSection());
- if (section_sp && section_sp->IsReadOnly()) {
- file_cache_bytes_read =
- ReadMemoryFromFileCache(resolved_addr, dst, dst_len, error);
-
- if (GetVerifyFileCacheMemoryReads()) {
- if (ProcessIsValid() && file_cache_bytes_read == dst_len) {
- if (load_addr == LLDB_INVALID_ADDRESS)
- load_addr = resolved_addr.GetLoadAddress(this);
- if (load_addr != LLDB_INVALID_ADDRESS) {
- std::unique_ptr<uint8_t[]> live_buf =
- std::make_unique<uint8_t[]>(dst_len);
- bytes_read = m_process_sp->ReadMemory(load_addr, live_buf.get(),
- dst_len, error);
- if (bytes_read == dst_len) {
- lldbassert(memcmp(live_buf.get(), dst, dst_len) == 0 &&
- "File cache and live memory diverge!");
- }
- }
+ if (section_sp) {
+ auto permissions = Flags(section_sp->GetPermissions());
+ bool is_readonly = !permissions.Test(ePermissionsWritable) &&
+ permissions.Test(ePermissionsReadable);
+ if (is_readonly) {
+ file_cache_bytes_read =
+ ReadMemoryFromFileCache(resolved_addr, dst, dst_len, error);
+ if (file_cache_bytes_read == dst_len)
+ return file_cache_bytes_read;
+ else if (file_cache_bytes_read > 0) {
+ file_cache_read_buffer =
+ std::make_unique<uint8_t[]>(file_cache_bytes_read);
+ std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
}
}
-
- if (file_cache_bytes_read == dst_len)
- return file_cache_bytes_read;
- if (file_cache_bytes_read > 0) {
- file_cache_read_buffer =
- std::make_unique<uint8_t[]>(file_cache_bytes_read);
- std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
- }
}
}
@@ -4389,17 +4376,6 @@ void TargetProperties::SetDebugUtilityExpression(bool debug) {
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, debug);
}
-bool TargetProperties::GetVerifyFileCacheMemoryReads() const {
- const uint32_t idx = ePropertyVerifyFileCacheMemoryReads;
- return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, idx, g_target_properties[idx].default_uint_value != 0);
-}
-
-void TargetProperties::SetVerifyFileCacheMemoryReads(bool verify) {
- const uint32_t idx = ePropertyVerifyFileCacheMemoryReads;
- m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, verify);
-}
-
// Target::TargetEventData
Target::TargetEventData::TargetEventData(const lldb::TargetSP &target_sp)
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index bce426884a7d2..8f627ad0f1a86 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -175,9 +175,6 @@ let Definition = "target" in {
def DebugUtilityExpression: Property<"debug-utility-expression", "Boolean">,
DefaultFalse,
Desc<"Enable debugging of LLDB-internal utility expressions.">;
- def VerifyFileCacheMemoryReads: Property<"verify-file-cache-memory-reads", "Boolean">,
- DefaultFalse,
- Desc<"Verify that memory read from the file-cache is identical to the memory read from the process.">;
}
let Definition = "process_experimental" in {
diff --git a/lldb/test/Shell/lit-lldb-init.in b/lldb/test/Shell/lit-lldb-init.in
index 60670c5357421..6d3b5fefb3bd3 100644
--- a/lldb/test/Shell/lit-lldb-init.in
+++ b/lldb/test/Shell/lit-lldb-init.in
@@ -6,4 +6,3 @@ settings set symbols.clang-modules-cache-path "@LLDB_TEST_MODULE_CACHE_LLDB@"
settings set target.auto-apply-fixits false
settings set target.inherit-tcc true
settings set target.detach-on-error false
-settings set target.verify-file-cache-memory-reads true
More information about the lldb-commits
mailing list