From: Michael Snyder <msnyder@redhat.com>
To: gdb-patches@sources.redhat.com
Cc: cagney@redhat.com, kevinb@redhat.com, drow@mvista.com,
echristo@redhat.com
Subject: [RFC] Mips, N32, cc, gcc, and gdb (longish)
Date: Thu, 01 Aug 2002 18:32:00 -0000 [thread overview]
Message-ID: <3D49DCF8.AB4C6718@redhat.com> (raw)
OK, I think I've made this as concise as practical. ;-)
In case the difference between Irix cc and gcc does not get
fixed (and I mean specifically the difference concerning
alignment of small struct arguments), I'd like to discuss
"fixing" gdb so that it will work correctly with both.
I've found a testcase for this problem in call-ar-st.exp:
(gdb) print print_long_arg_list (a, b, c, d, e, f, *struct1,
*struct2, *struct3, *struct4, *flags, *flags_combo,
*three_char, *five_char, *int_char_combo,
*d1, *d2, *d3, *f1, *f2, *f3)
This fails (or doesn't) depending on whether a small struct
is left-justified or right-justified when it is pushed onto
the stack (ie, when it is the 5th or higher argument).
The code in mips_push_arguments that controls this is:
if (MIPS_STACK_ARGSIZE == 8 &&
(typecode == TYPE_CODE_INT ||
typecode == TYPE_CODE_PTR ||
typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = MIPS_STACK_ARGSIZE - len;
else if ((typecode == TYPE_CODE_STRUCT ||
typecode == TYPE_CODE_UNION) &&
TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE)
longword_offset = MIPS_STACK_ARGSIZE - len;
}
As it is written, it "works" with gcc but fails with cc.
Kevin proposed this change to me (I don't remember if
he has submitted it yet):
***
typecode == TYPE_CODE_UNION) &&
! TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE)
longword_offset = MIPS_STACK_ARGSIZE - len;
---
typecode == TYPE_CODE_UNION) &&
! TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE
! && tdep->mips_abi != MIPS_ABI_N32)
longword_offset = MIPS_STACK_ARGSIZE - len;
***
With this change, it "works" with cc, but fails with gcc.
I want to discuss the following change, which should
make it "work" with both cc and gcc (given the current
behavior of both):
***
typecode == TYPE_CODE_UNION) &&
! TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE)
longword_offset = MIPS_STACK_ARGSIZE - len;
---
typecode == TYPE_CODE_UNION) &&
! TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE
! && (gcc_p ||tdep->mips_abi != MIPS_ABI_N32))
longword_offset = MIPS_STACK_ARGSIZE - len;
***
This of course makes gdb's behavior dependent on which
compiler it detects.
There is one problem: there is no variable "gcc_p" within
the scope of mips_push_arguments, because PUSH_ARGUMENTS
does not pass it. So that would need to be solved,
possibly by modifying the definition of PUSH_ARGUMENTS.
Comments?
Michael
next reply other threads:[~2002-08-02 1:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-01 18:32 Michael Snyder [this message]
2002-08-01 18:57 ` Daniel Jacobowitz
2002-08-01 19:42 ` Michael Snyder
2002-08-01 19:45 ` Daniel Jacobowitz
2002-08-01 20:19 ` Michael Snyder
2002-08-02 10:22 ` Andrew Cagney
2002-08-02 12:52 ` Eric Christopher
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=3D49DCF8.AB4C6718@redhat.com \
--to=msnyder@redhat.com \
--cc=cagney@redhat.com \
--cc=drow@mvista.com \
--cc=echristo@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kevinb@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