kgdb: Tweak to avoid extra inferior
authorJohn Marino <draco@marino.st>
Tue, 12 Jul 2011 22:57:53 +0000 (00:57 +0200)
committerJohn Marino <draco@marino.st>
Thu, 1 Sep 2011 17:51:47 +0000 (19:51 +0200)
Since one inferior exists when kgdb launches, the code was changed to
update the pid of the first inferior rather than to add it outright.

gnu/usr.bin/gdb/kgdb/trgt.c

index 4458833..d9516d3 100644 (file)
@@ -130,14 +130,16 @@ kgdb_trgt_open(char *filename, int from_tty)
        kt = kgdb_thr_init();
        while (kt != NULL) {
                if (!in_inferior_list(kt->pid)) {
-                     inf8 = add_inferior(kt->pid);
                      if (first_inferior) {
                        first_inferior = 0;
-                       set_current_inferior (inf8);
+                       inf8 = current_inferior();
+                       inf8->pid = kt->pid;
+                       inferior_appeared (inf8, kt->pid);
                        pspace = current_program_space;
                        pspace->ebfd = 0;
                        pspace->ebfd_mtime = 0;
                      } else {                    
+                       inf8 = add_inferior(kt->pid);
                        pspace = add_program_space(new_address_space());
                        pspace->symfile_object_file = symfile_objfile;
                        pspace->objfiles = object_files;