Commit 8439f446 authored by Tom de Vries's avatar Tom de Vries
Browse files

[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]+"}\]}, \
]+[(]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="<optimized out>"}]}, \
(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 <optimized out>.

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=<optimized out>) at s-tassta.adb:1295
which indeed falls outside of the ranges listed in the location info.

Fix this by accepting <optimized out> as valid value of self_id.

Tested on x86_64-linux.


2020-12-08  Tom de Vries  <>

	* gdb.ada/mi_task_arg.exp: Accept <optimized out> as valid value of
parent 28e36bf8
2020-12-08 Tom de Vries <>
* gdb.ada/mi_task_arg.exp: Accept <optimized out> as valid value of
2020-12-07 Pedro Alves <>
* gdb.base/break-on-linker-gcd-function.exp: Remove unused
......@@ -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|<optimized out>)\"\})?"
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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment