dejagnu scan-assembler regex

时间:2016-05-19 08:23:43

标签: c regex assembly

我想用DejaGnu扫描装配文件:

ld.h%d2,

但我无法解释点字符和数字字符。 我尝试了以下方法:(一个反斜杠,两个反斜杠和包围)

/* { dg-final { scan-assembler-times "ld\.h\t%d\d," 1 { target { tricore-*-* } } } } */
/* { dg-final { scan-assembler-times "ld\\.h\t%d\\d," 1 { target { tricore-*-* } } } } */
/* { dg-final { scan-assembler-times "ld[.]h\t%d[0-9]," 1 { target { tricore-*-* } } } } */
  1. 一个反斜杠的情况:它只是消失了,所以正则表达式的含义正在改变。
  2. 使用两个反斜杠:它保留两个反斜杠,因此在扫描过程中没有匹配。
  3. 带括号:出现错误。
  4. 输出:

    Running ../../../../testsuite/mytest/TX-1234.exp ...
    PASS: testsuite/mytest/size16.c (test for excess errors)
    FAIL: testsuite/mytest/size16.c scan-assembler-times \tld.h\t%dd, 1
    FAIL: testsuite/mytest/size16.c scan-assembler-times \tld\\.h\t%d\\d, 1
    ERROR: (DejaGnu) proc "." does not exist.
    

    那么,我如何解释\.字符或\d十进制字符?

2 个答案:

答案 0 :(得分:0)

这样:

(ld\.h \%d\d\,) 

将验证ld.h%d2, 但你还是要检查除了所有需要之外它是否没有采取错误的结果,如果是这样的话也要调整它。 享受

答案 1 :(得分:0)

表达式通过过滤器,因此点字符的正确解释是\\\.\\\. - > \.)。 \ d在DejaGnu中不起作用。请改为使用\[0-9\]\[0-9\] - > [0-9])。

相关问题