Why does `disassemble` behave differently on Linux and Mac?
Peng Yu
pengyu.ut@gmail.com
Sun Jan 24 15:06:10 GMT 2021
Hi,
https://visualgdb.com/gdbreference/commands/set_disassembly-flavor
I am trying to follow the above example, but it does behave the same
on Linux and Mac. Does anybody know how to make it work on Mac?
Thanks.
On Linux:
$ uname
Linux
$ cat func.c
int func(int a, int b) {
return a + b;
}
$ gcc -c func.c
$ gdb -q func.o
Reading symbols from func.o...
(No debugging symbols found in func.o)
(gdb) show disassembly-flavor
The disassembly flavor is "att".
(gdb) disassemble func
Dump of assembler code for function func:
0x0000000000000000 <+0>: push %rbp
0x0000000000000001 <+1>: mov %rsp,%rbp
0x0000000000000004 <+4>: mov %edi,-0x4(%rbp)
0x0000000000000007 <+7>: mov %esi,-0x8(%rbp)
0x000000000000000a <+10>: mov -0x4(%rbp),%edx
0x000000000000000d <+13>: mov -0x8(%rbp),%eax
0x0000000000000010 <+16>: add %edx,%eax
0x0000000000000012 <+18>: pop %rbp
0x0000000000000013 <+19>: ret
End of assembler dump.
On Mac:
$ uname
Darwin
$ cat func.c
int func(int a, int b) {
return a + b;
}
$ gcc -c func.c
$ gdb -q func.o
Reading symbols from func.o...
(No debugging symbols found in func.o)
(gdb) show disassembly-flavor
The disassembly flavor is "att".
(gdb) disassemble func
No symbol table is loaded. Use the "file" command.
--
Regards,
Peng
More information about the Gdb
mailing list