I've been playing around with binaries and clang. I was playing around and suddenly the executable stopped working for no apparent reason. Here's what I did:
- Build hello world
ex:echo -e '#include <stdio.h>\n int main() { puts("Hello"); }' | clang -x c -
- Use
shasum
ona.out
- Run
./a.out
to confirm it works - Open the binary in VS Code hex editor, change a letter, save
- Run to confirm it not executing
- Use
shasum
to confirm the sum is different - Change the letter back
- Use
shasum
to confirm the sum is the original value - Run
./a.out
and see it still fail
Any idea why?
a.out
back to the original content in a hex editor makes it execute as expected. Are you sure you are executing the correct version in the second run?