diff --git a/include/ehp.hpp b/include/ehp.hpp index 5b45e410f780e804a4cc53459d53ddd5a29fd895..827ce8221aa5c74dc7c4a53d2c3d93147b20afcb 100644 --- a/include/ehp.hpp +++ b/include/ehp.hpp @@ -5,6 +5,7 @@ #include <map> #include <memory> #include <set> +#include <vector> namespace EHP @@ -19,7 +20,7 @@ class EHProgramInstruction_t EHProgramInstruction_t() {} EHProgramInstruction_t(const EHProgramInstruction_t&) {} public: - virtual ~EHProgramInstruction_t() =0; + virtual ~EHProgramInstruction_t() {} virtual void print(uint64_t &pc, int64_t caf=1) const=0; virtual bool isNop() const =0; virtual bool isRestoreState() const =0; diff --git a/test/.SConscript.swp b/test/.SConscript.swp new file mode 100644 index 0000000000000000000000000000000000000000..eef29b8ac294ec8ad6a66478367019c3786f5abb Binary files /dev/null and b/test/.SConscript.swp differ diff --git a/test/SConscript b/test/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..4473aa96f20ac809ce7c6c2eade5c6359e81660f --- /dev/null +++ b/test/SConscript @@ -0,0 +1,28 @@ +import os + + + +Import('env') +myenv=env.Clone() + +files="test.cpp" + +cpppath=''' + ../include + ''' + +LIBPATH=''' + ../lib + ''' + +LIBS=''' + ehp + ''' +myenv=myenv.Clone(CPPPATH=Split(cpppath)) +myenv.Append(CXXFLAGS = " -std=c++11 -Wall -Werror -fmax-errors=1 -g ") + +lib=myenv.Program("test.exe", Split(files), LIBPATH=Split(LIBPATH), LIBS=Split(LIBS)) +install=myenv.Install("../lib/", lib) +Default(install) + +Return('install') diff --git a/test/SConstruct b/test/SConstruct new file mode 100644 index 0000000000000000000000000000000000000000..b5b7b78c5f88640c7e8877a9df76dc9191af7498 --- /dev/null +++ b/test/SConstruct @@ -0,0 +1,8 @@ + + + +env=Environment() +Export('env') +lib=SConscript("SConscript") + +Return('lib') diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c23a3cb79e395f9a840e9f6af328c5865df1bde2 --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,28 @@ + + +#include <ehp.hpp> +#include <iostream> + +using namespace std; +using namespace EHP; + +void usage(int argc, char* argv[]) +{ + cout<<"Usage: "<<argv[0]<<" <program to print eh info>"<<endl; + exit(1); +} + + +int main(int argc, char* argv[]) +{ + + if(argc!=2) + { + usage(argc,argv); + } + + auto ehp = EHFrameParser_t::factory(argv[1]); + ehp->print(); + + return 0; +} diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..b64713caef7a2886f75461148e7731494b23703c --- /dev/null +++ b/test/test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +cleanup() +{ + echo "Test failed" + exit 1 +} + +scons || cleanup +./test.exe ./test.exe || cleanup +./test.exe /bin/ls || cleanup +./test.exe /bin/bash || cleanup + +echo "test passed" +exit 0