[gdb/testsuite] Refactor gdb.cp/subtypes.exp Make test-case gdb.cp/subtypes.exp less repetitive by using foreach. Tested on x86_64-linux.