How to get the length of a function in bytes?

后端 未结 11 1114
醉酒成梦
醉酒成梦 2020-11-28 11:16

I want to know the length of C function (written by me) at runtime. Any method to get it? It seems sizeof doesn\'t work here.

11条回答
  •  星月不相逢
    2020-11-28 11:52

    There is a way to determine the size of a function. The command is:

     nm -S 
    

    This will return the sizes of each function inside the object file. Consult the manual pages in the GNU using 'man nm' to gather more information on this.

提交回复
热议问题