citrun

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

commit 4c131a4c65a6d240b97e1495856e77e76bc90625
parent 183530dd89da3c1f28eca5c8226eb7302edd1a5e
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 16 Jun 2016 19:22:25 -0600

src: don't use CITRUN_LIB env var anymore

- we know where the library will be at citrun compile time, so add it to the
  binary directly

Diffstat:
MTest/Project.pm | 1-
Mbin/citrun-wrap.sh | 1-
Msrc/citrun-inst.1 | 11++++-------
Msrc/inst_main.cc | 9++-------
4 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/Test/Project.pm b/Test/Project.pm @@ -52,7 +52,6 @@ EOF # Use the tools in this source tree my $cwd = getcwd; $ENV{CITRUN_PATH} = "$cwd/share"; - $ENV{CITRUN_LIB} = "$cwd/lib/libcitrun.a"; $ENV{PATH} = "$ENV{CITRUN_PATH}:$ENV{PATH}"; my $ret = system( "cd $tmp_dir && jam" ); diff --git a/bin/citrun-wrap.sh b/bin/citrun-wrap.sh @@ -1,7 +1,6 @@ #!/bin/sh export CITRUN_PATH="%PREFIX%/share/citrun" -export CITRUN_LIB="%PREFIX%/lib/libcitrun.a" export PATH="$CITRUN_PATH:$PATH" exec $@ diff --git a/src/citrun-inst.1 b/src/citrun-inst.1 @@ -23,13 +23,10 @@ line. Source files are matched on suffix, one of: When instrumentation is successful modified source files are compiled with the native command line. .Pp -When application link commands are detected the value of -.Ev CITRUN_LIB -is appended to the command line. +When application link commands are detected extra arguments are added to the +command line for the runtime library libcitrun. .Sh ENVIRONMENT .Bl -tag -width Ds -.It Ev CITRUN_LIB -The arguments necessary to link to the runtime library on this platform. .It Ev CITRUN_PATH Directory of symlinks named after supported compiler binaries. .It Ev PATH @@ -38,8 +35,8 @@ Must contain .El .Sh FILES .Bl -tag -width Ds -.It Pa LAST_NODE -The runtime entry point is linked with the contents of this file. +.It Pa INSTRUMENTED +File containing the names of all instrumented object files. .El .Sh EXIT STATUS .Ex -std diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -196,14 +196,9 @@ patch_link_command(std::vector<char *> &args) args.push_back(const_cast<char *>("citrun_patch.c")); - char *lib_str; - if ((lib_str = getenv("CITRUN_LIB")) == NULL) - errx(1, "CITRUN_LIB not found in environment."); - - // Add the runtime library and the symbol define hack - // automatically to the command line + // libcitrun.a needs pthread but is static and doesn't include it itself args.push_back(const_cast<char *>("-pthread")); - args.push_back(lib_str); + args.push_back(const_cast<char *>(STR(CITRUN_LIB))); } int