$ sudo apt-get update
$ sudo apt-get install gdb
$ gdb -v
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
#include <stdio.h>
int main() {
    int i;
    for(i=0; i< 10; i++){
        printf("Hello world\n");
    }
    return 0;
}
$ gcc main.c
$ ls -l a.out
-rwxrwxr-x 1 vagrant vagrant 8872 Feb 11 18:48 a.out
$ objdump -D a.out | grep -A main.:
grep: main.:: invalid context length argument
vagrant@vagrant:~/dev/c$ objdump -D a.out | grep -A20 main.:
0000000000000754 
 754:   a9be7bfd        stp     x29, x30, [sp, #-32]!
 758:   910003fd        mov     x29, sp
 75c:   b9001fff        str     wzr, [sp, #28]
 760:   14000007        b       77c 
 764:   90000000        adrp    x0, 0 <__abi_tag-0x278>
 768:   911ec000        add     x0, x0, #0x7b0
 76c:   97ffffb1        bl      630 
 774:   11000400        add     w0, w0, #0x1
 778:   b9001fe0        str     w0, [sp, #28]
 77c:   b9401fe0        ldr     w0, [sp, #28]
 780:   7100241f        cmp     w0, #0x9
 784:   54ffff0d        b.le    764 
 788:   52800000        mov     w0, #0x0                        // #0
 78c:   a8c27bfd        ldp     x29, x30, [sp], #32
 790:   d65f03c0        ret
Disassembly of section .fini:
0000000000000794 <_fini>:
$ gdb -q ./a.out
Reading symbols from ./a.out…
(No debugging symbols found in ./a.out)
(gdb) break main
Breakpoint 1 at 0x760
(gdb) run
Starting program: /home/vagrant/dev/c/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/aarch64-linux-gnu/libthread_db.so.1”.
Breakpoint 1, 0x0000aaaaaaaa0760 in main ()
(gdb) info registers
x0             0x1                 1
x1             0xfffffffff138      281474976706872
x2             0xfffffffff148      281474976706888
x3             0xaaaaaaaa0754      187649984431956
x4             0x0                 0
x5             0x840f359fc93a2758  -8930860575660300456
x6             0xfffff7f9cc90      281474842086544
x7             0x4554415649        297766311497
x8             0xd7                215
x9             0x10                16
x10            0xfffff7fc2490      281474842240144
x11            0x0                 0
x12            0x0                 0
x13            0x0                 0
–Type 
x14            0xfffff7fff000      281474842488832
x15            0xfffff7ff8e60      281474842463840
x16            0xfffff7fd6774      281474842322804
x17            0xfffff7f9b080      281474842079360
x18            0x2                 2
x19            0xfffffffff138      281474976706872
x20            0x1                 1
x21            0xaaaaaaab0d98      187649984499096
x22            0xfffff7ffe040      281474842484800
x23            0xaaaaaaaa0754      187649984431956
x24            0xfffff7f9a000      281474842075136
x25            0x0                 0
x26            0xfffffffff148      281474976706888
x27            0xaaaaaaab0d98      187649984499096
–Type 
x28            0x0                 0
x29            0xffffffffefa0      281474976706464
x30            0xfffff7e273fc      281474840556540
sp             0xffffffffefa0      0xffffffffefa0
pc             0xaaaaaaaa0760      0xaaaaaaaa0760 
cpsr           0x80001000          [ EL=0 BTYPE=0 SSBS N ]
fpsr           0x0                 [ ]
fpcr           0x0                 [ RMode=0 ]
pauth_dmask    0x7f000000000000    35747322042253312
pauth_cmask    0x7f000000000000    35747322042253312
(gdb) quit
A debugging session is active.
Inferior 1 [process 1266503] will be killed.
Quit anyway? (y or n) y
gdbを使うと別の世界に来た感じがしますね。
 
					 
