gimli: (gimli::write::ConvertError)InvalidAttributeValue while gimli::write::Dwarf::from() conversion
I am using Dwarf::from() to convert a readable Dwarf instance to a writable one using convert_address() function as follows:-
fn convert_address(addr: u64) -> Option<gimli::write::Address> {
Some(gimli::write::Address::Constant(addr))
}
let mut write_dwarf = match gimli::write::Dwarf::from(&dwarf, &convert_address) {
Ok(write_dwarf) => write_dwarf,
Err(error) => panic!("Error while Dwarf::from() : {:?}", error),
};
And I’m getting an InvalidAttributeValue error on the Dwarf::from line. As mentioned in Dwarf::from()'s documentation,
convert_address is a function to convert read addresses into the Address type. For non-relocatable addresses, this function may simply return Address::Constant(address). For relocatable addresses, it is the caller’s responsibility to determine the symbol and addend corresponding to the address and return Address::Symbol { symbol, addend }.
I’m simply returning Address::Constant(addr) in convert_address function. Could someone please clarify the changes to be done for relocatable addresses in convert_address function? (Is convert_address the cause for this error?)
Thanks
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 24 (13 by maintainers)
Hi @jjang3, I think you can use this option to disable it. “-gno-variable-location-views” (as mentioned on the page below) https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
It’s the
DW_AT_GNU_locviewsattribute, which we don’t support converting or writing yet.Correct,
objectdoesn’t support writing executables, only reading them.I updated
rewriteto handle currentgimliandobjectversions, but I wasn’t able to reproduce theInvalidAttributeValueerror when running it onsumofn-O0.o. So it may just be that you’re not handling relocations yet.gimliwon’t handle relocations if you’re only using itsReaderimplementations. You need to provide your own. SeeReaderRelocateinrewrite. But note that doesn’t work for relocations in.eh_frame(I’ve filed #484).