public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* How to use test-nlist
@ 2019-05-23  8:46 Yu, Mingli
  2019-05-23 11:50 ` Mark Wielaard
  0 siblings, 1 reply; 9+ messages in thread
From: Yu, Mingli @ 2019-05-23  8:46 UTC (permalink / raw)
  To: elfutils-devel

Hi Expert,

I run some tests about elfutils, but one test as test-nlist always fails 
as below:

# ./tests/test-nlist
nlist failed

# cd tests
# ./test-nlist  -d
nl[0].n_name = "var"
nl[0].n_value = 0
nl[0].n_scnum = 0
nl[0].n_type = 0
nl[0].n_sclass = 0
nl[0].n_numaux = 0

nl[1].n_name = "bss"
nl[1].n_value = 0
nl[1].n_scnum = 0
nl[1].n_type = 0
nl[1].n_sclass = 0
nl[1].n_numaux = 0

nl[2].n_name = "main"
nl[2].n_value = 0
nl[2].n_scnum = 0
nl[2].n_type = 0
nl[2].n_sclass = 0
nl[2].n_numaux = 0

nl[3].n_name = "foo"
nl[3].n_value = 0
nl[3].n_scnum = 0
nl[3].n_type = 0
nl[3].n_sclass = 0
nl[3].n_numaux = 0

nl[4].n_name = "not-there"
nl[4].n_value = 0
nl[4].n_scnum = 0
nl[4].n_type = 0
nl[4].n_sclass = 0
nl[4].n_numaux = 0
# echo $?
1


Any hints?

Thanks,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-23  8:46 How to use test-nlist Yu, Mingli
@ 2019-05-23 11:50 ` Mark Wielaard
  2019-05-24  2:54   ` Yu, Mingli
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Wielaard @ 2019-05-23 11:50 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: elfutils-devel

On Thu, May 23, 2019 at 04:52:39PM +0800, Yu, Mingli wrote:
> I run some tests about elfutils, but one test as test-nlist always fails as
> below:
> 
> # ./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.
As you do below:

> # cd tests
> # ./test-nlist  -d
> nl[0].n_name = "var"
> nl[0].n_value = 0
> nl[0].n_scnum = 0
> nl[0].n_type = 0
> nl[0].n_sclass = 0
> nl[0].n_numaux = 0
> 
> nl[1].n_name = "bss"
> nl[1].n_value = 0
> nl[1].n_scnum = 0
> nl[1].n_type = 0
> nl[1].n_sclass = 0
> nl[1].n_numaux = 0
> 
> nl[2].n_name = "main"
> nl[2].n_value = 0
> nl[2].n_scnum = 0
> nl[2].n_type = 0
> nl[2].n_sclass = 0
> nl[2].n_numaux = 0
> 
> nl[3].n_name = "foo"
> nl[3].n_value = 0
> nl[3].n_scnum = 0
> nl[3].n_type = 0
> nl[3].n_sclass = 0
> nl[3].n_numaux = 0
> 
> nl[4].n_name = "not-there"
> nl[4].n_value = 0
> nl[4].n_scnum = 0
> nl[4].n_type = 0
> nl[4].n_sclass = 0
> nl[4].n_numaux = 0
> # echo $?
> 1

For some reason all the n_ fields come out as zero.  That is not what
the test expects (except for the last "not-there" entry. It should
look somethng like:

nl[0].n_name = "var"
nl[0].n_value = 16456
nl[0].n_scnum = 24
nl[0].n_type = 1
nl[0].n_sclass = 0
nl[0].n_numaux = 0

nl[1].n_name = "bss"
nl[1].n_value = 16464
nl[1].n_scnum = 25
nl[1].n_type = 1
nl[1].n_sclass = 0
nl[1].n_numaux = 0

nl[2].n_name = "main"
nl[2].n_value = 4224
nl[2].n_scnum = 14
nl[2].n_type = 2
nl[2].n_sclass = 0
nl[2].n_numaux = 0

nl[3].n_name = "foo"
nl[3].n_value = 4880
nl[3].n_scnum = 14
nl[3].n_type = 2
nl[3].n_sclass = 0
nl[3].n_numaux = 0

nl[4].n_name = "not-there"
nl[4].n_value = 0
nl[4].n_scnum = 0
nl[4].n_type = 0
nl[4].n_sclass = 0
nl[4].n_numaux = 0

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

Hope that helps you debug.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-23 11:50 ` Mark Wielaard
@ 2019-05-24  2:54   ` Yu, Mingli
  2019-05-24  6:23     ` Mark Wielaard
  0 siblings, 1 reply; 9+ messages in thread
