Esempio n. 1
0
int map__load(struct map *map, symbol_filter_t filter)
{
	const char *name = map->dso->long_name;
	int nr;

	if (dso__loaded(map->dso, map->type))
		return 0;

	nr = dso__load(map->dso, map, filter);
	if (nr < 0) {
		if (map->dso->has_build_id) {
			char sbuild_id[BUILD_ID_SIZE * 2 + 1];

			build_id__sprintf(map->dso->build_id,
					  sizeof(map->dso->build_id),
					  sbuild_id);
			pr_warning("%s with build id %s not found",
				   name, sbuild_id);
		} else
			pr_warning("Failed to open %s", name);

		pr_warning(", continuing without symbols\n");
		return -1;
	} else if (nr == 0) {
#ifdef LIBELF_SUPPORT
		const size_t len = strlen(name);
		const size_t real_len = len - sizeof(DSO__DELETED);

		if (len > sizeof(DSO__DELETED) &&
		    strcmp(name + real_len + 1, DSO__DELETED) == 0) {
			pr_warning("%.*s was updated (is prelink enabled?). "
				"Restart the long running apps that use it!\n",
				   (int)real_len, name);
		} else {
			pr_warning("no symbols found in %s, maybe install "
				   "a debug package?\n", name);
		}
#endif
		return -1;
	}
	/*
	 * Only applies to the kernel, as its symtabs aren't relative like the
	 * module ones.
	 */
	if (map->dso->kernel)
		map__reloc_vmlinux(map);

	return 0;
}
Esempio n. 2
0
int map__load(struct map *self, symbol_filter_t filter)
{
	const char *name = self->dso->long_name;
	int nr;

	if (dso__loaded(self->dso, self->type))
		return 0;

	nr = dso__load(self->dso, self, filter);
	if (nr < 0) {
		if (self->dso->has_build_id) {
			char sbuild_id[BUILD_ID_SIZE * 2 + 1];

			build_id__sprintf(self->dso->build_id,
					  sizeof(self->dso->build_id),
					  sbuild_id);
			pr_warning("%s with build id %s not found",
				   name, sbuild_id);
		} else
			pr_warning("Failed to open %s", name);

		pr_warning(", continuing without symbols\n");
		return -1;
	} else if (nr == 0) {
		const size_t len = strlen(name);
		const size_t real_len = len - sizeof(DSO__DELETED);

		if (len > sizeof(DSO__DELETED) &&
		    strcmp(name + real_len + 1, DSO__DELETED) == 0) {
			pr_warning("%.*s was updated (is prelink enabled?). "
				"Restart the long running apps that use it!\n",
				   (int)real_len, name);
		} else {
			pr_warning("no symbols found in %s, maybe install "
				   "a debug package?\n", name);
		}

		return -1;
	}
	if (self->dso->kernel)
		map__reloc_vmlinux(self);

	return 0;
}
Esempio n. 3
0
struct symbol *map__find_symbol(struct map *self, u64 addr,
				symbol_filter_t filter)
{
	if (!dso__loaded(self->dso, self->type)) {
		int nr = dso__load(self->dso, self, filter);

		if (nr < 0) {
			if (self->dso->has_build_id) {
				char sbuild_id[BUILD_ID_SIZE * 2 + 1];

				build_id__sprintf(self->dso->build_id,
						  sizeof(self->dso->build_id),
						  sbuild_id);
				pr_warning("%s with build id %s not found",
					   self->dso->long_name, sbuild_id);
			} else
				pr_warning("Failed to open %s",
					   self->dso->long_name);
			pr_warning(", continuing without symbols\n");
			return NULL;
		} else if (nr == 0) {
			const char *name = self->dso->long_name;
			const size_t len = strlen(name);
			const size_t real_len = len - sizeof(DSO__DELETED);

			if (len > sizeof(DSO__DELETED) &&
			    strcmp(name + real_len + 1, DSO__DELETED) == 0) {
				pr_warning("%.*s was updated, restart the long running apps that use it!\n",
					   (int)real_len, name);
			} else {
				pr_warning("no symbols found in %s, maybe install a debug package?\n", name);
			}
			return NULL;
		}
	}

	return self->dso->find_symbol(self->dso, self->type, addr);
}