* inferiors.c (struct thread_info): Add gdb_id.
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-low.c
index 9e94addd8cea3e21ac77a127ac1ecabefd8f3cd7..aefec5e4bfd59353ddc0c90af915fdcb5d3f29a4 100644 (file)
@@ -160,7 +160,7 @@ linux_create_inferior (char *program, char **allargs)
     }
 
   new_process = add_process (pid);
-  add_thread (pid, new_process);
+  add_thread (pid, new_process, pid);
 
   return pid;
 }
@@ -185,7 +185,7 @@ linux_attach_lwp (unsigned long pid, unsigned long tid)
     }
 
   new_process = (struct process_info *) add_process (pid);
-  add_thread (tid, new_process);
+  add_thread (tid, new_process, pid);
 
   /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH
      brings it to a halt.  We should ignore that SIGSTOP and resume the process
@@ -667,7 +667,7 @@ retry:
      then we need to make sure we restart the other threads.  We could
      pick a thread at random or restart all; restarting all is less
      arbitrary.  */
-  if (cont_thread > 0)
+  if (cont_thread != 0 && cont_thread != -1)
     {
       child = (struct thread_info *) find_inferior_id (&all_threads,
                                                       cont_thread);
@@ -1126,7 +1126,12 @@ fetch_register (int regno)
          goto error_exit;
        }
     }
-  supply_register (regno, buf);
+  if (the_low_target.left_pad_xfer
+      && register_size (regno) < sizeof (PTRACE_XFER_TYPE))
+    supply_register (regno, (buf + sizeof (PTRACE_XFER_TYPE)
+                            - register_size (regno)));
+  else
+    supply_register (regno, buf);
 
 error_exit:;
 }
@@ -1168,7 +1173,12 @@ usr_store_inferior_registers (int regno)
             & - sizeof (PTRACE_XFER_TYPE);
       buf = alloca (size);
       memset (buf, 0, size);
-      collect_register (regno, buf);
+      if (the_low_target.left_pad_xfer
+         && register_size (regno) < sizeof (PTRACE_XFER_TYPE))
+       collect_register (regno, (buf + sizeof (PTRACE_XFER_TYPE)
+                                 - register_size (regno)));
+      else
+       collect_register (regno, buf);
       for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
        {
          errno = 0;
@@ -1435,7 +1445,7 @@ linux_send_signal (int signum)
 {
   extern unsigned long signal_pid;
 
-  if (cont_thread > 0)
+  if (cont_thread != 0 && cont_thread != -1)
     {
       struct process_info *process;
 
This page took 0.043891 seconds and 4 git commands to generate.