diff --git a/Makefile.am b/Makefile.am index fe7cdb6..68da99f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ pkginclude_HEADERS = verrou.h synchroLib/verrouSynchroLib.h PYTHON_REP=pyTools -bin_SCRIPTS = ${PYTHON_REP}/verrou_dd_line ${PYTHON_REP}/verrou_dd_sym ${PYTHON_REP}/genCovBB ${PYTHON_REP}/verrou_plot_stat ${PYTHON_REP}/paraview_script.py ${PYTHON_REP}/verrou_dd_synchro ${PYTHON_REP}/post_verrou_dd +bin_SCRIPTS = ${PYTHON_REP}/verrou_dd_line ${PYTHON_REP}/verrou_dd_sym ${PYTHON_REP}/genCovBB ${PYTHON_REP}/verrou_plot_stat ${PYTHON_REP}/paraview_script.py ${PYTHON_REP}/verrou_dd_synchro ${PYTHON_REP}/post_verrou_dd ${PYTHON_REP}/verrou_dd_stdout pkgpython_PYTHON = ${PYTHON_REP}/DD.py ${PYTHON_REP}/dd_config.py ${PYTHON_REP}/DD_stoch.py ${PYTHON_REP}/DD_exec_stat.py ${PYTHON_REP}/convNumLineTool.py ${PYTHON_REP}/post_config.py ${PYTHON_REP}/gen_config.py ${PYTHON_REP}/rounding_tool.py diff --git a/pyTools/DD_stoch.py b/pyTools/DD_stoch.py index e1cf10f..855de3f 100644 --- a/pyTools/DD_stoch.py +++ b/pyTools/DD_stoch.py @@ -316,7 +316,8 @@ def failure(): class DDStoch(DD.DD): def __init__(self, config, prefix, - selectBlocAndNumLine=lambda x: (x,0), joinBlocAndNumLine= lambda x,y: x ): + selectBlocAndNumLine=lambda x: (x,0), joinBlocAndNumLine= lambda x,y: x, + parseRef=None): DD.DD.__init__(self) self.config_=config if not self.config_.get_quiet(): @@ -333,7 +334,7 @@ def __init__(self, config, prefix, self.prepareCache() prepareOutput(self.ref_) self.reference() #generate the reference computation - self.mergeList() #generate the search space + self.mergeList(parseRef) #generate the search space self.rddminHeuristicLoadRep(selectBlocAndNumLine, joinBlocAndNumLine) # at the end because need the search space @@ -506,7 +507,7 @@ def reference(self): print("PASS") - def mergeList(self): + def mergeList(self, parseRef): """merge the file name.$PID into a uniq file called name """ dirname=self.ref_ name=self.getDeltaFileName() @@ -520,11 +521,17 @@ def mergeList(self): # for excludeFile in listOfExcludeFile[1:]: excludeMerged=[] for excludeFile in listOfExcludeFile: - with open(os.path.join(dirname,excludeFile), "r") as f: - for line in f.readlines(): - rsline=line.rstrip() - if rsline not in excludeMerged: - excludeMerged+=[rsline] + lines=None + if parseRef==None: + with open(os.path.join(dirname,excludeFile), "r") as f: + lines=[x.rstrip() for x in f.readlines()] + else: + lines=parseRef(os.path.join(dirname,excludeFile)) + + for line in lines: + if line not in excludeMerged: + excludeMerged+=[line] + with open(os.path.join(dirname, name), "w" )as f: for line in excludeMerged: f.write(line+"\n") @@ -946,7 +953,7 @@ def fullPerturbationSucceedsFailure(self): failure() def noPerturbationFailsFailure(self): - print("FAILURE: the comparison between the reference (code instrumented with nearest mode) andthe code without instrumentation failed") + print("FAILURE: the comparison between the reference (code instrumented with nearest mode) and the code without instrumentation failed") print("Suggestions:") print("\t1) check if reproducibilty discrepancies are larger than the failure criteria of the script %s"%self.compare_) diff --git a/pyTools/verrou_dd_stdout b/pyTools/verrou_dd_stdout new file mode 100755 index 0000000..e0d043e --- /dev/null +++ b/pyTools/verrou_dd_stdout @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 + +# This file is part of Verrou, a FPU instrumentation tool. + +# Copyright (C) 2014-2021 EDF +# F. Févotte +# B. Lathuilière + + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307, USA. + +# The GNU Lesser General Public License is contained in the file COPYING. + +import sys +import os +import subprocess +from valgrind import dd_config +from valgrind import DD_stoch +from valgrind import DD_exec_stat + + + +import re + +#adapatation from https://stackoverflow.com/questions/12643009/regular-expression-for-floating-point-numbers +regExp="([+-]?(?:\d+([.]\d*)(?:[eE][+-]?\d+)?|[.]\d+(?:[eE][+-]?\d+)?))" +regCompiled=re.compile(regExp) + +def floatReplace(lineStr): + return regCompiled.sub("*",lineStr) + + + +def selectFloatTask(logFile): + currentTask=None + taskRes=[] + + taskPattern="match [0]: " + fpInstrPattern="fp_instr: " + taskName=None + for line in open(logFile).readlines(): + if line.startswith(taskPattern): + taskName=line[len(taskPattern):] + if taskName.endswith("\n"): + taskName=taskName[0:-1] + if line.startswith(fpInstrPattern): + if taskName==None: + if len(taskRes)==0: + taskName="__verrou__stdout__init__" + else: + print("Failure selectFloatTask") + sys.exit(42) + nbInstr=int(line[len(fpInstrPattern):]) + if nbInstr!=0: + taskName=floatReplace(taskName) + if not (taskName in taskRes): + taskRes+=[taskName] + + return taskRes + + +class DDstdout(DD_stoch.DDStoch): + def __init__(self, config, prefix="dd.stdout"): + DD_stoch.DDStoch.__init__(self, config, prefix,parseRef=selectFloatTask) + + + def referenceRunEnv(self): + refPath=os.path.join(self.ref_, "vr_expect_ref.txt") + refFile=open(refPath,"w") + refFile.write("verbose: 1\n") + refFile.write("post-init: nb_instr\n") + refFile.write("match: *\n") + refFile.write("apply: reset_counter\n") + refFile.write("post-apply: nb_instr\n") + refFile.write("begin:\n") + refFile.close() + return {"PYTHONUNBUFFERED": "x", + "VERROU_ROUNDING_MODE": "nearest", + "VERROU_MCA_MODE": "ieee", + "VERROU_EXPECT_CLR":refPath} + + def isFileValidToMerge(self, name): + return name.startswith("vr_expect_ref.txt.log-") + + def getDeltaFileName(self): + return "dd.expect" + + + def genExcludeIncludeFile(self, dirname, deltas, include=False, exclude=False): + """Generate the *.exclude and *.include file in dirname rep from deltas""" + excludes=self.getDelta0() + dd=self.getDeltaFileName() + + with open(os.path.join(dirname,"vr_expect.txt"), "w") as f: + f.write("verbose: 1\n") + if "__verrou__stdout__init__" in excludes: + if "__verrou__stdout__init__" in deltas: + f.write("init: start\n") + else: + f.write("init: stop\n" ) + + for line in excludes: + if line=="__verrou__stdout__init__": + continue + f.write("match: "+ line+"\n") + if line in deltas: + f.write("apply: start\n") + else: + f.write("apply: stop\n") + f.write("begin:") + + if include: + with open(os.path.join(dirname,dd+".include"), "w") as f: + for d in deltas: + f.write(d+"\n") + + if exclude: + with open(os.path.join(dirname,dd+".exclude"), "w") as f: + for d in deltas: + excludes.remove(d) + + for line in excludes: + f.write(line+"\n") + + def sampleRunEnv(self,dirName): + return {"PYTHONUNBUFFERED": "x", + "VERROU_EXPECT_CLR": os.path.join(dirName, "vr_expect.txt")} + + def coerce(self, delta_config): + return "\n "+" \n ".join(["%s"%e for e in [l.strip() for l in delta_config ]]) +# return "\n " + "\n ".join(["%s:%d (%s)" % e for e in +# [(col[0], int(col[1]), self.demangle(col[2])) for col in +# [(l.strip()+"\t\t").split("\t") for l in delta_config]]]) + + + +if __name__ == "__main__": + et=DD_exec_stat.exec_stat("dd.stdout") + config=dd_config.ddConfig(sys.argv,os.environ, ["INTERFLOP","VERROU"]) + dd = DDstdout(config) + dd.run() + et.terminate() diff --git a/synchroLib/tstDDPython/Muller.py b/synchroLib/tstDDPython/Muller.py index 3dad735..1c2335e 100755 --- a/synchroLib/tstDDPython/Muller.py +++ b/synchroLib/tstDDPython/Muller.py @@ -25,4 +25,4 @@ def muller(nt,verbose=False): if __name__=="__main__": - muller(12) + muller(12, True) diff --git a/vr_expect_clr.c b/vr_expect_clr.c index 7dbe8f6..237ad96 100644 --- a/vr_expect_clr.c +++ b/vr_expect_clr.c @@ -1,15 +1,14 @@ /*--------------------------------------------------------------------*/ /*--- Verrou: a FPU instrumentation tool. ---*/ -/*--- This file contains code allowing to exclude some symbols ---*/ -/*--- from the instrumentation. ---*/ -/*--- vr_exclude.c ---*/ +/*--- This file contains code allowing to apply client request ---*/ +/*--- from an expect script. ---*/ +/*--- vr_expect_clr.c ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Verrou, a FPU instrumentation tool. - Copyright (C) 2014-2016 - F. Févotte + Copyright (C) 2014-2023 B. Lathuilière This program is free software; you can redistribute it and/or @@ -43,6 +42,13 @@ HChar vr_defaultKeyStr[]="default: "; SizeT vr_defaultKeyStrSize=sizeof(vr_defaultKeyStr)-1; +HChar vr_initKeyStr[]="init: "; +SizeT vr_initKeyStrSize=sizeof(vr_initKeyStr)-1; + +HChar vr_postinitKeyStr[]="post-init: "; +SizeT vr_postinitKeyStrSize=sizeof(vr_postinitKeyStr)-1; + + HChar vr_filterLineExecKeyStr[]="filter_line_exec: "; SizeT vr_filterLineExecKeyStrSize=sizeof(vr_filterLineExecKeyStr)-1 ; @@ -68,12 +74,20 @@ HChar vr_verboseKeyStr[]= "verbose: "; SizeT vr_verboseKeyStrSize=sizeof(vr_verboseKeyStr)-1; + #define DEFAULT_MAX 10 #define DEFAULT_SIZE_MAX 30 HChar vr_applyDefault[DEFAULT_MAX][DEFAULT_SIZE_MAX]; SizeT vr_nbDefault=0; -#define MATCH_MAX 10 +HChar vr_applyInit[DEFAULT_MAX][DEFAULT_SIZE_MAX]; +SizeT vr_nbInit=0; + +HChar vr_applypostInit[DEFAULT_MAX][DEFAULT_SIZE_MAX]; +SizeT vr_nbpostInit=0; + + +#define MATCH_MAX 1000 #define APPLY_PER_MATCH_MAX 5 #define POST_APPLY_PER_MATCH_MAX 2 #define MATCH_SIZE_MAX 30 @@ -104,6 +118,8 @@ HChar tmpFileNameFilter[256]="/tmp/shouldNotBeUsed"; HChar nopStr[]="nop"; HChar emptyStr[]=""; HChar defaultStr[]="default"; +HChar initStr[]="init"; +HChar postinitStr[]="post-init"; HChar stopStr[]="stop"; HChar startStr[]="start"; HChar displayCounterStr[]="display_counter"; @@ -115,12 +131,12 @@ HChar exitStr[]="exit"; -typedef enum {nopKey=0, emptyKey, defaultKey, stopKey, startKey, displayCounterKey, nbInstrKey, resetCounterKey, dumpCoverKey, panicKey, exitKey} Vr_applyKey; -static const SizeT actionNumber=11; -HChar* actionStrTab[]={nopStr, emptyStr, defaultStr, stopStr, startStr, displayCounterStr, nbInstrStr, resetCounterStr, dumpCoverStr, panicStr, exitStr}; -SizeT actionSizeTab[]={sizeof(nopStr), sizeof(emptyStr),sizeof(defaultStr),sizeof(stopStr), sizeof(startStr), sizeof(displayCounterStr), sizeof(nbInstrStr), sizeof(resetCounterStr), sizeof(dumpCoverStr),sizeof(panicStr),sizeof(exitStr)}; +typedef enum {nopKey=0, emptyKey, defaultKey, initKey, postinitKey, stopKey, startKey, displayCounterKey, nbInstrKey, resetCounterKey, dumpCoverKey, panicKey, exitKey} Vr_applyKey; +static const SizeT actionNumber=12; +HChar* actionStrTab[]={nopStr, emptyStr, defaultStr, initStr, postinitStr, stopStr, startStr, displayCounterStr, nbInstrStr, resetCounterStr, dumpCoverStr, panicStr, exitStr}; +SizeT actionSizeTab[]={sizeof(nopStr), sizeof(emptyStr),sizeof(defaultStr), sizeof(initStr), sizeof(postinitStr), sizeof(stopStr), sizeof(startStr), sizeof(displayCounterStr), sizeof(nbInstrStr), sizeof(resetCounterStr), sizeof(dumpCoverStr),sizeof(panicStr),sizeof(exitStr)}; -Bool actionRequireCacheCleanTab[]={False, False, False, True, True, False, False, False, False, False, False }; +//Bool actionRequireCacheCleanTab[]={False, False, False, False, False, True, True, False, False, False, False, False, False }; UInt expect_verbose=1; @@ -307,6 +323,154 @@ static Bool get_first_line ( Int fd, HChar** bufpp) +static void vr_applyCmd(Vr_applyKey key, const HChar* cmd, Bool noIntrusiveOnly){ + if(expect_verbose>1){ + VG_(umsg)("vr_applyCmd : %s\n", cmd); + } + switch(key){ + case nopKey: + return; + case emptyKey: + return; + case defaultKey: + VG_(tool_panic)("default treated before"); + return; + case initKey: + VG_(tool_panic)("init treated before"); + return; + case postinitKey: + VG_(tool_panic)("postinit treated before"); + return; + case stopKey: + if(noIntrusiveOnly){ + vr.instrument = False; + }else{ + vr_set_instrument_state ("Expect CLR", False, True); + } + VG_(fprintf)(vr.expectCLRFileOutput,"apply: stop\n"); + return; + case startKey: + if(noIntrusiveOnly){ + vr.instrument = True; + }else{ + vr_set_instrument_state ("Expect CLR", True, True); + } + VG_(fprintf)(vr.expectCLRFileOutput,"apply: start\n"); + return; + case displayCounterKey: + vr_ppOpCount(); + VG_(fprintf)(vr.expectCLRFileOutput,"apply: display_counter\n"); + return; + case nbInstrKey: + { + UInt nbInstr=vr_count_fp_instrumented(); + VG_(fprintf)(vr.expectCLRFileOutput,"fp_instr: %u\n", nbInstr ); + return; + } + case resetCounterKey: + { + vr_resetCount(); + return; + } + case dumpCoverKey: + { + SizeT ret; + ret=vr_traceBB_dumpCov(); + VG_(fprintf)(vr.expectCLRFileOutput,"apply: dump_cover : %lu\n", ret); + return; + } + case panicKey: + { + VG_(fprintf)(vr.expectCLRFileOutput, "apply: panic\n"); + VG_(tool_panic)("apply: panic"); + } + case exitKey: + { + VG_(fprintf)(vr.expectCLRFileOutput, "apply: exit\n"); + VG_(exit)(1); + } + } + VG_(umsg)("vr_applyCmd : unknown cmd : %s\n", cmd); + VG_(exit)(1); +} + + + + +static +void vr_expect_apply_clr(const HChar* cmd, Bool noIntrusiveOnly){ + if(expect_verbose>2){ + VG_(umsg)("vr_expect_apply_clr: %s\n",cmd); + } + + Vr_applyKey key=vr_CmdToEnum(cmd); + + if(key==initKey){ + for(SizeT i=0; i< vr_nbInit;i++){ + Vr_applyKey keyInit=vr_CmdToEnum(vr_applyInit[i]); + vr_applyCmd(keyInit,vr_applyInit[i], noIntrusiveOnly); + } + return; + } + if(key==postinitKey){ + for(SizeT i=0; i< vr_nbpostInit;i++){ + Vr_applyKey keypostInit=vr_CmdToEnum(vr_applypostInit[i]); + vr_applyCmd(keypostInit,vr_applypostInit[i],noIntrusiveOnly); + } + return; + } + + if(key==defaultKey){ + for(SizeT i=0; i< vr_nbDefault;i++){ + Vr_applyKey keyDefault=vr_CmdToEnum(vr_applyDefault[i]); + vr_applyCmd(keyDefault,vr_applyDefault[i],noIntrusiveOnly); + } + return; + } + + vr_applyCmd(key,cmd,noIntrusiveOnly); + +} + + + +static +void vr_expect_apply_clrs(void){ + Int countApply=0; + SizeT lineNo = 0; + + //Loop over input file until next expect line + while (!get_fullnc_line(vr.expectCLRFileInput, &vr_expectTmpLine, &lineNo)) { + + //except key + if( VG_(strncmp)(vr_expectTmpLine, vr_expectKeyStr, vr_expectKeyStrSize)==0 ){ + vr_last_expect_lineNo=lineNo; + vr_currentExpectStr=vr_expectTmpLine+vr_expectKeyStrSize; + if(countApply==0){ + vr_expect_apply_clr("default", False); + } + return; + } + //Apply key + if( VG_(strncmp)(vr_expectTmpLine, vr_applyKeyStr, vr_applyKeyStrSize)==0 ){ + vr_expect_apply_clr(vr_expectTmpLine+vr_applyKeyStrSize, False); + countApply++; + continue; + } + + // what to do with this line + VG_(fprintf)(vr.expectCLRFileOutput,"Line %lu ignored : %s\n", lineNo, vr_expectTmpLine); + if( expect_verbose >0){ + VG_(umsg)("expect_clr : Line %lu ignored : %s\n", lineNo, vr_expectTmpLine); + } + } + if(countApply==0){ + vr_expect_apply_clr("default", False); + } + vr_expectTmpLine[0]=0; +} + + void vr_expect_clr_init (const HChar * fileName) { @@ -320,10 +484,13 @@ void vr_expect_clr_init (const HChar * fileName) { } /*Open output File*/ - const HChar * strLogFilename="expect_clr.log-%p"; + const HChar * strLogPost=".log-%p"; + HChar strLogFilename[512]; + VG_(sprintf)(strLogFilename, "%s%s",fileName,strLogPost); + const HChar * strLogFilenameExpanded= VG_(expand_file_name)("vr.expect_clr_log.1", strLogFilename); - VG_(umsg)("Open expect clr file : `%s'... \n", strLogFilenameExpanded); + VG_(umsg)("Open expect clr log file : `%s'... \n", strLogFilenameExpanded); vr.expectCLRFileOutput = VG_(fopen)(strLogFilenameExpanded, VKI_O_WRONLY | VKI_O_CREAT | VKI_O_TRUNC, VKI_S_IRUSR|VKI_S_IWUSR|VKI_S_IRGRP|VKI_S_IROTH); @@ -364,6 +531,41 @@ void vr_expect_clr_init (const HChar * fileName) { } continue; } + + //Treat init key + if( VG_(strncmp)(vr_expectTmpLine, vr_initKeyStr, vr_initKeyStrSize)==0 ){ + const HChar* initAction=vr_expectTmpLine+vr_initKeyStrSize; + if(expect_verbose>1){ + VG_(umsg)("init action str : %s\n", initAction); + } + if (vr_valid_apply_cmd(initAction)){ + VG_(fprintf)(vr.expectCLRFileOutput, "init action [%lu] : %s\n",vr_nbInit , initAction); + VG_(strncpy)(vr_applyInit[vr_nbInit],initAction, DEFAULT_SIZE_MAX); + vr_nbInit++; + }else{ + VG_(umsg)("init action %s is not valid", initAction); + VG_(tool_panic)("vr_expect_clr : invalid action"); + } + continue; + } + + //Treat postinit key + if( VG_(strncmp)(vr_expectTmpLine, vr_postinitKeyStr, vr_postinitKeyStrSize)==0 ){ + const HChar* postinitAction=vr_expectTmpLine+vr_postinitKeyStrSize; + if(expect_verbose>1){ + VG_(umsg)("post-init action str : %s\n", postinitAction); + } + if (vr_valid_apply_cmd(postinitAction)){ + VG_(fprintf)(vr.expectCLRFileOutput, "postinit action [%lu] : %s\n",vr_nbpostInit , postinitAction); + VG_(strncpy)(vr_applypostInit[vr_nbpostInit], postinitAction, DEFAULT_SIZE_MAX); + vr_nbpostInit++; + }else{ + VG_(umsg)("post init action %s is not valid", postinitAction); + VG_(tool_panic)("vr_expect_clr : invalid action"); + } + continue; + } + //Treat match key if( VG_(strncmp)(vr_expectTmpLine, vr_matchKeyStr, vr_matchKeyStrSize)==0 ){ if(vr_nbMatch> MATCH_MAX){ @@ -461,131 +663,21 @@ void vr_expect_clr_init (const HChar * fileName) { } } -// VG_(umsg)("expectCLR init done\n"); -} - - - -static void vr_applyCmd(Vr_applyKey key, const HChar* cmd){ - if(expect_verbose>1){ - VG_(umsg)("vr_applyCmd : %s\n", cmd); - } - switch(key){ - case nopKey: - return; - case emptyKey: - return; - case defaultKey: - VG_(tool_panic)("default treated before"); - return; - case stopKey: - vr_set_instrument_state ("Expect CLR", False, True); - VG_(fprintf)(vr.expectCLRFileOutput,"apply: stop\n"); - return; - case startKey: - vr_set_instrument_state ("Expect CLR", True, True); - VG_(fprintf)(vr.expectCLRFileOutput,"apply: start\n"); - return; - case displayCounterKey: - vr_ppOpCount(); - VG_(fprintf)(vr.expectCLRFileOutput,"apply: display_counter\n"); - return; - case nbInstrKey: - { - UInt nbInstr=vr_count_fp_instrumented(); - VG_(fprintf)(vr.expectCLRFileOutput,"fp_instr: %u\n", nbInstr ); - return; - } - case resetCounterKey: - { - vr_resetCount(); - return; - } - case dumpCoverKey: - { - SizeT ret; - ret=vr_traceBB_dumpCov(); - VG_(fprintf)(vr.expectCLRFileOutput,"apply: dump_cover : %lu\n", ret); - return; - } - case panicKey: - { - VG_(fprintf)(vr.expectCLRFileOutput, "apply: panic\n"); - VG_(tool_panic)("apply: panic"); - } - case exitKey: - { - VG_(fprintf)(vr.expectCLRFileOutput, "apply: exit\n"); - VG_(exit)(1); - } - } - VG_(umsg)("vr_applyCmd : unknown cmd : %s\n", cmd); - VG_(exit)(1); -} - + vr_expect_apply_clr("init", True); -static -void vr_expect_apply_clr(const HChar* cmd, Bool noIntrusiveOnly){ - if(expect_verbose>2){ - VG_(umsg)("vr_expect_apply_clr: %s\n",cmd); - } - - Vr_applyKey key=vr_CmdToEnum(cmd); - if(key==defaultKey){ - for(SizeT i=0; i< vr_nbDefault;i++){ - Vr_applyKey keyDefault=vr_CmdToEnum(vr_applyDefault[i]); - if( !actionRequireCacheCleanTab[i] || !(noIntrusiveOnly)){ - vr_applyCmd(keyDefault,vr_applyDefault[i]); - } - } - }else{ - if( !actionRequireCacheCleanTab[key] || !(noIntrusiveOnly)){ - vr_applyCmd(key,cmd); - } - } +// VG_(umsg)("expectCLR init done\n"); } -static -void vr_expect_apply_clrs(void){ - Int countApply=0; - SizeT lineNo = 0; - - //Loop over input file until next expect line - while (!get_fullnc_line(vr.expectCLRFileInput, &vr_expectTmpLine, &lineNo)) { - - //except key - if( VG_(strncmp)(vr_expectTmpLine, vr_expectKeyStr, vr_expectKeyStrSize)==0 ){ - vr_last_expect_lineNo=lineNo; - vr_currentExpectStr=vr_expectTmpLine+vr_expectKeyStrSize; - if(countApply==0){ - vr_expect_apply_clr("default", False); - } - return; - } - //Apply key - if( VG_(strncmp)(vr_expectTmpLine, vr_applyKeyStr, vr_applyKeyStrSize)==0 ){ - vr_expect_apply_clr(vr_expectTmpLine+vr_applyKeyStrSize, False); - countApply++; - continue; - } - - // what to do with this line - VG_(fprintf)(vr.expectCLRFileOutput,"Line %lu ignored : %s\n", lineNo, vr_expectTmpLine); - if( expect_verbose >0){ - VG_(umsg)("expect_clr : Line %lu ignored : %s\n", lineNo, vr_expectTmpLine); - } - } - if(countApply==0){ - vr_expect_apply_clr("default", False); - } - vr_expectTmpLine[0]=0; -} void vr_expect_clr_checkmatch(const HChar* writeLine,SizeT size){ /*As the syscall to not give always a full line we need to create a buffer and to treat the buffer only we detect the end of line*/ + static Bool first=True; + if(first){ + vr_expect_apply_clr("post-init", False); + } SizeT totalSize= (vr_writeLineBuffCurrent - vr_writeLineBuff) + size; if(totalSize >= LINE_SIZEMAX){