# Linux Kernel Module Cheat

### 5.2. gdbserver libc

Our setup gives you the rare opportunity to step debug libc and other system libraries.

For example in the guest:

    ./gdbserver.sh ./posix/count.out

Then on host:

    ./run-gdb --gdbserver --userland userland/posix/count.c main

and inside GDB:

    break sleep
    continue

And you are now left inside the `sleep` function of our default libc implementation uclibc `libc/unistd/sleep.c`!

You can also step into the `sleep` call:

    step

This is made possible by the GDB command that we use by default:

    set sysroot ${common_buildroot_build_dir}/staging

which automatically finds unstripped shared libraries on the host for us.

See also: https://stackoverflow.com/questions/8611194/debugging-shared-libraries-with-gdbserver/45252113#45252113