这是整个命令序列和文字墙:
gdb -q ./a.out
Reading symbols for shared libraries .. done
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000100000f20 <main+0>: push %rbp
0x0000000100000f21 <main+1>: mov %rsp,%rbp
0x0000000100000f24 <main+4>: sub $0x10,%rsp
0x0000000100000f28 <main+8>: movl $0x0,-0x4(%rbp)
0x0000000100000f2f <main+15>: movl $0x0,-0x8(%rbp)
0x0000000100000f36 <main+22>: cmpl $0xa,-0x8(%rbp)
0x0000000100000f3d <main+29>: jge 0x100000f64 <main+68>
0x0000000100000f43 <main+35>: lea 0x44(%rip),%rdi # 0x100000f8e
0x0000000100000f4a <main+42>: mov $0x0,%al
0x0000000100000f4c <main+44>: callq 0x100000f6e <dyld_stub_printf>
0x0000000100000f51 <main+49>: mov %eax,-0xc(%rbp)
0x0000000100000f54 <main+52>: mov -0x8(%rbp),%eax
0x0000000100000f57 <main+55>: add $0x1,%eax
0x0000000100000f5c <main+60>: mov %eax,-0x8(%rbp)
0x0000000100000f5f <main+63>: jmpq 0x100000f36 <main+22>
0x0000000100000f64 <main+68>: mov -0x4(%rbp),%eax
0x0000000100000f67 <main+71>: add $0x10,%rsp
0x0000000100000f6b <main+75>: pop %rbp
0x0000000100000f6c <main+76>: retq
End of assembler dump.
(gdb) break main
Breakpoint 1 at 0x100000f2f: file firstprog.c, line 5.
(gdb) run
Starting program: /Users/sankarshanmudkavi/Desktop/test/test/a.out
Reading symbols for shared libraries +..............bfd_mach_o_scan_read_symtab_symbol: symbol "_bzero" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memccpy" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memchr" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memcmp" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memcpy" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memmove" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memset" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_strchr" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_strcmp" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_strncmp" is unsupported 'indirect' reference: setting to undefined
....warning: Could not find object file "/private/var/tmp/Libsyscall/Libsyscall-2422.1.72~6/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/_libc_funcptr.o" - no debug information available for "_libc_funcptr.c".
warning: Could not find object file "/private/var/tmp/Libsyscall/Libsyscall-2422.1.72~6/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/strlen.o" - no debug information available for "strlen.c".
还有更多类似的警告。那么到底发生了什么?谷歌搜索没有给我任何东西,但我怀疑这与我的 mac 的架构有关。(2012 人民币)。