[Bug 1420556] Re: gdb source tests are failing in Ubuntu 15.04

Ciro Santilli 六四事件 法轮功 ciro.santilli at gmail.com
Wed Jul 22 12:26:56 UTC 2015


It is well known that GDB has many failing tests. The wiki says:
https://sourceware.org/gdb/wiki/TestingGDB

> One unfortunate characteristic of the GDB testsuite is that, even if
GDB is horribly broken, many tests will still pass.  You can't have much
confidence that things are basically working with 356 failures. You
should look through gdb.log and work through a bunch of them to get a
feel for the state of things.

See also this issue:
https://sourceware.org/bugzilla/show_bug.cgi?id=18067

** Bug watch added: Sourceware.org Bugzilla #18067
   http://sourceware.org/bugzilla/show_bug.cgi?id=18067

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/1420556

Title:
  gdb source tests are failing in Ubuntu 15.04

Status in gdb package in Ubuntu:
  Confirmed

Bug description:
  ---Problem Description---
  gdb source tests are failing in Ubuntu 15.04
   
  ---uname output---
  Linux ubuntu 3.18.0-12-generic #13-Ubuntu SMP Thu Jan 29 13:44:26 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux
   
  Machine Type = P8 
    
  ---Steps to Reproduce---
  Install a Power VM LPAR with Ubuntu 15.04 ISO.
  Then install gdb source and build and execute the same.

  root at ubuntu:~# apt-get source gdb
  root at ubuntu:~# cd gdb-7.8.2/
  root at ubuntu:~/gdb-7.8.2# dpkg-buildpackage -b

                  === gdb Summary ===

  # of expected passes            25147
  # of unexpected failures        280
  # of unexpected successes       2
  # of expected failures          66
  # of unknown successes          1
  # of known failures             59
  # of unresolved testcases       11
  # of untested testcases         21
  # of unsupported tests          99
  /root/gdb-7.8.2/build/objdir/gdb/testsuite/../../gdb/gdb version  7.8.2-0ubuntu1) -nw -nx -data-directory /root/gdb-7.8.2/build/objdir/gdb/testsuite/../data-directory

  Package: gdb-7.8.2-0ubuntu1

  I've reproduced the tests and looking at gdb.log, noticed that for
  some reason breakpoints for main() are being hit in an unexpected
  place and this is causing a lot of testcase failures. Also, this
  problem happens only when using gcc 4.9 (Ubuntu 15.04 default); it's
  not reproducible on gcc 4.8 or 5. This is still being investigated.

  Moreover, in the gdb.python/python.exp specifically, there is this
  commit 55cfb2c4c8accd5031fd7c8167988fc4624e847c from upstream gdb that
  fixes the testcase, removing 19 of the unexpected failures.

  I've created this testcase that exemplifies the issue with the
  'breakpoint main' hit the unexpected place:

  ubuntu at ubuntu:~$ cat array.c
  int main (void)
  {
    int array[1];

    return 0;
  }
  ubuntu at ubuntu:~$ gcc array.c -g -o array-4.9
  ubuntu at ubuntu:~$ gdb -q ./array-4.9 -ex 'break main' -ex run
  Reading symbols from ./array-4.9...done.
  Breakpoint 1 at 0x1000060c: file array.c, line 3.
  Starting program: /home/ubuntu/array-4.9 

  Breakpoint 1, main () at array.c:3
  3       {
  (gdb) 

  While with gcc-4.8, gdb stops at the expected place:

  ubuntu at ubuntu:~$ gcc-4.8 array.c -g -o array-4.8
  ubuntu at ubuntu:~$ gdb -q ./array-4.8 -ex 'break main' -ex run
  Reading symbols from ./array-4.8...done.
  Breakpoint 1 at 0x100005a0: file array.c, line 6.
  Starting program: /home/ubuntu/array-4.8 

  Breakpoint 1, main () at array.c:6
  6         return 0;
  (gdb) 

  Comparing the assembly output generated by both gcc's, we can also
  notice a repeated '.loc 1 3 0' in the code that seems to cause this
  misplaced breakpoint:

  ubuntu at ubuntu:~$ gcc array.c -g -o array-4.9.s -S
  ubuntu at ubuntu:~$ cat array-4.9.s
  (...)
  main:   
  .LFB0:
          .file 1 "array.c"
          .loc 1 3 0
          .cfi_startproc
  0:      addis 2,12,.TOC.-0b at ha
          addi 2,2,.TOC.-0b at l
          .localentry     main,.-main
          mflr 0
          std 0,16(1)
          std 31,-8(1)
          stdu 1,-64(1)
          .cfi_def_cfa_offset 64
          .cfi_offset 65, 16
          .cfi_offset 31, -8
          mr 31,1
          .cfi_def_cfa_register 31
          .loc 1 3 0  <-- repeated .loc
          ld 9,-28688(13)
          std 9,40(31)
          li 9,0
          .loc 1 6 0
          li 9,0
          .loc 1 7 0
          mr 3,9   
          ld 10,40(31)
          ld 9,-28688(13)
          cmpld 7,10,9
          li 10,0  
          li 9,0   
          beq 7,.L3
          bl __stack_chk_fail
          nop
  .L3:
  (...)

  If this additional .loc is removed, gdb is able to hit the breakpoint at the correct place.
  Moreover, it might be worth mentioning that this additional .loc doesn't appear on gcc-5 output too, where this breakpoint issue is not reproducible as well.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1420556/+subscriptions



More information about the foundations-bugs mailing list