diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2014-10-08 17:14:53 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2014-10-08 17:14:53 +0000 |
commit | e231efaee500269201c38920c310c15bd51e1b5d (patch) | |
tree | 0f43319cefe802d42f4ffb22935165ceb0779ba2 /lldb/source | |
parent | 894eff7a9f045615f94ed7a8cdf80c4e15a2afc8 (diff) | |
download | bcm5719-llvm-e231efaee500269201c38920c310c15bd51e1b5d.tar.gz bcm5719-llvm-e231efaee500269201c38920c310c15bd51e1b5d.zip |
llgs: add logging to Native*Protocol breakpoints around byte values replaced and restored.
Useful for verifying what bytes a software breakpoint clobbers/restores.
llvm-svn: 219318
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Host/common/SoftwareBreakpoint.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Host/common/SoftwareBreakpoint.cpp b/lldb/source/Host/common/SoftwareBreakpoint.cpp index fe2f504ebc7..d9d1fa67156 100644 --- a/lldb/source/Host/common/SoftwareBreakpoint.cpp +++ b/lldb/source/Host/common/SoftwareBreakpoint.cpp @@ -119,6 +119,16 @@ SoftwareBreakpoint::EnableSoftwareBreakpoint (NativeProcessProtocol &process, ll return Error ("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); } + // Log what we read. + if (log) + { + 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)); + } + } + // 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); @@ -207,7 +217,7 @@ SoftwareBreakpoint::DoDisable () if (m_opcode_size > 0) { - // Clear a software breakoint instruction + // Clear a software breakpoint instruction uint8_t curr_break_op [MAX_TRAP_OPCODE_SIZE]; bool break_op_found = false; assert (m_opcode_size <= sizeof (curr_break_op)); @@ -265,7 +275,14 @@ SoftwareBreakpoint::DoDisable () { // SUCCESS if (log) + { + 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 " -- SUCCESS", __FUNCTION__, m_addr); + } return error; } else |