Skip to content

Commit 0e57707

Browse files
committed
Remove the clearly unnecessary parts from
dummy_scripted_process.py. Add a comment in ScriptedProcess::DoGetMemoryRegionInfo about what types of memory regions are rejecting.
1 parent f8f1d70 commit 0e57707

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t load_addr,
290290
if (auto region_or_err =
291291
GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
292292
region = *region_or_err;
293+
// Reject a region of {0,0} or {0,UINT64_MAX}, neither are
294+
// meaningful responses.
293295
if (region.GetRange().GetRangeBase() == 0 &&
294296
(region.GetRange().GetByteSize() == 0 ||
295-
region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {
297+
region.GetRange().GetByteSize() == UINT64_MAX)) {
296298
error = Status::FromErrorString(
297299
"Invalid memory region from scripted process");
298300
}

lldb/test/API/functionalities/scripted_process_empty_memory_region/dummy_scripted_process.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
from lldb.plugins.scripted_process import ScriptedThread
88

99

10-
class DummyStopHook:
11-
def __init__(self, target, args):
12-
self.target = target
13-
self.args = args
14-
15-
def handle_stop(self, exe_ctx, stream):
16-
print("My DummyStopHook triggered. Printing args: \n%s" % self.args)
17-
sp = exe_ctx.process.GetScriptedImplementation()
18-
sp.handled_stop = True
19-
20-
2110
class DummyScriptedProcess(ScriptedProcess):
2211
memory = None
2312

@@ -116,22 +105,6 @@ def get_register_context(self) -> str:
116105

117106

118107
def __lldb_init_module(debugger, dict):
119-
# This is used when loading the script in an interactive debug session to
120-
# automatically, register the stop-hook and launch the scripted process.
121-
if not "SKIP_SCRIPTED_PROCESS_LAUNCH" in os.environ:
122-
debugger.HandleCommand(
123-
"target stop-hook add -k first -v 1 -k second -v 2 -P %s.%s"
124-
% (__name__, DummyStopHook.__name__)
125-
)
126-
debugger.HandleCommand(
127-
"process launch -C %s.%s" % (__name__, DummyScriptedProcess.__name__)
128-
)
129-
else:
130-
print(
131-
"Name of the class that will manage the scripted process: '%s.%s'"
132-
% (__name__, DummyScriptedProcess.__name__)
133-
)
134-
print(
135-
"Name of the class that will manage the stop-hook: '%s.%s'"
136-
% (__name__, DummyStopHook.__name__)
137-
)
108+
debugger.HandleCommand(
109+
"process launch -C %s.%s" % (__name__, DummyScriptedProcess.__name__)
110+
)

0 commit comments

Comments
 (0)