* [PATCH/RFC] Get rid of deprectated_read_register_gen in i387-tdep.c
@ 2002-11-03 4:43 Mark Kettenis
2002-11-03 7:26 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2002-11-03 4:43 UTC (permalink / raw)
To: gdb-patches
I checked in the attached patch. Unfortunately this introduces a
FAIL: gdb.base/default.exp: info float
in the testsuite. The output now is:
info float
No registers.
Which makes sense to me since it's the truth. However, "info
registers" and "info vector" print a slightly different message:
info registers
The program has no registers now.
The reason is that the bit of code that prints this message:
if (!target_has_registers)
error ("The program has no registers now.");
if (selected_frame == NULL)
error ("No selected frame.");
isn't executed if a print_float_info method exists in the target
vector. Is there any reason not to move these statements up such that
they're executed even if a target provides the print_float_info
method?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i387-tdep.c (i387_print_float_info): Replace calls to
register_read and deprecated_read_register_gen with calls to
frame_register_read, and make the necessary adjustments to the
surrounding code.
Index: i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.24
diff -u -p -r1.24 i387-tdep.c
--- i387-tdep.c 2 Nov 2002 14:59:10 -0000 1.24
+++ i387-tdep.c 3 Nov 2002 12:31:46 -0000
@@ -321,26 +321,35 @@ void
i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
- unsigned int fctrl;
- unsigned int fstat;
- unsigned int ftag;
- unsigned int fiseg;
- unsigned int fioff;
- unsigned int foseg;
- unsigned int fooff;
- unsigned int fop;
+ char buf[4];
+ ULONGEST fctrl;
+ ULONGEST fstat;
+ ULONGEST ftag;
+ ULONGEST fiseg;
+ ULONGEST fioff;
+ ULONGEST foseg;
+ ULONGEST fooff;
+ ULONGEST fop;
int fpreg;
int top;
- fctrl = read_register (FCTRL_REGNUM);
- fstat = read_register (FSTAT_REGNUM);
- ftag = read_register (FTAG_REGNUM);
- fiseg = read_register (FCS_REGNUM);
- fioff = read_register (FCOFF_REGNUM);
- foseg = read_register (FDS_REGNUM);
- fooff = read_register (FDOFF_REGNUM);
- fop = read_register (FOP_REGNUM);
-
+ frame_register_read (frame, FCTRL_REGNUM, buf);
+ fctrl = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FSTAT_REGNUM, buf);
+ fstat = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FTAG_REGNUM, buf);
+ ftag = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FISEG_REGNUM, buf);
+ fiseg = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FIOFF_REGNUM, buf);
+ fioff = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FOSEG_REGNUM, buf);
+ foseg = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FOOFF_REGNUM, buf);
+ fooff = extract_unsigned_integer (buf, 4);
+ frame_register_read (frame, FOP_REGNUM, buf);
+ fop = extract_unsigned_integer (buf, 4);
+
top = ((fstat >> 11) & 7);
for (fpreg = 7; fpreg >= 0; fpreg--)
@@ -367,7 +376,7 @@ i387_print_float_info (struct gdbarch *g
break;
}
- deprecated_read_register_gen ((fpreg + 8 - top) % 8 + FP0_REGNUM, raw);
+ frame_register_read (frame, (fpreg + 8 - top) % 8 + FP0_REGNUM, raw);
fputs_filtered ("0x", file);
for (i = 9; i >= 0; i--)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH/RFC] Get rid of deprectated_read_register_gen in i387-tdep.c
2002-11-03 4:43 [PATCH/RFC] Get rid of deprectated_read_register_gen in i387-tdep.c Mark Kettenis
@ 2002-11-03 7:26 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2002-11-03 7:26 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> I checked in the attached patch. Unfortunately this introduces a
Thanks for flushing these!
> FAIL: gdb.base/default.exp: info float
>
> in the testsuite. The output now is:
>
> info float
> No registers.
>
> Which makes sense to me since it's the truth. However, "info
> registers" and "info vector" print a slightly different message:
>
> info registers
> The program has no registers now.
>
> The reason is that the bit of code that prints this message:
>
> if (!target_has_registers)
> error ("The program has no registers now.");
> if (selected_frame == NULL)
> error ("No selected frame.");
>
> isn't executed if a print_float_info method exists in the target
> vector. Is there any reason not to move these statements up such that
> they're executed even if a target provides the print_float_info
> method?
I can't think of a reason not to.
--
PS: My things to do real soon includes add a function:
get_selected_frame (thread_info *)
if (!thread's target_has_registers)
error ("...");
if (thread's selected_frame != NULL)
return thread's selected_frame;
// now for the fun
// selected_frame = find_frame_by_id (thread's selected frame-id);
// if (selected_frame != NULL)
// return selected_frame;
error ("No selected frame");
and then use that instead of the selected_frame global.
The bit that is commented out is more interesting. It would mean
differentiating between target_changed() and target_run() events.
The former shouldn't change the selected frame but the latter should set
it back to current frame. This will cause a behavioral change in GDB
but I think it will really fix a bug.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-03 15:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-03 4:43 [PATCH/RFC] Get rid of deprectated_read_register_gen in i387-tdep.c Mark Kettenis
2002-11-03 7:26 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox