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

Support EOF data in debug data entries. #583

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

DaZombieKiller
Copy link
Contributor

This pull request adds support for debug data entries located in EOF data, which are valid according to the PE spec:

Each debug directory entry identifies the location and size of a block of debug information. The specified RVA can be zero if the debug information is not covered by a section header (that is, it resides in the image file and is not mapped into the run-time address space). If it is mapped, the RVA is its address.

The file offset is also now preferred over the RVA when the file is not mapped.

@DaZombieKiller DaZombieKiller changed the base branch from master to development September 22, 2024 13:49
@Washi1337 Washi1337 added this to the 6.0.0 milestone Sep 23, 2024
@Washi1337 Washi1337 added bug pe Issues related to AsmResolver.PE labels Sep 23, 2024
@Washi1337
Copy link
Owner

Washi1337 commented Oct 7, 2024

Tests seem to fail because some debug data entries can have no contents (i.e., size == 0, and thus also pointer/address to raw data == 0, see HelloWorld.exe test binary).

We can't really return null for these entries or we lose the debug entry type. This is a downside of the current design on how debug data is modeled, as the entry type is currently only exposed by IDebugDataSegment to make it easier for end-users to add or swap out new debug data entries without having to specify the debug data type twice (i.e., the value of the DebugDataEntry::Contents implies the type of debug data).

Two options I see now:

  1. We reintroduce the Type property in DebugDataEntry, accepting that this is less ergonomic for end-users that want to add or modify debug data entries.
  2. We introduce an EmptyDebugDataSegment of sorts (or maybe reuse CustomDebugDataSegment), which is special cased for in the writer, allowing for empty debug entries to exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pe Issues related to AsmResolver.PE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants