- for (i = 0; i < e->used; i++) {
- DEBUG2("Looking for symbol %d, addr = '%s'", i, addrs[i]);
- fgets(line_func, 1024, pipe);
- line_func[strlen(line_func) - 1] = '\0';
- fgets(line_pos, 1024, pipe);
- line_pos[strlen(line_pos) - 1] = '\0';
+ for (std::size_t i = 0; i < e->bt.size(); i++) {
+ XBT_DEBUG("Looking for symbol %zd, addr = '%s'", i, addrs[i]);
+ if (fgets(line_func, 1024, pipe)) {
+ line_func[strlen(line_func) - 1] = '\0';
+ } else {
+ XBT_VERB("Cannot run fgets to look for symbol %zd, addr %s", i, addrs[i]);
+ strncpy(line_func, "???",3);
+ }
+ if (fgets(line_pos, 1024, pipe)) {
+ line_pos[strlen(line_pos) - 1] = '\0';
+ } else {
+ XBT_VERB("Cannot run fgets to look for symbol %zd, addr %s", i, addrs[i]);
+ strncpy(line_pos, backtrace_syms[i],1024);
+ }