Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagercon.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	  Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH] Support for Xilinx MicroBlaze
Date: Wed, 14 Oct 2009 17:49:00 -0000	[thread overview]
Message-ID: <4AD60F09.6020607@eagercon.com> (raw)
In-Reply-To: <20091014014655.GL5272@adacore.com>

Joel Brobecker wrote:
>> 2009-10-05  Michael Eager <eager@eagercon.com>

>> +  /* For sentinel frame, return address is actual PC.  For other frames,
>> +     return address is pc+8.  This is a workaround because gcc does not
>> +     generate correct return address in CIE.  */
> 
> You do what you have to do, but this is *BAD* idea (IMO). Unless you can
> detect the case when GCC generates bad return addresses or not in CIE,
> you'll end up having a broken debugger as soon as the compiler gets
> fixed.  Introducing work arounds for compiler deficiencies is often fine,
> but I don't think that this should be done at the cost of proper operation.

Yes, I agree.  But ...

I looked at fixing this in gcc a while ago.  The translation from rtx to CIE
entry doesn't allow expressing PC+8.  If I recall, there was another architecture
(sparc?) which also has a kludge to overcome this deficiency.

Perhaps it is possible to determine whether the CIE contains pc or pc+8
and make the right choice.  I'll take a look at this, but I think that
this info is lost long before the return address is used.  I really don't
want to put MicroBlaze-specific checks in the target-independent code which
parses the CIE.

If it's not possible to tell whether the CIE is generated correctly or not,
then the situation is that gdb will be unable to backtrace on a code generated
by a fixed compiler, or alternately, if gdb is changed, it will be unable to
backtrace on existing object files.  Neither is an acceptable choice.

>> +  struct regcache *regcache = get_current_regcache ();
> 
> This one raised a red flag, as we try to avoid depending on global
> variables.  But I'm not sure what the kosher way of getting the regcache
> would be. I thought there would be method to get the regcache from
> a frame, but apparently not.  Perhaps the right way is to use
> get_thread_arch_regcache (inferior_ptid, gdbarch), but I'm not sure.
> I'll ask Ulrich, who knows this area a lot better.

I wasn't able to find a better way to get the regcache either.  Perhaps
it's known farther up the call tree, but it isn't passed to the
software single step routine.

On the other hand, I'm not sure that this is functionality is
necessary in the real world.  In an embedded environment, I believe
that the target manager (XDM) handles single stepping; on Linux, ptrace
does this.  I'll check on this and see if I can eliminate the code.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


  reply	other threads:[~2009-10-14 17:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06  1:35 Michael Eager
2009-10-06  7:14 ` Eli Zaretskii
2009-10-14  1:47 ` Joel Brobecker
2009-10-14 17:49   ` Michael Eager [this message]
2009-10-14 17:56     ` Daniel Jacobowitz
2009-10-14 18:01       ` Michael Eager
2009-10-15 16:32 Michael Eager
2009-10-15 16:44 ` Tom Tromey
2009-10-15 16:47   ` Joel Brobecker
2009-10-15 18:00     ` Tom Tromey
2009-10-15 18:04       ` Tom Tromey
2009-10-15 18:31         ` Joel Brobecker
2009-10-16 12:53         ` Daniel Jacobowitz
2009-10-16 16:14           ` Michael Eager
2009-10-15 17:12   ` Michael Eager
2009-10-15 17:18     ` Joel Brobecker
2009-10-15 18:06       ` Michael Eager
2009-10-15 16:46 ` Joel Brobecker
2009-10-15 17:14   ` Michael Eager
2009-10-15 19:31   ` Michael Eager

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=4AD60F09.6020607@eagercon.com \
    --to=eager@eagercon.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@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