diff --git a/core/processview.cpp b/core/processview.cpp index 54f9e0ea..3cd61afd 100644 --- a/core/processview.cpp +++ b/core/processview.cpp @@ -41,7 +41,13 @@ DebugProcessView::DebugProcessView(BinaryView* parent): // TODO: Read segments from debugger uint64_t length = PerformGetLength(); - AddAutoSegment(0, length, 0, length, SegmentReadable | SegmentWritable | SegmentExecutable); + // If we do not add any segments, BN will malfunction. If we add a binary view that is large, e.g., 0xffffffff, + // it will be truncated to the size of the parent view. And the region from 0x0 to the size of the parent view will + // be unreadable, because BN will try to read the byte values from the parent view, rather from the debug process + // view, which eventually reads from the debug adapter backend. So, as a workaround, we add a segment that has size + // 0x1, which minimizes the unreadable regions. + // See https://github.com/Vector35/debugger/issues/334 for more details. + AddAutoSegment(0, 1, 0, 1, SegmentReadable | SegmentWritable | SegmentExecutable); AddAutoSection("Memory", 0, length); m_controller = DebuggerController::GetController(parent);