Skip to content

Commit 3c4fd6f

Browse files
subbrammaniangodlygeek
authored andcommitted
Add error message for core file load failures
Signed-off-by: Subbrammanian Nochur Ganeswaran <subbrammanian@gmail.com>
1 parent 0d04545 commit 3c4fd6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pystack/_pystack/elf_common.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#include <cassert>
2+
#include <cerrno>
23
#include <cstring>
34
#include <inttypes.h>
45
#include <iomanip>
56
#include <iostream>
7+
#include <string>
68
#include <utility>
79

810
#include "compat.h"
@@ -72,7 +74,8 @@ CoreFileAnalyzer::CoreFileAnalyzer(
7274

7375
d_fd = open(d_filename.c_str(), O_RDONLY);
7476
if (d_fd == -1) {
75-
throw ElfAnalyzerError("Failed to open ELF file " + d_filename);
77+
throw ElfAnalyzerError(
78+
"Failed to open ELF file '" + d_filename + "' (" + std::strerror(errno) + ")");
7679
}
7780

7881
d_elf = elf_unique_ptr(elf_begin(d_fd, ELF_C_READ_MMAP, nullptr), elf_end);

0 commit comments

Comments
 (0)