Skip to content

Commit 57e0cd3

Browse files
committed
[lldb] Make DoReadMemory a protected method.
DoReadMemory is LLDB's internal implementation and shouldn't be called directly. Differential revision: https://reviews.llvm.org/D94284
1 parent f2e0585 commit 57e0cd3

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,35 +1414,6 @@ class Process : public std::enable_shared_from_this<Process>,
14141414
/// this process.
14151415
virtual bool WarnBeforeDetach() const { return true; }
14161416

1417-
/// Actually do the reading of memory from a process.
1418-
///
1419-
/// Subclasses must override this function and can return fewer bytes than
1420-
/// requested when memory requests are too large. This class will break up
1421-
/// the memory requests and keep advancing the arguments along as needed.
1422-
///
1423-
/// \param[in] vm_addr
1424-
/// A virtual load address that indicates where to start reading
1425-
/// memory from.
1426-
///
1427-
/// \param[in] size
1428-
/// The number of bytes to read.
1429-
///
1430-
/// \param[out] buf
1431-
/// A byte buffer that is at least \a size bytes long that
1432-
/// will receive the memory bytes.
1433-
///
1434-
/// \param[out] error
1435-
/// An error that indicates the success or failure of this
1436-
/// operation. If error indicates success (error.Success()),
1437-
/// then the value returned can be trusted, otherwise zero
1438-
/// will be returned.
1439-
///
1440-
/// \return
1441-
/// The number of bytes that were actually read into \a buf.
1442-
/// Zero is returned in the case of an error.
1443-
virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
1444-
Status &error) = 0;
1445-
14461417
/// Read of memory from a process.
14471418
///
14481419
/// This function will read memory from the current process's address space
@@ -2570,6 +2541,35 @@ void PruneThreadPlans();
25702541
bool trap_exceptions = false);
25712542

25722543
protected:
2544+
/// Actually do the reading of memory from a process.
2545+
///
2546+
/// Subclasses must override this function and can return fewer bytes than
2547+
/// requested when memory requests are too large. This class will break up
2548+
/// the memory requests and keep advancing the arguments along as needed.
2549+
///
2550+
/// \param[in] vm_addr
2551+
/// A virtual load address that indicates where to start reading
2552+
/// memory from.
2553+
///
2554+
/// \param[in] size
2555+
/// The number of bytes to read.
2556+
///
2557+
/// \param[out] buf
2558+
/// A byte buffer that is at least \a size bytes long that
2559+
/// will receive the memory bytes.
2560+
///
2561+
/// \param[out] error
2562+
/// An error that indicates the success or failure of this
2563+
/// operation. If error indicates success (error.Success()),
2564+
/// then the value returned can be trusted, otherwise zero
2565+
/// will be returned.
2566+
///
2567+
/// \return
2568+
/// The number of bytes that were actually read into \a buf.
2569+
/// Zero is returned in the case of an error.
2570+
virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
2571+
Status &error) = 0;
2572+
25732573
void SetState(lldb::EventSP &event_sp);
25742574

25752575
lldb::StateType GetPrivateState();

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, Process *process, llvm::M
400400
*read_error = false;
401401

402402
// Read the mach header and see whether it looks like a kernel
403-
if (process->DoReadMemory (addr, &header, sizeof(header), error) !=
403+
if (process->ReadMemory(addr, &header, sizeof(header), error) !=
404404
sizeof(header)) {
405405
if (read_error)
406406
*read_error = true;
@@ -790,7 +790,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
790790

791791
// For the kernel, we really do need an on-disk file copy of the binary
792792
// to do anything useful. This will force a call to dsymForUUID if it
793-
// exists, instead of depending on the DebugSymbols preferences being
793+
// exists, instead of depending on the DebugSymbols preferences being
794794
// set.
795795
if (IsKernel()) {
796796
if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) {

lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ std::string HexagonDYLDRendezvous::ReadStringFromMemory(addr_t addr) {
246246
return std::string();
247247

248248
for (;;) {
249-
size = m_process->DoReadMemory(addr, &c, 1, error);
249+
size = m_process->ReadMemory(addr, &c, 1, error);
250250
if (size != 1 || error.Fail())
251251
return std::string();
252252
if (c == 0)

lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
291291
jit_descriptor<ptr_t> jit_desc;
292292
const size_t jit_desc_size = sizeof(jit_desc);
293293
Status error;
294-
size_t bytes_read = m_process->DoReadMemory(m_jit_descriptor_addr, &jit_desc,
295-
jit_desc_size, error);
294+
size_t bytes_read = m_process->ReadMemory(m_jit_descriptor_addr, &jit_desc,
295+
jit_desc_size, error);
296296
if (bytes_read != jit_desc_size || !error.Success()) {
297297
LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT descriptor",
298298
__FUNCTION__);

0 commit comments

Comments
 (0)