To execute shell code, you can edit a function's contents directly:
(gdb) b foo
Breakpoint 1 at 0x400608
(gdb) run
Breakpoint 1, 0x0000000000400608 in foo ()
(gdb) x/16bx foo
0x400604 <foo>: 0x55 0x48 0x89 0xe5 0x53 0x48 0x81 0xec
(gdb) set ((unsigned char *)foo)[6] = 0x85
(gdb) x/16bx foo
0x400604 <foo>: 0x55 0x48 0x89 0xe5 0x53 0x48 0x85 0xec
(gdb) cont
I don't know how to execute opcodes from within `gdb`, but you can certainly do whatever you want with registers. For instance, instead of `mov %rbx, %rax` you can use `set $rax = $rbx`:
(gdb) p $rax
$1 = 3671197290184
(gdb) set $rax = $rbx
(gdb) p $rax
$2 = 0
(gdb)