From 8439f446a1f2cbb69bb09535e99d166f94a7fdb4 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 8 Dec 2020 09:29:40 +0100 Subject: [PATCH] [gdb/testsuite] Fix gdb.ada/mi_task_arg.exp for -m32 When running test-case gdb.ada/mi_task_arg.exp with target board unix/-m32, I run into: ... (gdb) ^M Expecting: ^(-stack-list-arguments 1[^M ]+)?(\^done,stack-args=\[ \ frame={level="0",args=\[\]}, \ frame={level="1",args=\[{name="<_task>",value="0x[0-9A-Fa-f]+"}\]}, \ frame={level="2",args=\[({name="self_id",value="0x[0-9A-Fa-f]+"})?\]},.*[^M ]+[(]gdb[)] ^M [ ]*) -stack-list-arguments 1^M ^done,stack-args=[ \ frame={level="0",args=[]}, \ frame={level="1",args=[{name="<_task>",value="0x808abf0"}]}, \ frame={level="2",args=[{name="self_id",value=""}]}, \ frame={level="3",args=[]},frame={level="4",args=[]}]^M (gdb) ^M FAIL: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 (unexpected output) ... The problem is that we're expecting a $hex for the value of self_id, but instead get . Looking at the debug info for self_id: ... <1><12a1f>: Abbrev Number: 84 (DW_TAG_subprogram) <12a20> DW_AT_name : system__tasking__stages__task_wrapper ... <2><12a35>: Abbrev Number: 61 (DW_TAG_formal_parameter) <12a36> DW_AT_name : self_id <12a40> DW_AT_location : 0x459e (location list) ... it refers to location information here: ... 0000459e 08053060 080531ac (DW_OP_fbreg: 0) 000045aa 0805327c 080532a5 (DW_OP_fbreg: 0) 000045b6 08053320 08053324 (DW_OP_fbreg: 0) ... while the pc used to retrieve the location information is 0x080531c5: ... $ gdb -batch outputs/gdb.ada/mi_task_arg/task_switch \ -ex "break 57" -ex run -ex bt ... #0 task_switch.break_me () at task_switch.adb:57 #1 0x0804aaae in task_switch.caller (<_task>=0x808abf0) \ at task_switch.adb:51 #2 0x080531c5 in system.tasking.stages.task_wrapper \ (self_id=) at s-tassta.adb:1295 ... which indeed falls outside of the ranges listed in the location info. Fix this by accepting as valid value of self_id. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-12-08 Tom de Vries * gdb.ada/mi_task_arg.exp: Accept as valid value of self_id. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.ada/mi_task_arg.exp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3b7deafe91b..2cf25a4311b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-12-08 Tom de Vries + + * gdb.ada/mi_task_arg.exp: Accept as valid value of + self_id. + 2020-12-07 Pedro Alves * gdb.base/break-on-linker-gcd-function.exp: Remove unused diff --git a/gdb/testsuite/gdb.ada/mi_task_arg.exp b/gdb/testsuite/gdb.ada/mi_task_arg.exp index 2a4038d77b7..ace808c6059 100644 --- a/gdb/testsuite/gdb.ada/mi_task_arg.exp +++ b/gdb/testsuite/gdb.ada/mi_task_arg.exp @@ -49,9 +49,11 @@ if ![mi_runto "task_switch.break_me"] then { # Frame for task_switch.break_me set frame0 "frame=\{level=\"0\",args=\\\[\\\]\}" # Frame for task_switch.caller -set frame1 "frame=\{level=\"1\",args=\\\[\{name=\"<_task>\",value=\"$hex\"\}\\\]\}" +set frame1_args "\{name=\"<_task>\",value=\"$hex\"\}" +set frame1 "frame=\{level=\"1\",args=\\\[$frame1_args\\\]\}" # Frame for system.tasking.stages.task_wrapper -set frame2 "frame=\{level=\"2\",args=\\\[(\{name=\"self_id\",value=\"$hex\"\})?\\\]\}" +set frame2_args "(\{name=\"self_id\",value=\"($hex|)\"\})?" +set frame2 "frame=\{level=\"2\",args=\\\[$frame2_args\\\]\}" mi_gdb_test "-stack-list-arguments 1" \ "\\^done,stack-args=\\\[$frame0,$frame1,$frame2,.*" \ "-stack-list-arguments 1" -- 2.30.2