--- gdb.orig/inferior.c +++ gdb/inferior.c @@ -26,6 +26,7 @@ #include "gdbthread.h" #include "ui-out.h" #include "observer.h" +#include "regcache.h" void _initialize_inferiors (void); @@ -1124,6 +1125,29 @@ } void +switch_inferior_command (char *args, int from_tty) +{ + struct inferior *inf; + int pid; + ptid_t ptid; + + /* Get ptid. */ + get_inferior_or_pid (args, &inf, &pid); + if (pid <= 0) + { + printf_unfiltered (_("Can't switch to inferior %s\n"), args); + } + ptid = ptid_build (pid, pid, 0); + + if (ptid_equal (ptid, inferior_ptid)) + return; + + inferior_ptid = ptid; + reinit_frame_cache (); + registers_changed (); +} + +void _initialize_inferiors (void) { add_com ("add-inferior", no_class, add_inferior_command, _("\ @@ -1132,6 +1156,9 @@ add_com ("remove-inferior", no_class, remove_inferior_command, _("\ Remove the inferiors in ITSET.")); + add_com ("switch-inferior", no_class, switch_inferior_command, _("\ +Switch the inferiors in ITSET.")); + add_com ("name-inferior", no_class, name_inferior_command, _("\ Change the name of inferior OLDNAME to NEWNAME.")); --- gdb.orig/linux-nat.c +++ gdb/linux-nat.c @@ -1127,11 +1127,11 @@ { struct lwp_info *lp; - init_lwp_list (); + //init_lwp_list (); lp = add_lwp (new_ptid); lp->stopped = 1; - init_thread_list (); + //init_thread_list (); add_thread_silent (new_ptid); }