/frame-larger-than

A python script to help debug `-Wframe-larger-than=` warnings.

Primary LanguagePythonApache License 2.0Apache-2.0

Frame Larger Than

A python script to help debug -Wframe-larger-than= warnings.

Example

$  make CC=clang arch/x86/kernel/kvm.o CFLAGS=-Wframe-larger-than=1000
...
arch/x86/kernel/kvm.c:494:13: warning: stack frame size of 1064 bytes in function 'kvm_send_ipi_mask_allbutself' [-Wframe-larger-than=]
static void kvm_send_ipi_mask_allbutself(const struct cpumask *mask, int vector)
            ^
$ python3 frame_larger_than.py arch/x86/kernel/kvm.o kvm_send_ipi_mask_allbutself
kvm_send_ipi_mask_allbutself:
        1024    struct cpumask          new_mask
        4       unsigned int            this_cpu
        8       const struct cpumask*   local_mask
        4       int                     pscr_ret__
        4       int                     pfo_ret__
cpumask_copy:
bitmap_copy:
        4       unsigned int            len
        4       unsigned int            len
cpumask_clear_cpu:
clear_bit:
arch_clear_bit:

A little bit friendlier than trying to understand readelf --debug-dump=info *.o.

Dependencies

$ sudo -H pip3 install pyelftools

Formatting

$ pip3 install pyformat
$ pyformat --in-place frame_larger_than.py