I have discovered from reading https://docs.webkit.org/Build%20%26%20Debug/DebuggingOnTheCommandLine.html that WebKit, like many major projects, has Python scripts for GDB and LLDB to enhance the experience of debugging WebKit. For example the GDB one provides "pretty-printers" for WebKit data structures. This can be found at https://github.com/WebKit/WebKit/blob/main/Tools/gdb/webkit.py and it ought to be available in a Debian package of some kind. This should be installed in a way so that GDB can discover it.
GDB on Debian says
For Python in particular https://sourceware.org/gdb/current/onlinedocs/gdb.html/Python.html says
Therefore this webkit.py file should be available at /usr/share/gdb/python/webkit.py for example. I would double-check if this is still best practice, because as I will describe, other Debian packages handle this differently.
The way that some other Debian packages are doing this is by installing the script so that it has a name corresponding to the shared object it is intended to affect, and therefore GDB can pick up on them:
libc6-dev:amd64: /usr/share/gdb/auto-load/lib/x86_64-linux-gnu/libc.so.6-gdb.py
libgstreamer1.0-dev:amd64: /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.2602.0-gdb.py
libglib2.0-dev:amd64: /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.8400.4-gdb.py
libglib2.0-dev:amd64: /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.8400.4-gdb.py
This convention is documented at https://sourceware.org/gdb/current/onlinedocs/gdb.html/objfile_002dgdbdotext-file.html
An alternative option, to prevent having multiple copies of the same script, is to use a special ELF section in the shared objects to tell GDB about a path that can be used to *access* the Python script in the source tree. This is articulated at https://sourceware.org/gdb/current/onlinedocs/gdb.html/dotdebug_005fgdb_005fscripts-section.html
One could set the .debug_gdb_scripts ELF section to reference Tools/gdb/webkit.py for example, and then someone debugging WebKitGTK on Debian and who has the source tree handy may pick that up. Note that this is less helpful in Debian, as our debuginfod instance isn't capable of serving source files at the moment. It's also possible to use the ELF section to include the GDB script directly, which is appealing since it's not very long on this occasion. (The LLDB code at https://github.com/WebKit/WebKit/tree/main/Tools/lldb looks much more involved.)
Upstream also has a Valgrind suppressions file https://github.com/WebKit/WebKit/blob/main/Tools/Scripts/valgrind/suppressions.txt which will be helpful to folks developing WebKitGTK applications on Debian, and which should likewise be installed at a canonical system-wide location so it can be used easily by folks who don't know they need it yet.
The biggest hurdle here is that none of these files are shipped in the WebKitGTK source tarball that is generated. Perhaps folks using these features so far are mostly doing new development on WebKit itself from a Git checkout, and making these helpers installable by downstream distributors hasn't been a priority. In Debian it's normal to package these files, and we should do so, somehow.