DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
../llvm-project/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h:61:12:
warning: implicit conversion from 'unsigned long long' to 'size_t' (aka
'unsigned int')
changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
../llvm-project/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:275:39:
warning: result of comparison of constant 18446744073709551615 with expression
of type 'size_t' (aka 'unsigned int') is always false
[-Wtautological-constant-out-of-range-compare]
This happens because size_t on 32 bit is 32 bit, but LLDB_INVALID_OFFSET is
UINT64_MAX. Return lldb::offset_t instead, which is 64 bit everywhere.
DoWriteMemory still returns size_t but this is because every other
Process derived thing does that. As long as the failure check works I think
it should be fine.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146124
Files:
lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
Index:
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
===================================================================
---
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
@@ -50,8 +50,9 @@
lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size,
Status &error) override;
- size_t WriteMemoryAtAddress(lldb::addr_t addr, lldb::DataExtractorSP data_sp,
- Status &error) override;
+ lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
+ lldb::DataExtractorSP data_sp,
+ Status &error) override;
StructuredData::ArraySP GetLoadedImages() override;
Index:
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
===================================================================
---
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -136,7 +136,7 @@
return data_sp;
}
-size_t ScriptedProcessPythonInterface::WriteMemoryAtAddress(
+lldb::offset_t ScriptedProcessPythonInterface::WriteMemoryAtAddress(
lldb::addr_t addr, lldb::DataExtractorSP data_sp, Status &error) {
Status py_error;
StructuredData::ObjectSP obj =
Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -269,7 +269,7 @@
if (!data_extractor_sp || !data_extractor_sp->GetByteSize())
return 0;
- size_t bytes_written =
+ lldb::offset_t bytes_written =
GetInterface().WriteMemoryAtAddress(vm_addr, data_extractor_sp, error);
if (!bytes_written || bytes_written == LLDB_INVALID_OFFSET)
Index: lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
===================================================================
--- lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -55,9 +55,9 @@
return {};
}
- virtual size_t WriteMemoryAtAddress(lldb::addr_t addr,
- lldb::DataExtractorSP data_sp,
- Status &error) {
+ virtual lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
+ lldb::DataExtractorSP data_sp,
+ Status &error) {
return LLDB_INVALID_OFFSET;
};
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
@@ -50,8 +50,9 @@
lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size,
Status &error) override;
- size_t WriteMemoryAtAddress(lldb::addr_t addr, lldb::DataExtractorSP data_sp,
- Status &error) override;
+ lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
+ lldb::DataExtractorSP data_sp,
+ Status &error) override;
StructuredData::ArraySP GetLoadedImages() override;
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -136,7 +136,7 @@
return data_sp;
}
-size_t ScriptedProcessPythonInterface::WriteMemoryAtAddress(
+lldb::offset_t ScriptedProcessPythonInterface::WriteMemoryAtAddress(
lldb::addr_t addr, lldb::DataExtractorSP data_sp, Status &error) {
Status py_error;
StructuredData::ObjectSP obj =
Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -269,7 +269,7 @@
if (!data_extractor_sp || !data_extractor_sp->GetByteSize())
return 0;
- size_t bytes_written =
+ lldb::offset_t bytes_written =
GetInterface().WriteMemoryAtAddress(vm_addr, data_extractor_sp, error);
if (!bytes_written || bytes_written == LLDB_INVALID_OFFSET)
Index: lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
===================================================================
--- lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -55,9 +55,9 @@
return {};
}
- virtual size_t WriteMemoryAtAddress(lldb::addr_t addr,
- lldb::DataExtractorSP data_sp,
- Status &error) {
+ virtual lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
+ lldb::DataExtractorSP data_sp,
+ Status &error) {
return LLDB_INVALID_OFFSET;
};
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits