2003-06-19 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Thu, 19 Jun 2003 22:52:04 +0000 (22:52 +0000)
committerMichael Snyder <msnyder@vmware.com>
Thu, 19 Jun 2003 22:52:04 +0000 (22:52 +0000)
* linux-nat.h: New file.
* linux-nat.c: Include linux-nat.h.
* lin-lwp.c: Include linux-nat.h.
Move struct lwp_info def to linux-nat.h.
* linux-proc.c: Include linux-nat.h.
(linux_make_note_section): Iterate over lwps instead of threads.
(linux_do_thread_registers): Use lwp instead of merged pid.
* config/nm-linux.h: Move miscelaneous def'ns to linux-nat.h.
* Makefile.in (lin-lwp.o, linux-proc.o, linux-nat.o):
Add dependency on linux_nat_h.

gdb/ChangeLog
gdb/Makefile.in
gdb/config/nm-linux.h
gdb/lin-lwp.c
gdb/linux-nat.c
gdb/linux-nat.h [new file with mode: 0644]
gdb/linux-proc.c

index 1e07f8b4e1e6d73ea7f5139f38ab14b0f4d8f068..c43feaa96385c11aaf98472c70120947794f3264 100644 (file)
@@ -1,3 +1,16 @@
+2003-06-19  Michael Snyder  <msnyder@redhat.com>
+
+       * linux-nat.h: New file.
+       * linux-nat.c: Include linux-nat.h.
+       * lin-lwp.c: Include linux-nat.h.  
+       Move struct lwp_info def to linux-nat.h.
+       * linux-proc.c: Include linux-nat.h.  
+       (linux_make_note_section): Iterate over lwps instead of threads.
+       (linux_do_thread_registers): Use lwp instead of merged pid.
+       * config/nm-linux.h: Move miscelaneous def'ns to linux-nat.h.
+       * Makefile.in (lin-lwp.o, linux-proc.o, linux-nat.o): 
+       Add dependency on linux_nat_h.
+
 2003-06-19  Theodore A. Roth  <troth@openavr.org>
 
        * avr-tdep.c (avr_extract_return_value): Delete debugging fprintf.
index 6dcd7b7fb04589beb26604e94ae855e4e27d498a..bd4f6cd9af0d48763ab5f565c086cd62e2d68afa 100644 (file)
@@ -685,6 +685,7 @@ jv_lang_h = jv-lang.h
 kod_h = kod.h
 language_h = language.h
 linespec_h = linespec.h
+linux_nat_h = linux-nat.h
 m2_lang_h = m2-lang.h
 m68k_tdep_h = m68k-tdep.h
 macroexp_h = macroexp.h
@@ -1912,14 +1913,16 @@ language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
        $(parser_defs_h) $(jv_lang_h) $(demangle_h)
 lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
-       $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
+       $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) \
+       $(linux_nat_h)
 linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
        $(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
        $(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) $(objc_lang_h)
-linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_wait_h)
+linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_wait_h) \
+       $(linux_nat_h)
 linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
-       $(cli_decode_h) $(gdb_string_h)
+       $(cli_decode_h) $(gdb_string_h) $(linux_nat_h)
 lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
        $(gdbcore_h) $(regcache_h)
 m2-lang.o: m2-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
index e4ac629aad4532803e5e747d721a387f1f05bafa..9a04cf71cf19a75c317a18ba8f5152a834750e89 100644 (file)
@@ -70,13 +70,6 @@ extern void lin_thread_get_thread_signals (sigset_t *mask);
 /* Override child_pid_to_exec_file in 'inftarg.c'.  */
 #define CHILD_PID_TO_EXEC_FILE
 
-struct mem_attrib;
-extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len,
-                                  int write, struct mem_attrib *attrib,
-                                  struct target_ops *target);
-
-extern void linux_record_stopped_pid (int pid);
-
 #define CHILD_INSERT_FORK_CATCHPOINT
 #define CHILD_INSERT_VFORK_CATCHPOINT
 #define CHILD_INSERT_EXEC_CATCHPOINT
index 30dbd96f7ce077941ac49f90566a9724469419a7..a82adb7ea2a4dee39dd047bf4e210011635fe7be 100644 (file)
@@ -40,6 +40,8 @@
 static int debug_lin_lwp;
 extern char *strsignal (int sig);
 
+#include "linux-nat.h"
+
 /* On GNU/Linux there are no real LWP's.  The closest thing to LWP's
    are processes sharing the same VM space.  A multi-threaded process
    is basically a group of such processes.  However, such a grouping
@@ -73,43 +75,6 @@ extern char *strsignal (int sig);
      threads will run out of processes, even if the threads exit,
      because the "zombies" stay around.  */
 
-/* Structure describing a LWP.  */
-struct lwp_info
-{
-  /* The process id of the LWP.  This is a combination of the LWP id
-     and overall process id.  */
-  ptid_t ptid;
-
-  /* Non-zero if this LWP is cloned.  In this context "cloned" means
-     that the LWP is reporting to its parent using a signal other than
-     SIGCHLD.  */
-  int cloned;
-
-  /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
-     it back yet).  */
-  int signalled;
-
-  /* Non-zero if this LWP is stopped.  */
-  int stopped;
-
-  /* Non-zero if this LWP will be/has been resumed.  Note that an LWP
-     can be marked both as stopped and resumed at the same time.  This
-     happens if we try to resume an LWP that has a wait status
-     pending.  We shouldn't let the LWP run until that wait status has
-     been processed, but we should not report that wait status if GDB
-     didn't try to let the LWP run.  */
-  int resumed;
-
-  /* If non-zero, a pending wait status.  */
-  int status;
-
-  /* Non-zero if we were stepping this LWP.  */
-  int step;
-
-  /* Next LWP in list.  */
-  struct lwp_info *next;
-};
-
 /* List of known LWPs.  */
 static struct lwp_info *lwp_list;
 
index bef737b92a9bbcf178d3c059e28bca69b2fe8395..61931c6d58faa34c1219a7827aa5493d764ee700 100644 (file)
@@ -25,6 +25,8 @@
 #include "gdb_wait.h"
 #include <sys/ptrace.h>
 
+#include "linux-nat.h"
+
 /* If the system headers did not provide the constants, hard-code the normal
    values.  */
 #ifndef PTRACE_EVENT_FORK
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
new file mode 100644 (file)
index 0000000..78312d7
--- /dev/null
@@ -0,0 +1,70 @@
+/* Native debugging support for GNU/Linux (LWP layer).
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Structure describing an LWP.  */
+
+struct lwp_info
+{
+  /* The process id of the LWP.  This is a combination of the LWP id
+     and overall process id.  */
+  ptid_t ptid;
+
+  /* Non-zero if this LWP is cloned.  In this context "cloned" means
+     that the LWP is reporting to its parent using a signal other than
+     SIGCHLD.  */
+  int cloned;
+
+  /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
+     it back yet).  */
+  int signalled;
+
+  /* Non-zero if this LWP is stopped.  */
+  int stopped;
+
+  /* Non-zero if this LWP will be/has been resumed.  Note that an LWP
+     can be marked both as stopped and resumed at the same time.  This
+     happens if we try to resume an LWP that has a wait status
+     pending.  We shouldn't let the LWP run until that wait status has
+     been processed, but we should not report that wait status if GDB
+     didn't try to let the LWP run.  */
+  int resumed;
+
+  /* If non-zero, a pending wait status.  */
+  int status;
+
+  /* Non-zero if we were stepping this LWP.  */
+  int step;
+
+  /* Next LWP in list.  */
+  struct lwp_info *next;
+};
+
+/* Read/write to target memory via Linux's "proc file system".  */
+struct mem_attrib;
+extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len,
+                                  int write, struct mem_attrib *attrib,
+                                  struct target_ops *target);
+
+extern void linux_record_stopped_pid (int pid);
+
+/* Iterator function for lin-lwp's lwp list.  */
+struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *, 
+                                                    void *), 
+                                   void *data);
index a9512964dab71e7956c349948c9e27ddff95d7bc..e4ea747008b80d9329f79aad501329b55cf18f31 100644 (file)
@@ -35,6 +35,8 @@
 #include "cli/cli-decode.h"    /* for add_info */
 #include "gdb_string.h"
 
+#include "linux-nat.h"
+
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
 #endif
@@ -171,13 +173,13 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid,
 #ifdef FILL_FPXREGSET
   gdb_fpxregset_t fpxregs;
 #endif
-  unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
+  unsigned long lwp = ptid_get_lwp (ptid);
 
   fill_gregset (&gregs, -1);
   note_data = (char *) elfcore_write_prstatus (obfd,
                                               note_data,
                                               note_size,
-                                              merged_pid,
+                                              lwp,
                                               stop_signal, &gregs);
 
   fill_fpregset (&fpregs, -1);
@@ -210,7 +212,7 @@ struct linux_corefile_thread_data
  */
 
 static int
-linux_corefile_thread_callback (struct thread_info *ti, void *data)
+linux_corefile_thread_callback (struct lwp_info *ti, void *data)
 {
   struct linux_corefile_thread_data *args = data;
   ptid_t saved_ptid = inferior_ptid;
@@ -268,7 +270,7 @@ linux_make_note_section (bfd *obfd, int *note_size)
   thread_args.note_data = note_data;
   thread_args.note_size = note_size;
   thread_args.num_notes = 0;
-  iterate_over_threads (linux_corefile_thread_callback, &thread_args);
+  iterate_over_lwps (linux_corefile_thread_callback, &thread_args);
   if (thread_args.num_notes == 0)
     {
       /* iterate_over_threads didn't come up with any threads;
This page took 0.033953 seconds and 4 git commands to generate.