From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119722 invoked by alias); 24 May 2019 06:30:38 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 119502 invoked by uid 89); 24 May 2019 06:30:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-7.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=24=e6?= X-Spam-Status: No, score=-7.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mail1.windriver.com Received: from mail1.windriver.com (HELO mail1.windriver.com) (147.11.146.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 May 2019 06:30:13 +0000 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id x4O6U5v9027946 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 23 May 2019 23:30:06 -0700 (PDT) Received: from [128.224.162.170] (128.224.162.170) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 May 2019 23:30:05 -0700 Subject: Re: How to use test-nlist To: Mark Wielaard References: <5CE65F57.6010900@windriver.com> <20190523115029.GD2464@wildebeest.org> <5CE75E69.1060905@windriver.com> <20190524062336.GA2818@wildebeest.org> CC: From: "Yu, Mingli" Message-ID: <5CE790DF.6010809@windriver.com> Date: Fri, 24 May 2019 06:30:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20190524062336.GA2818@wildebeest.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [128.224.162.170] X-IsSubscribed: yes X-SW-Source: 2019-q2/txt/msg00099.txt.bz2 On 2019年05月24日 14:23, Mark Wielaard wrote: > On Fri, May 24, 2019 at 11:00:57AM +0800, Yu, Mingli wrote: >> On 2019年05月23日 19:50, Mark Wielaard wrote: >>>> # ./tests/test-nlist >>>> nlist failed >>> >>> You are supposed to run it with make check. >>> make check TESTS=test-nlist >>> >>> test-nlist tries to run nlist on itself. >>> So it has to be in the current working directory. >> >> Thanks Mark for your respond! >> As you said "So it has to be in the current working directory.", what do you >> mean? test-nlist needs to locate in the current working directory? > > Yes. See the source code. > The test tries to run nlist on "./test-nlist". Which package provides nlist, I didn't found nlist in my system. Thanks, > >>> Basically nlist fills in the n_value and n_scnum with the st_value and >>> st_shndx of the symbol named if found. >>> >>> As you can see for me it corresponds to the values found by: >>> >>> $ eu-readelf -s ./test-nlist | egrep ' (var|bss|main|foo)' >>> 58: 0000000000004048 4 OBJECT GLOBAL DEFAULT 24 var >>> 61: 0000000000004050 4 OBJECT GLOBAL DEFAULT 25 bss >>> 66: 0000000000001310 3 FUNC GLOBAL DEFAULT 14 foo >>> 71: 0000000000001080 408 FUNC GLOBAL DEFAULT 14 main >> >> # which eu-readelf >> /usr/bin/eu-readelf >> >> # /usr/bin/eu-readelf -s tests/test-nlist >> Symbol table [ 5] '.dynsym' contains 11 entries: >> 1 local symbol String table: [ 6] '.dynstr' >> Num: Value Size Type Bind Vis Ndx Name >> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF >> 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF >> _ITM_deregisterTMCloneTable >> 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> puts@GLIBC_2.2.5 (2) >> 3: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> __stack_chk_fail@GLIBC_2.4 (3) >> 4: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> __libc_start_main@GLIBC_2.2.5 (2) >> 5: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF >> __gmon_start__ >> 6: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> nlist@ELFUTILS_1.0 (4) >> 7: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> __printf_chk@GLIBC_2.3.4 (5) >> 8: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF >> exit@GLIBC_2.2.5 (2) >> 9: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF >> _ITM_registerTMCloneTable >> 10: 0000000000000000 0 FUNC WEAK DEFAULT UNDEF >> __cxa_finalize@GLIBC_2.2.5 (2) > > For some reason your test-nlist doesn't have an .symtab. > Make sure that when you build the tests CLFAGS contains -g. > And the that test binary isn't accidentially stripped afterwards. > > Cheers, > > Mark >