From: Joel Brobecker Date: Wed, 2 May 2018 20:59:12 +0000 (-0700) Subject: (ARM/fixed-point) wrong value shown by "finish" command: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a6617193990fd9b6762d735f742f2df542b859c7;p=binutils-gdb.git (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. --- diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7495434484e..e0ef1d2946e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -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