Skip to content
Snippets Groups Projects
Commit 3f8513cc authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

moved alll kinds of stuff in prep for open srcing.

Former-commit-id: 43b79ce8c5e7b8a3eea38fcc3a53255e7f614e61
parent 582a4c17
No related branches found
No related tags found
No related merge requests found
Showing
with 45 additions and 43 deletions
......@@ -21,10 +21,10 @@ if env.GetOption('clean'):
else:
# check/install targ-config.h
if not os.path.isfile(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/targ-config.h"):
#print "uname=", sysname, " xx ", nodename, " xx ", release, " xx ", version, " xx ", machine
shutil.copy( os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include",machine,"config.h"),
os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include","targ-config.h"))
#if not os.path.isfile(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/targ-config.h"):
##print "uname=", sysname, " xx ", nodename, " xx ", release, " xx ", version, " xx ", machine
#shutil.copy( os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include",machine,"config.h"),
#os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include","targ-config.h"))
os.chdir(os.environ['SECURITY_TRANSFORMS_HOME']+"/libcapstone")
print "Rebuilding libcapstone."
......@@ -40,9 +40,10 @@ else:
pedi = Command( target = "./testoutput",
source = "./SConscript",
action = os.environ['PEDI_HOME']+"/pedi -m manifest.txt " )
if "PEDI_HOME" in os.environ:
pedi = Command( target = "./testoutput",
source = "./SConscript",
action = os.environ['PEDI_HOME']+"/pedi -m manifest.txt " )
env['BASE_IRDB_LIBS']="IRDB-core", "pqxx", "pq", "EXEIO"
......@@ -50,7 +51,8 @@ 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",)
Depends(pedi,libPEBLISS)
if "PEDI_HOME" in os.environ:
Depends(pedi,libPEBLISS)
# pebliss requires iconv, which needs to be explicit on cygwin.
if "CYGWIN" in sysname:
......@@ -69,19 +71,29 @@ libtransform=SConscript("libtransform/SConscript", variant_dir='scons_build/libt
libEXEIO=SConscript("libEXEIO/SConscript", variant_dir='scons_build/libEXEIO')
#libbea=SConscript("beaengine/SConscript", variant_dir='scons_build/beaengine')
libMEDSannotation=SConscript("libMEDSannotation/SConscript", variant_dir='scons_build/libMEDSannotation')
libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
# libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
libIRDB=SConscript("libIRDB/SConscript", variant_dir='scons_build/libIRDB')
Depends(libIRDB,libcapstone)
libStructDiv=SConscript("libStructDiv/SConscript", variant_dir='scons_build/libStructDiv')
libElfDep=SConscript("libElfDep/SConscript", variant_dir='scons_build/libElfDep')
thanos=SConscript("thanos/SConscript", variant_dir='scons_build/thanos')
rida=SConscript("rida/SConscript", variant_dir='scons_build/rida')
meds2pdb=SConscript("meds2pdb/SConscript", variant_dir='scons_build/meds2pdb')
dump_map=SConscript("dump_map/SConscript", variant_dir='scons_build/dump_map')
dump_insns=SConscript("dump_insns/SConscript", variant_dir='scons_build/dump_insns')
Depends(pedi, (libehp,libtransform,libEXEIO,libMEDSannotation,libxform,libIRDB,libStructDiv,libElfDep, libcapstone))
tools=None
if 'build_tools' not in env or env['build_tools'] is None or int(env['build_tools']) == 1:
tools=SConscript("tools/SConscript", variant_dir='scons_build/tools')
Depends(pedi,tools)
if "PEDI_HOME" in os.environ:
Depends(pedi,tools)
Default( pedi )
if "PEDI_HOME" in os.environ:
Depends(pedi, (libehp,libtransform,libEXEIO,libMEDSannotation,libIRDB,libStructDiv,libElfDep, libcapstone, thanos, rida, meds2pdb, dump_map, dump_insns))
Default( pedi )
else:
Default(libehp,libtransform,libEXEIO,libMEDSannotation,libIRDB,libStructDiv,libElfDep, libcapstone, thanos, rida, meds2pdb, dump_map, dump_insns)
if 'build_tools' not in env or env['build_tools'] is None or int(env['build_tools']) == 1:
Default(tools)
......@@ -15,8 +15,9 @@ env.Replace(LINKFLAGS="-fPIC -fmax-errors=2 -Wall -Werror -fmax-errors=2 ")
# parse arguments
env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
env.Replace(PEDI_HOME=os.environ['PEDI_HOME'])
env.Replace(SMPSA_HOME=os.environ['SMPSA_HOME'])
if 'PEDI_HOME' in os.environ:
env.Replace(PEDI_HOME=os.environ['PEDI_HOME'])
#env.Replace(SMPSA_HOME=os.environ['SMPSA_HOME'])
env.Replace(do_64bit_build=ARGUMENTS.get("do_64bit_build",None))
env.Replace(debug=ARGUMENTS.get("debug",0))
env.Replace(build_appfw=ARGUMENTS.get("build_appfw", 0))
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
......@@ -44,7 +44,6 @@ class Instruction_t; // forward decl for many classes
#include <core/baseobj.hpp>
#include <core/reloc.hpp>
#include <core/address.hpp>
// xxx #include <core/instructioncfg.hpp>
#include <core/icfs.hpp>
#include <core/instruction.hpp>
#include <core/file.hpp>
......
......@@ -46,10 +46,6 @@ if 'build_tools' not in myenv or myenv['build_tools'] is None or int(myenv['buil
# most programs go to $sectrans/bin
pgms='''clone
generate_spri
find_strings
mark_functions_safe
decode_test
'''
for i in Split(pgms):
# print "Registering pgm: "+ i
......
......@@ -15,7 +15,7 @@ cpppath='''
$SECURITY_TRANSFORMS_HOME/libtransform/include
'''
files=Glob( Dir('.').srcnode().abspath+"/*.cpp")
files=Glob( Dir('.').srcnode().abspath+"/*.cpp") + Glob(Dir('.').srcnode().abspath+"/*.c")
pgm="meds2pdb"
......
File moved
......@@ -34,7 +34,7 @@ typedef struct aspri_address aspri_address_t;
struct aspri_address
{
char *library_name;
app_iaddr_t offset;
libIRDB::virtual_offset_t offset;
bool isCurrentPC;
};
......
......@@ -28,7 +28,7 @@
*/
#include "all.h"
#include "meds_all.h"
/*
......@@ -40,13 +40,13 @@ bitvector_t * allocate_bitvector(int num_fields, int num_data_chunks)
/* round number of bits up to 8 then convert to bytes */
int num_bytes_to_allocate=(((num_fields*num_data_chunks) + 7) &~7)/8;
bitvector_t * the_bitvector = spri_allocate_type(sizeof(bitvector_t));
bitvector_t * the_bitvector = (bitvector_t*)spri_allocate_type(sizeof(bitvector_t));
/* allocate the_bits
* the number of bits needed is num_fields * num_data_chunks
* rounded to nearest 8 (num bits in a char)
* to get bytes, need to divide by 8 bits
*/
the_bitvector->the_bits = spri_allocate_type(num_bytes_to_allocate*sizeof(char));
the_bitvector->the_bits = (char*)spri_allocate_type(num_bytes_to_allocate*sizeof(char));
the_bitvector->size = num_fields*num_data_chunks;
the_bitvector->num_bytes = num_bytes_to_allocate;
......@@ -57,7 +57,7 @@ bitvector_t * allocate_bitvector(int num_fields, int num_data_chunks)
void free_bitvector(bitvector_t *the_bitvector_to_be_freed)
{
#ifndef NDEBUG
STRATA_LOG("profile_fields_allocate","bitvector address: 0x%x size: %d\n", the_bitvector_to_be_freed, the_bitvector_to_be_freed->size);
// STRATA_LOG("profile_fields_allocate","bitvector address: 0x%x size: %d\n", the_bitvector_to_be_freed, the_bitvector_to_be_freed->size);
#endif
/* first free the_bits vector */
spri_deallocate_type((void *)the_bitvector_to_be_freed->the_bits, ((the_bitvector_to_be_freed->size+7)&~7)/8);
......
File moved
......@@ -21,7 +21,7 @@
*
*/
#include "all.h"
#include "meds_all.h"
Hashtable *constants_hash=NULL;
......@@ -48,7 +48,7 @@ long constants_key_compare(void* key1, void* key2)
}
constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type)
constant_hash_value_t * add_constant_ref(libIRDB::virtual_offset_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type)
{
constant_hash_key_t *chk=(constant_hash_key_t*)spri_allocate_type(sizeof(constant_hash_key_t ));
constant_hash_value_t *chv=(constant_hash_value_t*)spri_allocate_type(sizeof(constant_hash_value_t ));
......@@ -60,10 +60,11 @@ constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_
chv->type=the_type;
Hashtable_put(constants_hash, chk, chv);
return chv;
}
constant_hash_value_t * get_constant_ref(app_iaddr_t pc, int the_const, constant_hash_field_t the_field)
constant_hash_value_t * get_constant_ref(libIRDB::virtual_offset_t pc, int the_const, constant_hash_field_t the_field)
{
constant_hash_key_t chk={pc, the_const, the_field};
constant_hash_value_t *chv=(constant_hash_value_t*)Hashtable_get(constants_hash, &chk);
......
......@@ -33,7 +33,7 @@ typedef enum constant_hash_field constant_hash_field_t;
extern Hashtable *constants_hash;
struct constant_hash_key
{
app_iaddr_t pc;
libIRDB::virtual_offset_t pc;
int the_const;
constant_hash_field_t field;
};
......@@ -49,9 +49,9 @@ long constants_compute_hash(void* key1);
long constants_key_compare(void* key1, void* key2);
constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type);
constant_hash_value_t * add_constant_ref(libIRDB::virtual_offset_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type);
constant_hash_value_t * get_constant_ref(app_iaddr_t pc, int the_const, constant_hash_field_t the_field);
constant_hash_value_t * get_constant_ref(libIRDB::virtual_offset_t pc, int the_const, constant_hash_field_t the_field);
const char* constant_hash_type_to_string(constant_hash_type_t type);
......
......@@ -20,15 +20,8 @@
#include <iostream>
#include <string.h>
#include "targ-config.h"
#include <stdio.h>
/*
#include "elfio/elfio.hpp"
#include "elfio/elfio_dump.hpp"
*/
#include <libIRDB-core.hpp>
#include "elfreader.h"
using namespace std;
......@@ -86,7 +79,7 @@ ElfReader::~ElfReader()
/*
* Read <p_numBytes> from ELF file for location <p_pc>
*/
string ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes) const
string ElfReader::read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes) const
{
for ( int i = 0; i < m_reader->sections.size(); ++i )
{
......@@ -109,7 +102,7 @@ string ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes) const
* No bounds checking is done on <p_buf>
* Return false if address not in valid sections
*/
bool ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes, char* p_buf) const
bool ElfReader::read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes, char* p_buf) const
{
for ( int i = 0; i < m_reader->sections.size(); ++i )
{
......@@ -130,7 +123,7 @@ bool ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes, char* p_buf) const
/*
* Return buffer for instruction off the ELF file
*/
const char* ElfReader::getInstructionBuffer(app_iaddr_t p_pc) const
const char* ElfReader::getInstructionBuffer(libIRDB::virtual_offset_t p_pc) const
{
for ( int i = 0; i < m_reader->sections.size(); ++i )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment