[binutils-gdb] (Ada/tasking) fix array or string index out of range warning

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[binutils-gdb] (Ada/tasking) fix array or string index out of range warning

sergiodj+buildbot-2
*** TEST RESULTS FOR COMMIT 76136aeda5ca3f23ba2f86fb6a6938b381d37f61 ***

Author: Joel Brobecker <[hidden email]>
Branch: master
Commit: 76136aeda5ca3f23ba2f86fb6a6938b381d37f61

(Ada/tasking) fix array or string index out of range warning

A recent change in the compiler highlighted a small weakness in
the function reading the contents of the Ada Task Control Block
(ATCB -- the data that allows us to inspect Ada tasks). As a result,
anytime we read it, we started getting some warnings. For instance,
using the gdb.ada/tasks.exp testcase...

        $ gnatmake -g foo.adb
        $ gdb foo
        (gdb) b foo.adb:60
        Breakpoint 1 at 0x403e07: file foo.adb, line 60.
        (gdb) run
        [...]
        Thread 1 "foo" hit Breakpoint 1, foo () at foo.adb:60
        60         for J in Task_List'Range loop  -- STOP_HERE

... we can see that the "info tasks" command produces some warnings,
followed by the correct output.

        (gdb) info tasks
  !! ->  warning: array or string index out of range
  !! ->  warning: array or string index out of range
  !! ->  warning: array or string index out of range
  !! ->  warning: array or string index out of range
           ID       TID P-ID Pri State                  Name
        *   1    654050       48 Runnable               main_task
            2    654ef0    1  48 Accept or Select Term  task_list(1)
            3    658680    1  48 Accept or Select Term  task_list(2)
            4    65be10    1  48 Accept or Select Term  task_list(3)

The problem comes from the fact that read_atcb, the function responsible
for loading the contents of the ATCB, blindly tries to read some data
which is only relevant when a task is waiting for another task on
an entry call. A comment in that code's section gives a hint as to
how the information is meant to be decoded:

      /* Let My_ATCB be the Ada task control block of a task calling the
         entry of another task; then the Task_Id of the called task is
         in My_ATCB.Entry_Calls (My_ATCB.ATC_Nesting_Level).Called_Task.  */

What the comment shows is that, to get the Id of the task being called,
one has to go through the entry calls field, which is an array pointer.
Up to now, we were lucky that, for tasks that are _not_ waiting on an
entry call, its ATCB atc_nesting_level used to be set to 1, and so
we were able to silently read some irrelevant data. But a recent change
now causes this field to be zero instead, and this triggers the warning,
since we are now trying to read outside of the array's range (arrays
in Ada often start at index 1, as is the case here).

We avoid this issue by simply only reading that data when the data
is actually known to be relevant (state == Entry_Caller_Sleep).

This, in turn, allows us to simplify a bit the use of the task_info->state
field, where we no longer need to check task the task has a state equal
to Entry_Caller_Sleep before using this field. Indeed, with this new
approach, we now know that, unless task_info->state == Entry_Caller_Sleep,
the state is now guaranteed to be zero. In other words, we no longer set
task_info->called_task to some random value, forcing to check the task's
state first as a way to verify that the data is not random.

gdb/ChangeLog:

        * ada-lang.c (read_atcb): Only set task_info->called_task if
        task_info->state == Entry_Caller_Sleep.
        (print_ada_task_info): Do not check task_info->state before
        checking task_info->called_task.
        (info_task): Likewise.
Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master

