Fix: flt.lttng-utils.debug-info: cannot find addr past the first CU
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 28 May 2019 00:45:06 +0000 (20:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 29 May 2019 20:53:02 +0000 (16:53 -0400)
commitdbde36fba9e566745beeceea0b923b928e0ceae3
treedb34ad6ee53f3fd3da00ccd61b44ed62b4f981c1
parenta9d1c305b4f3e6991cd17e6b67e7e23071c41bdb
Fix: flt.lttng-utils.debug-info: cannot find addr past the first CU

Issue
=====
The `bin_info_lookup_source_location()` function doesn't look past the
first Compile Unit(CU) in the Dwarf information to find the filename and
line number of an address. This function iterates over all CUs of the
binary (or shared object) and tries to translate the address with each
of them. It ends up calling two other functions:
`bin_info_lookup_cu_src_loc_no_inl()`and `bin_info_lookup_cu_src_loc_inl()`
in a loop to cover all the CUs.

The `bin_info_lookup_cu_src_loc_no_inl()` function returns an error
(returning -1) if it can't find the line of the give address making the
calling function exit the loop, and thus abort the resolving.

The information that the resolving was unsuccessful is transmit back to
the caller by omitting to set the `src_loc` output parameter. The return
value of this function is used to notify the caller of an error. Not
resolving the source line should not make the function return -1.

This has the effect that if an address is contained in a CU after the
first one this function will not be able to resolve it.

Solution
========
Return 0 if the line is not found so that the search continues with
other CUs.

Drawbacks
=========
None.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I4d85bc75d32a9a25a7044f3686c6d5940311fa68
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1337
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/lttng-utils/debug-info/bin-info.c
This page took 0.025477 seconds and 4 git commands to generate.