Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Remote debugging</strong></p> <p>Alice and Bob should use remote debugging. Bob starts gdbserver:</p> <pre><code>bob@localhost:/home/bob$ gdbserver :2345 ./helloworld </code></pre> <p>And Alice connects to it:</p> <pre><code>alice@localhost:/home/alice$ gdb [...] (gdb) file helloworld Reading symbols from /home/alice/helloworld...done. (gdb) target remote :2345 Remote debugging using :2345 [...] 0x00007fbdc6329af0 in _start () from /lib64/ld-linux-x86-64.so.2 </code></pre> <p><strong>Remote debugging with absolute paths</strong></p> <p>This works in this simple case. However, some more sophistication is requried when Bob uses absolute paths for his shared libraries:</p> <pre><code>bob@localhost:/home/bob$ ls helloworld libmylib.so bob@localhost:/home/bob$ LD_LIBRARY_PATH=/home/bob gdbserver :2345 ./helloworld </code></pre> <p>Now, alice can't find the shared library:</p> <pre><code>alice@localhost:/home/alice$ gdb [...] (gdb) file helloworld Reading symbols from /home/alice/helloworld...done. (gdb) target remote :2345 Remote debugging using :2345 [...] (gdb) break helloWorld() Breakpoint 1 at 0x400480 (gdb) c Continuing. Error while mapping shared library sections: /home/bob/libmylib.so: No such file or directory. </code></pre> <p>To solve this, Alice creates a virtual root folder with links to its on binaries:</p> <pre><code>alice@localhost:/home/alice$ mkdir -p gdb-symbols/home/ alice@localhost:/home/alice$ ln -s /home/alice gdb-symbols/home/bob alice@localhost:/home/alice$ ln -s /lib gdb-symbols/lib alice@localhost:/home/alice$ ln -s /lib64 gdb-symbols/lib64 [and so forth for every shared library that cannot be found...] </code></pre> <p>And is now able to debug with all symbols loaded:</p> <pre><code>alice@localhost:/home/alice$ gdb [...] (gdb) file helloworld Reading symbols from /home/alice/helloworld...done. (gdb) target remote :2345 Remote debugging using :2345 [...] Reading symbols from /home/alice/gdb-symbols/home/bob/libmylib.so...done. Loaded symbols from /home/alice/gdb-symbols/home/bob/libmylib.so (gdb) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload