gdb/mi: fix regression in mi -add-inferior command

Prior to the multi-target support commit:

  commit 5b6d1e4fa4
  Date:   Fri Jan 10 20:06:08 2020 +0000

      Multi-target support

When a new inferior was added using the MI -add-inferior command, the
new inferior would be using the same target as all the other
inferiors.  This makes sense, GDB only supported a single target stack
at a time.

After the above commit, each inferior has its own target stack.

To maintain backward compatibility, for the CLI add-inferior command,
when a new inferior is added the above commit has the new inferior
inherit a copy of the target stack from the current inferior.

Unfortunately, this same backward compatibility is missing for the MI.

This commit fixes this oversight.

Now, when the -add-inferior MI command is used, the new inferior will
inherit a copy of the target stack from the current inferior.
This commit is contained in:
Umair Sair
2022-02-24 22:25:51 +05:00
committed by Andrew Burgess
parent cfeab26e4d
commit d43bd54d54
5 changed files with 141 additions and 4 deletions

View File

@@ -759,11 +759,9 @@ add_inferior_with_spaces (void)
return inf;
}
/* Switch to inferior NEW_INF, a new inferior, and unless
NO_CONNECTION is true, push the process_stratum_target of ORG_INF
to NEW_INF. */
/* See inferior.h. */
static void
void
switch_to_inferior_and_push_target (inferior *new_inf,
bool no_connection, inferior *org_inf)
{