Skip to content

Commit

Permalink
Attempt to print stacktrace to figure out what the exception is
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Sep 1, 2024
1 parent 1fb92b5 commit fd01c3f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
# using clang or gcc

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -rdynamic")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
# debugging
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
Expand Down
26 changes: 21 additions & 5 deletions test/src/pdf2htmlEX_wrapper_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,28 @@ TEST_P(pdf2htmlEXWrapperTests, html) {
password = "sample-user-password";
}

Html html = odr::internal::html::pdf2htmlEX_wrapper(
test_file.path, output_path, config, password);
try {
Html html = odr::internal::html::pdf2htmlEX_wrapper(
test_file.path, output_path, config, password);

for (const HtmlPage &html_page : html.pages()) {
EXPECT_TRUE(fs::is_regular_file(html_page.path));
EXPECT_LT(0, fs::file_size(html_page.path));
for (const HtmlPage &html_page : html.pages()) {
EXPECT_TRUE(fs::is_regular_file(html_page.path));
EXPECT_LT(0, fs::file_size(html_page.path));
}
} catch (const std::exception & e) {
std::cerr << e.what() << std::endl << std::flush;

void *array[10];
int size = backtrace(array, 10);
char ** symbols = backtrace_symbols(array, size);
for (int i = 0; i < size; i++) {
std::cerr << symbols[i] << std::endl;
}
free(symbols);
std::cerr << std::flush;
sleep(2);

throw e;
}
}

Expand Down

0 comments on commit fd01c3f

Please sign in to comment.