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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 28 May 2019 14:04:03 +0000 (10:04 -0400)
commit1ed6d0cc62643f0a6acfa13623339e18ae4daa79
treeb4083db3eeb20832182dfdb4ace01f93048b9464
parent233b228c8d1fefaa04e33730bc67d7c010a3d4dd
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.026348 seconds and 4 git commands to generate.