summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dae52e7)
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
#include <stdint.h>
#include <stdlib.h>
#include <dwarf.h>
#include <stdint.h>
#include <stdlib.h>
#include <dwarf.h>
*
* @param die bt_dwarf_die instance
* @param addr The memory address to verify
*
* @param die bt_dwarf_die instance
* @param addr The memory address to verify
- * @param contains Out parameter, 1 if addr is contained,
- * 0 if not
+ * @param contains Out parameter, true if addr is contained,
+ * false if not
* @returns 0 on succes, -1 on failure
*/
BT_HIDDEN
int bt_dwarf_die_contains_addr(struct bt_dwarf_die *die, uint64_t addr,
* @returns 0 on succes, -1 on failure
*/
BT_HIDDEN
int bt_dwarf_die_contains_addr(struct bt_dwarf_die *die, uint64_t addr,
#endif /* _BABELTRACE_DWARF_H */
#endif /* _BABELTRACE_DWARF_H */
int bin_info_lookup_cu_function_name(struct bt_dwarf_cu *cu, uint64_t addr,
char **func_name)
{
int bin_info_lookup_cu_function_name(struct bt_dwarf_cu *cu, uint64_t addr,
char **func_name)
{
- int ret = 0, found = 0;
+ int ret = 0;
+ bool found = false;
struct bt_dwarf_die *die = NULL;
if (!cu || !func_name) {
struct bt_dwarf_die *die = NULL;
if (!cu || !func_name) {
* subroutines are inlined within this function and would contain
* `addr`.
*
* subroutines are inlined within this function and would contain
* `addr`.
*
+ * On success, the out parameter `contains` is set with the boolean
+ * value indicating whether the DIE's range covers `addr`. On failure,
+ * it remains unchanged.
+ *
* Do note that this function advances the position of `die`. If the
* address is found within one of its children, `die` will be pointing
* to that child upon returning from the function, allowing to extract
* the information deemed necessary.
*
* Do note that this function advances the position of `die`. If the
* address is found within one of its children, `die` will be pointing
* to that child upon returning from the function, allowing to extract
* the information deemed necessary.
*
- * @param die The parent DIE in whose children the address will be
- * looked for
- * @param addr The address for which to look for in the DIEs
- * @returns Returns 1 if the address was found, 0 if not
+ * @param die The parent DIE in whose children the address will be
+ * looked for
+ * @param addr The address for which to look for in the DIEs
+ * @param contains Out parameter, true if addr is contained,
+ * false if not
+ * @returns Returns 0 on success, -1 on failure
-int bin_info_child_die_has_address(struct bt_dwarf_die *die, uint64_t addr)
+int bin_info_child_die_has_address(struct bt_dwarf_die *die, uint64_t addr, bool *contains)
- int ret = 0, contains = 0;
+ int ret = 0;
+ bool _contains = false;
}
if (tag == DW_TAG_inlined_subroutine) {
}
if (tag == DW_TAG_inlined_subroutine) {
- ret = bt_dwarf_die_contains_addr(die, addr, &contains);
+ ret = bt_dwarf_die_contains_addr(die, addr, &_contains);
if (ret) {
goto error;
}
if (contains) {
if (ret) {
goto error;
}
if (contains) {
goto end;
}
}
} while (bt_dwarf_die_next(die) == 0);
end:
goto end;
}
}
} while (bt_dwarf_die_next(die) == 0);
end:
+ *contains = _contains;
+ return 0;
int bin_info_lookup_cu_src_loc_inl(struct bt_dwarf_cu *cu, uint64_t addr,
struct source_location **src_loc)
{
int bin_info_lookup_cu_src_loc_inl(struct bt_dwarf_cu *cu, uint64_t addr,
struct source_location **src_loc)
{
- int ret = 0, found = 0;
+ int ret = 0;
+ bool found = false;
struct bt_dwarf_die *die = NULL;
struct source_location *_src_loc = NULL;
struct bt_dwarf_die *die = NULL;
struct source_location *_src_loc = NULL;
}
if (tag == DW_TAG_subprogram) {
}
if (tag == DW_TAG_subprogram) {
ret = bt_dwarf_die_contains_addr(die, addr, &contains);
if (ret) {
ret = bt_dwarf_die_contains_addr(die, addr, &contains);
if (ret) {
* Try to find an inlined subroutine
* child of this DIE containing addr.
*/
* Try to find an inlined subroutine
* child of this DIE containing addr.
*/
- found = bin_info_child_die_has_address(
- die, addr);
+ ret = bin_info_child_die_has_address(die, addr,
+ &found);
+ if(ret) {
+ goto error;
+ }
+
BT_HIDDEN
int bt_dwarf_die_contains_addr(struct bt_dwarf_die *die, uint64_t addr,
BT_HIDDEN
int bt_dwarf_die_contains_addr(struct bt_dwarf_die *die, uint64_t addr,
+ *contains = (ret == 1);