OK, I think I found a way to make this work, thanks to a new wiki entry about native package building
1. Download http://www.uclibc.org/downloads/root_fs_mipsel.ext2.bz2
2. Mount it and extract the bits needed
bunzip2 root_fs_mipsel.ext2.bz2
mount -o loop root_fs_mipsel.ext2 /mnt
cd /mnt
tar -czf /tmp/gdbserver.tgz usr/bin/gdbserver lib/libthread_db* lib/libgcc_s*
3. Copy /tmp/gdbserver.tgz to the Openwrt box and untar it at the root directory
ssh root@x.x.x.x 'tar -C / -xvzf -' </tmp/gdbserver.tgz
4. Away you go, as per this thread
Target side:
gdbserver 127.0.0.1:1234 /usr/bin/myprog myargs
Host side:
# cd /path/to/myprog/src
# /path/to/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-gdb ./myprog
gdb> set solib-absolute-prefix /path/to/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel
gdb> target remote x.x.x.x:1234
gdb> cont
In fact, thanks to the hint about 'solib-absolute-prefix', I've managed to get gdb to work with core dumps too:
1. On target: 'ulimit -c unlimited'
2. Run the program, let it dump core, copy the core file to the host
3. On host:
# cd /path/to/myprog/src
# /path/to/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-gdb ./myprog
gdb> set solib-absolute-prefix /path/to/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel
gdb> target core /path/to/core.xxxx
This doesn't require any messing around with gdbserver.
HTH,
Brian.