[Lldb-commits] [lldb] r236132 - Remove trap code from disassembly.
Chaoren Lin
chaorenl at google.com
Wed Apr 29 10:24:49 PDT 2015
Author: chaoren
Date: Wed Apr 29 12:24:48 2015
New Revision: 236132
URL: http://llvm.org/viewvc/llvm-project?rev=236132&view=rev
Log:
Remove trap code from disassembly.
Summary:
NativeProcessProtocol uses ReadMemory internally for setting/checking
breakpoints but also for generic memory reads (Handle_m), this change adds a
ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t
as size/length.
Test Plan: `disassemble` no longer shows the trap code.
Reviewers: jingham, vharron, clayborg
Reviewed By: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9330
Modified:
lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h
lldb/trunk/source/Host/common/NativeBreakpointList.cpp
lldb/trunk/source/Host/common/NativeRegisterContext.cpp
lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h Wed Apr 29 12:24:48 2015
@@ -42,6 +42,9 @@ namespace lldb_private
Error
GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
+ Error
+ RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
+
private:
typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Wed Apr 29 12:24:48 2015
@@ -90,13 +90,16 @@ namespace lldb_private
GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);
virtual Error
- ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) = 0;
+ ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
virtual Error
- WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) = 0;
+ ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
virtual Error
- AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
+ WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) = 0;
+
+ virtual Error
+ AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
virtual Error
DeallocateMemory (lldb::addr_t addr) = 0;
Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h Wed Apr 29 12:24:48 2015
@@ -115,10 +115,10 @@ public:
HardwareSingleStep (bool enable);
virtual Error
- ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, lldb::addr_t src_len, RegisterValue ®_value);
+ ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value);
virtual Error
- WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, lldb::addr_t dst_len, const RegisterValue ®_value);
+ WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value);
//------------------------------------------------------------------
// Subclasses should not override these
Modified: lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h (original)
+++ lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h Wed Apr 29 12:24:48 2015
@@ -17,6 +17,8 @@ namespace lldb_private
{
class SoftwareBreakpoint : public NativeBreakpoint
{
+ friend class NativeBreakpointList;
+
public:
static Error
CreateSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_spn);
Modified: lldb/trunk/source/Host/common/NativeBreakpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeBreakpointList.cpp?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeBreakpointList.cpp (original)
+++ lldb/trunk/source/Host/common/NativeBreakpointList.cpp Wed Apr 29 12:24:48 2015
@@ -12,6 +12,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Host/common/NativeBreakpoint.h"
+#include "lldb/Host/common/SoftwareBreakpoint.h"
using namespace lldb;
using namespace lldb_private;
@@ -197,3 +198,24 @@ NativeBreakpointList::GetBreakpoint (lld
return Error ();
}
+Error
+NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const
+{
+ for (const auto &map : m_breakpoints)
+ {
+ lldb::addr_t bp_addr = map.first;
+ // Breapoint not in range, ignore
+ if (bp_addr < addr || addr + size <= bp_addr)
+ continue;
+ const auto &bp_sp = map.second;
+ // Not software breakpoint, ignore
+ if (!bp_sp->IsSoftwareBreakpoint())
+ continue;
+ auto software_bp_sp = std::static_pointer_cast<SoftwareBreakpoint>(bp_sp);
+ auto opcode_addr = static_cast<char *>(buf) + bp_addr - addr;
+ auto saved_opcodes = software_bp_sp->m_saved_opcodes;
+ auto opcode_size = software_bp_sp->m_opcode_size;
+ ::memcpy(opcode_addr, saved_opcodes, opcode_size);
+ }
+ return Error();
+}
Modified: lldb/trunk/source/Host/common/NativeRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeRegisterContext.cpp?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeRegisterContext.cpp (original)
+++ lldb/trunk/source/Host/common/NativeRegisterContext.cpp Wed Apr 29 12:24:48 2015
@@ -338,7 +338,7 @@ Error
NativeRegisterContext::ReadRegisterValueFromMemory (
const RegisterInfo *reg_info,
lldb::addr_t src_addr,
- lldb::addr_t src_len,
+ size_t src_len,
RegisterValue ®_value)
{
Error error;
@@ -371,7 +371,7 @@ NativeRegisterContext::ReadRegisterValue
return error;
}
- const lldb::addr_t dst_len = reg_info->byte_size;
+ const size_t dst_len = reg_info->byte_size;
if (src_len > dst_len)
{
@@ -389,7 +389,7 @@ NativeRegisterContext::ReadRegisterValue
uint8_t src[RegisterValue::kMaxRegisterByteSize];
// Read the memory
- lldb::addr_t bytes_read;
+ size_t bytes_read;
error = process_sp->ReadMemory (src_addr, src, src_len, bytes_read);
if (error.Fail ())
return error;
@@ -428,7 +428,7 @@ Error
NativeRegisterContext::WriteRegisterValueToMemory (
const RegisterInfo *reg_info,
lldb::addr_t dst_addr,
- lldb::addr_t dst_len,
+ size_t dst_len,
const RegisterValue ®_value)
{
@@ -447,7 +447,7 @@ NativeRegisterContext::WriteRegisterValu
if (!process_sp->GetByteOrder (byte_order))
return Error ("NativeProcessProtocol::GetByteOrder () failed");
- const lldb::addr_t bytes_copied = reg_value.GetAsMemoryData (
+ const size_t bytes_copied = reg_value.GetAsMemoryData (
reg_info,
dst,
dst_len,
@@ -462,8 +462,8 @@ NativeRegisterContext::WriteRegisterValu
}
else
{
- lldb::addr_t bytes_written;
- error = process_sp->WriteMemory (dst_addr, dst, bytes_copied, bytes_written);
+ size_t bytes_written;
+ error = process_sp->WriteMemory(dst_addr, dst, bytes_copied, bytes_written);
if (error.Fail ())
return error;
Modified: lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp (original)
+++ lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp Wed Apr 29 12:24:48 2015
@@ -101,9 +101,9 @@ SoftwareBreakpoint::EnableSoftwareBreakp
log->Printf ("SoftwareBreakpoint::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
// Save the original opcodes by reading them so we can restore later.
- lldb::addr_t bytes_read = 0;
+ size_t bytes_read = 0;
- Error error = process.ReadMemory(addr, saved_opcode_bytes, static_cast<lldb::addr_t> (bp_opcode_size), bytes_read);
+ Error error = process.ReadMemory(addr, saved_opcode_bytes, bp_opcode_size, bytes_read);
if (error.Fail ())
{
if (log)
@@ -112,7 +112,7 @@ SoftwareBreakpoint::EnableSoftwareBreakp
}
// Ensure we read as many bytes as we expected.
- if (bytes_read != static_cast<lldb::addr_t> (bp_opcode_size))
+ if (bytes_read != bp_opcode_size)
{
if (log)
log->Printf ("SoftwareBreakpoint::%s failed to read memory while attempting to set breakpoint: attempted to read %lu bytes but only read %" PRIu64, __FUNCTION__, bp_opcode_size, bytes_read);
@@ -125,13 +125,15 @@ SoftwareBreakpoint::EnableSoftwareBreakp
int i = 0;
for (const uint8_t *read_byte = saved_opcode_bytes; read_byte < saved_opcode_bytes + bp_opcode_size; ++read_byte)
{
- log->Printf ("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " ovewriting byte index %d (was 0x%x)", __FUNCTION__, addr, i++, static_cast<int> (*read_byte));
+ log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64
+ " ovewriting byte index %d (was 0x%hhx)",
+ __FUNCTION__, addr, i++, *read_byte);
}
}
// Write a software breakpoint in place of the original opcode.
- lldb::addr_t bytes_written = 0;
- error = process.WriteMemory (addr, bp_opcode_bytes, static_cast<lldb::addr_t> (bp_opcode_size), bytes_written);
+ size_t bytes_written = 0;
+ error = process.WriteMemory(addr, bp_opcode_bytes, bp_opcode_size, bytes_written);
if (error.Fail ())
{
if (log)
@@ -140,7 +142,7 @@ SoftwareBreakpoint::EnableSoftwareBreakp
}
// Ensure we wrote as many bytes as we expected.
- if (bytes_written != static_cast<lldb::addr_t> (bp_opcode_size))
+ if (bytes_written != bp_opcode_size)
{
error.SetErrorStringWithFormat("SoftwareBreakpoint::%s failed write memory while attempting to set breakpoint: attempted to write %lu bytes but only wrote %" PRIu64, __FUNCTION__, bp_opcode_size, bytes_written);
if (log)
@@ -149,8 +151,8 @@ SoftwareBreakpoint::EnableSoftwareBreakp
}
uint8_t verify_bp_opcode_bytes [MAX_TRAP_OPCODE_SIZE];
- lldb::addr_t verify_bytes_read = 0;
- error = process.ReadMemory(addr, verify_bp_opcode_bytes, static_cast<lldb::addr_t> (bp_opcode_size), verify_bytes_read);
+ size_t verify_bytes_read = 0;
+ error = process.ReadMemory(addr, verify_bp_opcode_bytes, bp_opcode_size, verify_bytes_read);
if (error.Fail ())
{
if (log)
@@ -159,7 +161,7 @@ SoftwareBreakpoint::EnableSoftwareBreakp
}
// Ensure we read as many verification bytes as we expected.
- if (verify_bytes_read != static_cast<lldb::addr_t> (bp_opcode_size))
+ if (verify_bytes_read != bp_opcode_size)
{
if (log)
log->Printf ("SoftwareBreakpoint::%s failed to read memory while attempting to verify breakpoint: attempted to read %lu bytes but only read %" PRIu64, __FUNCTION__, bp_opcode_size, verify_bytes_read);
@@ -223,9 +225,9 @@ SoftwareBreakpoint::DoDisable ()
assert (m_opcode_size <= sizeof (curr_break_op));
// Read the breakpoint opcode
- lldb::addr_t bytes_read = 0;
+ size_t bytes_read = 0;
error = m_process.ReadMemory (m_addr, curr_break_op, m_opcode_size, bytes_read);
- if (error.Success () && (bytes_read < static_cast<lldb::addr_t> (m_opcode_size)))
+ if (error.Success() && bytes_read < m_opcode_size)
{
error.SetErrorStringWithFormat ("SoftwareBreakpointr::%s addr=0x%" PRIx64 ": tried to read %lu bytes but only read %" PRIu64, __FUNCTION__, m_addr, m_opcode_size, bytes_read);
}
@@ -238,9 +240,9 @@ SoftwareBreakpoint::DoDisable ()
break_op_found = true;
// We found a valid breakpoint opcode at this address, now restore
// the saved opcode.
- lldb::addr_t bytes_written = 0;
+ size_t bytes_written = 0;
error = m_process.WriteMemory (m_addr, m_saved_opcodes, m_opcode_size, bytes_written);
- if (error.Success () && (bytes_written < static_cast<lldb::addr_t> (m_opcode_size)))
+ if (error.Success() && bytes_written < m_opcode_size)
{
error.SetErrorStringWithFormat ("SoftwareBreakpoint::%s addr=0x%" PRIx64 ": tried to write %lu bytes but only wrote %" PRIu64, __FUNCTION__, m_addr, m_opcode_size, bytes_written);
}
@@ -262,9 +264,9 @@ SoftwareBreakpoint::DoDisable ()
assert (m_opcode_size <= sizeof (verify_opcode));
// Verify that our original opcode made it back to the inferior
- lldb::addr_t verify_bytes_read = 0;
+ size_t verify_bytes_read = 0;
error = m_process.ReadMemory (m_addr, verify_opcode, m_opcode_size, verify_bytes_read);
- if (error.Success () && (verify_bytes_read < static_cast<lldb::addr_t> (m_opcode_size)))
+ if (error.Success() && verify_bytes_read < m_opcode_size)
{
error.SetErrorStringWithFormat ("SoftwareBreakpoint::%s addr=0x%" PRIx64 ": tried to read %lu verification bytes but only read %" PRIu64, __FUNCTION__, m_addr, m_opcode_size, verify_bytes_read);
}
@@ -279,7 +281,9 @@ SoftwareBreakpoint::DoDisable ()
int i = 0;
for (const uint8_t *verify_byte = verify_opcode; verify_byte < verify_opcode + m_opcode_size; ++verify_byte)
{
- log->Printf ("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " replaced byte index %d with 0x%x", __FUNCTION__, m_addr, i++, static_cast<int> (*verify_byte));
+ log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64
+ " replaced byte index %d with 0x%hhx",
+ __FUNCTION__, m_addr, i++, *verify_byte);
}
log->Printf ("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " -- SUCCESS", __FUNCTION__, m_addr);
}
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Apr 29 12:24:48 2015
@@ -345,19 +345,19 @@ namespace
// NativeProcessLinux::WriteMemory. This enables mutual recursion between these
// functions without needed to go thru the thread funnel.
- lldb::addr_t
- DoReadMemory (
+ size_t
+ DoReadMemory(
lldb::pid_t pid,
lldb::addr_t vm_addr,
void *buf,
- lldb::addr_t size,
+ size_t size,
Error &error)
{
// ptrace word size is determined by the host, not the child
static const unsigned word_size = sizeof(void*);
unsigned char *dst = static_cast<unsigned char*>(buf);
- lldb::addr_t bytes_read;
- lldb::addr_t remainder;
+ size_t bytes_read;
+ size_t remainder;
long data;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_ALL));
@@ -407,19 +407,19 @@ namespace
return bytes_read;
}
- lldb::addr_t
+ size_t
DoWriteMemory(
lldb::pid_t pid,
lldb::addr_t vm_addr,
const void *buf,
- lldb::addr_t size,
+ size_t size,
Error &error)
{
// ptrace word size is determined by the host, not the child
static const unsigned word_size = sizeof(void*);
const unsigned char *src = static_cast<const unsigned char*>(buf);
- lldb::addr_t bytes_written = 0;
- lldb::addr_t remainder;
+ size_t bytes_written = 0;
+ size_t remainder;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_ALL));
if (log)
@@ -526,11 +526,11 @@ namespace
class ReadOperation : public Operation
{
public:
- ReadOperation (
+ ReadOperation(
lldb::addr_t addr,
void *buff,
- lldb::addr_t size,
- lldb::addr_t &result) :
+ size_t size,
+ size_t &result) :
Operation (),
m_addr (addr),
m_buff (buff),
@@ -544,8 +544,8 @@ namespace
private:
lldb::addr_t m_addr;
void *m_buff;
- lldb::addr_t m_size;
- lldb::addr_t &m_result;
+ size_t m_size;
+ size_t &m_result;
};
void
@@ -560,11 +560,11 @@ namespace
class WriteOperation : public Operation
{
public:
- WriteOperation (
+ WriteOperation(
lldb::addr_t addr,
const void *buff,
- lldb::addr_t size,
- lldb::addr_t &result) :
+ size_t size,
+ size_t &result) :
Operation (),
m_addr (addr),
m_buff (buff),
@@ -578,8 +578,8 @@ namespace
private:
lldb::addr_t m_addr;
const void *m_buff;
- lldb::addr_t m_size;
- lldb::addr_t &m_result;
+ size_t m_size;
+ size_t &m_result;
};
void
@@ -2825,7 +2825,7 @@ ReadMemoryCallback (EmulateInstruction *
{
EmulatorBaton* emulator_baton = static_cast<EmulatorBaton*>(baton);
- lldb::addr_t bytes_read;
+ size_t bytes_read;
emulator_baton->m_process->ReadMemory(addr, dst, length, bytes_read);
return bytes_read;
}
@@ -3472,10 +3472,7 @@ NativeProcessLinux::DoStopIDBumped (uint
}
Error
-NativeProcessLinux::AllocateMemory (
- lldb::addr_t size,
- uint32_t permissions,
- lldb::addr_t &addr)
+NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr)
{
// FIXME implementing this requires the equivalent of
// InferiorCallPOSIX::InferiorCallMmap, which depends on
@@ -3837,7 +3834,7 @@ NativeProcessLinux::GetCrashReasonForSIG
#endif
Error
-NativeProcessLinux::ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read)
+NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
{
ReadOperation op(addr, buf, size, bytes_read);
m_monitor_up->DoOperation(&op);
@@ -3845,7 +3842,15 @@ NativeProcessLinux::ReadMemory (lldb::ad
}
Error
-NativeProcessLinux::WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written)
+NativeProcessLinux::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
+{
+ Error error = ReadMemory(addr, buf, size, bytes_read);
+ if (error.Fail()) return error;
+ return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size);
+}
+
+Error
+NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)
{
WriteOperation op(addr, buf, size, bytes_written);
m_monitor_up->DoOperation(&op);
@@ -4182,11 +4187,11 @@ NativeProcessLinux::FixupBreakpointPCAsN
// First try probing for a breakpoint at a software breakpoint location: PC - breakpoint size.
const lldb::addr_t initial_pc_addr = context_sp->GetPC ();
lldb::addr_t breakpoint_addr = initial_pc_addr;
- if (breakpoint_size > static_cast<lldb::addr_t> (0))
+ if (breakpoint_size > 0)
{
// Do not allow breakpoint probe to wrap around.
- if (breakpoint_addr >= static_cast<lldb::addr_t> (breakpoint_size))
- breakpoint_addr -= static_cast<lldb::addr_t> (breakpoint_size);
+ if (breakpoint_addr >= breakpoint_size)
+ breakpoint_addr -= breakpoint_size;
}
// Check if we stopped because of a breakpoint.
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Wed Apr 29 12:24:48 2015
@@ -84,13 +84,16 @@ namespace process_linux {
GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info) override;
Error
- ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) override;
+ ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) override;
Error
- WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) override;
+ ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) override;
Error
- AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) override;
+ WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) override;
+
+ Error
+ AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) override;
Error
DeallocateMemory (lldb::addr_t addr) override;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=236132&r1=236131&r2=236132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Wed Apr 29 12:24:48 2015
@@ -1846,8 +1846,8 @@ GDBRemoteCommunicationServerLLGS::Handle
// Retrieve the process memory.
- lldb::addr_t bytes_read = 0;
- Error error = m_debugged_process_sp->ReadMemory (read_addr, &buf[0], byte_count, bytes_read);
+ size_t bytes_read = 0;
+ Error error = m_debugged_process_sp->ReadMemoryWithoutTrap(read_addr, &buf[0], byte_count, bytes_read);
if (error.Fail ())
{
if (log)
@@ -1863,7 +1863,7 @@ GDBRemoteCommunicationServerLLGS::Handle
}
StreamGDBRemote response;
- for (lldb::addr_t i = 0; i < bytes_read; ++i)
+ for (size_t i = 0; i < bytes_read; ++i)
response.PutHex8(buf[i]);
return SendPacketNoLock(response.GetData(), response.GetSize());
@@ -1917,7 +1917,7 @@ GDBRemoteCommunicationServerLLGS::Handle
// Convert the hex memory write contents to bytes.
StreamGDBRemote response;
- const uint64_t convert_count = static_cast<uint64_t> (packet.GetHexBytes (&buf[0], byte_count, 0));
+ const uint64_t convert_count = packet.GetHexBytes(&buf[0], byte_count, 0);
if (convert_count != byte_count)
{
if (log)
@@ -1926,7 +1926,7 @@ GDBRemoteCommunicationServerLLGS::Handle
}
// Write the process memory.
- lldb::addr_t bytes_written = 0;
+ size_t bytes_written = 0;
Error error = m_debugged_process_sp->WriteMemory (write_addr, &buf[0], byte_count, bytes_written);
if (error.Fail ())
{
More information about the lldb-commits
mailing list