summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
233b228)
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>
* @param cu bt_dwarf_cu instance in which to look for the address
* @param addr The address for which to look for
* @param src_loc Out parameter, the source location (filename and
* @param cu bt_dwarf_cu instance in which to look for the address
* @param addr The address for which to look for
* @param src_loc Out parameter, the source location (filename and
- * line number) for the address
+ * line number) for the address. Set only if the address
+ * is found and resolved successfully
+ *
* @returns 0 on success, -1 on failure
*/
static
* @returns 0 on success, -1 on failure
*/
static
line = dwarf_getsrc_die(die->dwarf_die, addr);
if (!line) {
line = dwarf_getsrc_die(die->dwarf_die, addr);
if (!line) {
+ /* This is not an error. The caller needs to keep looking. */
+ goto end;
}
ret = dwarf_lineaddr(line, &line_addr);
}
ret = dwarf_lineaddr(line, &line_addr);