2008-08-18 Pedro Alves * remote-mips.c: Include "gdbthread.h". (remote_mips_ptid): New. (common_open): Set inferior_ptid to remote_mips_ptid and add it as a thread to GDB's thread list. (mips_close): Delete remote_mips_ptid from GDB's thread list. (mips_create_inferior): Remove FIXME note. (mips_load): Don't delete symtab users, or reset inferior_ptid. (_initialize_remote_mips): Initialize remote_mips_ptid. --- gdb/remote-mips.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) Index: src/gdb/remote-mips.c =================================================================== --- src.orig/gdb/remote-mips.c 2008-08-17 23:28:19.000000000 +0100 +++ src/gdb/remote-mips.c 2008-08-18 13:09:40.000000000 +0100 @@ -35,6 +35,7 @@ #include "regcache.h" #include #include "mips-tdep.h" +#include "gdbthread.h" /* Breakpoint types. Values 0, 1, and 2 must agree with the watch @@ -450,6 +451,11 @@ struct lsi_error lsi_error_table[] = of warnings returned by PMON when hardware breakpoints are used. */ static int monitor_warnings; +/* This is the ptid we use while we're connected to the remote. Its + value is arbitrary, as the remote-sim target don't have a notion or + processes or threads, but we need something non-null to place in + inferior_ptid. */ +static ptid_t remote_mips_ptid; static void close_ports (void) @@ -1577,6 +1583,9 @@ device is attached to the target board ( /* Try to figure out the processor model if possible. */ deprecated_mips_set_processor_regs_hack (); + inferior_ptid = remote_mips_ptid; + add_thread_silent (remote_mips_ptid); + /* This is really the job of start_remote however, that makes an assumption that the target is about to print out a status message of some sort. That doesn't happen here (in fact, it may not be @@ -1648,6 +1657,8 @@ mips_close (int quitting) close_ports (); } + + delete_thread_silent (remote_mips_ptid); } /* Detach from the remote board. */ @@ -2208,8 +2219,6 @@ Can't pass arguments to remote MIPS boar init_wait_for_inferior (); - /* FIXME: Should we set inferior_ptid here? */ - write_pc (entry_pt); } @@ -3288,16 +3297,6 @@ mips_load (char *file, int from_tty) } if (exec_bfd) write_pc (bfd_get_start_address (exec_bfd)); - - inferior_ptid = null_ptid; /* No process now */ - -/* This is necessary because many things were based on the PC at the time that - we attached to the monitor, which is no longer valid now that we have loaded - new code (and just changed the PC). Another way to do this might be to call - normal_stop, except that the stack may not be valid, and things would get - horribly confused... */ - - clear_symtab_users (); } @@ -3450,4 +3449,8 @@ Use \"on\" to enable the masking and \"o NULL, NULL, /* FIXME: i18n: */ &setlist, &showlist); + + /* Yes, 42000 is arbitrary. The only sense out of it, is that it + isn't 0. */ + remote_mips_ptid = ptid_build (42000, 0, 42000); }