Exemple #1
0
int main(int argc, char* argv[]) {


	bfd *obj, *objout;
	bfd_init();
	unsigned int h;


	if (argc != 2) {

		printf("not enough arguments!\n");
	}


	else {

		// printf("%s\n", argv[1]);


		obj = bfd_openr(argv[1], "elf64-x86-64");

		if (!obj) {

			bfd_perror("open failure\n");
		}

		if (!bfd_check_format(obj, bfd_object)) {

			printf("format error!\n");

		}

		else {


			// findSections passes findSectionData to map_over_sections
			findSections(obj, findSectionData);

		}

	}

	return 0;


}
Exemple #2
0
valid::Result File::validate() const {
    valid::Result result;
    // now get all entities from the file: use the multi-getter for each type of entity
    // (the multi-getters use size_t-getter which in the end use H5Lget_name_by_idx
    // to get each file objects name - the count is determined by H5::Group::getNumObjs
    // so that in the end really all file objects are retrieved)

    // Blocks
    auto blcks = blocks();
    for (auto &block : blcks) {
        result.concat(valid::validate(block));
        // DataArrays
        auto data_arrays = block.dataArrays();
        for (auto &data_array : data_arrays) {
            result.concat(valid::validate(data_array));
            // Dimensions
            auto dims = data_array.dimensions();
            for (auto &dim : dims) {
                if (dim.dimensionType() == DimensionType::Range) {
                    auto d = dim.asRangeDimension();
                    result.concat(valid::validate(d));
                }
                if (dim.dimensionType() == DimensionType::Set) {
                    auto d = dim.asSetDimension();
                    result.concat(valid::validate(d));
                }
                if (dim.dimensionType() == DimensionType::Sample) {
                    auto d = dim.asSampledDimension();
                    result.concat(valid::validate(d));
                }
            }
        }
        // MultiTags
        auto multi_tags = block.multiTags();
        for (auto &multi_tag : multi_tags) {
            result.concat(valid::validate(multi_tag));
            // Features
            auto features = multi_tag.features();
            for (auto &feature : features) {
                result.concat(valid::validate(feature));
            }
        }
        // Tags
        auto tags = block.tags();
        for (auto &tag : tags) {
            result.concat(valid::validate(tag));
            // Features
            auto features = tag.features();
            for (auto &feature : features) {
                result.concat(valid::validate(feature));
            }
        }
        // Sources
        auto sources = block.findSources();
        for (auto &source : sources) {
            result.concat(valid::validate(source));
        }
    }
    // Sections
    auto sections = findSections();
    for (auto &section : sections) {
        result.concat(valid::validate(section));
        // Properties
        auto props = section.properties();
        for (auto &prop : props) {
            result.concat(valid::validate(prop));
        }
    }

    return result;
}