[llvm-dev] yaml2obj support for COFF debug directories
James Henderson via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 4 01:25:12 PST 2020
I'm not sure I know enough about COFF and debug directories to know how
useful this feature will be, but I do have some thoughts on the syntax,
based on my experience working with the ELF part of yaml2obj. From reading
the spec you linked, I would think it might look something like the
following:
DebugDirectory:
- Characteristics: 1234 # Optional, defaults to 0. Contains value to
write in Characteristics field.
TimeDateStamp: 4321 # Optional, defaults to 0(?).
MajorVersion: 1 # Optional, defaults to 0.
MinorVersion: 2 # Optional, defaults to 0.
Data: # Required
- Type: 12 # Required, contains the value of the Type field, can be
written as raw number or enum value (see how ELF works for various fields).
Size: 1111 # Optional, derives size from data field, if not specified.
Address: 2222 # Optional, defaults to 0(?)
Pointer: 3333 # Optional, defaults to wherever yaml2obj chooses to
place the data.
RawData: '12345678abcdef0' # Optional byte string (see 'Content'
fields for ELF sections). Defaults to empty if not specified.
## The following fields are all defined based on the Type value (for
unrecognised values, by default only RawData is allowed). Cannot be mixed
with RawData field. Only those actually required need to be implemented up
front.
ExtendedDLLCharacteristics: # Used for
IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS
- ... # Fields related to DLL Characteristics
FPOInfo: # Used for IMAGE_DEBUG_TYPE_FP
- ...
- ... # FPO Information array
...
Does this make sense? It's somewhat similar to how Sections are defined in
ELF yaml2obj.
James
On Wed, 4 Mar 2020 at 03:10, Penzin, Petr <petr.penzin at intel.com> wrote:
> *Spoiler:* the following only applies to Windows binary format handling.
>
> Potential for extending yaml2obj to support COFF debug directories
> <https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#debug-directory-image-only>
> recently came up during a code review
> <https://reviews.llvm.org/D70606#1873185>. Currently, its COFF syntax
> <http://llvm.org/docs/yaml2obj.html#coff-syntax> allows for specifying
> section data, but not debug directories, that's why llvm-readobj tests
> which depend on debug directory contents use pre-built executable images
> instead of yaml2obj.
>
> It is possible to extend the tool, but first I would be interested in
> gathering feedback on usability of this, especially on potential uses of
> this change. It looks like porting llvm-readobj tests for codeview would
> depend on this and also D70606 <https://reviews.llvm.org/D70606> is
> introducing another possible use. But I am not sure how trivial would the
> codeview effort, would it be worth it or is it easier to leave things as
> they are for now?
>
> In case this is interesting, base Yaml syntax for COFF debug directory may
> look like this (enum values representing COFF Debug Types
> <https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#debug-type>
> ):
>
> DebugDirectory:
> - Type: [ {type: str, enum: [...]}, {type: int} ]
> - DebugDirectoryData: {type: str}
>
> This may have to be further specialized for sub-categories, specifically
> codeview.
>
>
>
> Best,
>
> Petr
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200304/53de98a3/attachment.html>
More information about the llvm-dev
mailing list