Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Jafa" <jafa@silicondust.com>
To: "Andrew Cagney" <ac131313@redhat.com>, <gdb@sources.redhat.com>
Subject: Re: Frame handling
Date: Tue, 01 Jul 2003 16:14:00 -0000	[thread overview]
Message-ID: <007a01c33feb$d4d020e0$0a00a8c0@nkelseyhome> (raw)
In-Reply-To: <redirect-6810084@silicondust.com>

Hi Andrew

>>> I'm not sure I understand the question.

>> I agree, and I don't think it will make much difference eitehr way,
however
>> I was just thinking that it would be a whole lot easier to explain these
>> functions...
>>

>Um, this is still dangling.  Can you please express your question using
>terminology consistent with the frame unwind code.

Sorry, it was a bit of a ramble :-)

Avr and d10v ports both have function avr/d10v_frame_unwind_cache which
figure out everything about a frame but are internal functions.

The frame-base and frame-unwind APIs provides a machanism to register
functions -

struct frame_base
{
  ...
  frame_this_base_ftype *this_base;
  frame_this_locals_ftype *this_locals;
  frame_this_args_ftype *this_args;
};

struct frame_unwind
{
  ...
  frame_this_id_ftype *this_id;
  frame_prev_register_ftype *prev_register;
};

All five of these functions work on the principle of "given this frame,
figure out xxx information of the caller's frame" and are passed a pointer
to the next_frame (child frame). For example, "given this frame, figure out
where the arguments start of the caller's frame."

I would like to suggest the following:
- <port>_frame_unwind_cache functions to be registered as part of the
frame-unwind API.
- GDB to call <port>_frame_unwind_cache once each time it wants to go back
one frame.
- next_frame parameter removed from all five functions above.
- remove call to <port>_frame_unwind_cache function from the port-specific
implementations of the five functions above.

At a minimum the <port>_frame_unwind_cache function could store the
next_frame parameter and the five functions above could get next_frame from
this_base_cache parameter.

In practice many (most?) ports will do a <port>_frame_unwind_cache function
that figures out everything about the frame in one step and the five
fucntions above will simply read out of the this_base_cache.

Advantages:
- Eliminates some common code from all ports. (call to
<port>_frame_unwind_cache inside each function).
- Eliminates next_frame parameter to these functions.
- Easier to explain/understand the API because you only have to think about
one frame level.
- If a particular port wants the next_frame parameter to search within each
of the five functions then they can save the next_frame parameter themselves
(1 line of code) and it is exactly the same.

I would be happy to provide a patch to look at if that would help explain
and fuel the discussion.

Thanks

Nick


  parent reply	other threads:[~2003-07-01 16:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-01  1:20 Jafa
2003-07-01  3:42 ` Daniel Jacobowitz
2003-07-01  4:18   ` Andrew Cagney
     [not found]   ` <redirect-6800274@silicondust.com>
2003-07-01  5:13     ` Jafa
2003-07-01 12:58       ` Andrew Cagney
2003-07-01 14:09         ` Daniel Jacobowitz
2003-07-01 14:57           ` Andrew Cagney
     [not found]           ` <redirect-6810110@silicondust.com>
2003-07-01 17:00             ` Jafa
2003-07-02  7:13               ` libgdb jacques
     [not found]       ` <redirect-6810084@silicondust.com>
2003-07-01 16:14         ` Jafa [this message]
2003-07-01 17:59           ` Frame handling Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2003-07-01  5:00 Jafa
2003-07-01 12:45 ` Daniel Jacobowitz
2003-07-01 13:02 ` Andrew Cagney
2003-07-03  9:05   ` Paul N. Hilfinger
2003-04-08 18:35 Jafa
2003-04-14  3:43 ` Andrew Cagney

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='007a01c33feb$d4d020e0$0a00a8c0@nkelseyhome' \
    --to=jafa@silicondust.com \
    --cc=ac131313@redhat.com \
    --cc=gdb@sources.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