Skip to content

Commit

Permalink
Workaround for parent view shadowing the bytes from the debugger bina…
Browse files Browse the repository at this point in the history
…ry view
  • Loading branch information
xusheng6 committed Dec 9, 2022
1 parent 7cad713 commit 1dc80bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/processview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1dc80bd

Please sign in to comment.