Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • opensrc/zipr
  • whh8b/zipr
2 results
Show changes
Commits on Source (2)
......@@ -45,12 +45,11 @@ if "PEDI_HOME" in os.environ:
source = "./SConscript",
action = os.environ['PEDI_HOME']+"/pedi -m manifest.txt " )
env['BASE_IRDB_LIBS']="irdb-core", "pqxx", "pq"
env['BASE_IRDB_LIBS']="irdb-core"
if sysname != "SunOS":
libPEBLISS=SConscript("pebliss/trunk/pe_lib/SConscript", variant_dir='scons_build/libPEBLISS')
# setup libraries needed for linking
env['BASE_IRDB_LIBS']=env['BASE_IRDB_LIBS']+("pebliss",)
if "PEDI_HOME" in os.environ:
Depends(pedi,libPEBLISS)
......
......@@ -5,24 +5,25 @@ import os
Import('env')
myenv=env.Clone()
myenv.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
myenv.Replace(IRDB_SDK=os.environ['IRDB_SDK'])
cpppath='''
$IRDB_SDK/include
'''
myenv.Append(CPPFLAGS="-std=c++11")
files=Glob( Dir('.').srcnode().abspath+"/*.cpp")
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split( " irdb-core irdb-cfg irdb-util irdb-transform ")
myenv=myenv.Clone(CPPPATH=Split(cpppath))
dm=myenv.Program("dump_map.exe", Split("dump_map.cpp"), LIBPATH=LIBPATH, LIBS=LIBS)
dm_install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install/", "dump_map.exe")
myenv.Append(CPPFLAGS="-std=c++11")
dehp=myenv.Program("dump_ehp.exe", Split("dump_ehp.cpp"), LIBPATH=LIBPATH, LIBS=LIBS)
dehp_install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install/", "dump_ehp.exe")
all=list() + dm_install + dehp_install
pgm="dump_map.exe"
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split( env.subst('$BASE_IRDB_LIBS')+ " irdb-cfg irdb-util irdb-transform ")
myenv=myenv.Clone(CPPPATH=Split(cpppath))
pgm=myenv.Program(pgm, files, LIBPATH=LIBPATH, LIBS=LIBS)
#install=myenv.Install("$SECURITY_TRANSFORMS_HOME/bin/", pgm)
install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install/", pgm)
Default(install)
Return('install')
Default(all)
Return('all')
......@@ -2,6 +2,8 @@
env=Environment()
env.Append(LINKFLAGS=" -Wl,-unresolved-symbols=ignore-in-shared-libs -L../lib")
Export('env')
install=SConscript("SConscript")
Return('install')
/*
* Copyright (c) 2014, 2015 - University of Virginia
*
* This file may be used and modified for non-commercial purposes as long as
* all copyright, permission, and nonwarranty notices are preserved.
* Redistribution is prohibited without prior written consent from the University
* of Virginia.
*
* Please contact the authors for restrictions applying to commercial use.
*
* THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Author: University of Virginia
* e-mail: jwd@virginia.com
* URL : http://www.cs.virginia.edu/
*
*/
#include <stdlib.h>
#include <fstream>
#include <irdb-core>
#include <libgen.h>
#include <iomanip>
#include <algorithm>
using namespace std;
using namespace IRDB_SDK;
void usage(char* name)
{
cerr<<"Usage: "<<name<<" <variant_id>\n";
}
int main(int argc, char **argv)
{
if(argc != 2)
{
usage(argv[0]);
exit(1);
}
auto programName=string(argv[0]);
auto variantID = atoi(argv[1]);
/* setup the interface to the sql server */
auto pqxx_interface=pqxxDB_t::factory();
BaseObj_t::setInterface(pqxx_interface.get());
auto pidp=VariantID_t::factory(variantID);
assert(pidp->isRegistered()==true);
auto one_success = false;
auto this_file = pidp->getMainFile();
try
{
auto firp = FileIR_t::factory(pidp.get(), this_file);
cout<<"file: "<<this_file->getURL()<<endl;
cout<<setw(9)<<"ID"<<" "
<<setw(10)<<"Addr."<<" "
<<setw(30)<<left << "Comment"<<" "
<<setw(9)<<right<<"EhpID"<<" "
<<setw(15)<<"FDE prog sz"<<endl;
assert(firp && pidp);
auto total_fde_instructions = (size_t)0;
for(auto insn : firp->getInstructions())
{
cout<<hex<<setw(9)<<insn->getBaseID()<<" "<<hex<<setw(10)<<insn->getAddress()->getVirtualOffset();
cout<<" "<<setw(30)<<left << insn->getComment() << right;
const auto ehp=insn->getEhProgram();
if(ehp==nullptr)
{
cout<<"No EHP";
}
else
{
auto ehpID=ehp->getBaseID();
cout<<setw(9)<<hex<<ehpID<<" ";
auto fdeprog_size=ehp->getFDEProgram().size();
cout<<setw(15)<<hex<<fdeprog_size<<" ";
total_fde_instructions+=fdeprog_size;
}
cout<<endl;
}
cout<<"Total FDE Program instructions " << dec << total_fde_instructions << endl;
}
catch (DatabaseError_t pnide)
{
cerr << programName << ": Unexpected database error: " << pnide << "file url: " << this_file->getURL() << endl;
}
catch (...)
{
cerr << programName << ": Unexpected error file url: " << this_file->getURL() << endl;
}
// if any integer transforms for any files succeeded, we commit
if (one_success)
{
cout<<"Commiting changes...\n";
pqxx_interface->commit();
}
return 0;
}
......@@ -19,7 +19,7 @@ if 'build_tools' not in myenv or myenv['build_tools'] is None or int(myenv['buil
'''
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split( 'irdb-cfg irdb-util ' + env.subst('$BASE_IRDB_LIBS')+ " ehp irdb-transform MEDSannotation EXEIO")
LIBS=Split( 'irdb-cfg irdb-util pqxx ' + env.subst('$BASE_IRDB_LIBS')+ " ehp irdb-transform MEDSannotation EXEIO")
myenv=myenv.Clone(CPPPATH=Split(cpppath))
......
......@@ -296,7 +296,7 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
auto build_ir_insn=[&](Instruction_t* insn) -> void
{
const auto find_addr=insn->getAddress()->getVirtualOffset();
static auto fie_ptr=shared_ptr<FDEContents_t>();
static auto fie_ptr=(const FDEContents_t*)nullptr;
static auto cie_instructions=shared_ptr<EHProgramInstructionVector_t>();
static auto fde_instructions=shared_ptr<EHProgramInstructionVector_t>();
......@@ -336,7 +336,8 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
{
auto out_pgm=vector<shared_ptr<EHProgramInstruction_t> >();
auto cur_addr=fde_addr;
const auto in_pgm_instructions=*in_pgm_instructions_ptr;
const auto &in_pgm_instructions=*in_pgm_instructions_ptr;
auto last_was_def_cfa_offset = false;
for(const auto & insn_ptr : in_pgm_instructions)
{
const auto & insn=*insn_ptr;
......@@ -370,7 +371,17 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
}
else
{
out_pgm.push_back(insn_ptr);
const auto this_is_def_cfa_offset=insn.isDefCFAOffset();
if(last_was_def_cfa_offset && this_is_def_cfa_offset)
{
out_pgm.pop_back();
out_pgm.push_back(insn_ptr);
}
else
{
out_pgm.push_back(insn_ptr);
}
last_was_def_cfa_offset=this_is_def_cfa_offset;
}
}
......@@ -463,7 +474,7 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
}
// build the IR from the FDE.
fde_contents_build_ir(*fie_ptr.get(), insn);
fde_contents_build_ir(*fie_ptr, insn);
}
else
{
......@@ -504,6 +515,17 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
};
#endif
/*
for(auto f : firp->getFunctions())
{
for(Instruction_t* i : f->getInstructions())
{
build_ir_insn(i);
}
eh_program_cache.clear(); // this can get big, so we erase it between functions. there's minimal re-use between functions anyhow
}
*/
for(Instruction_t* i : firp->getInstructions())
{
build_ir_insn(i);
......@@ -529,7 +551,7 @@ template <int ptrsize>
Instruction_t* split_eh_frame_impl_t<ptrsize>::find_lp(Instruction_t* i) const
{
const auto find_addr=i->getAddress()->getVirtualOffset();
const auto fde_ptr=eh_frame_parser->findFDE(find_addr);
auto fde_ptr=eh_frame_parser->findFDE(find_addr);
if(fde_ptr==nullptr)
return nullptr;
......
Subproject commit cda036f54b68d2eb1bfd0c0d636dad954433a3b7
Subproject commit 30ad94f8eb2f18f7c5d9ca61a05d55213100bdc8
......@@ -21,7 +21,7 @@ pgm="meds2pdb"
myenv.Append(CXXFLAGS = " -std=c++11 ")
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split(" irdb-cfg irdb-util irdb-transform EXEIO MEDSannotation "+env.subst('$BASE_IRDB_LIBS'))
LIBS=Split(" irdb-cfg irdb-util irdb-transform EXEIO MEDSannotation pqxx "+env.subst('$BASE_IRDB_LIBS'))
myenv=myenv.Clone(CPPPATH=Split(cpppath))
pgm=myenv.Program(pgm, files, LIBPATH=LIBPATH, LIBS=LIBS)
install1=myenv.Install("$SECURITY_TRANSFORMS_HOME/bin/", pgm)
......
......@@ -19,7 +19,7 @@ myenv.Append(CXXFLAGS = " -std=c++11 -Wall ")
pgm="thanos.exe"
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split( env.subst('$BASE_IRDB_LIBS')+ " irdb-transform dl")
LIBS=Split( env.subst('$BASE_IRDB_LIBS')+ " irdb-transform dl pqxx pq")
myenv=myenv.Clone(CPPPATH=Split(cpppath))
pgm=myenv.Program(pgm, files, LIBPATH=LIBPATH, LIBS=LIBS)
install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install", pgm)
......