dwarf-aux.c (527c465a3c8716d93201ae34b7fc52679610596d) dwarf-aux.c (75186a9b09e47072f442f43e292cd47180b67b5c)
1/*
2 * dwarf-aux.c : libdw auxiliary interfaces
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 720 unchanged lines hidden (view full) ---

729 * Note that this walks not only dwarf line list, but also function entries
730 * and inline call-site.
731 */
732int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)
733{
734 Dwarf_Lines *lines;
735 Dwarf_Line *line;
736 Dwarf_Addr addr;
1/*
2 * dwarf-aux.c : libdw auxiliary interfaces
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 720 unchanged lines hidden (view full) ---

729 * Note that this walks not only dwarf line list, but also function entries
730 * and inline call-site.
731 */
732int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)
733{
734 Dwarf_Lines *lines;
735 Dwarf_Line *line;
736 Dwarf_Addr addr;
737 const char *fname;
737 const char *fname, *decf = NULL;
738 int lineno, ret = 0;
738 int lineno, ret = 0;
739 int decl = 0, inl;
739 Dwarf_Die die_mem, *cu_die;
740 size_t nlines, i;
741
742 /* Get the CU die */
740 Dwarf_Die die_mem, *cu_die;
741 size_t nlines, i;
742
743 /* Get the CU die */
743 if (dwarf_tag(rt_die) != DW_TAG_compile_unit)
744 if (dwarf_tag(rt_die) != DW_TAG_compile_unit) {
744 cu_die = dwarf_diecu(rt_die, &die_mem, NULL, NULL);
745 cu_die = dwarf_diecu(rt_die, &die_mem, NULL, NULL);
745 else
746 dwarf_decl_line(rt_die, &decl);
747 decf = dwarf_decl_file(rt_die);
748 } else
746 cu_die = rt_die;
747 if (!cu_die) {
748 pr_debug2("Failed to get CU from given DIE.\n");
749 return -EINVAL;
750 }
751
752 /* Get lines list in the CU */
753 if (dwarf_getsrclines(cu_die, &lines, &nlines) != 0) {

--- 14 unchanged lines hidden (view full) ---

768 }
769 /* Filter lines based on address */
770 if (rt_die != cu_die)
771 /*
772 * Address filtering
773 * The line is included in given function, and
774 * no inline block includes it.
775 */
749 cu_die = rt_die;
750 if (!cu_die) {
751 pr_debug2("Failed to get CU from given DIE.\n");
752 return -EINVAL;
753 }
754
755 /* Get lines list in the CU */
756 if (dwarf_getsrclines(cu_die, &lines, &nlines) != 0) {

--- 14 unchanged lines hidden (view full) ---

771 }
772 /* Filter lines based on address */
773 if (rt_die != cu_die)
774 /*
775 * Address filtering
776 * The line is included in given function, and
777 * no inline block includes it.
778 */
776 if (!dwarf_haspc(rt_die, addr) ||
777 die_find_inlinefunc(rt_die, addr, &die_mem))
779 if (!dwarf_haspc(rt_die, addr))
778 continue;
780 continue;
781 if (die_find_inlinefunc(rt_die, addr, &die_mem)) {
782 dwarf_decl_line(&die_mem, &inl);
783 if (inl != decl ||
784 decf != dwarf_decl_file(&die_mem))
785 continue;
786 }
779 /* Get source line */
780 fname = dwarf_linesrc(line, NULL, NULL);
781
782 ret = callback(fname, lineno, addr, data);
783 if (ret != 0)
784 return ret;
785 }
786

--- 287 unchanged lines hidden ---
787 /* Get source line */
788 fname = dwarf_linesrc(line, NULL, NULL);
789
790 ret = callback(fname, lineno, addr, data);
791 if (ret != 0)
792 return ret;
793 }
794

--- 287 unchanged lines hidden ---