Skip to content

Commit daa4061

Browse files
committed
Revert "[lldb] Do not bump memory modificator ID when "internal" debugger memory is updated (#129092)"
And a follow up warning fix. This reverts commit 6aa963f and 2bff80f. This is failing on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/8375 Seems to produce the line the test wants but not in the right place. Reverting while I investigate.
1 parent df26417 commit daa4061

12 files changed

+2
-280
lines changed

lldb/include/lldb/Target/Memory.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ class AllocatedMemoryCache {
125125

126126
bool DeallocateMemory(lldb::addr_t ptr);
127127

128-
bool IsInCache(lldb::addr_t addr) const;
129-
130128
protected:
131129
typedef std::shared_ptr<AllocatedBlock> AllocatedBlockSP;
132130

@@ -135,7 +133,7 @@ class AllocatedMemoryCache {
135133

136134
// Classes that inherit from MemoryCache can see and modify these
137135
Process &m_process;
138-
mutable std::recursive_mutex m_mutex;
136+
std::recursive_mutex m_mutex;
139137
typedef std::multimap<uint32_t, AllocatedBlockSP> PermissionsToBlockMap;
140138
PermissionsToBlockMap m_memory_map;
141139

lldb/include/lldb/Target/Process.h

-13
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ class ProcessProperties : public Properties {
111111
void SetOSPluginReportsAllThreads(bool does_report);
112112
bool GetSteppingRunsAllThreads() const;
113113
FollowForkMode GetFollowForkMode() const;
114-
bool TrackMemoryCacheChanges() const;
115114

116115
protected:
117116
Process *m_process; // Can be nullptr for global ProcessProperties
@@ -313,18 +312,6 @@ class ProcessModID {
313312
return lldb::EventSP();
314313
}
315314

316-
void Dump(Stream &stream) const {
317-
stream.Format("ProcessModID:\n"
318-
" m_stop_id: {0}\n m_last_natural_stop_id: {1}\n"
319-
" m_resume_id: {2}\n m_memory_id: {3}\n"
320-
" m_last_user_expression_resume: {4}\n"
321-
" m_running_user_expression: {5}\n"
322-
" m_running_utility_function: {6}\n",
323-
m_stop_id, m_last_natural_stop_id, m_resume_id, m_memory_id,
324-
m_last_user_expression_resume, m_running_user_expression,
325-
m_running_utility_function);
326-
}
327-
328315
private:
329316
uint32_t m_stop_id = 0;
330317
uint32_t m_last_natural_stop_id = 0;

lldb/source/Commands/CommandObjectProcess.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -1388,9 +1388,6 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
13881388
case 'v':
13891389
m_verbose = true;
13901390
break;
1391-
case 'd':
1392-
m_dump = true;
1393-
break;
13941391
default:
13951392
llvm_unreachable("Unimplemented option");
13961393
}
@@ -1400,7 +1397,6 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
14001397

14011398
void OptionParsingStarting(ExecutionContext *execution_context) override {
14021399
m_verbose = false;
1403-
m_dump = false;
14041400
}
14051401

14061402
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
@@ -1409,7 +1405,6 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
14091405

14101406
// Instance variables to hold the values for command options.
14111407
bool m_verbose = false;
1412-
bool m_dump = false;
14131408
};
14141409

14151410
protected:
@@ -1464,14 +1459,6 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
14641459
crash_info_sp->GetDescription(strm);
14651460
}
14661461
}
1467-
1468-
if (m_options.m_dump) {
1469-
StateType state = process->GetState();
1470-
if (state == eStateStopped) {
1471-
ProcessModID process_mod_id = process->GetModID();
1472-
process_mod_id.Dump(result.GetOutputStream());
1473-
}
1474-
}
14751462
}
14761463

14771464
private:

lldb/source/Commands/Options.td

