* [patch/mips] Use unwind in mips_get_saved_register
@ 2002-09-13 10:55 Andrew Cagney
2002-09-13 11:20 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-09-13 10:55 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
Hello,
The attached is ``two steps forward, one step back'' patch.
It modifies mips_get_saved_register() so that it uses the new unwind
code. The new unwind code automatically handles the fetching of
registers in dummy-frames. Unfortunatly, the change doesn't fix the
problem of the MIPS fiddling memory register reads dependant on the
current ABI.
I think, over all it is a step forward though. It at least helps to
make it possible to convert the MIPS to generic dummy frames.
-o32 -64 and -n32 all show no regressions.
committed,
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2903 bytes --]
Fri Sep 13 07:42:09 2002 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (mips_get_saved_register): Re-hack using
frame_register_unwind.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.121
diff -u -r1.121 mips-tdep.c
--- mips-tdep.c 10 Sep 2002 21:31:18 -0000 1.121
+++ mips-tdep.c 13 Sep 2002 17:21:13 -0000
@@ -5426,59 +5426,47 @@
static void
mips_get_saved_register (char *raw_buffer,
- int *optimized,
+ int *optimizedp,
CORE_ADDR *addrp,
struct frame_info *frame,
int regnum,
- enum lval_type *lval)
+ enum lval_type *lvalp)
{
- CORE_ADDR addr;
+ CORE_ADDR addrx;
+ enum lval_type lvalx;
+ int optimizedx;
+ int realnum;
if (!target_has_registers)
error ("No registers.");
- /* Normal systems don't optimize out things with register numbers. */
- if (optimized != NULL)
- *optimized = 0;
- addr = find_saved_register (frame, regnum);
- if (addr != 0)
+ /* Make certain that all needed parameters are present. */
+ if (addrp == NULL)
+ addrp = &addrx;
+ if (lvalp == NULL)
+ lvalp = &lvalx;
+ if (optimizedp == NULL)
+ optimizedp = &optimizedx;
+ frame_register_unwind (get_next_frame (frame), regnum, optimizedp, lvalp,
+ addrp, &realnum, raw_buffer);
+ /* FIXME: cagney/2002-09-13: This is just so bad. The MIPS should
+ have a pseudo register range that correspons to the ABI's, rather
+ than the ISA's, view of registers. These registers would then
+ implicitly describe their size and hence could be used without
+ the below munging. */
+ if ((*lvalp) == lval_memory)
{
- if (lval != NULL)
- *lval = lval_memory;
- if (regnum == SP_REGNUM)
- {
- if (raw_buffer != NULL)
- {
- /* Put it back in target format. */
- store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
- (LONGEST) addr);
- }
- if (addrp != NULL)
- *addrp = 0;
- return;
- }
if (raw_buffer != NULL)
{
- LONGEST val;
if (regnum < 32)
- /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
- saved. */
- val = read_memory_integer (addr, MIPS_SAVED_REGSIZE);
- else
- val = read_memory_integer (addr, REGISTER_RAW_SIZE (regnum));
- store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val);
+ {
+ /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
+ saved. */
+ LONGEST val = read_memory_integer ((*addrp), MIPS_SAVED_REGSIZE);
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val);
+ }
}
}
- else
- {
- if (lval != NULL)
- *lval = lval_register;
- addr = REGISTER_BYTE (regnum);
- if (raw_buffer != NULL)
- read_register_gen (regnum, raw_buffer);
- }
- if (addrp != NULL)
- *addrp = addr;
}
/* Immediately after a function call, return the saved pc.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch/mips] Use unwind in mips_get_saved_register
2002-09-13 10:55 [patch/mips] Use unwind in mips_get_saved_register Andrew Cagney
@ 2002-09-13 11:20 ` Kevin Buettner
2002-09-13 13:00 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2002-09-13 11:20 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
On Sep 13, 1:55pm, Andrew Cagney wrote:
> The attached is ``two steps forward, one step back'' patch.
>
> It modifies mips_get_saved_register() so that it uses the new unwind
> code. The new unwind code automatically handles the fetching of
> registers in dummy-frames. Unfortunatly, the change doesn't fix the
> problem of the MIPS fiddling memory register reads dependant on the
> current ABI.
I posted a similar patch last month:
http://sources.redhat.com/ml/gdb-patches/2002-08/msg00198.html
At that time you rejected it for the reasons given in:
http://sources.redhat.com/ml/gdb-patches/2002-08/msg00214.html
http://sources.redhat.com/ml/gdb-patches/2002-08/msg00235.html
Please explain what has changed between then and now which makes it
acceptable to now use frame_register_unwind()?
Puzzled,
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch/mips] Use unwind in mips_get_saved_register
2002-09-13 11:20 ` Kevin Buettner
@ 2002-09-13 13:00 ` Andrew Cagney
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2002-09-13 13:00 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On Sep 13, 1:55pm, Andrew Cagney wrote:
>
>
>> The attached is ``two steps forward, one step back'' patch.
>>
>> It modifies mips_get_saved_register() so that it uses the new unwind
>> code. The new unwind code automatically handles the fetching of
>> registers in dummy-frames. Unfortunatly, the change doesn't fix the
>> problem of the MIPS fiddling memory register reads dependant on the
>> current ABI.
>
>
> I posted a similar patch last month:
>
> http://sources.redhat.com/ml/gdb-patches/2002-08/msg00198.html
>
> At that time you rejected it for the reasons given in:
>
> http://sources.redhat.com/ml/gdb-patches/2002-08/msg00214.html
> http://sources.redhat.com/ml/gdb-patches/2002-08/msg00235.html
>
> Please explain what has changed between then and now which makes it
> acceptable to now use frame_register_unwind()?
I know. See:
http://sources.redhat.com/ml/gdb-patches/2002-09/msg00223.html
At the time of your original patch, the only motivation was the
elimination of frame_register_unwind() --- on its own, I don't see any
benefit. Since then, as part of converting the MIPS to generic dummy
frames (a needed and huge forward step), I've found that I need to use
the generic unwind code to at least keep things working. You'll note
that the code includes some very blunt comments that make it clear where
any bugs are.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-13 20:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13 10:55 [patch/mips] Use unwind in mips_get_saved_register Andrew Cagney
2002-09-13 11:20 ` Kevin Buettner
2002-09-13 13:00 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox