citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 0df2a8ecf99675b271b7d19813be3d79c590e214
parent 176db5bc269d1a0803c38c8b0f253cab1b5b86c7
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 12 Jan 2017 23:30:55 -0700

use a prefix.h file instead of messing around with #defines

Diffstat:
MJamfile | 3+--
Mconfigure | 16+++++++++++++++-
Minst_frontend.cc | 14+++++++-------
Dwrap.sh | 5-----
4 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/Jamfile b/Jamfile @@ -13,14 +13,13 @@ if $(NT) { } # -# citrun_wrap, citrun_check +# citrun_check # if $(NT) { File citrun_wrap.bat : wrap.bat ; Clean clean : citrun_wrap.bat ; } else { - Shell citrun_wrap : wrap.sh ; Shell citrun_check : check.sh ; } diff --git a/configure b/configure @@ -54,7 +54,21 @@ CLANG_LIBS="-lclangAST -lclangAnalysis -lclangBasic -lclangDriver \ LLVM_LIBS="bitreader mcparser transformutils option" -# Write top of Jamrules. Any errors inside backticks get ignored. +# Write prefix.h +cat <<EOF > prefix.h +static const char *prefix = R"(${PREFIX-`pwd`})"; +EOF + +# Write citrun_wrap +cat <<EOF > citrun_wrap +#!/bin/sh + +export PATH="${PREFIX-`pwd`}/compilers:\$PATH" +exec \$@ +EOF +chmod +x citrun_wrap + +# Write Jamrules. Any errors inside backticks get ignored. cat <<EOF > Jamrules CC = ${CC-cc} ; C++ = ${CXX-c++} ; diff --git a/inst_frontend.cc b/inst_frontend.cc @@ -16,6 +16,7 @@ #include "inst_action.h" // InstrumentActionFactory #include "inst_frontend.h" #include "lib.h" // citrun_major, citrun_minor +#include "prefix.h" // prefix #include <sys/stat.h> // stat @@ -72,16 +73,15 @@ InstFrontend::InstFrontend(int argc, char *argv[], bool is_citrun_inst) : { log_identity(); - const char *citrun_path = std::getenv("CITRUN_PATH"); + m_compilers_path = prefix ; + m_lib_path = prefix ; - m_compilers_path = citrun_path ? citrun_path : "" ; - m_compilers_path.append("compilers"); - - m_lib_path = citrun_path ? citrun_path : "" ; #ifdef _WIN32 - m_lib_path.append("libcitrun.lib"); + m_compilers_path.append("\\compilers"); + m_lib_path.append("\\libcitrun.lib"); #else - m_lib_path.append("libcitrun.a"); + m_compilers_path.append("/compilers"); + m_lib_path.append("/libcitrun.a"); #endif // _WIN32 m_log << "Compilers path = '" << m_compilers_path << "'" << std::endl; diff --git a/wrap.sh b/wrap.sh @@ -1,5 +0,0 @@ - -dirname=`dirname $0` -export CITRUN_PATH="`cd $dirname && pwd`/" -export PATH="${CITRUN_PATH}compilers:$PATH" -exec $@