gimli-rs / gimli

A library for reading and writing the DWARF debugging format

Home Page:https://docs.rs/gimli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use locations() function in gimli::read::LocationLists with object files using DWARF4

vaibspider opened this issue · comments

Hi,
I am trying to read location lists from the .debug_loc section in object files having debugging information in DWARF4.
While using the locations() function from gimli::read::LocationLists (https://docs.rs/gimli/0.18.0/gimli/read/struct.LocationLists.html#method.locations), I noticed that it takes debug_addr and debug_addr_base parameters, as follows.

pub fn locations(
    &self,
    offset: LocationListsOffset<R::Offset>,
    unit_encoding: Encoding,
    base_address: u64,
    debug_addr: &DebugAddr<R>,
    debug_addr_base: DebugAddrBase<R::Offset>
) -> Result<LocListIter<R>>

But, these parameters correspond to the .debug_addr section, which was added in DWARF5.
So, I am not able to use this function to read the location lists for an object file that uses DWARF4.
Could you please suggest something?
Thanks!

It doesn't matter what those parameters are in that case because there won't be any attributes that use them, so default them to empty/zero.

Ok, I see. Thanks! I have done that and it works.