sergiodj+buildbot-2
Buildslave:
        fedora-x86-64-3

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-x86_64-native-extended-gdbserver-m32/builds/11115>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-x86_64-native-extended-gdbserver-m32/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> UNRESOLVED: gdb.ada/mi_var_array.exp: breakpoint at main
PASS -> FAIL: gdb.ada/mi_var_array.exp: create bt varobj
PASS -> FAIL: gdb.ada/mi_var_array.exp: list vta's children
PASS -> UNRESOLVED: gdb.ada/mi_var_array.exp: run to bar.adb:28
new FAIL: gdb.ada/mi_var_array.exp: wait for stop
new UNRESOLVED: gdb.fortran/short-circuit-argument-list.exp: delete all breakpoints in delete_breakpoints
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-extended-gdbserver-m32/xfails/master/xfail?id=27660b60>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-extended-gdbserver-m32/xfails/master/xfail.table?id=27660b60>



Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-x86_64-cc-with-index, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        fedora-x86-64-4

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-x86_64-cc-with-index/builds/11351>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-x86_64-cc-with-index/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=on: cond_bp_target=0: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-cc-with-index/xfails/master/xfail?id=353d7162>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-cc-with-index/xfails/master/xfail.table?id=353d7162>



Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        fedora-x86-64-1

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-x86_64-native-extended-gdbserver-m64/builds/11386>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-x86_64-native-extended-gdbserver-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> FAIL: gdb.arch/amd64-prologue-skip.exp: break *minsym
PASS -> UNRESOLVED: gdb.arch/amd64-prologue-skip.exp: break *pushrbp
PASS -> FAIL: gdb.arch/amd64-prologue-skip.exp: break minsym
PASS -> FAIL: gdb.arch/amd64-prologue-skip.exp: break pushrbp
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=off: cond_bp_target=0: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-extended-gdbserver-m64/xfails/master/xfail?id=afbcf1ed>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-extended-gdbserver-m64/xfails/master/xfail.table?id=afbcf1ed>



Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-x86_64-native-gdbserver-m32, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        fedora-x86-64-3

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-x86_64-native-gdbserver-m32/builds/11124>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-x86_64-native-gdbserver-m32/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
new UNRESOLVED: gdb.base/interrupt.exp: echo more data
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-gdbserver-m32/xfails/master/xfail?id=a94ee872>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-native-gdbserver-m32/xfails/master/xfail.table?id=a94ee872>



Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-x86_64-m32, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        fedora-x86-64-2

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-x86_64-m32/builds/11191>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-x86_64-m32/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=off: cond_bp_target=1: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-m32/xfails/master/xfail?id=252f4af6>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-x86_64-m32/xfails/master/xfail.table?id=252f4af6>



Reply | Threaded
Open this post in threaded view
|

Failures on RHEL-s390x-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        rhel-7_1-s390x-1

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/RHEL-s390x-m64/builds/8754>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/RHEL-s390x-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=on: cond_bp_target=0: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/RHEL-s390x-m64/xfails/master/xfail?id=f63d7267>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/RHEL-s390x-m64/xfails/master/xfail.table?id=f63d7267>



Reply | Threaded
Open this post in threaded view
|

Failures on Fedora-s390x-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        marist-fedora-s390x

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Fedora-s390x-m64/builds/10078>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Fedora-s390x-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> KFAIL: gdb.threads/non-ldr-exit.exp: program exits normally
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=off: cond_bp_target=1: inferior 1 exited
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=on: cond_bp_target=1: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-s390x-m64/xfails/master/xfail?id=c150c6be>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Fedora-s390x-m64/xfails/master/xfail.table?id=c150c6be>



Reply | Threaded
Open this post in threaded view
|

Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        ubuntu16-aarch64

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Ubuntu-Aarch64-native-extended-gdbserver-m64/builds/116>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Ubuntu-Aarch64-native-extended-gdbserver-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>




Reply | Threaded
Open this post in threaded view
|

Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        ubuntu16-aarch64

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Ubuntu-Aarch64-native-gdbserver-m64/builds/4485>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Ubuntu-Aarch64-native-gdbserver-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>




Reply | Threaded
Open this post in threaded view
|

Failures on Ubuntu-Aarch64-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        ubuntu16-aarch64

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Ubuntu-Aarch64-m64/builds/4553>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Ubuntu-Aarch64-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> FAIL: gdb.threads/multi-create.exp: continue to breakpoint 10
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Ubuntu-Aarch64-m64/xfails/master/xfail?id=a78cdb4f>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Ubuntu-Aarch64-m64/xfails/master/xfail.table?id=a78cdb4f>



Reply | Threaded
Open this post in threaded view
|

Failures on Debian-s390x-native-gdbserver-m64, branch master

sergiodj+buildbot-2
In reply to this post by sergiodj+buildbot-2
Buildslave:
        debian-jessie-s390x-1

Full Build URL:
        <http://gdb-build.sergiodj.net/builders/Debian-s390x-native-gdbserver-m64/builds/6918>

Commit(s) tested:
        76136aeda5ca3f23ba2f86fb6a6938b381d37f61

Author(s) (in the same order as the commits):
        Joel Brobecker <[hidden email]>

Subject:
        (Ada/tasking) fix array or string index out of range warning

Testsuite log (gdb.sum and gdb.log) URL(s):
        <http://gdb-build.sergiodj.net/results/Debian-s390x-native-gdbserver-m64/76/76136aeda5ca3f23ba2f86fb6a6938b381d37f61/>

*** Diff to previous build ***
============================
PASS -> KFAIL: gdb.threads/process-dies-while-handling-bp.exp: non_stop=on: cond_bp_target=1: inferior 1 exited
============================


*** Complete list of XFAILs for this builder ***

To obtain the list of XFAIL tests for this builder, go to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Debian-s390x-native-gdbserver-m64/xfails/master/xfail?id=c5738df2>

You can also see a pretty-printed version of the list, with more information
about each XFAIL, by going to:

        <https://git.sergiodj.net/gdb-xfails.git/tree/xfails/Debian-s390x-native-gdbserver-m64/xfails/master/xfail.table?id=c5738df2>