aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/amd64-tdep.c24
-rw-r--r--gdb/osabi.c14
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.arch/amd64-osabi.exp43
5 files changed, 88 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a5773e8..59ca3d7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
+ PR gdb/22979
+ * amd64-tdep.c (amd64_none_init_abi): New function.
+ (amd64_x32_none_init_abi): New function.
+ (_initialize_amd64_tdep): Register handlers for x86-64 and
+ x64_32 with GDB_OSABI_NONE.
+ * osabi.c (gdbarch_init_osabi): Allow running handlers for the
+ GDB_OSABI_NONE osabi.
+
+2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
+
PR gdb/22980
* defs.h (enum gdb_osabi): Remove GDB_OSABI_UNINITIALIZED, add
GDB_OSABI_NONE.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 07eef5e..bceb6e1 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -47,6 +47,7 @@
#include "ax.h"
#include "ax-gdb.h"
#include "common/byte-vector.h"
+#include "osabi.h"
/* Note that the AMD64 architecture was previously known as x86-64.
The latter is (forever) engraved into the canonical system name as
@@ -3206,7 +3207,14 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_insn_is_ret (gdbarch, amd64_insn_is_ret);
set_gdbarch_insn_is_jump (gdbarch, amd64_insn_is_jump);
}
-
+
+/* Initialize ARCH for x86-64, no osabi. */
+
+static void
+amd64_none_init_abi (gdbarch_info info, gdbarch *arch)
+{
+ amd64_init_abi (info, arch, amd64_target_description (X86_XSTATE_SSE_MASK));
+}
static struct type *
amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
@@ -3240,6 +3248,15 @@ amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_ptr_bit (gdbarch, 32);
}
+/* Initialize ARCH for x64-32, no osabi. */
+
+static void
+amd64_x32_none_init_abi (gdbarch_info info, gdbarch *arch)
+{
+ amd64_x32_init_abi (info, arch,
+ amd64_target_description (X86_XSTATE_SSE_MASK));
+}
+
/* Return the target description for a specified XSAVE feature mask. */
const struct target_desc *
@@ -3263,6 +3280,11 @@ amd64_target_description (uint64_t xcr0)
void
_initialize_amd64_tdep (void)
{
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_NONE,
+ amd64_none_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, GDB_OSABI_NONE,
+ amd64_x32_none_init_abi);
+
#if GDB_SELF_TEST
struct
{
diff --git a/gdb/osabi.c b/gdb/osabi.c
index ef1d993..7d0540b 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -338,13 +338,6 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
gdb_assert (info.osabi != GDB_OSABI_UNKNOWN);
- if (info.osabi == GDB_OSABI_NONE)
- {
- /* Don't complain about no OSABI. Assume the user knows
- what they are doing. */
- return;
- }
-
for (handler = gdb_osabi_handler_list; handler != NULL;
handler = handler->next)
{
@@ -378,6 +371,13 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
}
+ if (info.osabi == GDB_OSABI_NONE)
+ {
+ /* Don't complain about no OSABI. Assume the user knows
+ what they are doing. */
+ return;
+ }
+
warning
("A handler for the OS ABI \"%s\" is not built into this configuration\n"
"of GDB. Attempting to continue with the default %s settings.\n",
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5a885bf..34e7610 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
+ PR gdb/22979
+ * gdb.arch/amd64-osabi.exp: New file.
+
+2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
+
PR gdb/22980
* gdb.base/osabi.exp: New file.
diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp
new file mode 100644
index 0000000..4f764d3
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-osabi.exp
@@ -0,0 +1,43 @@
+# Copyright 2018 Free Software Foundation, Inc.
+
+# 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/>.
+
+# Verify that gdbarches for i386 variants and osabi none are properly created.
+
+if { ![istarget x86_64-*-* ] } {
+ untested "skipping x86-64 specific test"
+ return
+}
+
+
+proc test_osabi_none { arch void_ptr_size long_double_size } {
+ clean_restart
+
+ gdb_test "set architecture i386:x86-64" "The target architecture is assumed to be i386:x86-64"
+ gdb_test_no_output "set osabi none" "set osabi none"
+ gdb_test "print sizeof (void*)" " = 8"
+ gdb_test "print sizeof (long double)" " = 16"
+}
+
+set infos { \
+ { "i386:x86-64" 8 16 } \
+ { "i386:x64-32" 4 16 } \
+ { "i386" 4 12 } }
+
+foreach info $infos {
+ lassign $info arch void_ptr_size long_double_size
+ with_test_prefix "arch=$arch" {
+ test_osabi_none $arch $void_ptr_size $long_double_size
+ }
+}