c - dejagnu 扫描汇编程序正则表达式

标签 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. 带括号:出现错误。

输出:

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 十进制一?

最佳答案

这个:

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

将验证 ld.h %d2, 但是除了所有需要的结果之外,您仍然必须检查它是否没有错误的结果,如果是的话,就调整它。 享受

关于c - dejagnu 扫描汇编程序正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37317750/

相关文章:

c - 如何找到第n个数?

c - 在 C 中的二维数组中划分行时遇到问题

c# - 正则表达式提取字符串

python - 如何使 re.split() 具有包容性

c - 错误 : ‘asm’ undeclared (first use in this function)

css - css 中的正则表达式失败

linux - 为 MIPS 汇编开发创建功能齐全的环境

assembly - 在 c/asm x86 中重新编程中断

linux - 在i386和x86-64上UNIX和Linux系统调用的调用约定是什么

c - 将 wchar_t 定义为 2byte