Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for debugging with drgn #152

Open
morbidrsa opened this issue Feb 16, 2021 · 3 comments
Open

add support for debugging with drgn #152

morbidrsa opened this issue Feb 16, 2021 · 3 comments
Assignees

Comments

@morbidrsa
Copy link
Collaborator

Drgn (pronounced dragon) is a scriptable run time kernel debugger (drgn documentation, drgn lwn.net article) written in Python.

When debugging kernel problems on test kernels in rapido it is sometimes helpful to runtime inspect kernel data structures without the overhead of attaching gdb to the VM, creating breakpoints and so on.

Unfortunately it is a bit cumbersome to just add a local --include or --install for drgn in a cut script:

diff --git a/cut/fstests_btrfs_zoned.sh b/cut/fstests_btrfs_zoned.sh
index a4c1bb134616..ef7f86fe04b9 100755
--- a/cut/fstests_btrfs_zoned.sh
+++ b/cut/fstests_btrfs_zoned.sh
@@ -19,6 +19,10 @@ _rt_require_dracut_args "$RAPIDO_DIR/autorun/fstests_btrfs_zoned.sh" "$@"
 _rt_require_fstests
 _rt_require_btrfs_progs

+DRGN_BIN_DEPS="python3 drgn"
+PYTHON_LIBS="/usr/lib/python3.8/"
+PYTHON_LIBS64="/usr/lib64/python3.8/"
+
 # wipefs mount
 "$DRACUT" --install "tail blockdev ps rmdir resize dd vim grep find df sha256sum \
                   strace mkfs  free \
@@ -36,9 +40,14 @@ _rt_require_btrfs_progs
                   ${FSTESTS_SRC}/ltp/* ${FSTESTS_SRC}/src/* \
                   ${FSTESTS_SRC}/src/log-writes/* \
                   ${FSTESTS_SRC}/src/aio-dio-regress/*
+                  $DRGN_BIN_DEPS \
                   $BTRFS_PROGS_BINS" \
        --include "$FSTESTS_SRC" "$FSTESTS_SRC" \
+       --include "/usr/lib64/libgomp.so.1" "/usr/lib64/libgomp.so.1" \
+       --include "/usr/lib64/libexpat.so.1" "/usr/lib64/libexpat.so.1" \
        $DRACUT_RAPIDO_INCLUDES \
+       --include "$PYTHON_LIBS" "$PYTHON_LIBS" \
+       --include "$PYTHON_LIBS64" "$PYTHON_LIBS64" \
        --include "$RAPIDO_DIR/wipefs" "/usr/sbin/wipefs" \
        --include "$RAPIDO_DIR/mount" "/usr/sbin/mount" \
        --add-drivers "lzo lzo-rle dm-snapshot dm-flakey btrfs raid6_pq \

so we'd need to create a dracut module and include it if needed.

@morbidrsa morbidrsa self-assigned this Feb 16, 2021
@ddiss
Copy link
Collaborator

ddiss commented Feb 16, 2021

At one stage I remember looking into whether we could get Dracut to "overlay" rapido specific modules atop the distro ones packaged in /usr/lib/dracut/modules.d. Unfortunately Dracut only seems to support all or nothing via the --local parameter.
That said, one option might be to use --local and play some symlink games to include /usr/lib/dracut/modules.d subpaths.

@morbidrsa
Copy link
Collaborator Author

Another version would be to add all the new paths, libraries and bins to a $DRACUT_RAPIDO_DRGN_INCLUDES, might be easier for starters

@ddiss
Copy link
Collaborator

ddiss commented Mar 9, 2021

At one stage I remember looking into whether we could get Dracut to "overlay" rapido specific modules atop the distro ones packaged in /usr/lib/dracut/modules.d. Unfortunately Dracut only seems to support all or nothing via the --local parameter.
That said, one option might be to use --local and play some symlink games to include /usr/lib/dracut/modules.d subpaths.

One thing I found recently while digging through Documentation/driver-api/early-userspace/buffer-format.rst is that the kernel accepts cpio archives which are chained back to back. So we could add support for rapido overlays by just appending to the Dracut archive using the kernel's usr/gen_init_cpio helper binary... Just something to keep in mind :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants