(ARM/fixed-point) wrong value shown by "finish" command:

Consider the following Ada code:

   type FP1_Type is delta 0.1 range -1.0 .. +1.0; --  Ordinary
   FP1_Arg : FP1_Type := 0.0;

   function Call_FP1 (F : FP1_Type) return FP1_Type is
   begin
      FP1_Arg := F;
      return FP1_Arg;
   end Call_FP1;

After having stopped inside function Call_FP1 as follow:

    Breakpoint 1, pck.call_fp1 (f=1) at /[...]/pck.adb:5
    5             FP1_Arg := F;

Returning from that function call using "finish" should show
that the function return "1.0" (the same value as was passed
as an argument). However, this is not the case:

    (gdb) finish
    Run till exit from #0  pck.call_fp1 (f=1)
    [...]
    9          F1 := Call_FP1 (F1);
    Value returned is $1 = 0

This patch enhances the extraction of the return value to know about
fixed point types.
This commit is contained in:
Joel Brobecker
2018-05-02 13:59:12 -07:00
committed by Tom Tromey
parent 28397ae781
commit a661719399

View File

@ -8001,7 +8001,8 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
|| type->code () == TYPE_CODE_ENUM
|| is_fixed_point_type (type))
{
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit