if (is_thread (inferior_ptid) ||	 !target_thread_alive (inferior_ptid))	 inferior_ptid = procfs_first_available ();
if (is_thread (inferior_ptid) || !target_thread_alive (inferior_ptid)) {  inferior_ptid = procfs_first_available (); }
rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,	   char *buf, int size){  struct cleanup *old_chain;  old_chain = save_inferior_ptid ();  if (is_thread (inferior_ptid) ||	/* A thread */      !target_thread_alive (inferior_ptid))	/* An lwp, but not alive */    inferior_ptid = procfs_first_available ();	/* Find any live lwp.  */  /* Note: don't need to call switch_to_thread; we're just reading memory.  */#if defined (__sparcv9)  /* For Sparc64 cross Sparc32, make sure the address has not been     accidentally sign-extended (or whatever) to beyond 32 bits.  */  if (bfd_get_arch_size (exec_bfd) == 32)    addr &= 0xffffffff;#endif  while (size > 0)    {      int cc;      /* FIXME: passing 0 as attrib argument.  */      if (target_has_execution)	cc = procfs_ops.to_xfer_memory (addr, buf, size,					dowrite, 0, &procfs_ops);      else	cc = orig_core_ops.to_xfer_memory (addr, buf, size,					   dowrite, 0, &core_ops);      if (cc < 0)	{	  if (dowrite == 0)	    print_sys_errmsg ("rw_common (): read", errno);	  else	    print_sys_errmsg ("rw_common (): write", errno);	  do_cleanups (old_chain);	  return PS_ERR;	}      else if (cc == 0)	{	  if (dowrite == 0)	    warning ("rw_common (): unable to read at addr 0x%lx",		     (long) addr);	  else	    warning ("rw_common (): unable to write at addr 0x%lx",		     (long) addr);	  do_cleanups (old_chain);	  return PS_ERR;	}      size -= cc;      buf += cc;    }  do_cleanups (old_chain);  return PS_OK;}