|
@@ -331,26 +331,32 @@ int dso__data_fd(struct dso *dso, struct machine *machine)
|
|
};
|
|
};
|
|
int i = 0;
|
|
int i = 0;
|
|
|
|
|
|
|
|
+ if (dso->data.status == DSO_DATA_STATUS_ERROR)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
if (dso->data.fd >= 0)
|
|
if (dso->data.fd >= 0)
|
|
- return dso->data.fd;
|
|
|
|
|
|
+ goto out;
|
|
|
|
|
|
if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) {
|
|
if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) {
|
|
dso->data.fd = open_dso(dso, machine);
|
|
dso->data.fd = open_dso(dso, machine);
|
|
- return dso->data.fd;
|
|
|
|
|
|
+ goto out;
|
|
}
|
|
}
|
|
|
|
|
|
do {
|
|
do {
|
|
- int fd;
|
|
|
|
-
|
|
|
|
dso->binary_type = binary_type_data[i++];
|
|
dso->binary_type = binary_type_data[i++];
|
|
|
|
|
|
- fd = open_dso(dso, machine);
|
|
|
|
- if (fd >= 0)
|
|
|
|
- return dso->data.fd = fd;
|
|
|
|
|
|
+ dso->data.fd = open_dso(dso, machine);
|
|
|
|
+ if (dso->data.fd >= 0)
|
|
|
|
+ goto out;
|
|
|
|
|
|
} while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND);
|
|
} while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND);
|
|
|
|
+out:
|
|
|
|
+ if (dso->data.fd >= 0)
|
|
|
|
+ dso->data.status = DSO_DATA_STATUS_OK;
|
|
|
|
+ else
|
|
|
|
+ dso->data.status = DSO_DATA_STATUS_ERROR;
|
|
|
|
|
|
- return -EINVAL;
|
|
|
|
|
|
+ return dso->data.fd;
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -701,6 +707,7 @@ struct dso *dso__new(const char *name)
|
|
dso->symbols[i] = dso->symbol_names[i] = RB_ROOT;
|
|
dso->symbols[i] = dso->symbol_names[i] = RB_ROOT;
|
|
dso->data.cache = RB_ROOT;
|
|
dso->data.cache = RB_ROOT;
|
|
dso->data.fd = -1;
|
|
dso->data.fd = -1;
|
|
|
|
+ dso->data.status = DSO_DATA_STATUS_UNKNOWN;
|
|
dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
|
|
dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
|
|
dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND;
|
|
dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND;
|
|
dso->is_64_bit = (sizeof(void *) == 8);
|
|
dso->is_64_bit = (sizeof(void *) == 8);
|