From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: RFA: probable rs6000-aix-tdep.c bug found by clang
Date: Thu, 18 Oct 2012 18:49:00 -0000 [thread overview]
Message-ID: <20121018184941.GU3050@adacore.com> (raw)
In-Reply-To: <20121018153304.GS3050@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
> OK - I will take care of removing the condition and simplifying
> the function.
Here is what I propose we check in. I can't test it at the moment,
because we've suffered a massive power outage and we're still working
on getting every machine back up. I'm fairly confident, though.
Rather than remove the check, I added an assertion. That's because
eventually I want to add an extra check, for Lynx178. On the GDB side,
the Lynx178 port is roughly a bareboard powerpc configuration. But
it is using XCOFF, and I wanted to make sure that we'd never match
a Lynx178 binary with the AIX ABI. To do that, I use a BFD/XCOFF
function, so I thought adding the explict assertion would help.
While at it, I added a function description, that explicitly mentions
the pre-condition/assertion.
If there are no objections, I will commit the attached patch within
the next few days, after being able to test on AIX again.
Thanks,
--
Joel
[-- Attachment #2: 0001-ppc-aix-osabi-sniffer-Turn-test-of-bfd-flavour-into-.patch --]
[-- Type: text/x-diff, Size: 1755 bytes --]
From a2aff2ac36f9573ede236e899994054e6194ba65 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 18 Oct 2012 11:31:28 -0700
Subject: [PATCH] ppc-aix osabi sniffer: Turn test of bfd flavour into
assertion
Due to the way this function is registers, we know that given bfd's
flavour should always be bfd_target_xcoff_flavour, thus making
the former test always true, which means that this function should
always return GDB_OSABI_AIX, and never return GDB_OSABI_UNKNOWN.
This patch also fixes a typo detected by Tom Tromey that caused
the test itself to be completely ineffective.
gdb/ChangeLog (by Tom Tromey and Joel Brobecker):
* rs6000-aix-tdep.c (rs6000_aix_osabi_sniffer): Replace
inneffective if condition by gdb assertion. Add function
description comment.
---
gdb/rs6000-aix-tdep.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 59cfa73..06b43de 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -719,14 +719,19 @@ rs6000_software_single_step (struct frame_info *frame)
return 1;
}
+/* Implement an osabi sniffer for RS6000/AIX.
+
+ This function assumes that ABFD's flavour is XCOFF. In other words,
+ it should be registered as a sniffer for bfd_target_xcoff_flavour
+ objfiles only. A failed assertion will be raised if this condition
+ is not met. */
+
static enum gdb_osabi
rs6000_aix_osabi_sniffer (bfd *abfd)
{
-
- if (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
- return GDB_OSABI_AIX;
+ gdb_assert (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
- return GDB_OSABI_UNKNOWN;
+ return GDB_OSABI_AIX;
}
static void
--
1.7.9.5
next prev parent reply other threads:[~2012-10-18 18:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 20:06 Tom Tromey
2012-10-17 21:24 ` Joel Brobecker
2012-10-18 9:10 ` Pedro Alves
2012-10-18 15:33 ` Joel Brobecker
2012-10-18 15:46 ` Pedro Alves
2012-10-18 15:58 ` Joel Brobecker
2012-10-18 16:06 ` Pedro Alves
2012-10-18 18:49 ` Joel Brobecker [this message]
2012-10-18 19:43 ` Tom Tromey
2012-10-19 20:00 ` Joel Brobecker
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=20121018184941.GU3050@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/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