2021-01-13 C源码中自动插桩auto stubbing

z@z-ThinkPad-X61:~/zworkingCopy/mcu/F407_dhcp_tracing_allPCs$ cat zautoStubbing.cmd

find | grep mother | cat -n | awk '{ print("echo "$1";  grep  -nH \\\"{\\\\s*$\\\" "$2); }' | xargs -i bash -c "{}" \

  | sed 's/mother:/mother /g' | sed 's/:.*//g' | awk '{ if(/^[0-9]/) fileNo=$1; else {print fileNo" "$0;}  }'  | awk '{print "cp "$2" "$2";" "sed '\''0,/{\s*$/s/{\s*$/{ zhcpushPC("$1", "$3");/1 '\'' -i  "$2}' \

  | sed 's/.mother$//g' | sed 's/.mother;/;  /g' |  awk '{if(x==$2) {$1="";$2="";$3=""; print $0;} else {x=$2; print $0;} }' > tmp.cmd

chmod +x tmp.cmd

./tmp.cmd

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(struct.*{\s*\)zhcpush.*/\1/g' -i {}

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(typedef struct.*{\s*\)zhcpush.*/\1/g' -i {}

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(const struct.*{\s*\)zhcpush.*/\1/g' -i {}

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(const .*{\s*\)zhcpush.*/\1/g' -i {}

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(static.*{\s*\)zhcpush.*/\1/g' -i {}

find | grep mother | sed 's/.mother//g'  | xargs -i sed 's/^\(\s*enum .*{\s*\)zhcpush.*/\1/g' -i {}

你可能感兴趣的:(2021-01-13 C源码中自动插桩auto stubbing)