Пример #1
0
int main(int argc, char **argv) {
	const char *path;
	gel_file_t *file;
	int opt;
	gel_sym_iter_t iter;
	gel_sym_t *sym;

	/* Check arguments */
	opterr = 1;
	while((opt = getopt(argc, argv, "h")) != EOF)
		switch(opt) {
		case 'h':
			help();
		default:
			assert(0);
		}
	if(optind >= argc)
		help();
	path = argv[optind];

	/* open the file */
	file = gel_open(path, "", 0);
	if(file == NULL) {
    	fprintf(stderr, "ERROR: %s\n", gel_strerror());
    	return 2;
  	}

	/* display header */
	printf("st_value st_size  binding type    st_shndx         name\n");

	/* iterate on symboles */
	for(sym = gel_sym_first(&iter, file); sym; sym = gel_sym_next(&iter)) {

		/* get information */
		gel_sym_info_t infos;
		gel_sym_infos(sym, &infos);
		if(strcmp(infos.name, "") == 0)
			continue;

		/* display information */
		printf("%08x %8x %-7s %-7s %-16s %s\n",
			infos.vaddr,
			infos.size,
			get_binding(&infos),
			get_type(&infos),
			get_section_index(file, &infos),
			infos.name);
	}

	/* cleanup */
	gel_close(file);
	return 0;
}
Пример #2
0
inline size_t SlabAlloc::get_lower_section_boundary(size_t start_pos) const noexcept
{
    return get_section_base(get_section_index(start_pos));
}