public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Fix generation of x86-64 gdbarch with osabi none (PR 22979)
Date: Sat, 07 Apr 2018 18:05:00 -0000	[thread overview]
Message-ID: <c912f608be7bc2598b919da2b11721b3c262d154@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT c912f608be7bc2598b919da2b11721b3c262d154 ***

Author: Simon Marchi <simon.marchi@ericsson.com>
Branch: master
Commit: c912f608be7bc2598b919da2b11721b3c262d154

Fix generation of x86-64 gdbarch with osabi none (PR 22979)

When a 64-bits (x86-64) gdbarch is created, it is first born as a
32-bits gdbarch in i386_gdbarch_init.  The call gdbarch_init_osabi will
call the handler register for the selected (arch, osabi) pair, such as
amd64_linux_init_abi.  The various amd64 handlers call amd64_init_abi,
which turns the gdbarch into a 64-bits one.

When selecting the i386:x86-64 architecture with no osabi, no such
handler is ever called, so the gdbarch stays (wrongfully) a 32-bits one.

My first idea was to manually call amd64_init_abi & al in
i386_gdbarch_init when the osabi is GDB_OSABI_NONE.  However, this
doesn't work in a build of GDB where i386 is included as a target but
not amd64.  My next option (implemented in this patch), is to allow
registering handlers for GDB_OSABI_NONE.  I added two such handlers in
amd64-tdep.c, so now it works the same as for the "normal" osabis.  It
required re-ordering things in gdbarch_init_osabi to allow running
handlers for GDB_OSABI_NONE.

Without this patch applied (but with the previous one*) :

  (gdb) set osabi none
  (gdb) set architecture i386:x86-64
  The target architecture is assumed to be i386:x86-64
  (gdb) p sizeof(void*)
  $1 = 4

and now:

  (gdb) set osabi none
  (gdb) set architecture i386:x86-64
  The target architecture is assumed to be i386:x86-64
  (gdb) p sizeof(void*)
  $1 = 8

* Before the previous patch, which fixed "set osabi none", this bug was
  hidden because we didn't actually try to generate a gdbarch for no
  osabi, it would always fall back on Linux.  Generating the gdbarch for
  amd64/linux did work.

gdb/ChangeLog:

	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.

gdb/testsuite/ChangeLog:

	PR gdb/22979
	* gdb.arch/amd64-osabi.exp: New file.


             reply	other threads:[~2018-04-07 18:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 18:05 sergiodj+buildbot [this message]
2018-04-07 18:05 ` Failures on RHEL-s390x-m64, branch master sergiodj+buildbot
2018-04-07 19:31 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-04-07 19:32 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2018-04-07 19:34 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot
2018-04-07 20:03 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-04-07 20:10 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-04-07 20:29 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-04-07 20:56 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-04-07 21:22 ` Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot

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=c912f608be7bc2598b919da2b11721b3c262d154@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).