SUSE / clang-extract

Other
7 stars 3 forks source link

inline tool gives misleading output on console #19

Open marcosps opened 1 month ago

marcosps commented 1 month ago

When using the inline tool from clang-extract to check for inlined functions, if the output it set to be done to -graphviz it works as expected:

a

But if the output is the console, then it shows a different picture:

~/git/clang-extract/build/inline -where-is-inlined -ipa-files drivers/net/ipvlan/ipvlan_core.c.000i.ipa-clones  -debuginfo ~/kgr/data/x86_64/lib/modules/5.14.21-150500.55.31-default/kernel/drivers/net/ipvlan/ipvlan.ko  -symvers Module.symvers ipvlan_process_outbound                     
Mangled name        Demangled name      Type    Available?
ipvlan_queue_xmit   ipvlan_queue_xmit   FUNC    Public symbol
ipvlan_xmit_mode_l3 ipvlan_xmit_mode_l3 NOTYPE  Inlined

IMHO, I would expect the last entry to be the public symbol. Maybe we could change the output to let it more obvious which function should be extracted.

giulianobelinassi commented 1 month ago

ipvlan_xmit_mode_l3 is not labeled as Public Symbol most likely the symbol was not present on the debuginfo (.o ELF?) you passed on -debuginfo flag. Hence there is no way for the tool to know that it is a public symbol that got inlined.

marcosps commented 1 month ago

I agree, and the top most symbol that is public is indeed ipvlan_queue_xmit. But in this case there could be a more visible output to show this is the symbol that we need to livepatch. It's not a big deal, but improving the output would help us to use more the console output.

Graphviz already generates a very nice output of what we want to know. maybe the console output could be more straightforward as well.

giulianobelinassi commented 1 month ago

What is the output you expect?

marcosps commented 1 month ago

At least that the entries are sorted in the same way of the graphviz output: the private symbol comes first, and the last entry should be the function to be patched.

giulianobelinassi commented 1 month ago

At least that the entries are sorted in the same way of the graphviz output: the private symbol comes first, and the last entry should be the function to be patched.

You will have to sort the output the way you want in InlineAnalysis.cpp:457.