This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch/rfc] Add selected_frame->level
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 10 Apr 2002 18:12:47 -0400
- Subject: Re: [patch/rfc] Add selected_frame->level
- References: <3CAF98A9.10603@cygnus.com>
> Hello,
>
> The attached patch is the first shakey step towards eliminating the global variable selected_frame_level.
>
> The patch makes two changes:
>
> - adds the ``struct frame .level'' field so that each frame is self aware of its level within the stack (it could also be implemented as a function but that is another story).
>
> - adds a complicated assertion to the select_frame() function to check that selected_frame_level,selected_frame->level and the level parameter are all consistent (or at least have expected values).
>
> I've so far run the testsuite and not seen any regressions (or internal errors). My intent is to commit this patch and then leave it for a week or so to see if anyone encounters problems with it.
>
> If all appears safe I'll follow up with a second sequence of patches that remove the global and many many level parameters.
>
> thoughts (especially on the strategy),
> Andrew
Given JimI is hitting problems with the current code. I'm going to move
a little on this. I've checked this in:
> 2002-04-06 Andrew Cagney <ac131313@redhat.com>
>
> * stack.c (select_frame): Check that selected_frame and the
> expected level are as expected.
> * blockframe.c (get_prev_frame): Set the `level' from next_frame.
> Update copyright.
> * frame.h (struct frame_info): Add field `level'. Update
> copyright.
>
I'll then hold my breath for a week to see if anyone gets this assertion
failure:
+ else
+ internal_error (__FILE__, __LINE__,
+
"oops! fi=0x%p, fi->level=%d, level=%d",
+
fi, fi ? fi->level : -1, level);
If no one does then it will be time to rip out the selected_frame_level
global variable.
Andrew