i have a shared obj file say a.so and in that i want to see if a particular function (say fname) is inlined or not. I tried following 4 ways and getting different answers :
1) nm a.so | grep fname
-> this doesn't give any o/p implying that the function is inlined. Please let me know if this is sufficient check to see if a function is inlined or not.
2) objdump -d a.so | grep fname
->this doesn't give any o/p implying that the function is inlined. Please correct me if i am wrong in conclusion here.
3) objdump -W a.so
-> for function fname, this gives me the following o/p the last line of which says "declared as inline but ignored"
DW_AT_name : (indirect string, offset: 0x10411): fname
DW_AT_decl_file : 246
DW_AT_decl_line : 40
DW_AT_prototyped : 1
DW_AT_inline : 2 (declared as inline but ignored)
4) pfunct -G a.so | grep fname
->this dwarves utility shows the function fname implying that the function is not inlined.
Now first two ways imply that the function is inlined while rest two say the opposite. Can anyone please explain the following :
1) Why are there differences in the above 4 ways ?
2) Are there any known issues with objdump and pfunct ?
3) Also let me know the best way to check if a function is inlined or not.
Any help will be greatly appreciated. Thanks !!!
Since the function is called at only one place in the .c file, the best way to check if the function is inlined is the following:
objdump -d a.so | grep call | grep fname
If there is any result, then fname
is not inlined. Otherwise, it must be inlined because it is called at only one place and the call site in not found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With