Skip to content

What's the easiest way to create predicates that match patterns? #48

@gnzlbg

Description

@gnzlbg

For example, I need to match:

lib_crate::sum_array (src/lib.rs:6):
 push    rbp
 mov     rbp, rsp
 test    rsi, rsi
  je      LBB13_1
  lea     r9, [4*rsi, -, 4]
 shr     r9, 2
 inc     r9
 cmp     r9, 8
 jae     LBB13_4
  xor     eax, eax
 mov     rcx, rdi
 jmp     LBB13_13
LBB13_1:
 xor     eax, eax
 pop     rbp
 ret

on macos, but on windows all the LBB13_... are LBB14_.. and they change on linux as well. Also on windows and linux, the push+mov at the beginning, and pop at the end parts of my pattern are not present.

In rustc, I would write something like this

lib_crate::sum_array (src/lib.rs:6):
{{.*}}
 test    rsi, rsi
 je      LBB{{.*}}_1
 lea     r9, [4*rsi, -, 4]
 shr     r9, 2
 inc     r9
 cmp     r9, 8
 jae     LBB{{.*}}_4
 xor     eax, eax
 mov     rcx, rdi
 jmp     LBB{{.*}}_13
LBB{{.*}}_1:
 xor     eax, eax
{{.*}}
 ret

where the {{regexp}} is used to match any pattern.

What's the easiest way of doing something like this to assert outputs that using assert_cmd ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions