From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [VxWorks 18/20] Add tdep files for x86 and powerpc.
Date: Fri, 04 Mar 2011 06:25:00 -0000 [thread overview]
Message-ID: <1299219720-13398-19-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1299219720-13398-1-git-send-email-brobecker@adacore.com>
This patch adds a new GDB_OSABI_VXWORKS for VxWorks targets, and
introduces new VxWorks tdep files for x86 and powerpc. They will
be included in the build by the next patch.
gdb/ChangeLog:
* defs.h (enum gdb_osabi): Add GDB_OSABI_VXWORKS.
* osabi.c (gdb_osabi_names): Add entry for GDB_OSABI_VXWORKS.
* i386-vxworks-tdep.c, rs6000-vxworks-tdep.c: New files.
---
gdb/defs.h | 1 +
gdb/i386-vxworks-tdep.c | 53 +++++++++++++++++++++++++
gdb/osabi.c | 1 +
gdb/rs6000-vxworks-tdep.c | 95 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 150 insertions(+), 0 deletions(-)
create mode 100644 gdb/i386-vxworks-tdep.c
create mode 100644 gdb/rs6000-vxworks-tdep.c
diff --git a/gdb/defs.h b/gdb/defs.h
index 11178f8..eaffebc 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -991,6 +991,7 @@ enum gdb_osabi
GDB_OSABI_QNXNTO,
GDB_OSABI_CYGWIN,
GDB_OSABI_AIX,
+ GDB_OSABI_VXWORKS,
GDB_OSABI_DICOS,
GDB_OSABI_DARWIN,
GDB_OSABI_SYMBIAN,
diff --git a/gdb/i386-vxworks-tdep.c b/gdb/i386-vxworks-tdep.c
new file mode 100644
index 0000000..78aaf0f
--- /dev/null
+++ b/gdb/i386-vxworks-tdep.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2007, 2010, 2011 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 3 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, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "osabi.h"
+#include "i386-tdep.h"
+
+static void
+i386_vxworks_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ /* The AT_ENTRY_POINT method is not practical on VxWorks systems,
+ because there is no concept of "the" executable. Furthermore,
+ memory space is shared by all processes (and thus someone
+ spawning a new task using the same entry point might interfere
+ with our function call). So we rely on the ON_STACK method
+ instead. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+}
+
+static enum gdb_osabi
+i386_vxworks_osabi_sniffer (bfd * abfd)
+{
+ char *target_name = bfd_get_target (abfd);
+
+ if (strstr (target_name, "vxworks") != NULL)
+ return GDB_OSABI_VXWORKS;
+
+ return GDB_OSABI_UNKNOWN;
+}
+void
+_initialize_vxworks_tdep (void)
+{
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
+ i386_vxworks_osabi_sniffer);
+ gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_VXWORKS,
+ i386_vxworks_init_abi);
+}
+
diff --git a/gdb/osabi.c b/gdb/osabi.c
index a264924..9b29b16 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -70,6 +70,7 @@ static const char * const gdb_osabi_names[] =
"QNX Neutrino",
"Cygwin",
"AIX",
+ "VxWorks",
"DICOS",
"Darwin",
"Symbian",
diff --git a/gdb/rs6000-vxworks-tdep.c b/gdb/rs6000-vxworks-tdep.c
new file mode 100644
index 0000000..656214d
--- /dev/null
+++ b/gdb/rs6000-vxworks-tdep.c
@@ -0,0 +1,95 @@
+/* Target-dependent code for GDB, the GNU debugger.
+
+ Copyright (C) 2009, 2010, 2011 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 3 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, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "gdbarch.h"
+#include "osabi.h"
+#include "ppc-tdep.h"
+#include "gdb_assert.h"
+#include "inferior.h"
+#include "gdb_string.h"
+
+static CORE_ADDR
+rs6000_vxworks_push_dummy_code (struct gdbarch *gdbarch,
+ CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+ struct regcache *regcache)
+{
+ int bplen;
+ CORE_ADDR unused;
+
+ /* Force the stack's alignment. The intent is to ensure that the SP
+ is aligned to at least a breakpoint instruction's boundary. */
+ gdb_assert (gdbarch_frame_align_p (gdbarch));
+ sp = gdbarch_frame_align (gdbarch, sp);
+
+ /* Allocate space for, and then position the breakpoint on the stack. */
+ gdbarch_breakpoint_from_pc (gdbarch, &unused, &bplen);
+ sp = gdbarch_frame_align (gdbarch, sp - bplen);
+ (*bp_addr) = sp;
+
+ /* Inferior resumes at the function entry point. */
+ (*real_pc) = funaddr;
+ return sp;
+}
+
+static void
+rs6000_vxworks_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Certain versions of VxWorks do not provide support for Altivec
+ registers. For now, disable support for these registers on all
+ versions of GDB. */
+ tdep->ppc_vr0_regnum = -1;
+ tdep->ppc_vrsave_regnum = -1;
+
+ /* The AT_ENTRY_POINT method is not practical on VxWorks systems,
+ because there is no concept of "the" executable. Furthermore,
+ memory space is shared by all processes (and thus someone
+ spawning a new task using the same entry point might interfere
+ with our function call). So we rely on the ON_STACK method
+ instead. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_push_dummy_code (gdbarch, rs6000_vxworks_push_dummy_code);
+}
+
+static enum gdb_osabi
+rs6000_vxworks_osabi_sniffer (bfd * abfd)
+{
+ char *target_name = bfd_get_target (abfd);
+
+ if (strstr (target_name, "vxworks") != NULL)
+ return GDB_OSABI_VXWORKS;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
+void
+_initialize_rs6000_vxworks_tdep (void)
+{
+ /* Register the sniffer for the VxWorks targets. */
+ gdbarch_register_osabi_sniffer (bfd_arch_powerpc, bfd_target_elf_flavour,
+ rs6000_vxworks_osabi_sniffer);
+ gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_VXWORKS,
+ rs6000_vxworks_init_abi);
+}
+
--
1.7.0.4
next prev parent reply other threads:[~2011-03-04 6:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 6:22 Add support for VxWorks (v3) Joel Brobecker
2011-03-04 6:22 ` [VxWorks 01/20] fix parameter names in cli/cli-utils.h Joel Brobecker
2011-03-04 6:22 ` [VxWorks 03/20] New toplevel_command_post observer Joel Brobecker
2011-03-04 6:22 ` [VxWorks 05/20] more parsing routines in cli/cli-utils Joel Brobecker
2011-03-04 6:22 ` [VxWorks 04/20] New general purpose routines in utils.c Joel Brobecker
2011-03-04 6:22 ` [VxWorks 02/20] Some ada-lang/ada-tasks routines needed by the VxWorks target Joel Brobecker
2011-03-04 6:23 ` [VxWorks 07/20] new struct bp_target_info target_private_data field Joel Brobecker
2011-03-04 6:23 ` [VxWorks 10/20] Add options to control Vxworks related settings Joel Brobecker
2011-03-04 6:23 ` [VxWorks 06/20] add new "unload" command (symetry of existing "load" command) Joel Brobecker
2011-03-04 6:23 ` [VxWorks 08/20] New modules gdb_dlfcn and remote-wtx-utils Joel Brobecker
2011-03-04 6:24 ` [VxWorks 14/20] remote-wtx-hw: register fetch/store support Joel Brobecker
2011-03-04 6:24 ` [VxWorks 11/20] VxWorks breakpoint-handling module Joel Brobecker
2011-03-04 6:24 ` [VxWorks 12/20] "multi-tasks-mode" support Joel Brobecker
2011-03-04 6:24 ` [VxWorks 13/20] Add partition support Joel Brobecker
2011-03-04 6:24 ` [VxWorks 09/20] remote-wtxapi: The WTX API abstraction layer Joel Brobecker
2011-03-04 6:25 ` [VxWorks 19/20] Configury and Makefile updates for VxWorks Joel Brobecker
2011-03-04 6:25 ` [VxWorks 15/20] Add new "wtx" target Joel Brobecker
2011-03-04 6:25 ` [VxWorks 17/20] Add support for VxWorks 6 Joel Brobecker
2011-03-04 6:25 ` [VxWorks 16/20] WTX-TCL support module Joel Brobecker
2011-03-04 6:25 ` Joel Brobecker [this message]
2011-03-04 6:25 ` [VxWorks 20/20] document the new VxWorks port Joel Brobecker
2011-03-04 9:36 ` Add support for VxWorks (v3) Pedro Alves
2011-03-04 10:05 ` Joel Brobecker
2011-03-04 10:45 ` Pedro Alves
2011-03-04 12:10 ` Joel Brobecker
2011-03-07 19:49 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299219720-13398-19-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox