Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Michal Ludvig <mludvig@suse.cz>,
	GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [RFA] Artifical dwarf2 debug info
Date: Thu, 02 Jan 2003 23:05:00 -0000	[thread overview]
Message-ID: <3E14C5C1.5060100@redhat.com> (raw)
In-Reply-To: <20030102211836.GA23173@nevyn.them.org>

> On Thu, Jan 02, 2003 at 08:54:33PM +0000, Andrew Cagney wrote:
> 
>>   fde = get_fde_for_addr (context->ra - 1);
> 
>> > >+
>> > >+  if (fde == NULL)
>> > >+    fde = guess_generic_fde (context->ra - 1);
>> > >
>> > >   if (fde == NULL)
>> > >     return;
> 
>> 
>> Just to be clear.  The above is the change that I think is wrong.
>> 
>> Instead of this function `guessing' the source of the FDE, the code 
>> needs to be re-structured so that the caller always supplies a 
>> pre-created FDE.
>> 
>> That way a dwarf2 cfi frame can call the above function with an FDE 
>> built from the object files debug info, while an artifical frame can 
>> call it with an artifically created FDE.   There is no guessing involved.
> 
> 
> Hold a second here; I don't think we're really communicating on what
> this change is supposed to do.  Look at where that code is: it's in
> frame_state_for.  Its inputs are a CONTEXT and FS (struct frame_state
> *).  The first line in your quote is:
>   fde = get_fde_for_addr (context->ra - 1);

Right.  That gets removed.  Instead that info gets passed to the CFI 
code as a `parameter' (perhaphs explicitly, or perhaps implicitly as 
part of a member of the CONTEXT object).

> I just don't understand what you mean by "the caller supplies an FDE";
> this is where we locate the FDE.  The caller's got no business knowing
> what an FDE is.  This new mechanism is supposed to handled any code
> which doesn't have a defined FDE, for which an architecutre-specific
> (yes) hook can deduce the appropriate FDE from code inspection.


> These are not "artificial frames".  We've got four types of frames that
> we've been talking about recently:

[`artificial frame' was a poor choice of name - a real frame that uses 
artifically created dwarf2 debug info]

>   - the magical register frame/inner frame
>   - dummy frames
>   - sigtramp frames
>   - "normal" stack frames caused by compiled code calling other
>     compiled code

The latter can be further broken down into:

dwarf2 fde / cfi frames
saved-register frames
artifical fde / cfi frames
...

> Maybe there will be others, but notice that all the above are
> conceptually different kinds of things.  These "artifical" frames are
> just normal frames, where we synthesize the debug information because
> we didn't have any.  It's a mechanism to coalesce things like prologue
> readers.  It is absolutely not a new type of frame.
> 
> That's why I think this code is in exactly the right place, right now. 
> Are you saying that the CFI code should just be returning, saying "no
> idea, go away, don't talk to me", and leaving this be? 

Why was the dwarf2cfi code even called?  Since there is no dwarf2 cfi 
that code path should not have been reached.  Per my comment below, this 
would have happend because the caller (or something up the stack) failed 
to check for an edge condition.  That change is patching things up after 
the event.

Instead, during `struct frame_info' creation, if there isn't any dwarf2 
info, and the architecture really wants to use the dwarf2cfi logic, it 
should create an `artifical fde / cfi frame' that first fakes up the FDE 
info and then supplies that to the dwarf2cfi logic.  Similarly, a dwarf2 
cfi frame can first read the fde and then call the relevant code.

 > That's all well
 > and good but that way we end up duplicating the whole of the CFI
 > reader.  A good long term direction, with appropriate code factoring,
 > but it's hardly practical.

How does this result in the duplication of the CFI reader?

>> This is part of a long standing problem - it predates dwarf2cf by many 
>> years.  Instead of using recursion, people modify debug/target dependent 
>> frame code so that it attempts to directly handle all cases.  Cf all the 
>> PC_IN_CALL_DUMMY(frame->next), PC_IN_SIGTRAMP(frame->next) and other 
>> tests scattered through out the -tdep.c code; and the calls to 
>> get_next_frame() in dwarf2cfi.c.
> 
> 
> The one call to get_next_frame, which parallels init_frame_pc_default.

Right.  And init_frame_pc_default() is, again, typical of the problem. 
It shouldn't need to refer to frame->next.

Andrew



  reply	other threads:[~2003-01-02 23:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-14 17:31 Michal Ludvig
2002-12-14 22:53 ` Eli Zaretskii
2002-12-15 11:03 ` Daniel Jacobowitz
2002-12-16  7:28   ` Michal Ludvig
2002-12-16  7:49     ` Daniel Jacobowitz
2002-12-16  9:27       ` Michal Ludvig
2002-12-16  9:54         ` Daniel Jacobowitz
2002-12-16 10:38         ` Eli Zaretskii
2002-12-20  8:43           ` Michal Ludvig
2002-12-20 10:51             ` Eli Zaretskii
2002-12-16  9:25 ` Andrew Cagney
2002-12-16  9:40   ` Daniel Jacobowitz
2002-12-16 10:04     ` Andrew Cagney
2002-12-16 10:17       ` Daniel Jacobowitz
2002-12-16 10:56         ` Andrew Cagney
2002-12-16 11:13           ` Daniel Jacobowitz
2002-12-16 11:34             ` Andrew Cagney
2002-12-16 11:57               ` Daniel Jacobowitz
2002-12-16 12:10                 ` Andrew Cagney
2002-12-16 12:42                   ` Daniel Jacobowitz
2002-12-17  6:23                     ` Michal Ludvig
2002-12-17  6:28                       ` Andrew Cagney
2002-12-17  8:42                         ` Daniel Jacobowitz
2002-12-18  4:39                           ` Andrew Cagney
2002-12-18 10:05                             ` Daniel Jacobowitz
2003-01-02 20:54                               ` Andrew Cagney
2003-01-02 21:19                                 ` Daniel Jacobowitz
2003-01-02 23:05                                   ` Andrew Cagney [this message]
2003-01-02 23:27                                     ` Daniel Jacobowitz
2003-01-03  0:28                                       ` Andrew Cagney
2002-12-16  9:46   ` Michal Ludvig
2002-12-16  9:57     ` Andrew Cagney
2002-12-16 10:01       ` Michal Ludvig

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=3E14C5C1.5060100@redhat.com \
    --to=ac131313@redhat.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mludvig@suse.cz \
    /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