Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@ges.redhat.com>
To: Michal Ludvig <mludvig@suse.cz>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [RFA] struct context moved
Date: Tue, 09 Jul 2002 08:07:00 -0000	[thread overview]
Message-ID: <3D2AF821.4090407@ges.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0207082233090.27221-100000@chimera.suse.cz>


>> Michael,
>>
>> I don't understand the rationale behind this.
>>
>> As a general trend, frame.h / struct frame is becomming increasingly
>> opaque.  I don't see a reason for moving dwarf2cfi specific stuff into
>> frame.h.
> 
> 
> Because we have
> 	struct context *context;
> in the declaration of "struct frame_info", I thought it was logical to
> declare "struct context" in the same file. Otherwise, when debugging gdb
> itself, I'm getting "incomplete type" message when examining the content
> of struct frame_info. AFAIK it doesn't increase the size of the code, it
> just gives to debugger the appropriate information about the type of
> the structure.

Ah!

GDB is going in the direction of reducing the information visible in 
header files.  ``struct gdbarch'', ``struct cmd_list_element'' and 
``struct regcache'', for instance, are all opaque.

Consequently, and very likely, ``struct frame_info'' will eventually 
become opaque.

This approach puts very strong controls over how an object can be 
accessed.  In the past GDB has relied on convention (macros) and code 
review as a way of ensuring this this is followed.  Unfortunatly, as an 
examination of the code reveals, this has proven unreliable.

As a very up-to-date example of the problem, consider the fixes Martin 
Hunt recently committed (added cmd_func()).  GDB, for some time has been 
doing the very non-portable equivalent of:

	void f (int, float);
	(void (*)(int, float, void *)) f (1, 1.0, &foo);

(assming I've got my C right :-) This was fixed in core GDB, 
Ufortunatly, because Insight (which uses GDB) was still accessing 
``struct cmd_list_element'' internals, it was missed, and that lead to 
the unintentional introduction of a core dump.  If the ``struct 
cmd_list_element'' had always been opaque, the internals change needed 
to fix this could have been implemented more robustly - the probably of 
the changes causing insight to crash would have been significantly reduced.

Anyway, I'm some what puzzled by your problem.  I suspect a stabs vs 
dwarf2 thing :-(  When I debug, I have no problems displaying things 
like ``struct gdbarch'' which is opaque.  The only other wild guess is 
to add the opaque declaration of ``struct context;'' to the top of 
"frame.h"??

enjoy,
Andrew



  reply	other threads:[~2002-07-09 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-08  8:28 Michal Ludvig
2002-07-08 11:36 ` Andrew Cagney
2002-07-08 13:46   ` Michal Ludvig
2002-07-09  8:07     ` Andrew Cagney [this message]
2002-08-26 19:24     ` Michael Snyder

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=3D2AF821.4090407@ges.redhat.com \
    --to=ac131313@ges.redhat.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