diff options
| -rw-r--r-- | fix.m4 | 3 | ||||
| -rw-r--r-- | helpers.cc | 8 | ||||
| -rw-r--r-- | helpers.hh | 5 | ||||
| -rw-r--r-- | trace-call.cc | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/fix.m4 b/fix.m4 index 356db4a..02553cd 100644 --- a/fix.m4 +++ b/fix.m4 @@ -60,6 +60,7 @@ do grep -F "$binary" | sed 's/^ #\([0-9]\+ 0x[0-9a-f]\+\).*$/\1/' done | sort -n | uniq > "$wd/stack-trace" +test -s "$wd/stack-trace" (grep '^0 0x[0-9a-f]\+$' "$wd/stack-trace" | sed 's/^0 0x0*//' || true) > "$wd/call-trace" @@ -68,6 +69,7 @@ done | sort -n | uniq > "$wd/stack-trace" grep -v '^0 0x[0-9a-f]\+$' "$wd/stack-trace" | sed 's/^[0-9]\+ 0x0*//' | taosc-trace-call "$binary" >> "$wd/call-trace" +test -s "$wd/call-trace" rm -f "$wd/patch-location" pushd DATA_DIR 1>/dev/null @@ -147,4 +149,5 @@ find "$wd/values/malicious" -mindepth 1 -type d -name '*.d' | mv "$d/@@" "$wd/values/top/$(basename "$d" .d).@@" done taosc-synth $stack_size "$wd"/values/{bottom,top} > "$wd/predicates" +test -s "$wd/predicates" # vim: filetype=sh.m4 diff --git a/helpers.cc b/helpers.cc index 7bb1215..0aa2fe9 100644 --- a/helpers.cc +++ b/helpers.cc @@ -45,9 +45,15 @@ parse_args (int argc, char const* const* argv) } void -die_for (Address address, std::string const& message) +warn (Address address, std::string const& message) { std::cerr << message << ' ' << std::hex << address << '\n'; +} + +[[noreturn]] void +die_for (Address address, std::string const& message) +{ + warn (address, message); std::exit (1); } diff --git a/helpers.hh b/helpers.hh index 9843418..9805af7 100644 --- a/helpers.hh +++ b/helpers.hh @@ -29,7 +29,10 @@ /// otherwise print usage and exit char const* parse_args (int, char const* const*); -/// Print the message about the given address +/// Print the message about the given address to stderr +void warn (Dyninst::Address, std::string const&); + +/// Print the message about the given address to stderr /// then terminate the program with exit code 1 void die_for (Dyninst::Address, std::string const&); diff --git a/trace-call.cc b/trace-call.cc index 9d22599..2b374cc 100644 --- a/trace-call.cc +++ b/trace-call.cc @@ -67,7 +67,7 @@ main (int argc, char** argv) std::cout << std::hex << call_address << '\n'; } if (call_address == 0) - die_for (return_address, "no call found for return address"); + warn (return_address, "no call found for return address"); } if (std::cin.eof ()) return 0; |
