Defns have to do:
int
internal_function
foo (...)
i386 build will break with internal_function decls but not defns.
s/dwarf_readhooks.c/libdw_relocate.c/
A dwarf_*.c name is for a file implementing a function of that name.
All the calls seem to use a size == 8 expression for the bool argument.
Just make it an offset/address size argument that is 4/8.
s/addr/off/ in dwarf_formref_die, dwarf_getpubnames
+ Dwarf_Addr escape = addr64 ? (Elf64_Addr)-1 : (Elf64_Addr)(Elf32_Addr)-1;
Write a libdwP.h macro for this (taking address_size rather than bool).
It will be used again in dwarf_ranges.
s/Dwarf_Word/Dwarf_Off/ for offset-flavored parameters.
s/Dwarf_Word/Dwarf_Addr/ for address-flavored parameters.
I don't think the names are too long. Let's use "address" and
"offset".
If it makes the decoder code nicer, define macros or static inlines
"read_address" and "read_offset" (+"_inc") wrappers for
convenience.
(You might want to do that for the _inc flavors anyway, so the arithmetic
inlines away.)
Make read_offset also take an IDX_* argument for the referring section.
If it's a macro, you can make the args short and use IDX_debug_##arg.
+ if (*offset >= data->d_size
+ || *offset + addr64 ? 8 : 4 >= data->d_size)
Use:
|| data->d_size - offset_size < *offset)
Don't call the addr function in the off function. Even as soon as the test
code, they will be disjoint code paths. (A common local inline that has
the size-check if clause and zero extension is fine of course.)
Use const pointers everywhere.
Two of these:
+ return -1l;
Neither of those functions return long int. Use plain -1.
Thanks,
Roland