From: Yu, Mingli @ 2019-05-24  2:54 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel



On 2019年05月23日 19:50, Mark Wielaard wrote:
> On Thu, May 23, 2019 at 04:52:39PM +0800, Yu, Mingli wrote:
>> I run some tests about elfutils, but one test as test-nlist always fails as
>> below:
>>
>> # ./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?

> As you do below:
>
>> # cd tests
>> # ./test-nlist  -d
>> nl[0].n_name = "var"
>> nl[0].n_value = 0
>> nl[0].n_scnum = 0
>> nl[0].n_type = 0
>> nl[0].n_sclass = 0
>> nl[0].n_numaux = 0
>>
>> nl[1].n_name = "bss"
>> nl[1].n_value = 0
>> nl[1].n_scnum = 0
>> nl[1].n_type = 0
>> nl[1].n_sclass = 0
>> nl[1].n_numaux = 0
>>
>> nl[2].n_name = "main"
>> nl[2].n_value = 0
>> nl[2].n_scnum = 0
>> nl[2].n_type = 0
>> nl[2].n_sclass = 0
>> nl[2].n_numaux = 0
>>
>> nl[3].n_name = "foo"
>> nl[3].n_value = 0
>> nl[3].n_scnum = 0
>> nl[3].n_type = 0
>> nl[3].n_sclass = 0
>> nl[3].n_numaux = 0
>>
>> nl[4].n_name = "not-there"
>> nl[4].n_value = 0
>> nl[4].n_scnum = 0
>> nl[4].n_type = 0
>> nl[4].n_sclass = 0
>> nl[4].n_numaux = 0
>> # echo $?
>> 1
>
> For some reason all the n_ fields come out as zero.  That is not what
> the test expects (except for the last "not-there" entry. It should
> look somethng like:
>
> nl[0].n_name = "var"
> nl[0].n_value = 16456
> nl[0].n_scnum = 24
> nl[0].n_type = 1
> nl[0].n_sclass = 0
> nl[0].n_numaux = 0
>
> nl[1].n_name = "bss"
> nl[1].n_value = 16464
> nl[1].n_scnum = 25
> nl[1].n_type = 1
> nl[1].n_sclass = 0
> nl[1].n_numaux = 0
>
> nl[2].n_name = "main"
> nl[2].n_value = 4224
> nl[2].n_scnum = 14
> nl[2].n_type = 2
> nl[2].n_sclass = 0
> nl[2].n_numaux = 0
>
> nl[3].n_name = "foo"
> nl[3].n_value = 4880
> nl[3].n_scnum = 14
> nl[3].n_type = 2
> nl[3].n_sclass = 0
> nl[3].n_numaux = 0
>
> nl[4].n_name = "not-there"
> nl[4].n_value = 0
> nl[4].n_scnum = 0
> nl[4].n_type = 0
> nl[4].n_sclass = 0
> nl[4].n_numaux = 0
>
> 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)

Thanks,

