![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Cómo usar gdbserver para remote debuggingHay que seguir las instrucciones de este post ("Linus's blog: How to debug your initramfs init"):gdbserver gdbserver is a component of gdb that allows exposing debugging of a process via the network or a serial interface. It has two modes: one where it launches the to-be-debugged child process and waits for a client to connect: $ gdbserver localhost:3333 sleep infinity Process hello created; pid = 7780 Listening on port 3333 (meanwhile, in another terminal) (gdb) target remote localhost:3333 Remote debugging using localhost:3333 Reading /nix/store/w8vm09hri2zz7yacryzzzxvsapik4ps4-coreutils-9.1/bin/coreutils from remote target... [...] (gdb) bt
Continuing. ^C Program received signal SIGINT, Interrupt. 0x00007f2c0715ed24 in pause () from target:/nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6 (gdb) And another mode where it attaches to an already running process. $ sleep infinity & [1] 3945492 $ gdbserver --attach localhost:3333 3945492 Attached; pid = 3945492 Listening on port 3333 and attach: (gdb) target remote localhost:3333 Remote debugging using localhost:3333 Reading /nix/store/jmy11m3c935yyvs4njz3s52p9azgvg6f-coreutils-full-9.3/bin/coreutils from remote target... [...] 0x00007f5b562fd6c4 in pause () from target:/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6 (gdb) bt
|