On Mon, Apr 1, 2024 at 9:08 AM Martin Rodriguez Reboredo
<yakoyoku@xxxxxxxxx> wrote:
[...]
Awesome sauce! Namhyung was just mentioning the idea to do this to me.
I wonder when this lands we can just work to remove all of the
BUILD_NONDISTRO options, namely libbfd, libiberty, etc. I suspect we
have dead/broken code hiding there.
[...]
What does SYMBOLIZER mean in this context? Shouldn't the code be gated
on say a HAVE_LIBDW?
[...]
Perhaps libdw_a2l_data to avoid confusion with data used for forked
addr2line. Could you comment the variables? Names like "input" are
fairly generic so you could provide an example of what their values
are. It is also useful to comment when something like a string is
owned by the struct, so that cleaning it up can be checked.
+ const char *input;
+ Dwarf_Addr addr;
+ Dwarf_Addr bias;
+
+ bool found;
+ const char *filename;
+ const char *funcname;
+ int line;
Moving "found" and "line" later will avoid padding. As this data is
attached to a DSO, does there need to be some kind of locking protocol
for >1 symbolizing the same DSO? Perhaps these should be filled in as
out arguments to avoid this kind of complexity.
Also, there is some DSO clean up happening in:
https://lore.kernel.org/lkml/CAM9d7chqnsDBCVFoK2hSs=22QrXBS=13Px5hGA4hM=ho7CZd2g@xxxxxxxxxxxxxx/
where accessor functions are used for the sake of reference count checking:
https://perf.wiki.kernel.org/index.php/Reference_Count_Checking
which may cause some minor conflicts with this patch.
[...]
+ Dwarf_Die subroutine;
+ Dwarf_Off dieoff = dwarf_dieoffset(&scopes[0]);
+ dwarf_offdie(dwfl_module_getdwarf(a2l->mod, &bias), dieoff,
+ &subroutine);
+ free(scopes);
+ scopes = NULL;
Is this dead code?
+
+ nscopes = dwarf_getscopes_die(&subroutine, &scopes);
+ if (nscopes > 1) {
Similar early return comment to above to avoid indentation.
Thanks,
Ian
[...]