+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.
+ * arch-utils.c (gdbarch_info_init): Don't set info->osabi.
+ * osabi.c (gdb_osabi_names): Add "unknown" entry.
+
2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
* common/byte-vector.h (char_vector): New type.
memset (info, 0, sizeof (struct gdbarch_info));
info->byte_order = BFD_ENDIAN_UNKNOWN;
info->byte_order_for_code = info->byte_order;
- info->osabi = GDB_OSABI_UNINITIALIZED;
}
/* Similar to init, but this time fill in the blanks. Information is
/* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */
/* From the manual override, or from file. */
- if (info->osabi == GDB_OSABI_UNINITIALIZED)
+ if (info->osabi == GDB_OSABI_UNKNOWN)
info->osabi = gdbarch_lookup_osabi (info->abfd);
/* From the target. */
+
if (info->osabi == GDB_OSABI_UNKNOWN && info->target_desc != NULL)
info->osabi = tdesc_osabi (info->target_desc);
/* From the configured default. */
if (info->osabi == GDB_OSABI_UNKNOWN)
info->osabi = GDB_OSABI_DEFAULT;
#endif
+ /* If we still don't know which osabi to pick, pick none. */
+ if (info->osabi == GDB_OSABI_UNKNOWN)
+ info->osabi = GDB_OSABI_NONE;
/* Must have at least filled in the architecture. */
gdb_assert (info->bfd_arch_info != NULL);
table in osabi.c. */
enum gdb_osabi
{
- GDB_OSABI_UNINITIALIZED = -1, /* For struct gdbarch_info. */
-
GDB_OSABI_UNKNOWN = 0, /* keep this zero */
+ GDB_OSABI_NONE,
GDB_OSABI_SVR4,
GDB_OSABI_HURD,
them in sync. */
static const struct osabi_names gdb_osabi_names[] =
{
+ { "unknown", NULL },
{ "none", NULL },
{ "SVR4", NULL },
{
struct gdb_osabi_handler *handler;
- if (info.osabi == GDB_OSABI_UNKNOWN)
+ gdb_assert (info.osabi != GDB_OSABI_UNKNOWN);
+
+ if (info.osabi == GDB_OSABI_NONE)
{
- /* Don't complain about an unknown OSABI. Assume the user knows
+ /* Don't complain about no OSABI. Assume the user knows
what they are doing. */
return;
}
user_selected_osabi = GDB_OSABI_DEFAULT;
user_osabi_state = osabi_user;
}
- else if (strcmp (set_osabi_string, "none") == 0)
- {
- user_selected_osabi = GDB_OSABI_UNKNOWN;
- user_osabi_state = osabi_user;
- }
else
{
int i;
+2018-04-07 Simon Marchi <simon.marchi@ericsson.com>
+
+ PR gdb/22980
+ * gdb.base/osabi.exp: New file.
+
2018-04-02 Weimin Pan <weimin.pan@oracle.com>
* gdb.cp/static-typedef-print.exp: New file.
--- /dev/null
+# Copyright (C) 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/>.
+
+# This file is part of the gdb testsuite.
+
+# Test that choosing "set osabi none" really requests a gdbarch with no osabi.
+
+proc test_set_osabi_none { } {
+ clean_restart
+ gdb_test_no_output "set debug arch 1"
+ gdb_test "set osabi none" ".*gdbarch_find_by_info: info.osabi 1 \\(none\\).*"
+}
+
+test_set_osabi_none