scripts/gdb: convert ModuleList to generator function