>
> Hope that helps you debug.
>
> Cheers,
>
> Mark
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  2:54   ` Yu, Mingli
@ 2019-05-24  6:23     ` Mark Wielaard
  2019-05-24  6:30       ` Yu, Mingli
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Wielaard @ 2019-05-24  6:23 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: elfutils-devel

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".

> > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  6:23     ` Mark Wielaard
@ 2019-05-24  6:30       ` Yu, Mingli
  2019-05-24  6:39         ` Yu, Mingli
  2019-05-24  6:40         ` Mark Wielaard
  0 siblings, 2 replies; 9+ messages in thread
From: Yu, Mingli @ 2019-05-24  6:30 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel



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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  6:30       ` Yu, Mingli
@ 2019-05-24  6:39         ` Yu, Mingli
  2019-05-24  7:00           ` Mark Wielaard
  2019-05-24  6:40         ` Mark Wielaard
  1 sibling, 1 reply; 9+ messages in thread
From: Yu, Mingli @ 2019-05-24  6:39 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel



On 2019年05月24日 14:36, Yu, Mingli wrote:
>
>
> 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.

Sorry, please ignore this question. I misunderstood just now and thought 
there should be two file nlist and test-nlist need to locate in the 
current working directory.

And I noticed the source code and already run as "./test-nlist", but 
Seems it doesn't work as expected.
# ./test-nlist
# echo $?
1
# ./test-nlist -d
nl[0].n_name = "var"
nl[0].n_value = 0
nl[0].n_scnum = 0
nl[0].n_type = 0
nl[0].n_sclass = 0
nl[0].n_numaux = 0

nl[1].n_name = "bss"
nl[1].n_value = 0
nl[1].n_scnum = 0
nl[1].n_type = 0
nl[1].n_sclass = 0
nl[1].n_numaux = 0

nl[2].n_name = "main"
nl[2].n_value = 0
nl[2].n_scnum = 0
nl[2].n_type = 0
nl[2].n_sclass = 0
nl[2].n_numaux = 0

nl[3].n_name = "foo"
nl[3].n_value = 0
nl[3].n_scnum = 0
nl[3].n_type = 0
nl[3].n_sclass = 0
nl[3].n_numaux = 0

nl[4].n_name = "not-there"
nl[4].n_value = 0
nl[4].n_scnum = 0
nl[4].n_type = 0
nl[4].n_sclass = 0
nl[4].n_numaux = 0
# echo $?
1

Thanks,

>
> 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
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  6:30       ` Yu, Mingli
  2019-05-24  6:39         ` Yu, Mingli
@ 2019-05-24  6:40         ` Mark Wielaard
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Wielaard @ 2019-05-24  6:40 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: elfutils-devel

On Fri, May 24, 2019 at 02:36:15PM +0800, Yu, Mingli wrote:
> > 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.

nlist is a function in libelf, one of the libraries of elfutils.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  6:39         ` Yu, Mingli
@ 2019-05-24  7:00           ` Mark Wielaard
  2019-05-28  2:17             ` Yu, Mingli
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Wielaard @ 2019-05-24  7:00 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: elfutils-devel

On Fri, May 24, 2019 at 02:45:21PM +0800, Yu, Mingli wrote:
> And I noticed the source code and already run as "./test-nlist", but Seems
> it doesn't work as expected.
> # ./test-nlist
> # echo $?
> 1
> # ./test-nlist -d
> nl[0].n_name = "var"
> nl[0].n_value = 0
> nl[0].n_scnum = 0
> nl[0].n_type = 0
> nl[0].n_sclass = 0
> nl[0].n_numaux = 0
> [...]

Right. And that is because...

> > > 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.

Make sure you fix that and the test will pass.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to use test-nlist
  2019-05-24  7:00           ` Mark Wielaard
@ 2019-05-28  2:17             ` Yu, Mingli
  0 siblings, 0 replies; 9+ messages in thread
From: Yu, Mingli @ 2019-05-28  2:17 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel



On 2019年05月24日 15:00, Mark Wielaard wrote:
> On Fri, May 24, 2019 at 02:45:21PM +0800, Yu, Mingli wrote:
>> And I noticed the source code and already run as "./test-nlist", but Seems
>> it doesn't work as expected.
>> # ./test-nlist
>> # echo $?
>> 1
>> # ./test-nlist -d
>> nl[0].n_name = "var"
>> nl[0].n_value = 0
>> nl[0].n_scnum = 0
>> nl[0].n_type = 0
>> nl[0].n_sclass = 0
>> nl[0].n_numaux = 0
>> [...]
>
> Right. And that is because...
>
>>>> 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.
>
> Make sure you fix that and the test will pass.

Thanks Mark very much!

In fact, the package always build with -g, but I just split the debug 
info to another package elfutils-dbg, and now the test pass if not split 
the debug info to the elfutils-dbg package.

Thanks,

>
> Cheers,
>
> Mark
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-05-28  2:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23  8:46 How to use test-nlist Yu, Mingli
2019-05-23 11:50 ` Mark Wielaard
2019-05-24  2:54   ` Yu, Mingli
2019-05-24  6:23     ` Mark Wielaard
2019-05-24  6:30       ` Yu, Mingli
2019-05-24  6:39         ` Yu, Mingli
2019-05-24  7:00           ` Mark Wielaard
2019-05-28  2:17             ` Yu, Mingli
2019-05-24  6:40         ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).