Skip to content
Snippets Groups Projects
Commit 429dbefa authored by an7s's avatar an7s
Browse files

pin for coverage

Former-commit-id: 6dce16f254f86b430dd5a9dd93b6d5a5fcd7256a
parent cdbcad91
No related branches found
No related tags found
No related merge requests found
......@@ -389,6 +389,9 @@ tools/p1xform.pbed.deprecated.sh -text
tools/p1xform_v2.sh -text
tools/peasoup_link -text
tools/peasoup_link++ -text
tools/pin/LICENSE -text
tools/pin/itraceunique.cpp -text
tools/pin/pin -text
tools/ps_analyze.sh -text
tools/ps_comp++.sh -text
tools/ps_comp.sh -text
......
IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
Do not copy, install, or use the "Materials" provided under this
license agreement ("Agreement"), until you have carefully read the
following terms and conditions. By copying, installing, or otherwise
using the Materials, you agree to be bound by the terms of this
Agreement. If you do not agree to the terms of this Agreement, do not
copy, install, or use the Materials.
Pre-Release License Agreement for Pre-Release Software
1. PRE-RELEASE: The Materials are pre-release code, which may not be
fully functional and which Intel may substantially modify in producing
any final version. Intel can provide no assurance that it will ever
produce or make generally available a final version.
2. LICENSE DEFINITIONS:
A. "Materials" are defined as the software, documentation, license key
codes and other materials, including any updates and upgrade thereto,
for the applicable pre-release software (which may be found at
http://whatif.intel.com/), that are provided to you under this
Agreement.
3. LICENSE GRANT:
A. Subject to all of the terms and conditions of this Agreement, Intel
Corporation ("Intel") grants to you a non-exclusive, non-assignable
copyright license to make only the minimum number of copies of the
Materials reasonably necessary for your internal testing and
development of your products.
B. Subject to all of the terms and conditions of this Agreement, Intel
grants to you a non-exclusive, non-assignable copyright license to
modify the Materials that are provided in source code (human readable)
form.
C. If the Materials include the file named “redist.txt”, then subject to
all of the terms and conditions of this Agreement and any specific
restrictions which may appear in the “redist.txt” file, Intel grants to
you a non-exclusive, non-assignable copyright license to redistribute
the files (unmodified or modified by you) listed in the “redist.txt”
file only as part of the application you develop with the Materials.
4. LICENSE RESTRICTIONS:
A. You may not reverse-assemble, reverse-compile, or otherwise reverse-engineer any software provided solely in binary form.
B. You may not distribute any portion of Materials, whether in source or binary form, to any third party, except as specified in this Agreement.
5. COPYRIGHT: Title to the Materials and all copies thereof remain
with Intel or its suppliers. The Materials are copyrighted and are
protected by United States copyright laws and international treaty
provisions. You will not remove any copyright notice from the
Materials. You agree to prevent any unauthorized copying of the
Materials. Except as expressly provided herein, Intel does not grant
any express or implied right to you under Intel patents, copyrights,
trademarks, or trade secret information. Subject to Intel’s ownership
of the Materials, all right, title and interest in and to your
modifications shall belong to you.
6. REPLACEMENTS: The Materials are provided "AS IS" without warranty
of any kind. If the media on which the Materials are furnished are
found to be defective in material or workmanship under normal use for
a period of ninety (90) days from the date of receipt, Intel's entire
liability and your exclusive remedy shall be the replacement of the
media. This offer is void if the media defect results from accident,
abuse, or misapplication.
7. LIMITATION OF LIABILITY: THE ABOVE REPLACEMENT PROVISION IS THE
ONLY WARRANTY OF ANY KIND. INTEL OFFERS NO OTHER WARRANTY EITHER
EXPRESS OR IMPLIED INCLUDING THOSE OF MERCHANTABILITY, NONINFRINGEMENT
OF THIRD- PARTY INTELLECTUAL PROPERTY OR FITNESS FOR A PARTICULAR
PURPOSE. NEITHER INTEL NOR ITS SUPPLIERS SHALL BE LIABLE FOR ANY
DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
OR OTHER LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE
SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR
LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE
ABOVE LIMITATION MAY NOT APPLY TO YOU.
8. UNAUTHORIZED USE: THE MATERIALS ARE NOT DESIGNED, INTENDED, OR
AUTHORIZED FOR USE IN ANY TYPE OF SYSTEM OR APPLICATION IN WHICH THE
FAILURE OF THE MATERIALS COULD CREATE A SITUATION WHERE PERSONAL
INJURY OR DEATH MAY OCCUR (E.G MEDICAL SYSTEMS, LIFE SUSTAINING OR
LIFE SAVING SYSTEMS). Should the buyer purchase or use the Materials
for any such unintended or unauthorized use, the buyer shall indemnify
and hold Intel and its officers, subsidiaries and affiliates harmless
against all claims, costs, damages, and expenses, and reasonable
attorney fees arising out of, directly or indirectly, any claim of
product liability, personal injury or death associated with such
unintended or unauthorized use, even if such claim alleges that Intel
was negligent regarding the design or manufacture of the part.
9. USER SUBMISSIONS: You agree that any material, information or other
communication, including all data, images, sounds, text, and other
things embodied therein, you transmit or post to an Intel website or
provide to Intel under this Agreement will be considered
non-confidential ("Communications"). Intel will have no
confidentiality obligations with respect to the Communications. You
agree that Intel and its designees will be free to copy, modify,
create derivative works, publicly display, disclose, distribute,
license and sublicense through multiple tiers of distribution and
licensees, incorporate and otherwise use the Communications, including
derivative works thereto, for any and all commercial or non-commercial
purposes.
10. TERMINATION OF THIS LICENSE: The term of this Agreement will
commence on the date this Agreement is accepted by You and will
continue until terminated. This Agreement will terminate without
notice on the last day of the pre-release period, which is specified
elsewhere in the Materials, or upon the commercial release of the
Materials. Intel may terminate this Agreement at any time, with or
without cause, with written notice to you. Upon termination, you will
immediately destroy the Materials or return all copies of the
Materials to Intel along with any copies you have made.
11. U.S. GOVERNMENT RESTRICTED RIGHTS: The Materials are provided with
"RESTRICTED RIGHTS". Use, duplication or disclosure by the Government
is subject to restrictions set forth in FAR52.227-14 and
DFAR252.227-7013 et seq. or its successor. Use of the Materials by
the Government constitutes acknowledgment of Intel's rights in them.
12. EXPORT RESTRICTED RIGHTS: This software is subject to the U.S.
Export Administration Regulations and other U.S. law, and may not be
exported or re-exported to certain countries (Burma, Cuba, Iran, North
Korea, Sudan, and Syria) or to persons or entities prohibited from
receiving U.S. exports (including Denied Parties, Specially Designated
Nationals, and entities on the Bureau of Export Administration Entity
List or involved with missile technology or nuclear, chemical or
biological weapons).
13. APPLICABLE LAWS: Any claim arising under or relating to this
Agreement shall be governed by the internal substantive laws of the
State of Delaware or federal courts located in Delaware, without
regard to principles of conflict of laws. You may not export the
Materials in violation of applicable export laws.
* Other names and brands may be claimed as the property of others
/*BEGIN_LEGAL
Intel Open Source License
Copyright (c) 2002-2011 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of
the Intel Corporation nor the names of its contributors may be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
END_LEGAL */
#include <stdio.h>
#include <set>
#include "pin.H"
FILE * trace;
std::set<void *> instructions;
// This function is called before every instruction is executed
// and prints the IP
VOID printip(VOID *ip) {
if (instructions.count(ip) > 0)
return;
fprintf(trace, "printip %p\n", ip);
instructions.insert(ip);
}
// Pin calls this function every time a new instruction is encountered
VOID Instruction(INS ins, VOID *v)
{
// fprintf(trace, "0x%08x\n", INS_Address(ins));
// Insert a call to printip before every instruction, and pass it the IP
INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)printip, IARG_INST_PTR, IARG_END);
}
// This function is called when the application exits
VOID Fini(INT32 code, VOID *v)
{
fclose(trace);
}
/* ===================================================================== */
/* Print Help Message */
/* ===================================================================== */
INT32 Usage()
{
PIN_ERROR("This Pintool prints the IPs of every instruction executed\n"
+ KNOB_BASE::StringKnobSummary() + "\n");
return -1;
}
/* ===================================================================== */
/* Main */
/* ===================================================================== */
int main(int argc, char * argv[])
{
trace = fopen("itrace.out", "w");
// Initialize pin
if (PIN_Init(argc, argv)) return Usage();
// Register Instruction to be called to instrument instructions
INS_AddInstrumentFunction(Instruction, 0);
// Register Fini to be called when the application exits
PIN_AddFiniFunction(Fini, 0);
// Start the program, never returns
PIN_StartProgram();
return 0;
}
#! /bin/bash
# get the directory of this script
origin=$0
# If it does not begin with /, then it is relative to the current working directory
if [ "${origin:0:1}" != "/" ]; then
origin=$PWD/$origin
fi
origin=`dirname "$origin"`
# Libraries are found relative to origin
lib_base="$origin"
cpp_libs="$lib_base/ia32/runtime:$lib_base/intel64/runtime:$lib_base/ia64/runtime"
glibc_libs="$lib_base/ia32/runtime/glibc:$lib_base/intel64/runtime/glibc:$lib_base/ia64/runtime/glibc"
# vm/tool need cpp and glibc libs
export PIN_VM_LD_LIBRARY_PATH=$cpp_libs:$glibc_libs:$LD_LIBRARY_PATH
# If variables we are going to modify are set, save the value. They will be restored
# after the injector starts
export PIN_LD_RESTORE_REQUIRED=t
if [ -n "${LD_LIBRARY_PATH+x}" ]
then
export PIN_APP_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
fi
if [ -n "${LD_ASSUME_KERNEL+x}" ]
then
export PIN_APP_LD_ASSUME_KERNEL=$LD_ASSUME_KERNEL
fi
unset LD_ASSUME_KERNEL
if [ -n "${LD_BIND_NOW+x}" ]
then
export PIN_APP_LD_BIND_NOW=$LD_BIND_NOW
fi
if [ -n "${LD_PRELOAD+x}" ]
then
export PIN_APP_LD_PRELOAD=$LD_PRELOAD
fi
unset LD_PRELOAD
# injector just needs cpp libs, it cannot use glibc lib
export LD_LIBRARY_PATH=$cpp_libs:$LD_LIBRARY_PATH
machine=`uname -m`
if [ $machine == "ia64" ]
then
exec "$origin"/ia64/bin/pinbin "${@}"
else
exec "$origin"/ia32/bin/pinbin -p64 "$origin"/intel64/bin/pinbin "${@}"
fi
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