hello.c
#include<stdio.h>
int main(){
printf("helloWorld!\n");
return 0;
}
# Mac with M3 (Apple Silicon)
clang hello.c -o hello-clang-mac-arm.out
# Mac with Intel Chip
clang hello.c -o hello-clang-mac-x86.out
现象:killed
。
➜ Downloads ./hello-clang-mac-arm.out
helloWorld!
➜ Downloads strings ./hello-clang-mac-arm.out
helloWorld!
➜ Downloads emacs hello-clang-mac-arm.out
➜ Downloads strings ./hello-clang-mac-arm.out
helloWoXXX!
➜ Downloads ./hello-clang-mac-arm.out
[1] 32025 killed ./hello-clang-mac-arm.out
用 lldb:正常(?)执行!
➜ Downloads lldb ./hello-clang-mac-arm.out
(lldb) target create "./hello-clang-mac-arm.out"
Current executable set to '/Users/sonion/Downloads/hello-clang-mac-arm.out' (arm64).
(lldb) r
Process 32437 launched: '/Users/sonion/Downloads/hello-clang-mac-arm.out' (arm64)
helloWoXXX!
Process 32437 exited with status = 0 (0x00000000)
(lldb) r
Process 32460 launched: '/Users/sonion/Downloads/hello-clang-mac-arm.out' (arm64)
helloWoXXX!
Process 32460 exited with status = 0 (0x00000000)
(lldb) ^D
现象:killed
。
➜ Downloads emacs hello-clang-mac-arm.out
➜ Downloads strings ./hello-clang-mac-arm.out
helloWoXXXXXX
➜ Downloads ./hello-clang-mac-arm.out
[1] 32150 killed ./hello-clang-mac-arm.out
用 lldb:error: process exited with status -1 (no such process.)
➜ Downloads lldb ./hello-clang-mac-arm.out
(lldb) target create "./hello-clang-mac-arm.out"
Current executable set to '/Users/sonion/Downloads/hello-clang-mac-arm.out' (arm64).
(lldb) r
error: process exited with status -1 (no such process.)
(lldb) r
error: process exited with status -1 (no such process.)
(lldb) ^D