what is cmp DWORD PTR [rbp-0x4],0x1 mean

1.8k Views Asked by At
x00000000000006ca <+0>: push   rbp
   0x00000000000006cb <+1>: mov    rbp,rsp
   0x00000000000006ce <+4>: sub    rsp,0x10
   0x00000000000006d2 <+8>: mov    DWORD PTR [rbp-0x4],edi
   0x00000000000006d5 <+11>:    mov    QWORD PTR [rbp-0x10],rsi
   0x00000000000006d9 <+15>:    cmp    DWORD PTR [rbp-0x4],0x1
   0x00000000000006dd <+19>:    jg     0x6f5 <main+43>
   0x00000000000006df <+21>:    lea    rdi,[rip+0x162]        # 0x848
   0x00000000000006e6 <+28>:    call   0x580 <puts@plt>
   0x00000000000006eb <+33>:    mov    eax,0x0
   0x00000000000006f0 <+38>:    jmp    0x79d <main+211>
   0x00000000000006f5 <+43>:    mov    rax,QWORD PTR [rbp-0x10]
   0x00000000000006f9 <+47>:    add    rax,0x8
   0x00000000000006fd <+51>:    mov    rax,QWORD PTR [rax]
   0x0000000000000700 <+54>:    mov    rdi,rax
   0x000000000000

i got a crackme code and i stuck tn the0x00000000000006d9 <+15>: cmp DWORD PTR [rbp-0x4],0x1how do crack it by gdb should i set up any registers?

1

There are 1 best solutions below

0
Rooted0x01 On

rbp or ( ebp) is base pointr stack

   0x00000000000006d2 <+8>: mov    DWORD PTR [rbp-0x4],edi
  
  0x00000000000006d9 <+15>:    cmp    DWORD PTR [rbp-0x4],0x1

line 8 move edi to value pointer to [rbp-0x4] then compare it to 1 at line 15