Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the MacOS remote unwinder for VS4Mac #63405

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/coreclr/debug/dbgutil/machoreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ MachOModule::ReadLoadCommands()
m_segments.push_back(segment);

// Calculate the load bias for the module. This is the value to add to the vmaddr of a
// segment to get the actual address. For shared modules, this is 0 since those segments
// are absolute address.
if (segment->fileoff == 0 && segment->filesize > 0)
// segment to get the actual address.
if (strcmp(segment->segname, SEG_TEXT) == 0)
mikem8361 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any guarantee that the first segment is the text segment, and that there's only one ever (the spec seems to imply that there is always at least one, but nothing about there being multiple or the ordering)? Otherwise we may get here more than once or have a wrong offset.

Also, what happens with the bias of data segments? Granted, this was already never considered if the first segment was always text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is only __TEXT segment and it always seems to be the first one.

{
m_loadBias = m_baseAddress - segment->vmaddr;
}
Expand Down