美文网首页
2021-01-13 C源码中自动插桩auto stubbing

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

作者: linuxScripter | 来源:发表于2021-01-13 18:24 被阅读0次

    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

          本文链接:https://www.haomeiwen.com/subject/uelpaktx.html