Skip to content

Commit f675df7

Browse files
committed
checking for BreakpointResolver disassembly error
1 parent d2d55fa commit f675df7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lldb/source/Breakpoint/BreakpointResolver.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,22 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
367367

368368
BreakpointLocationSP BreakpointResolver::AddLocation(Address loc_addr,
369369
bool *new_location) {
370-
if (m_offset_is_insn_count && m_offset > 0) {
370+
if (m_offset_is_insn_count) {
371371
Target &target = GetBreakpoint()->GetTarget();
372372
const DisassemblerSP instructions =
373373
target.ReadInstructions(loc_addr, m_offset);
374+
if (!instructions ||
375+
instructions->GetInstructionList().GetSize() != m_offset) {
376+
Log *log = GetLog(LLDBLog::Breakpoints);
377+
LLDB_LOGF(log,
378+
"error: Unable to read %lu instructions at address 0x%" PRIx64
379+
"\n",
380+
m_offset, loc_addr.GetFileAddress());
381+
return BreakpointLocationSP();
382+
}
383+
374384
loc_addr.Slide(instructions->GetInstructionList().GetTotalByteSize());
375-
} else if (!m_offset_is_insn_count) {
385+
} else {
376386
loc_addr.Slide(m_offset);
377387
}
378388

0 commit comments

Comments
 (0)