* [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame()
@ 2002-07-08 5:24 Mark Kettenis
2002-07-08 11:37 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2002-07-08 5:24 UTC (permalink / raw)
To: gdb-patches
Using alloca() here is pretty obvious. I discussed the other fix with
Michael Ludvig.
Checked in.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* dwarf2cfi.c (cfi_pop_frame): Use alloca() for regbuf.
Don't call get_current_frame().
Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.11
diff -u -p -r1.11 dwarf2cfi.c
--- dwarf2cfi.c 21 Jun 2002 13:53:24 -0000 1.11
+++ dwarf2cfi.c 4 Jul 2002 14:40:22 -0000
@@ -1757,10 +1757,8 @@ cfi_write_fp (CORE_ADDR val)
void
cfi_pop_frame (struct frame_info *fi)
{
- char regbuf[MAX_REGISTER_RAW_SIZE];
+ char *regbuf = alloca (MAX_REGISTER_RAW_SIZE);
int regnum;
-
- fi = get_current_frame ();
for (regnum = 0; regnum < NUM_REGS; regnum++)
{
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame()
2002-07-08 5:24 [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame() Mark Kettenis
@ 2002-07-08 11:37 ` Andrew Cagney
2002-07-10 5:22 ` Richard Earnshaw
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-07-08 11:37 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Using alloca() here is pretty obvious. I discussed the other fix with
> Michael Ludvig.
>
> Checked in.
>
> Mark
>
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * dwarf2cfi.c (cfi_pop_frame): Use alloca() for regbuf.
> Don't call get_current_frame().
>
Heads up,
I think the write_register_bytes() call should be replaced by
regcache_register_write(current_regcache, ). This is new code so it
doesn't need to go through any of that nasty write_register_bytes() stuff.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame()
2002-07-08 11:37 ` Andrew Cagney
@ 2002-07-10 5:22 ` Richard Earnshaw
2002-07-10 9:43 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Richard Earnshaw @ 2002-07-10 5:22 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Mark Kettenis, gdb-patches, Richard.Earnshaw
> > Using alloca() here is pretty obvious. I discussed the other fix with
> > Michael Ludvig.
> >
> > Checked in.
> >
> > Mark
> >
> > Index: ChangeLog
> > from Mark Kettenis <kettenis@gnu.org>
> >
> > * dwarf2cfi.c (cfi_pop_frame): Use alloca() for regbuf.
> > Don't call get_current_frame().
> >
>
> Heads up,
>
> I think the write_register_bytes() call should be replaced by
> regcache_register_write(current_regcache, ). This is new code so it
> doesn't need to go through any of that nasty write_register_bytes() stuff.
>
> Andrew
>
>
Why is this code trying to poke directly into the regcache at all? AFAICT
it should be operating on the pseudo registers not the cache.
R.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame()
2002-07-10 5:22 ` Richard Earnshaw
@ 2002-07-10 9:43 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-07-10 9:43 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Mark Kettenis, gdb-patches
> Mark
>> >
>> > Index: ChangeLog
>> > from Mark Kettenis <kettenis@gnu.org>
>> >
>> > * dwarf2cfi.c (cfi_pop_frame): Use alloca() for regbuf.
>> > Don't call get_current_frame().
>> >
>
>>
>> Heads up,
>>
>> I think the write_register_bytes() call should be replaced by
>> regcache_register_write(current_regcache, ). This is new code so it
>> doesn't need to go through any of that nasty write_register_bytes() stuff.
>>
>> Andrew
>>
>>
>
>
> Why is this code trying to poke directly into the regcache at all? AFAICT
> it should be operating on the pseudo registers not the cache.
[cooked]
Hmm, yes, good point. It should at least use regcache_cpy() so that it
is ``bug compatible'' with generic_pop_dummy_frame()(1).
At present GDB saves/restores registers in a confused sort of way.
Firstly, the save/restore operation (see regcache_cpy):
- for old targets it iterates over 0..NUM_REGS (the full raw register
space) using write_register_bytes() to restore the registers.
- for new targets it iterates over 0..NUM_REGS (the full raw register
space) using regcache_write() to directly transfer the raw registers.
It then uses this single mechanism(2) to handle two orthogonal
situtations, and that is the problem:
- saving / restoring a raw register cache before / after an inferior
function call. Here, a select list of raw registers should be transfered.
- unwinding a stack frame, storing those unwound register values, and
hence having the effect of poping one or more frames. Here, a select
list of cooked registers should be stored.
Andrew
(1) I also suspect that some cleanups would let the function in question
be eliminated from dwarf2cfi but that is another story.
(2) I believe the regcache changes were ``bug compatible''.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-07-10 16:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-08 5:24 [PATCH] Remove bogosities from dwarf2cfi.c:cfi_pop_frame() Mark Kettenis
2002-07-08 11:37 ` Andrew Cagney
2002-07-10 5:22 ` Richard Earnshaw
2002-07-10 9:43 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox