From 574750681c50da771a382a07c52c01785bf5ae70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Tue, 16 Jul 2019 11:18:16 +0200 Subject: [PATCH] Handle binaries without unwinding data --- src/FactoredSwitchCompiler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FactoredSwitchCompiler.cpp b/src/FactoredSwitchCompiler.cpp index ed8f484..9fd66cc 100644 --- a/src/FactoredSwitchCompiler.cpp +++ b/src/FactoredSwitchCompiler.cpp @@ -2,6 +2,7 @@ #include #include +#include using namespace std; FactoredSwitchCompiler::FactoredSwitchCompiler(int indent): @@ -12,6 +13,13 @@ FactoredSwitchCompiler::FactoredSwitchCompiler(int indent): void FactoredSwitchCompiler::to_stream( std::ostream& os, const SwitchStatement& sw) { + if(sw.cases.empty()) { + std::cerr << "WARNING: empty unwinding data!\n"; + os + << indent_str("/* WARNING: empty unwinding data! */\n") + << indent_str(sw.default_case) << "\n"; + return; + } JumpPointMap jump_points; gen_binsearch_tree(os, jump_points, sw.switch_var,