2016-05-19 20 views
1

我想掃描組件文件,爲的DejaGnu:的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小數呢?

回答

0

這樣的:

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

將驗證ld.h%D2, 但你還是要檢查是否所有需要它沒有考慮除了錯誤的結果和tweek它,如果它是一個案例。 享受

+0

此表達式也失敗。 DejaGnu的解析器不是常規的RegEx解析器。 – Tannis

0

表達式通過一個過濾器,所以點字符的正確解釋是\\\.\\\. - >\.)。 \ d不適用於DejaGnu。改爲使用\[0-9\]\[0-9\] - >[0-9])。