This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] QNX Neutrino/i386 support


That's great Mark but what about the native procfs stuff?  The most recent
patch that I had submitted was a native only version.  The only stuff in the
i386-nto-tdep.c that was even vaguely related to the remote protocol was
stuffing the regset type in the register area.  This is also used by
nto-procfs.c so I refactored the regset numbers to be defines that can be
used by both.

The file you have reduced to here is completely useless for any form of
debugging on Neutrino.  We don't currently support the standard gdb debug
protocol although it's on our to-do list.  Our i386 registers are in a
different order that gdb so we need to do the mapping.  I have already
applied patches to solib.c to do a special lookup of target solibs.  Without
that support, libs won't be found properly.

BTW, the OSABI stuff is already committed (they gave me write-after approval
for cvs) - the only stuff left is the addition of new files.  I would like
to get the config dir stuff, the tdep files, the nto-share headers and
nto-procfs.c committed.

What we have currently is something that works perfectly for us.  I really
don't want to start with something completely broken and make additions
until it works.  I want to add the working stuff and then cut away any fat
that we can prove that we don't need.  I don't mind doing major refactoring
but I want to have working code in CVS at all times.  That is something that
the GDB project strives for and I would like to do for our target as well.

I've attached a tarball with the files in it.  I think that it's pretty much
the same as what you have with the changes for the remote defines.  I
appreciate the time you're putting into this and I really want our port to
be as clean as it can be.  I know that there's lots of work to be done but
I'd really rather start from a working version and clean from there.  This
is one of my highest priority projects so I have lots of cycles available to
do the work but I want to be able to point our customers to the head branch
and have it work for them.

cheers,

Kris

----- Original Message -----
From: "Mark Kettenis" <kettenis at chello dot nl>
To: "Kris Warkentin" <kewarken at qnx dot com>
Cc: <gdb-patches at sources dot redhat dot com>
Sent: Saturday, March 08, 2003 8:44 AM
Subject: [RFC] QNX Neutrino/i386 support


> Kris,
>
> Here is a sort-of minimal patch to add the QNX Neutroni/i386 target
> stuff into GDB.  I left out all the controversial bits for now, and
> some bits I don't understand yet.  I also left out the bits dealing
> with the special NTO remote protocol.  As I wrote to you before, I'd
> rather not have those bits in i386-nto-tdep.c.
>
> I'm still struggling with the shared library stuff.  There's something
> fishy in there, but it seems that the comment in nto-tdep.c is wrong,
> or at least outdated.
>
> Anyway, this should be enough to do some basic debugging via the
> standard GDB remote protocol if it were supported on NTO.  My proposal
> is to check this in, and work from there.
>
> Mark
>
> Index: configure.tgt
> ===================================================================
> RCS file: /cvs/src/src/gdb/configure.tgt,v
> retrieving revision 1.98
> diff -u -p -r1.98 configure.tgt
> --- configure.tgt 5 Feb 2003 23:14:47 -0000 1.98
> +++ configure.tgt 8 Mar 2003 13:25:19 -0000
> @@ -90,6 +90,7 @@ i[3456]86-*-netbsd*) gdb_target=nbsd ;;
>  i[3456]86-*-openbsd*) gdb_target=obsd ;;
>  i[3456]86-*-go32*) gdb_target=i386aout ;;
>  i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;;
> +i[3456]86-*-nto* | x86-*-nto*) gdb_target=nto ;;
>  i[3456]86-*-lynxos*) gdb_target=i386lynx ;;
>  i[3456]86-*-solaris*) gdb_target=i386sol2 ;;
>  i[3456]86-*-sco*) gdb_target=i386v ;;
> @@ -280,5 +281,6 @@ esac
>  case "${target}" in
>  *-*-linux*) gdb_osabi=GDB_OSABI_LINUX ;;
>  *-*-gnu*) gdb_osabi=GDB_OSABI_HURD ;;
> +*-*-nto*) gdb_osabi=GDB_OSABI_QNXNTO ;;
>  *-*-solaris*) gdb_osabi=GDB_OSABI_SOLARIS ;;
>  esac
> --- /dev/null Sat Mar  8 14:22:37 2003
> +++ config/i386/tm-nto.h Sat Mar  1 20:33:57 2003
> @@ -0,0 +1,27 @@
> +/* Target-dependent definitions for QNX Neutrino/i386.
> +   Copyright 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.  */
> +
> +#ifndef TM_NTO_H
> +#define TM_NTO_H
> +
> +#include "i386/tm-i386.h"
> +#include "solib.h"
> +
> +#endif /* TM_NTO_H */
> --- /dev/null Sat Mar  8 14:22:37 2003
> +++ config/i386/nto.mt Sat Mar  1 20:37:46 2003
> @@ -0,0 +1,4 @@
> +# Target: Intel 386 running QNX
> +TDEPFILES= i386-tdep.o i387-tdep.o i386-nto-tdep.o \
> + solib.o solib-svr4.o
> +TM_FILE= tm-nto.h
> --- /dev/null Sat Mar  8 14:22:37 2003
> +++ i386-nto-tdep.c Sat Mar  1 20:31:29 2003
> @@ -0,0 +1,125 @@
> +/* Target-dependent code for NTO.
> +   Copyright 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.  */
> +
> +#include "defs.h"
> +#include "frame.h"
> +#include "symtab.h"
> +#include "objfiles.h"
> +#include "osabi.h"
> +#include "regcache.h"
> +
> +#include "i386-tdep.h"
> +
> +#include "solib-svr4.h"
> +
> +static int
> +i386_nto_pc_in_sigtramp (CORE_ADDR pc, char *name)
> +{
> +  return (name && strcmp ("__signalstub", name) == 0);
> +}
> +
> +#define I386_NTO_SIGCONTEXT_OFFSET 136
> +
> +static CORE_ADDR
> +i386_nto_sigcontext_addr (struct frame_info *frame)
> +{
> +  struct frame_info *next = get_next_frame (frame);
> +
> +  if (next)
> +    return get_frame_base (next) + I386_NTO_SIGCONTEXT_OFFSET;
> +
> +  return read_register (SP_REGNUM) + I386_NTO_SIGCONTEXT_OFFSET;
> +}
> +
> +/* Fetch (and possibly build) an appropriate link_map_offsets
> +   structure for native x86 targets using the struct offsets defined
> +   in link.h (but without actual reference to that file).
> +
> +   This makes it possible to access x86 shared libraries from a GDB
> +   that was not built on an x86 host (for cross debugging).  */
> +
> +static struct link_map_offsets *
> +i386_nto_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_debug_size = 8; /* The actual size is larger, but this
> +                                   is all we need.  */
> +      lmo.r_map_offset = 4;
> +      lmo.r_map_size = 4;
> +
> +      lmo.link_map_size = 20; /* The actual size is larger bytes,
> +    but this is all we need.  */
> +      lmo.l_addr_offset = 0;
> +      lmo.l_addr_size = 4;
> +
> +      lmo.l_name_offset = 4;
> +      lmo.l_name_size = 4;
> +
> +      lmo.l_next_offset = 12;
> +      lmo.l_next_size = 4;
> +
> +      lmo.l_prev_offset = 16;
> +      lmo.l_prev_size = 4;
> +    }
> +
> +  return lmp;
> +}
> +
> +/* QNX Neutrino (NTO).  */
> +
> +static void
> +i386_nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> +{
> +  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> +
> +  /* NTO uses ELF.  */
> +  i386_elf_init_abi (info, gdbarch);
> +
> +  /* NTO has shared libraries.  */
> +  set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
> +  set_gdbarch_skip_trampoline_code (gdbarch,
find_solib_trampoline_target);
> +
> +  set_gdbarch_pc_in_sigtramp (gdbarch, i386_nto_pc_in_sigtramp);
> +  tdep->sigcontext_addr = i386_nto_sigcontext_addr;
> +  tdep->sc_pc_offset = 56;
> +  tdep->sc_sp_offset = 68;
> +
> +  tdep->jb_pc_offset = 20;
> +
> +  set_solib_svr4_fetch_link_map_offsets (gdbarch,
> + i386_nto_svr4_fetch_link_map_offsets);
> +}
> +
> +
> +/* Provide a prototype to silence -Wmissing-prototypes.  */
> +void _initialize_i386_nto_tdep (void);
> +
> +void
> +_initialize_i386_nto_tdep (void)
> +{
> +  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_QNXNTO,
> +   i386_nto_init_abi);
> +}
>

Attachment: qnx_files.tgz
Description: application/compressed


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]