-2
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,6 @@ let Command = "process handle" in {
788788
let Command = "process status" in {
789789
def process_status_verbose : Option<"verbose", "v">, Group<1>,
790790
Desc<"Show verbose process status including extended crash information.">;
791-
def process_status_dump : Option<"dump-modification-id", "d">, Group<1>,
792-
Desc<"Dump the state of the ProcessModID of the stopped process.">;
793791
}
794792

795793
let Command = "process save_core" in {

lldb/source/Target/Memory.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,3 @@ bool AllocatedMemoryCache::DeallocateMemory(lldb::addr_t addr) {
433433
(uint64_t)addr, success);
434434
return success;
435435
}
436-
437-
bool AllocatedMemoryCache::IsInCache(lldb::addr_t addr) const {
438-
std::lock_guard<std::recursive_mutex> guard(m_mutex);
439-
440-
return llvm::any_of(m_memory_map, [addr](const auto &block) {
441-
return block.second->Contains(addr);
442-
});
443-
}

lldb/source/Target/Process.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ FollowForkMode ProcessProperties::GetFollowForkMode() const {
370370
g_process_properties[idx].default_uint_value));
371371
}
372372

373-
bool ProcessProperties::TrackMemoryCacheChanges() const {
374-
const uint32_t idx = ePropertyTrackMemoryCacheChanges;
375-
return GetPropertyAtIndexAs<bool>(
376-
idx, g_process_properties[idx].default_uint_value != 0);
377-
}
378-
379373
ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
380374
llvm::StringRef plugin_name,
381375
ListenerSP listener_sp,
@@ -2291,7 +2285,6 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size,
22912285
return bytes_written;
22922286
}
22932287

2294-
#define USE_ALLOCATE_MEMORY_CACHE 1
22952288
size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
22962289
Status &error) {
22972290
if (ABISP abi_sp = GetABI())
@@ -2304,12 +2297,7 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
23042297
if (buf == nullptr || size == 0)
23052298
return 0;
23062299

2307-
#if defined(USE_ALLOCATE_MEMORY_CACHE)
2308-
if (TrackMemoryCacheChanges() || !m_allocated_memory_cache.IsInCache(addr))
2309-
m_mod_id.BumpMemoryID();
2310-
#else
23112300
m_mod_id.BumpMemoryID();
2312-
#endif
23132301

23142302
// We need to write any data that would go where any current software traps
23152303
// (enabled software breakpoints) any software traps (breakpoints) that we
@@ -2438,6 +2426,7 @@ Status Process::WriteObjectFile(std::vector<ObjectFile::LoadableData> entries) {
24382426
return error;
24392427
}
24402428

2429+
#define USE_ALLOCATE_MEMORY_CACHE 1
24412430
addr_t Process::AllocateMemory(size_t size, uint32_t permissions,
24422431
Status &error) {
24432432
if (GetPrivateState() != eStateStopped) {

lldb/source/Target/TargetProperties.td

-3
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ let Definition = "process" in {
299299
DefaultEnumValue<"eFollowParent">,
300300
EnumValues<"OptionEnumValues(g_follow_fork_mode_values)">,
301301
Desc<"Debugger's behavior upon fork or vfork.">;
302-
def TrackMemoryCacheChanges: Property<"track-memory-cache-changes", "Boolean">,
303-
DefaultTrue,
304-
Desc<"If true, memory cache modifications (which happen often during expressions evaluation) will bump process state ID (and invalidate all synthetic children). Disabling this option helps to avoid synthetic children reevaluation when pretty printers heavily use expressions. The downside of disabled setting is that convenience variables won't reevaluate synthetic children automatically.">;
305302
}
306303

307304
let Definition = "platform" in {

lldb/test/API/commands/settings/TestSettings.py

-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,6 @@ def test_all_settings_exist(self):
905905
"target.use-hex-immediates",
906906
"target.process.disable-memory-cache",
907907
"target.process.extra-startup-command",
908-
"target.process.track-memory-cache-changes",
909908
"target.process.thread.trace-thread",
910909
"target.process.thread.step-avoid-regexp",
911910
],

lldb/test/Shell/Expr/TestExprWithSideEffect.cpp

-55
This file was deleted.

lldb/test/Shell/Expr/TestExprWithSideEffectOnConvenienceVar.cpp

-52
This file was deleted.

lldb/test/Shell/Expr/TestExprWithSideEffectOnConvenienceVarWindows.cpp

-51
This file was deleted.

lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp

-67
This file was deleted.

0 commit comments

Comments
 (0)