def test_dwarfng_error_misc_elfs_cpp_test_o(self):
     test_file = 'misc_elfs/cpp-test.o'
     test_loc = self.get_test_loc(test_file)
     emsg1 = 'File format is ambiguous'
     try:
         list(dwarfng.get_dwarf_cu_and_die_paths(test_loc))
     except Exception as e:
         assert emsg1 in str(e)
 def test_dwarfng_error_shash_x86_64(self):
     test_file = 'dwarf/shash.x86_64'
     test_loc = self.get_test_loc(test_file)
     emsg1 = 'File format is ambiguous'
     try:
         list(dwarfng.get_dwarf_cu_and_die_paths(test_loc))
     except Exception as e:
         assert emsg1 in str(e)
    def check_dwarfng(self, test_file, expected_file, regen=False):
        test_loc = self.get_test_loc(test_file)
        result = [list(r) for r in dwarfng.get_dwarf_cu_and_die_paths(test_loc)]

        expected_loc = self.get_test_loc(expected_file, must_exist=False)

        if regen:
            with open(expected_loc, 'w') as exc:
                json.dump(result, exc, indent=2)

        with open(expected_loc) as exc:
            expected = json.load(exc)

        assert result == expected
 def test_dwarfng_empty_on_non_existing_file(self):
     test_file = 'dwarf/32.fsize.chgg_DOES_NOT_EXIST'
     assert list(dwarfng.get_dwarf_cu_and_die_paths(test_file)) == []
def dwarf_source_path_ng(location, **kwargs):
    """
    Collect unique paths to compiled source code found in Elf binaries DWARF
    sections for D2D.
    """
    return dwarfng.get_dwarf_cu_and_die_paths(location)