Hi, I did "dtrace -l" on libc.so.1 with "_c??????" matching pattern and yield only two probes but there are 6 of them matches that pattern when invoke "nm" on libc. Why? See below for details: %dtrace -w -qn ''BEGIN {system("dtrace -l -mlibc.so.1 > libc_dtrace");} pid$target:libc:_c??????:entry{}'' -c ''sleep 1'' % cat libc_dtrace ID PROVIDER MODULE FUNCTION NAME 42288 pid22010 libc.so.1 _cleanup entry 42289 pid22010 libc.so.1 _creat64 entry % /usr/ccs/bin/nm -n /lib/libc.so.1 | grep ''\|_c......$'' | grep FUNC [8747] | 260828| 500|FUNC |GLOB |0 |9 |_catgets [8845] | 261328| 148|FUNC |GLOB |0 |9 |_catopen [6100] | 525792| 16|FUNC |WEAK |0 |9 |_cleanup [7789] | 651320| 24|FUNC |GLOB |0 |9 |_creat64 [8799] | 515852| 56|FUNC |GLOB |0 |9 |_ctermid [8814] | 271940| 72|FUNC |GLOB |0 |9 |_ctime_r [8071] | 515964| 144|FUNC |GLOB |0 |9 |_cuserid % /CP Lin
Upon further investigation, I found that a lot of libc functions with leading ''_'' actually have a twin without leading ''_". For example, _ctermid and ctermid are both the same function with different names. An elfdump of libc reveal this: # /usr/ccs/bin/elfdump /lib/libc.so.1 | grep ''ctermid$'' | grep FUNC [2321] 0x0007df0c 0x00000038 FUNC WEAK D 35 .text ctermid [2802] 0x0007df0c 0x00000038 FUNC GLOB D 35 .text _ctermid [8318] 0x0007df0c 0x00000038 FUNC WEAK D 0 .text ctermid [8799] 0x0007df0c 0x00000038 FUNC GLOB D 0 .text _ctermid # So, how do I know Dtrace is going to pick ctermid not _ctermid? THX. Chian-Phon Lin wrote On 03/30/06 20:38,:> Hi, > > I did "dtrace -l" on libc.so.1 with "_c??????" > matching pattern and yield only two probes but > there are 6 of them matches that pattern when > invoke "nm" on libc. Why? > > See below for details: > > %dtrace -w -qn ''BEGIN {system("dtrace -l -mlibc.so.1 > libc_dtrace");} pid$target:libc:_c??????:entry{}'' -c ''sleep 1'' > > % cat libc_dtrace > ID PROVIDER MODULE FUNCTION NAME > 42288 pid22010 libc.so.1 _cleanup entry > 42289 pid22010 libc.so.1 _creat64 entry > % /usr/ccs/bin/nm -n /lib/libc.so.1 | grep ''\|_c......$'' | grep FUNC > [8747] | 260828| 500|FUNC |GLOB |0 |9 |_catgets > [8845] | 261328| 148|FUNC |GLOB |0 |9 |_catopen > [6100] | 525792| 16|FUNC |WEAK |0 |9 |_cleanup > [7789] | 651320| 24|FUNC |GLOB |0 |9 |_creat64 > [8799] | 515852| 56|FUNC |GLOB |0 |9 |_ctermid > [8814] | 271940| 72|FUNC |GLOB |0 |9 |_ctime_r > [8071] | 515964| 144|FUNC |GLOB |0 |9 |_cuserid > % > > /CP Lin > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- ************************************************ * C P Lin, Common Technology Project Lead. * * Sun Microsystems Inc. * * E-Mail: c.lin at sun.com * * Address: 4150 Network Circle, M/S UMPK12-330 * * Santa Clara, CA 95054 * * Phone: 650/352-4967 Fax: 650/786-7816 * ************************************************
Hi, On 3/31/06, CHIAN-PHON LIN <C.Lin at sun.com> wrote:> Upon further investigation, I found that a lot of > libc functions with leading ''_'' actually have a twin > without leading ''_". For example, _ctermid and > ctermid are both the same function with different > names. An elfdump of libc reveal this: > > # /usr/ccs/bin/elfdump /lib/libc.so.1 | grep ''ctermid$'' | grep FUNC > [2321] 0x0007df0c 0x00000038 FUNC WEAK D 35 .text ctermid > [2802] 0x0007df0c 0x00000038 FUNC GLOB D 35 .text _ctermid > [8318] 0x0007df0c 0x00000038 FUNC WEAK D 0 .text ctermid > [8799] 0x0007df0c 0x00000038 FUNC GLOB D 0 .text _ctermid > # > > So, how do I know Dtrace is going to pick ctermid > not _ctermid?When the functions _X and X are equivalent, observed from their starting address, only 1 probe is available. In this case, X is probably chosen since it is the outward facing function. -- Just me, Wire ...
Apparently Analagous Threads
- [LLVMdev] DW_AT_location not getting generated for local variables
- [LLVMdev] DW_AT_location not getting generated for local variables
- [LLVMdev] [lldb-dev] How is variable info retrieved in debugging for executables generated by llvm backend?
- [LLVMdev] [lldb-dev] How is variable info retrieved in debugging for executables generated by llvm backend?
- [LLVMdev] How is variable info retrieved in debugging for executables generated by llvm backend?