<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/29/2018 01:09 AM, Khem Raj wrote:<br>
    </div>
    <blockquote
      cite="mid:ab613fa4-f4b8-9415-bedf-e2a2b6a52101@gmail.com"
      type="cite">
      <br>
      <br>
      On 12/28/18 8:31 AM, <a class="moz-txt-link-abbreviated" href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a> wrote:
      <br>
      <blockquote type="cite">On Fri, 2018-12-28 at 17:49 +0800, ChenQi
        wrote:
        <br>
        <blockquote type="cite">On 12/26/2018 07:06 PM,
          <a class="moz-txt-link-abbreviated" href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a> wrote:
          <br>
          <blockquote type="cite">On Wed, 2018-12-26 at 10:09 +0800,
            ChenQi wrote:
            <br>
            <blockquote type="cite">Hi All,
              <br>
              <br>
              'oe-selftest -r
              package.PackageTests.test_gdb_hardlink_debug'
              <br>
              fails.
              <br>
              I did the tests on both my Fedora27 and ubuntu16.04
              servers. They
              <br>
              both
              <br>
              failed.
              <br>
              I can also reproduce this issue manually.
              <br>
              <br>
              I did some investigation. No clue how to fix this it. So I
              want
              <br>
              to seek
              <br>
              help from community.
              <br>
              <br>
              Below is some output from oe-selftest.
              <br>
              [snip]
              <br>
              2018-12-26 09:27:58,440 - oe-selftest - INFO -
              <br>
              test_gdb_hardlink_debug
              <br>
              (package.PackageTests)
              <br>
              2018-12-26 09:37:55,333 - oe-selftest - INFO - gdbtest
              <br>
              /usr/bin/hello1
              <br>
              2018-12-26 09:37:59,904 - oe-selftest - ERROR - GDB
              result:
              <br>
              1: Reading symbols from /usr/bin/hello1...Reading symbols
              from
              <br>
              /usr/bin/.debug/hello4...done.
              <br>
              done.
              <br>
              (gdb) Breakpoint 1 at 0x1060: file
              /usr/include/bits/stdio2.h,
              <br>
              line 107.
              <br>
              (gdb) Starting program: /usr/bin/hello1
              <br>
              <br>
              Breakpoint 1, main () at /usr/include/bits/stdio2.h:107
              <br>
              107    /usr/include/bits/stdio2.h: No such file or
              directory.
              <br>
              (gdb) Continuing.
              <br>
              Hello World!
              <br>
              [Inferior 1 (process 312) exited normally]
              <br>
              (gdb)
              <br>
              2018-12-26 09:38:00,907 - oe-selftest - INFO -  ... FAIL
              <br>
              [snip]
              <br>
              <br>
              The hello world problem is as follows.
              <br>
              $ cat
              <br>
              meta-selftest/recipes-test/selftest-hardlink/selftest-
              <br>
              hardlink/hello.c
              <br>
              #include &lt;stdio.h&gt;
              <br>
              <br>
              int main() {
              <br>
                    printf("Hello World!\n");
              <br>
              }
              <br>
              <br>
              Some extra information:
              <br>
              1. Remove '-O2' or '-D_FORTIFY_SOURCE=2', and it works
              correctly.
              <br>
              2. Adding some system call like daemon(0,0) before printf
              also
              <br>
              works.
              <br>
              3. Reverting poky repo to
              <br>
              1c048479af7cc98e30f9a33d1f3bef03711544aa,
              <br>
              which adds this selftest case, does not work. It still
              fails.
              <br>
              4. Hongxu confirms that things work on his host.
              <br>
              5. I also don't see failure about this test case on
              yocto's
              <br>
              autobuilder.
              <br>
              <br>
              Could somebody help to provide some suggestions?
              <br>
            </blockquote>
            <br>
            This is strange and there must be some difference between
            your
            <br>
            configuration and what what we test on the autobuilder or on
            <br>
            Hongxu's
            <br>
            setup.
            <br>
          </blockquote>
            Hi Richard,
          <br>
          <br>
          I have talked with Hongxu and we can now both confirm that
          there does
          <br>
          exist some problem.
          <br>
          <br>
          <blockquote type="cite">Which DISTRO and MACHINE are you
            using?
            <br>
          </blockquote>
            DISTRO is poky
          <br>
          MACHINE is qemux86.
          <br>
          <br>
          It seems that if MACHINE is qemux86-64, the test case could
          pass. But
          <br>
          that's just because the test case only checks 'Breakpoint 1,
          main ()
          <br>
          at hello.c:4'. See the console output below.
          <br>
          (gdb) b main
          <br>
          Breakpoint 1 at 0x1050: file /usr/include/bits/stdio2.h, line
          107.
          <br>
          (gdb) r
          <br>
          Starting program: /usr/bin/hello1
          <br>
          <br>
          Breakpoint 1, main () at hello.c:4
          <br>
          4        printf("Hello World!\n");
          <br>
          (gdb) c
          <br>
          Continuing.
          <br>
          Hello World!
          <br>
          [Inferior 1 (process 156) exited normally]
          <br>
          (gdb) q
          <br>
          <br>
          Even in this case, the 'b main' does not give correct result.
          The
          <br>
          test case passes because 'Breakpoint 1, main () at hello.c:4'
          is
          <br>
          there.
          <br>
          <br>
          On qemux86, we have:
          <br>
          (gdb) Breakpoint 1 at 0x1060: file /usr/include/bits/stdio2.h,
          line
          <br>
          107.
          <br>
          (gdb) Starting program: /usr/bin/hello1
          <br>
          <br>
          Breakpoint 1, main () at /usr/include/bits/stdio2.h:107
          <br>
          107    /usr/include/bits/stdio2.h: No such file or directory.
          <br>
          (gdb) Continuing.
          <br>
          Hello World!
          <br>
          [Inferior 1 (process 156) exited normally]
          <br>
          (gdb)
          <br>
          <br>
          <blockquote type="cite">I think the key to resolving this is
            will be to understanding how
            <br>
            to
            <br>
            reproduce it...
            <br>
          </blockquote>
            Two ways to reproduce the problem:
          <br>
          <br>
          I) reproduce it via oe-selftest
          <br>
          1) . oe-init-build-env build-selftest
          <br>
          2) SANITY_TESTED_DISTROS = ""
          <br>
          3) oe-selftest -r package.PackageTests.test_gdb_hardlink_debug
          <br>
          <br>
          II) reproduce it manually
          <br>
          1) add meta-selftest to bblayers.conf
          <br>
          2) IMAGE_INSTALL_append = " selftest-hardlink
          selftest-hardlink-dbg
          <br>
          selftest-hardlink-gdb"
          <br>
          3) bitbake core-image-minimal
          <br>
          4) On target:
          <br>
                gdb /usr/bin/hello1
          <br>
                (gdb) b main
          <br>
        </blockquote>
        <br>
        I confirmed I could also reproduce it. We've just been lucky
        with the
        <br>
        configuration the autobuilder tests.
        <br>
        <br>
        I think we need to improve the test case. Does installing the
        libc
        <br>
        headers/dev package so that stdio2.h is there help?
        <br>
      </blockquote>
      <br>
      This is not exported API so libc headers may not work but
      installing libc dev package should help here.
      <br>
      <br>
    </blockquote>
    <br>
    Hi Richard and Khem,<br>
    <br>
    Unfortunately installing libc-dev package does not help.<br>
    <br>
    On qemux86:<br>
    1: Reading symbols from /usr/bin/hello1...Reading symbols from
    /usr/bin/.debug/hello4...done.<br>
    done.<br>
    <b>(gdb) Breakpoint 1 at 0x1060: file /usr/include/bits/stdio2.h,
      line 107.</b><br>
    (gdb) Starting program: /usr/bin/hello1 <br>
    <br>
    <b>Breakpoint 1, main () at /usr/include/bits/stdio2.h:107</b><b><br>
    </b><b>107      return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt,
      __va_arg_pack ());</b><br>
    (gdb) Continuing.<br>
    Hello World!<br>
    [Inferior 1 (process 309) exited normally]<br>
    (gdb) <br>
    2018-12-29 10:58:11,538 - oe-selftest - INFO -  ... FAIL<br>
    <br>
    For qemux86-64, things are the same.<br>
    <br>
    Best Regards,<br>
    Chen Qi<br>
    <br>
    <blockquote
      cite="mid:ab613fa4-f4b8-9415-bedf-e2a2b6a52101@gmail.com"
      type="cite">
      <blockquote type="cite">
        <br>
        Cheers,
        <br>
        <br>
        Richard
        <br>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>