Quiz Entry - updated: 2026.07.06
How do you recognize a string comparison in assembly?
Look for a hardcoded string address loaded into a register, a call to a compare routine, then test %eax, %eax + a conditional jump on the result.
mov $0x402490, %esi
mov %rbx, %rdi
call <strings_not_equal>
test %eax, %eax
je success_label
The pattern:
- One register gets a hardcoded address (
$0x402490) — this points to an expected string in.rodata - Another register holds user input (often
%rdi) - A comparison function is called (returns 0 if equal)
test %eax, %eax+je= "jump if they matched"
How to extract the string in GDB:
(gdb) x/s 0x402490
0x402490: "Brownie, you are doing a heck of a job."
Go deeper:
TEST instruction reference — the test %eax,%eax + je that follows the compare call decides whether the strings matched.