You could bind a function like pdb-restart
(which may not exist) to 'R' via something like this:
(define-key gud-mode-map "R" 'pdb-restart)
Though this will really affect all gud sessions. You can always set specific hooks to override this behavior if it is unwanted in other gud sessions.
EDIT:
A better way could be to use pdb-mode-hook
instead of modifying gud-mode-map
:
(add-hook 'pdb-mode-hook '(define-key (current-local-map) "R" 'pdb-restart))
I've tried to restart the pdb session myself and ended up having to write my own command to do it. It first tries to send a nice 'restart' with comint-send-input, but if that doesn't work, it falls back to killing the buffer (along with the underlying pdb process), and restarts the pdb session, using the same directory and arguments as the last started pdb session.
(defun pdb-restart ()
(interactive)
(comint-insert-send "restart")
(sleep-for .5)
(when
(or
(last-lines-match "raise Restart.*
Restart")
(last-lines-match "restart")
(not (get-buffer-process (current-buffer))))
(let ((kill-buffer-query-functions nil );disable confirming for process kill
(pdbcmd (car-safe (symbol-value (gud-symbol 'history nil 'pdb))))
(default-directory default-directory))
(kill-this-buffer)
(cd default-directory)
(pdb pdbcmd)))
(comint-insert-send "n"))