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