Skip to content

Large file/low memory mode #586

@sevaa

Description

@sevaa

Won't be the first time users are calling for a low memory mode for handling DWARF in extra large binaries. See also: #540, #576, #479; #481 for a slurp alternative.

I think the low memory mode should be explicitly opt in - I don't like to impose size thresholds on other people, let the library consumers do it. The large-file flag will be off by default, would go as an optional parameter into ELFFile.get_dwarf_info() and into the DWARFInfo() constructor, and will be kept there for all the parsing logic to see.

Eliminating the mandatory caching of CUs and DIEs would be rather trivial (but might break some API, or make them crazily slow - I'll have to try and see). But we still have the problem of slurping whole sections into memory. We kind of discussed it in #557, and settled that memory mapping is the way to go, however, how would you prefer to deal with transforms? If there is compression and/or relocation in DWARF sections, would you rather:

  • throw an exception that the binary is not compatible with the low memory mode
  • do the transforms anyway, even if it will eat a bunch of memory
  • let the user choose by either:
    • introducing another optional, false by default boolean flag
    • making the large-file flag a three way one (True|False|None or an enum)

Also, how would you like to test the large-file mode?

OBTW, any reason why _read_dwarf_section() writes the section data (a bytes) into BytesIO rather than constructing the BytesIO around the data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions