⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 050-debian-subset.patch

📁 用于生成linux操作系统下的交叉编译工具链和嵌入式linux系统的根文件系统,支持x86、arm、powerpc等处理器
💻 PATCH
📖 第 1 页 / 共 2 页
字号:
This patch fixes debugging threaded applications which are statically linkedwithout breaking debugging threaded core files.  It also fixes the PIDs ingenerate-core-file'd corefiles.  Mostly.diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c gdb-5.2.debian90.cvs20021120/gdb/corelow.c--- o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c	2002-09-18 13:23:15.000000000 -0400+++ gdb-5.2.debian90.cvs20021120/gdb/corelow.c	2002-12-03 14:03:32.000000000 -0500@@ -350,7 +350,7 @@   bfd_map_over_sections (core_bfd, add_to_thread_list, 			 bfd_get_section_by_name (core_bfd, ".reg")); -  if (ontop)+  if (ontop || 1)     {       /* Fetch all registers from core file.  */       target_fetch_registers (-1);diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c--- o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c	2002-12-03 14:13:52.000000000 -0500+++ gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c	2002-12-03 13:56:34.000000000 -0500@@ -177,7 +177,7 @@ #ifdef FILL_FPXREGSET   gdb_fpxregset_t fpxregs; #endif-  unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);+  unsigned long merged_pid = ptid_get_tid (ptid) << 16; /*  | ptid_get_pid (ptid); */    fill_gregset (&gregs, -1);   note_data = (char *) elfcore_write_prstatus (obfd, diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/target.c gdb-5.2.debian90.cvs20021120/gdb/target.c--- o/gdb-5.2.debian90.cvs20021120/gdb/target.c	2002-09-18 13:23:22.000000000 -0400+++ gdb-5.2.debian90.cvs20021120/gdb/target.c	2002-12-03 14:06:07.000000000 -0500@@ -1589,6 +1589,7 @@   dummy_target.to_find_memory_regions = dummy_find_memory_regions;   dummy_target.to_make_corefile_notes = dummy_make_corefile_notes;   dummy_target.to_magic = OPS_MAGIC;+  cleanup_target (&dummy_target); }  diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c gdb-5.2.debian90.cvs20021120/gdb/thread-db.c--- o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c	2002-12-03 14:13:50.000000000 -0500+++ gdb-5.2.debian90.cvs20021120/gdb/thread-db.c	2002-12-03 13:39:54.000000000 -0500@@ -57,6 +57,31 @@ /* Non-zero if we're using this module's target vector.  */ static int using_thread_db; +/* Macros to pass an event to the next target if we should not be handling it+   here in the thread_stratum.  */+#define FIND_NEXT_TARGET(METHOD_NAME)			\+  struct target_ops *next_target = &thread_db_ops;	\+  while (1)						\+    {							\+      next_target = find_target_beneath (next_target);	\+      if (next_target->METHOD_NAME != NULL)		\+	break;						\+    }++#define MAYBE_HAND_DOWN(METHOD_NAME,ARGS)		\+  if (proc_handle.pid == 0)				\+    {							\+      FIND_NEXT_TARGET (METHOD_NAME);			\+      (*next_target->METHOD_NAME) ARGS;			\+      return;						\+    }+#define MAYBE_HAND_DOWN_RETURN(METHOD_NAME,ARGS)	\+  if (proc_handle.pid == 0)				\+    {							\+      FIND_NEXT_TARGET (METHOD_NAME);			\+      return (*next_target->METHOD_NAME) ARGS;		\+    }+ /* Non-zero if we have to keep this module's target vector active    across re-runs.  */ static int keep_thread_db;@@ -489,9 +514,7 @@ {   td_err_e err; -  /* Don't attempt to use thread_db on targets which can not run-     (core files).  */-  if (objfile == NULL || !target_has_execution)+  if (objfile == NULL)     {       /* All symbols have been discarded.  If the thread_db target is          active, deactivate it now.  */@@ -515,7 +538,10 @@   /* Initialize the structure that identifies the child process.  Note      that at this point there is no guarantee that we actually have a      child process.  */-  proc_handle.pid = GET_PID (inferior_ptid);+  if (target_has_execution)+    proc_handle.pid = GET_PID (inferior_ptid);+  else+    proc_handle.pid = 0;    /* Now attempt to open a connection to the thread library.  */   err = td_ta_new_p (&proc_handle, &thread_agent);@@ -758,6 +784,9 @@   struct cleanup *old_chain = save_inferior_ptid ();   int xfer; +  MAYBE_HAND_DOWN_RETURN (to_xfer_memory, (memaddr, myaddr, len, write,+					   attrib, target));+   if (is_thread (inferior_ptid))     {       /* FIXME: This seems to be necessary to make sure breakpoints@@ -782,6 +811,8 @@   gdb_prfpregset_t fpregset;   td_err_e err; +  MAYBE_HAND_DOWN (to_fetch_registers, (regno));+   if (!is_thread (inferior_ptid))     {       /* Pass the request to the target beneath us.  */@@ -819,6 +850,8 @@   gdb_prfpregset_t fpregset;   td_err_e err; +  MAYBE_HAND_DOWN (to_store_registers, (regno));+   if (!is_thread (inferior_ptid))     {       /* Pass the request to the target beneath us.  */@@ -908,6 +941,8 @@   td_thrinfo_t ti;   td_err_e err; +  MAYBE_HAND_DOWN_RETURN (to_thread_alive, (ptid));+   if (is_thread (ptid))     {       err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);@@ -961,6 +996,8 @@ {   td_err_e err; +  MAYBE_HAND_DOWN (to_find_new_threads, ());+   /* Iterate over all user-space threads to discover new threads.  */   err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL, 			  TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,@@ -972,6 +1009,8 @@ static char * thread_db_pid_to_str (ptid_t ptid) {+  MAYBE_HAND_DOWN_RETURN (to_pid_to_str, (ptid));+   if (is_thread (ptid))     {       static char buf[64];Trivial.  Need to submit this.--- gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c.orig	2002-12-03 14:35:44.000000000 -0500+++ gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c	2002-12-03 14:43:02.000000000 -0500@@ -861,6 +861,8 @@       else 	line = gdb_readline (0); +      if (line == NULL || *line == EOF)+	break;       linetype = validate_actionline (&line, t);       if (linetype == BADLINE) 	continue;		/* already warned -- collect another line */Fix build on Sparc.--- gdb-5.3/gdb/sparc-nat.c.orig	2003-01-04 00:11:28.000000000 -0500+++ gdb-5.3/gdb/sparc-nat.c	2003-01-04 00:12:42.000000000 -0500@@ -33,6 +33,13 @@ #include <sys/ptrace.h> #include <sys/wait.h> #ifdef __linux__+/* Sadly, <sys/ucontext.h> conflicts with <asm/reg.h> on Linux.  And+   -D_GNU_SOURCE brings in <sys/ucontext.h> implicitly with <signal.h>.+   Hack around this.  */+#undef FPU_REGS_TYPE+#define fpu asm_reg_fpu+#define fq asm_reg_fq+#define fpq asm_reg_fpq #include <asm/reg.h> #else #include <machine/reg.h>diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c--- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c	2002-07-09 11:38:58.000000000 -0600+++ gdb-5.3/gdb/gdbserver/gdbreplay.c	2003-08-20 08:44:20.000000000 -0600@@ -54,14 +54,15 @@ perror_with_name (char *string) { #ifndef STDC_HEADERS-  extern int sys_nerr;   extern char *sys_errlist[];   extern int errno; #endif   const char *err;   char *combined; -  err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";+  err = strerror (errno);+  if (err == NULL)+    err = "unknown error";   combined = (char *) alloca (strlen (err) + strlen (string) + 3);   strcpy (combined, string);   strcat (combined, ": ");diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c--- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c	2002-01-17 14:13:49.000000000 -0700+++ gdb-5.3/gdb/gdbserver/low-hppabsd.c	2003-08-20 08:46:04.000000000 -0600@@ -61,7 +61,7 @@       execv (program, allargs);        fprintf (stderr, "Cannot exec %s: %s.\n", program,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");+	       strerror (errno));       fflush (stderr);       _exit (0177);     }diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c--- gdb-5.3/gdb/gdbserver.orig/low-lynx.c	2002-01-17 14:13:49.000000000 -0700+++ gdb-5.3/gdb/gdbserver/low-lynx.c	2003-08-20 08:46:18.000000000 -0600@@ -79,7 +79,7 @@        fprintf (stderr, "GDBserver (process %d):  Cannot exec %s: %s.\n", 	       getpid (), program,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");+	       strerror (errno));       fflush (stderr);       _exit (0177);     }diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c--- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c	2002-01-17 14:13:49.000000000 -0700+++ gdb-5.3/gdb/gdbserver/low-nbsd.c	2003-08-20 08:46:27.000000000 -0600@@ -137,7 +137,7 @@       execv (program, allargs);        fprintf (stderr, "Cannot exec %s: %s.\n", program,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");+	       strerror (errno));       fflush (stderr);       _exit (0177);     }diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c--- gdb-5.3/gdb/gdbserver.orig/low-sparc.c	2002-01-17 14:13:50.000000000 -0700+++ gdb-5.3/gdb/gdbserver/low-sparc.c	2003-08-20 08:46:38.000000000 -0600@@ -44,7 +44,6 @@ #include <sys/ptrace.h> #include <sys/reg.h> -extern int sys_nerr; extern char **sys_errlist; extern int errno; @@ -67,7 +66,7 @@       execv (program, allargs);        fprintf (stderr, "Cannot exec %s: %s.\n", program,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");+	       strerror (errno));       fflush (stderr);       _exit (0177);     }diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c--- gdb-5.3/gdb/gdbserver.orig/low-sun3.c	2002-01-17 14:13:50.000000000 -0700+++ gdb-5.3/gdb/gdbserver/low-sun3.c	2003-08-20 08:46:51.000000000 -0600@@ -41,7 +41,6 @@ #include <sys/ptrace.h> #include <machine/reg.h> -extern int sys_nerr; extern char **sys_errlist; extern int errno; @@ -64,7 +63,7 @@       execv (program, allargs);        fprintf (stderr, "Cannot exec %s: %s.\n", program,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error");+	       strerror (errno));       fflush (stderr);       _exit (0177);     }diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c--- gdb-5.3/gdb/gdbserver.orig/utils.c	2003-08-20 08:47:56.000000000 -0600+++ gdb-5.3/gdb/gdbserver/utils.c	2003-08-20 08:48:15.000000000 -0600@@ -33,16 +33,13 @@ perror_with_name (char *string) { #ifndef STDC_HEADERS-  extern int sys_nerr;-  extern char *sys_errlist[];   extern int errno; #endif   const char *err;   char *combined; -  if (errno < sys_nerr)-    err = sys_errlist[errno];-  else+  err = strerror (errno);+  if (err == NULL)     err = "unknown error";    combined = (char *) alloca (strlen (err) + strlen (string) + 3);diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig--- gdb-5.3/gdb/gdbserver.orig/linux-low.c	2003-08-20 08:40:27.000000000 -0600+++ gdb-5.3/gdb/gdbserver/linux-low.c	2003-08-20 08:44:54.000000000 -0600@@ -175,8 +175,7 @@   if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)     {       fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid,-	       errno < sys_nerr ? sys_errlist[errno] : "unknown error",-	       errno);+	       strerror (errno), errno);       fflush (stderr);        /* If we fail to attach to an LWP, just return.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -