Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] nto target update
@ 2007-11-08 15:48 Aleksandar Ristovski
  2007-11-08 20:51 ` Ulrich Weigand
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandar Ristovski @ 2007-11-08 15:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ryan Mansfield, Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

Nto target has been maintained in our private branch and hasn't been
synchronized with mainstream for a while.
As a result, nto target does not compile. This patch brings it up-to date.

Thank you,

Aleksandar Ristovski



ChangeLog:

2007-11-07  Aleksandar Ristovski <aristovski@qnx.com>

	Update for nto target.

	* i386-nto-tdep.c: Update.
	* nto-procfs.c: Update.
	* nto-tdep.c: Update.
	* nto-tdep.h: Update.


------
Attachments are virus free!

This message has been scanned for viruses at the originating end by
Nemx Anti-Virus for MS Exchange Server/IMC
	http://www.nemx.com/products/antivirus

  


[-- Attachment #2: nto.patch --]
[-- Type: application/octet-stream, Size: 21203 bytes --]

Index: gdb/i386-nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nto-tdep.c,v
retrieving revision 1.27
diff -u -p -r1.27 i386-nto-tdep.c
--- gdb/i386-nto-tdep.c	24 Oct 2007 21:18:51 -0000	1.27
+++ gdb/i386-nto-tdep.c	8 Nov 2007 15:38:05 -0000
@@ -217,21 +217,20 @@ i386nto_sigtramp_p (struct frame_info *n
   return name && strcmp ("__signalstub", name) == 0;
 }
 
-#define I386_NTO_SIGCONTEXT_OFFSET 136
-
 /* Assuming NEXT_FRAME is a frame following a QNX Neutrino sigtramp
    routine, return the address of the associated sigcontext structure.  */
 
 static CORE_ADDR
 i386nto_sigcontext_addr (struct frame_info *next_frame)
 {
-  char buf[4];
-  CORE_ADDR sp;
-
-  frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
-  sp = extract_unsigned_integer (buf, 4);
+  CORE_ADDR ptrctx;
 
-  return sp + I386_NTO_SIGCONTEXT_OFFSET;
+  /* we store __ucontext_t addr in EDI register */
+  ptrctx = frame_unwind_register_unsigned (next_frame, 
+  				I386_EDI_REGNUM);
+  ptrctx += 24 /* context pointer is at this offset */;
+  nto_trace(0) ("sigcontext addr=0x%s\n", paddr(ptrctx));
+  return ptrctx;
 }
 
 static void
@@ -270,8 +269,8 @@ i386nto_init_abi (struct gdbarch_info in
 
   tdep->sigtramp_p = i386nto_sigtramp_p;
   tdep->sigcontext_addr = i386nto_sigcontext_addr;
-  tdep->sc_pc_offset = 56;
-  tdep->sc_sp_offset = 68;
+  tdep->sc_reg_offset = i386nto_gregset_reg_offset;
+  tdep->sc_num_regs = ARRAY_SIZE (i386nto_gregset_reg_offset); 
 
   /* Setjmp()'s return PC saved in EDX (5).  */
   tdep->jb_pc_offset = 20;	/* 5x32 bit ints in.  */
Index: gdb/nto-procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-procfs.c,v
retrieving revision 1.25
diff -u -p -r1.25 nto-procfs.c
--- gdb/nto-procfs.c	23 Aug 2007 18:08:36 -0000	1.25
+++ gdb/nto-procfs.c	8 Nov 2007 15:38:07 -0000
@@ -61,7 +61,7 @@ static int procfs_can_run (void);
 
 static ptid_t procfs_wait (ptid_t, struct target_waitstatus *);
 
-static int procfs_xfer_memory (CORE_ADDR, char *, int, int,
+static int procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
 			       struct mem_attrib *attrib,
 			       struct target_ops *);
 
@@ -634,8 +634,13 @@ procfs_wait (ptid_t ptid, struct target_
   devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0);
   while (!(status.flags & _DEBUG_FLAG_ISTOP))
     {
+      int sigwaitres;
       ofunc = (void (*)()) signal (SIGINT, nto_interrupt);
-      sigwaitinfo (&set, &info);
+      sigwaitres = sigwaitinfo (&set, &info);
+      if (sigwaitres == -1)
+        {
+	  internal_error (__FILE__, __LINE__ - 3, "sigwaitres failed with errno: %d\n", errno);
+        }
       signal (SIGINT, ofunc);
       devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0);
     }
@@ -744,7 +749,7 @@ procfs_fetch_registers (struct regcache 
    doesn't allow memory operations to cross below us in the target stack
    anyway.  */
 static int
-procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+procfs_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int dowrite,
 		    struct mem_attrib *attrib, struct target_ops *target)
 {
   int nbytes = 0;
@@ -798,6 +803,8 @@ procfs_breakpoint (CORE_ADDR addr, int t
 {
   procfs_break brk;
 
+  nto_trace (0) ("%s (addr=%s, type=%d, size=%d)\n", __func__, paddr (addr), type, size);
+
   brk.type = type;
   brk.addr = addr;
   brk.size = size;
@@ -838,6 +845,8 @@ procfs_resume (ptid_t ptid, int step, en
 {
   int signal_to_pass;
   procfs_status status;
+  void *pvoid;
+  sigset_t *psigset;
 
   if (ptid_equal (inferior_ptid, null_ptid))
     return;
@@ -849,17 +858,21 @@ procfs_resume (ptid_t ptid, int step, en
   if (step)
     run.flags |= _DEBUG_RUN_STEP;
 
-  sigemptyset ((sigset_t *) &run.fault);
-  sigaddset ((sigset_t *) &run.fault, FLTBPT);
-  sigaddset ((sigset_t *) &run.fault, FLTTRACE);
-  sigaddset ((sigset_t *) &run.fault, FLTILL);
-  sigaddset ((sigset_t *) &run.fault, FLTPRIV);
-  sigaddset ((sigset_t *) &run.fault, FLTBOUNDS);
-  sigaddset ((sigset_t *) &run.fault, FLTIOVF);
-  sigaddset ((sigset_t *) &run.fault, FLTIZDIV);
-  sigaddset ((sigset_t *) &run.fault, FLTFPE);
+  pvoid = (void*)&run.fault;
+
+  psigset = (sigset_t *) pvoid;
+
+  sigemptyset (psigset);
+  sigaddset (psigset, FLTBPT);
+  sigaddset (psigset, FLTTRACE);
+  sigaddset (psigset, FLTILL);
+  sigaddset (psigset, FLTPRIV);
+  sigaddset (psigset, FLTBOUNDS);
+  sigaddset (psigset, FLTIOVF);
+  sigaddset (psigset, FLTIZDIV);
+  sigaddset (psigset, FLTFPE);
   /* Peter V will be changing this at some point.  */
-  sigaddset ((sigset_t *) &run.fault, FLTPAGE);
+  sigaddset (psigset, FLTPAGE);
 
   run.flags |= _DEBUG_RUN_ARM;
 
Index: gdb/nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.c,v
retrieving revision 1.21
diff -u -p -r1.21 nto-tdep.c
--- gdb/nto-tdep.c	23 Aug 2007 18:08:36 -0000	1.21
+++ gdb/nto-tdep.c	8 Nov 2007 15:38:07 -0000
@@ -19,6 +19,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "gdb_assert.h"
 #include "gdb_stat.h"
 #include "gdb_string.h"
 #include "nto-tdep.h"
@@ -33,19 +34,17 @@
 #include "gdbcore.h"
 #include "objfiles.h"
 
+#include "gdbcmd.h"
+
 #include <string.h>
 
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>
 #endif
 
-#ifdef __CYGWIN__
-static char default_nto_target[] = "C:\\QNXsdk\\target\\qnx6";
-#elif defined(__sun__) || defined(linux)
-static char default_nto_target[] = "/opt/QNXsdk/target/qnx6";
-#else
+#define link_map 	so_map
+
 static char default_nto_target[] = "";
-#endif
 
 struct nto_target_ops current_nto_target;
 
@@ -69,6 +68,7 @@ nto_target (void)
 void
 nto_set_target (struct nto_target_ops *targ)
 {
+  nto_trace (0) ("%s ()\n", __func__);
   nto_regset_id = targ->regset_id;
   nto_supply_gregset = targ->supply_gregset;
   nto_supply_fpregset = targ->supply_fpregset;
@@ -106,6 +106,7 @@ nto_find_and_open_solib (char *solib, un
 #define PATH_FMT "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
 
   nto_root = nto_target ();
+  nto_trace (0) ("%s (..) nto_root: %s\n", __func__, nto_root);
   if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
@@ -154,7 +155,12 @@ nto_find_and_open_solib (char *solib, un
 	  if (ret >= 0)
 	    *temp_pathname = gdb_realpath (arch_path);
 	  else
-	    **temp_pathname = '\0';
+	    {
+	      if (*temp_pathname)
+	        **temp_pathname = '\0';
+	      else
+	        *temp_pathname = "";
+	    }
 	}
     }
   return ret;
@@ -192,10 +198,19 @@ nto_init_solib_absolute_prefix (void)
 
   sprintf (buf, "set solib-absolute-prefix %s", arch_path);
   execute_command (buf, 0);
+
+#if defined (__MINGW32__)
+#define PATH_SEP ";"
+#else
+#define PATH_SEP ":"
+#endif
+
+  sprintf (buf, "set solib-search-path %s/%s" PATH_SEP "%s/%s", arch_path, "lib", arch_path, "usr/lib");
+  execute_command (buf, 0);
 }
 
 char **
-nto_parse_redirection (char *pargv[], char **pin, char **pout, char **perr)
+nto_parse_redirection (char *pargv[], const char **pin, const char **pout, const char **perr)
 {
   char **argv;
   char *in, *out, *err, *p;
@@ -247,6 +262,32 @@ nto_parse_redirection (char *pargv[], ch
   return argv;
 }
 
+struct link_map_offsets *
+nto_generic_svr4_fetch_link_map_offsets (void)
+{
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = NULL;
+
+  if (lmp == NULL)
+    {
+      lmp = &lmo;
+
+      lmo.r_map_offset = 4;
+
+      lmo.link_map_size = 20;	/* The actual size is 552 bytes, but
+				   this is all we need.  */
+      lmo.l_addr_offset = 0;
+
+      lmo.l_name_offset = 4;
+
+      lmo.l_next_offset = 12;
+
+      lmo.l_prev_offset = 16;
+    }
+
+  return lmp;
+}
+
 /* The struct lm_info, LM_ADDR, and nto_truncate_ptr are copied from
    solib-svr4.c to support nto_relocate_section_addresses
    which is different from the svr4 version.  */
@@ -259,14 +300,23 @@ struct lm_info
   char *lm;
 };
 
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+#endif
+#define fieldsize(TYPE, MEMBER) (sizeof (((TYPE *)0)->MEMBER))
+
 static CORE_ADDR
-LM_ADDR (struct so_list *so)
+LM_ADDR_FROM_LINK_MAP (struct so_list *so)
 {
   struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
 
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm +
-					     lmo->l_addr_offset,
-					     lmo->l_addr_size);
+  gdb_byte *buf = so->lm_info->lm + lmo->l_addr_offset;
+  if (NULL == buf)
+    {
+      return 0;
+    }
+  return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+               builtin_type_void_data_ptr);
 }
 
 static CORE_ADDR
@@ -307,8 +357,8 @@ nto_relocate_section_addresses (struct s
   Elf_Internal_Phdr *phdr = find_load_phdr (sec->bfd);
   unsigned vaddr = phdr ? phdr->p_vaddr : 0;
 
-  sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR (so) - vaddr);
-  sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr);
+  sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR_FROM_LINK_MAP (so) - vaddr);
+  sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR_FROM_LINK_MAP (so) - vaddr);
 }
 
 /* This is cheating a bit because our linker code is in libc.so.  If we
@@ -356,6 +406,184 @@ nto_elf_osabi_sniffer (bfd *abfd)
   return GDB_OSABI_UNKNOWN;
 }
 
+char *
+nto_target_extra_thread_info (struct thread_info *ti)
+{
+  if (ti && ti->private && ti->private->name[0])
+    return ti->private->name;
+  return "";
+}
+
+#ifndef __QNXNTO__
+
+#define NTO_SIGHUP      1   /* hangup */
+#define NTO_SIGINT      2   /* interrupt */
+#define NTO_SIGQUIT     3   /* quit */
+#define NTO_SIGILL      4   /* illegal instruction (not reset when caught) */
+#define NTO_SIGTRAP     5   /* trace trap (not reset when caught) */
+#define NTO_SIGIOT      6   /* IOT instruction */
+#define NTO_SIGABRT     6   /* used by abort */
+#define NTO_SIGEMT      7   /* EMT instruction */
+#define NTO_SIGDEADLK   7   /* Mutex deadlock */
+#define NTO_SIGFPE      8   /* floating point exception */
+#define NTO_SIGKILL     9   /* kill (cannot be caught or ignored) */
+#define NTO_SIGBUS      10  /* bus error */
+#define NTO_SIGSEGV     11  /* segmentation violation */
+#define NTO_SIGSYS      12  /* bad argument to system call */
+#define NTO_SIGPIPE     13  /* write on pipe with no reader */
+#define NTO_SIGALRM     14  /* real-time alarm clock */
+#define NTO_SIGTERM     15  /* software termination signal from kill */
+#define NTO_SIGUSR1     16  /* user defined signal 1 */
+#define NTO_SIGUSR2     17  /* user defined signal 2 */
+#define NTO_SIGCHLD     18  /* death of child */
+#define NTO_SIGPWR      19  /* power-fail restart */
+#define NTO_SIGWINCH    20  /* window change */
+#define NTO_SIGURG      21  /* urgent condition on I/O channel */
+#define NTO_SIGPOLL     22  /* System V name for NTO_SIGIO */
+#define NTO_SIGIO       NTO_SIGPOLL
+#define NTO_SIGSTOP     23  /* sendable stop signal not from tty */
+#define NTO_SIGTSTP     24  /* stop signal from tty */
+#define NTO_SIGCONT     25  /* continue a stopped process */
+#define NTO_SIGTTIN     26  /* attempted background tty read */
+#define NTO_SIGTTOU     27  /* attempted background tty write */
+#define NTO_SIGVTALRM   28  /* virtual timer expired */
+#define NTO_SIGPROF     29  /* profileing timer expired */
+#define NTO_SIGXCPU     30  /* exceded cpu limit */
+#define NTO_SIGXFSZ     31  /* exceded file size limit */
+
+static struct
+  {
+    int nto_sig;
+    enum target_signal gdb_sig;
+  }
+sig_map[] =
+{
+  {1, TARGET_SIGNAL_HUP},
+  {2, TARGET_SIGNAL_INT},
+  {3, TARGET_SIGNAL_QUIT},
+  {4, TARGET_SIGNAL_ILL},
+  {5, TARGET_SIGNAL_TRAP},
+  {6, TARGET_SIGNAL_ABRT},
+  {7, TARGET_SIGNAL_EMT},
+  {8, TARGET_SIGNAL_FPE},
+  {9, TARGET_SIGNAL_KILL},
+  {10, TARGET_SIGNAL_BUS},
+  {11, TARGET_SIGNAL_SEGV},
+  {12, TARGET_SIGNAL_SYS},
+  {13, TARGET_SIGNAL_PIPE},
+  {14, TARGET_SIGNAL_ALRM},
+  {15, TARGET_SIGNAL_TERM},
+  {16, TARGET_SIGNAL_USR1},
+  {17, TARGET_SIGNAL_USR2},
+  {18, TARGET_SIGNAL_CHLD},
+  {19, TARGET_SIGNAL_PWR},
+  {20, TARGET_SIGNAL_WINCH},
+  {21, TARGET_SIGNAL_URG},
+  {22, TARGET_SIGNAL_POLL},
+  {23, TARGET_SIGNAL_STOP},
+  {24, TARGET_SIGNAL_TSTP},
+  {25, TARGET_SIGNAL_CONT},
+  {26, TARGET_SIGNAL_TTIN},
+  {27, TARGET_SIGNAL_TTOU},
+  {28, TARGET_SIGNAL_VTALRM},
+  {29, TARGET_SIGNAL_PROF},
+  {30, TARGET_SIGNAL_XCPU},
+  {31, TARGET_SIGNAL_XFSZ}
+};
+#endif // ndef __QNXNTO__
+
+/* Convert nto signal to gdb signal.  */
+enum target_signal
+target_signal_from_nto(int sig)
+{
+#ifndef __QNXNTO__
+  switch(sig)
+  {
+    case 0: return 0; break;
+    case NTO_SIGHUP: return TARGET_SIGNAL_HUP; break;
+    case NTO_SIGINT: return TARGET_SIGNAL_INT; break;
+    case NTO_SIGQUIT: return TARGET_SIGNAL_QUIT; break;
+    case NTO_SIGILL: return TARGET_SIGNAL_ILL; break;
+    case NTO_SIGTRAP: return TARGET_SIGNAL_TRAP; break;
+    case NTO_SIGABRT: return TARGET_SIGNAL_ABRT; break;
+    case NTO_SIGEMT: return TARGET_SIGNAL_EMT; break;
+    case NTO_SIGFPE: return TARGET_SIGNAL_FPE; break;
+    case NTO_SIGKILL: return TARGET_SIGNAL_KILL; break;
+    case NTO_SIGBUS: return TARGET_SIGNAL_BUS; break;
+    case NTO_SIGSEGV: return TARGET_SIGNAL_SEGV; break;
+    case NTO_SIGSYS: return TARGET_SIGNAL_SYS; break;
+    case NTO_SIGPIPE: return TARGET_SIGNAL_PIPE; break;
+    case NTO_SIGALRM: return TARGET_SIGNAL_ALRM; break;
+    case NTO_SIGTERM: return TARGET_SIGNAL_TERM; break;
+    case NTO_SIGUSR1: return TARGET_SIGNAL_USR1; break;
+    case NTO_SIGUSR2: return TARGET_SIGNAL_USR2; break;
+    case NTO_SIGCHLD: return TARGET_SIGNAL_CHLD; break;
+    case NTO_SIGPWR: return TARGET_SIGNAL_PWR; break;
+    case NTO_SIGWINCH: return TARGET_SIGNAL_WINCH; break;
+    case NTO_SIGURG: return TARGET_SIGNAL_URG; break;
+    case NTO_SIGPOLL: return TARGET_SIGNAL_POLL; break;
+    case NTO_SIGSTOP: return TARGET_SIGNAL_STOP; break;
+    case NTO_SIGTSTP: return TARGET_SIGNAL_TSTP; break;
+    case NTO_SIGCONT: return TARGET_SIGNAL_CONT; break;
+    case NTO_SIGTTIN: return TARGET_SIGNAL_TTIN; break;
+    case NTO_SIGTTOU: return TARGET_SIGNAL_TTOU; break;
+    case NTO_SIGVTALRM: return TARGET_SIGNAL_VTALRM; break;
+    case NTO_SIGPROF: return TARGET_SIGNAL_PROF; break;
+    case NTO_SIGXCPU: return TARGET_SIGNAL_XCPU; break;
+    case NTO_SIGXFSZ: return TARGET_SIGNAL_XFSZ; break;
+    default: break;
+  }
+#endif /* __QNXNTO__ */
+  return target_signal_from_host(sig);
+}
+
+
+/* Convert gdb signal to nto signal.  */
+int
+target_signal_to_nto(enum target_signal sig)
+{
+#ifndef __QNXNTO__
+  switch(sig)
+  {
+    case 0: return 0; break;
+    case TARGET_SIGNAL_HUP: return NTO_SIGHUP; break;
+    case TARGET_SIGNAL_INT: return NTO_SIGINT; break;
+    case TARGET_SIGNAL_QUIT: return NTO_SIGQUIT; break;
+    case TARGET_SIGNAL_ILL: return NTO_SIGILL; break;
+    case TARGET_SIGNAL_TRAP: return NTO_SIGTRAP; break;
+    case TARGET_SIGNAL_ABRT: return NTO_SIGABRT; break;
+    case TARGET_SIGNAL_EMT: return NTO_SIGEMT; break;
+    case TARGET_SIGNAL_FPE: return NTO_SIGFPE; break;
+    case TARGET_SIGNAL_KILL: return NTO_SIGKILL; break;
+    case TARGET_SIGNAL_BUS: return NTO_SIGBUS; break;
+    case TARGET_SIGNAL_SEGV: return NTO_SIGSEGV; break;
+    case TARGET_SIGNAL_SYS: return NTO_SIGSYS; break;
+    case TARGET_SIGNAL_PIPE: return NTO_SIGPIPE; break;
+    case TARGET_SIGNAL_ALRM: return NTO_SIGALRM; break;
+    case TARGET_SIGNAL_TERM: return NTO_SIGTERM; break;
+    case TARGET_SIGNAL_USR1: return NTO_SIGUSR1; break;
+    case TARGET_SIGNAL_USR2: return NTO_SIGUSR2; break;
+    case TARGET_SIGNAL_CHLD: return NTO_SIGCHLD; break;
+    case TARGET_SIGNAL_PWR: return NTO_SIGPWR; break;
+    case TARGET_SIGNAL_WINCH: return NTO_SIGWINCH; break;
+    case TARGET_SIGNAL_URG: return NTO_SIGURG; break;
+    case TARGET_SIGNAL_IO: return NTO_SIGIO; break;
+    case TARGET_SIGNAL_POLL: return NTO_SIGPOLL; break;
+    case TARGET_SIGNAL_STOP: return NTO_SIGSTOP; break;
+    case TARGET_SIGNAL_TSTP: return NTO_SIGTSTP; break;
+    case TARGET_SIGNAL_CONT: return NTO_SIGCONT; break;
+    case TARGET_SIGNAL_TTIN: return NTO_SIGTTIN; break;
+    case TARGET_SIGNAL_TTOU: return NTO_SIGTTOU; break;
+    case TARGET_SIGNAL_VTALRM: return NTO_SIGVTALRM; break;
+    case TARGET_SIGNAL_PROF: return NTO_SIGPROF; break;
+    case TARGET_SIGNAL_XCPU: return NTO_SIGXCPU; break;
+    case TARGET_SIGNAL_XFSZ: return NTO_SIGXFSZ; break;
+    default: break;
+  }
+#endif /* __QNXNTO__ */
+  return target_signal_to_host(sig);
+}
+
 void
 nto_initialize_signals (void)
 {
@@ -379,17 +607,48 @@ nto_initialize_signals (void)
 #endif
 }
 
+static void
+show_nto_debug (struct ui_file *file, int from_tty,
+                struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("QNX NTO debug level is %d.\n"), nto_internal_debugging);
+}
+
+static int 
+nto_print_tidinfo_callback (struct thread_info *tp, void *data)
+{
+  printf_filtered("%c%d\t%d\t%d\n", ptid_equal (tp->ptid, inferior_ptid) ? '*' : ' ', tp->private->tid, tp->private->state, tp->private->flags );
+  return 0;
+}
+
+static void 
+nto_info_tidinfo_command (char *args, int from_tty)
+{
+  nto_trace (0) ("%s (args=%s, from_tty=%d)\n", __func__, args, from_tty);
+
+  target_find_new_threads ();
+  printf_filtered("Threads for pid %d (%s)\nTid:\tState:\tFlags:\n", ptid_get_pid (inferior_ptid), get_exec_file (0));
+  
+  iterate_over_threads (nto_print_tidinfo_callback, NULL);
+}
+
+
+
 void
 _initialize_nto_tdep (void)
 {
+  nto_trace (0) ("%s ()\n", __func__);
   add_setshow_zinteger_cmd ("nto-debug", class_maintenance,
 			    &nto_internal_debugging, _("\
-Set QNX NTO internal debugging."), _("\
-Show QNX NTO internal debugging."), _("\
+Set QNX NTO debug level."), _("\
+Show QNX NTO debug level."), _("\
 When non-zero, nto specific debug info is\n\
 displayed. Different information is displayed\n\
 for different positive values."),
 			    NULL,
-			    NULL, /* FIXME: i18n: QNX NTO internal debugging is %s.  */
-			    &setdebuglist, &showdebuglist);
+			    show_nto_debug,
+			    &maintenance_set_cmdlist,
+			    &maintenance_show_cmdlist);
+
+  add_info ("tidinfo", nto_info_tidinfo_command, "List threads for current process." );
 }
Index: gdb/nto-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.h,v
retrieving revision 1.7
diff -u -p -r1.7 nto-tdep.h
--- gdb/nto-tdep.h	23 Aug 2007 18:08:36 -0000	1.7
+++ gdb/nto-tdep.h	8 Nov 2007 15:38:08 -0000
@@ -26,6 +26,7 @@
 #include "solist.h"
 #include "osabi.h"
 #include "regset.h"
+#include "gdbthread.h"
 
 /* Target operations defined for Neutrino targets (<target>-nto-tdep.c).  */
 
@@ -104,6 +105,18 @@ extern struct nto_target_ops current_nto
 
 #define nto_is_nto_target (current_nto_target.is_nto_target)
 
+#define nto_trace(level) \
+  if ((nto_internal_debugging & 0xFF) <= level) {} else \
+    printf_unfiltered
+
+/* register supply helper macros*/
+#define NTO_ALL_REGS (-1)
+#define RAW_SUPPLY_IF_NEEDED(regcache, whichreg, dataptr) \
+  {if (!(NTO_ALL_REGS == regno || regno == (whichreg))) {} \
+    else regcache_raw_supply (regcache, whichreg, dataptr); }
+
+
+
 /* Keep this consistant with neutrino syspage.h.  */
 enum
 {
@@ -139,14 +152,22 @@ typedef struct _debug_regs
   qnx_reg64 padding[1024];
 } nto_regset_t;
 
+/* Used by gdbthread.h.  Same as struct tidinfo in pdebug protocol */
+struct private_thread_info {
+  short tid;
+  unsigned char state;
+  unsigned char flags;
+  char name[1];
+};
+
 /* Generic functions in nto-tdep.c.  */
 
 void nto_init_solib_absolute_prefix (void);
 
 void nto_set_target(struct nto_target_ops *);
 
-char **nto_parse_redirection (char *start_argv[], char **in,
-			      char **out, char **err);
+char **nto_parse_redirection (char *start_argv[], const char **in,
+			      const char **out, const char **err);
 
 int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
 
@@ -176,4 +197,15 @@ void nto_dummy_supply_regset (struct reg
 
 int nto_in_dynsym_resolve_code (CORE_ADDR pc);
 
+char *nto_target_extra_thread_info (struct thread_info *);
+
+struct link_map_offsets* nto_generic_svr4_fetch_link_map_offsets (void);
+
+/* needed for remote protocol and for core files */
+enum target_signal target_signal_from_nto (int sig);
+int target_signal_to_nto(enum target_signal sig);
+
+
+
+
 #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-07 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 15:48 [patch] nto target update Aleksandar Ristovski
2007-11-08 20:51 ` Ulrich Weigand
2008-01-25 22:51   ` Aleksandar Ristovski
2008-02-07 19:15     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox