How to use test-nlist

Yu, Mingli mingli.yu@windriver.com
Fri May 24 06:30:00 GMT 2019



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
>



More information about the Elfutils-devel mailing list