Bug#936055: t/unthreaded.t test failing

Sergio Durigan Junior sergiodj at debian.org
Mon Mar 2 05:10:32 GMT 2020


Control: reassign -1 gdb 9.1-1
Control: forwarded -1 https://sourceware.org/ml/gdb-patches/2020-03/msg00010.html
Control: retitle -1 [regression] GDB can't printf convenience vars that hold pointers to strings

On Wednesday, February 19 2020, gregor herrmann wrote:

> On Wed, 19 Feb 2020 14:16:52 +0100, Héctor Orón Martínez wrote:
>
>>   This issue is now affecting GDB 9.1 autopkgtests and preventing it from migrating to testing.
>>   https://ci.debian.net/data/autopkgtest/testing/amd64/liba/libapp-stacktrace-perl/4328197/log.gz
>>   https://ci.debian.net/data/autopkgtest/testing/arm64/liba/libapp-stacktrace-perl/4314744/log.gz
>
> Oh, one of the bugs which "hide":
> https://ci.debian.net/packages/liba/libapp-stacktrace-perl/testing/amd64/
> is all green, and after clicking on britney it turns red:
> https://ci.debian.net/user/britney/jobs?package=libapp-stacktrace-perl&suite[]=testing&arch[]=amd64

Hi there,

After spending a non-trivial amount of time investigating this over the
weekend, I was able to find the underlying case of the bug (and come up
with a fix).  Please, keep reading.

> Anyway, in the meantime it also FTBFS in unstable:
>
> # [Thread debugging using libthread_db enabled]
> # Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> # 0x00007f7b77cc1047 in select () from /lib/x86_64-linux-gnu/libc.so.6
> # à|ÚU:101
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # [Inferior 1 (process 25884) detached]
>
> #   Failed test at t/unthreaded.t line 55.
> #                   '[Thread debugging using libthread_db enabled]
> # Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> # 0x00007f7b77cc1047 in select () from /lib/x86_64-linux-gnu/libc.so.6
> # à|ÚU:101
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # à|ÚU:106
> # [Inferior 1 (process 25884) detached]
> # '
> #     doesn't match '(?^mx:
> #                 (?:
> #                     ^t/unthreaded\.t:\d+\n
> #                 ){10}
> #             )'
> # Looks like you failed 1 test of 5.
> t/unthreaded.t ............ 
> 1..5
> not ok 1
> ok 2 - Reaped pstack
> ok 3 - exit(0)
> ok 4 - No signals
> ok 5 - No core dump
> # Alive top 1582127930: 1 middle: 1
> # Alive top 1582127931: 1 middle: 0
> Dubious, test returned 1 (wstat 256, 0x100)
> Failed 1/5 subtests 
>
> Test Summary Report
> -------------------
> t/unthreaded.t          (Wstat: 256 Tests: 5 Failed: 1)
>   Failed test:  1
>   Non-zero exit status: 1
> Files=4, Tests=6,  2 wallclock secs ( 0.03 usr  0.01 sys +  0.96 cusr  0.09 csys =  1.09 CPU)
> Result: FAIL
>
> (I _think_ that's yet another different error.)

This seems to be the same failure reported by doko.

> In testing with gdb 8.3.1 the package still builds:
>
> # [Thread debugging using libthread_db enabled]
> # Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> # 0x00007f1b9eb77047 in select () from /lib/x86_64-linux-gnu/libc.so.6
> # t/unthreaded.t:101
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # t/unthreaded.t:106
> # [Inferior 1 (process 3207) detached]
> t/unthreaded.t ............ 
> 1..5
> ok 1
> ok 2 - Reaped pstack
> ok 3 - exit(0)
> ok 4 - No signals
> ok 5 - No core dump
> # Alive top 1582128303: 1 middle: 1
> # Alive top 1582128304: 1 middle: 0
> ok

Right.  This is actually a regression that happened on GDB (therefore
I'm reassigning the bug).

So, it took me quite a bit of time to debug this because
libapp-stacktrace-perl doesn't help when it comes to seeing what GDB is
doing inside it...  But I was able to determine that the problem started
happening after the following upstream commit:

  commit 1f6f6e21fa86dc3411a6498608f32e9eb24b7851
  Author: Philippe Waroquiers <philippe.waroquiers at skynet.be>
  Date:   Mon Jun 10 21:41:51 2019 +0200

      Ensure GDB printf command can print convenience var strings without a target.

As the commit title says, the goal here was to make GDB's "printf"
command be able to print convenience variables that are strings without
the need for a target (a program/corefile being debugged, for example).
However, the commit changed the way GDB treats convenience variables
that *point* to addresses referring to e.g. a "char *" inside the
debuggee's memory space.  GDB will treat this as a string (because it's
pointing to a "char *"), and will try to obtain its value via the wrong
mechanism.

I won't dive too deep here; suffice it to say that if we treat
convenience variables that hold pointers in a different manner, then
things get back to normal.

I submitted a tentative patch to fix this upstream, and will backport it
downstream once my approach is deemed correct.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20200302/3c046089/attachment-0001.sig>


More information about the pkg-perl-maintainers mailing list