Generate "list file" for file in Linux kernel?

161 views
Skip to first unread message

Chris Furlough

unread,
Aug 6, 2019, 6:33:41 PM8/6/19
to Android Linux Kernel Development
Hey list, I have a BSP for a development board, and I'm having a kernel crash likely due to the SACK security patches that I added, and I'd like to debug it.  I get the kernel panic info, and it tells me a little info:

[  254.383076] PC is at rb_next+0x1c/0x58
[  254.386802] LR is at __tcp_retransmit_skb+0x3c0/0x678


The thing is, with all the inlineing, and other tricks that the compiler does, I can't locate where rb_next is called inside of __tcp_retransmit_skb. 

So, I wondered.  "Can I get the compiler to output a file containing the C code, AND the generated assembly intermixed so that tell what's causing this?

In the old days with GCC, I'd just give it a -S option to do this.  But with the project being built with ninja, I have NO IDEA where I would put this, and how to avoid having it generate these files for EVERY file compiled.

Thanks!
-Chris

Chris Furlough

unread,
Aug 7, 2019, 6:52:37 PM8/7/19
to Android Linux Kernel Development
Friends, if you run into this issue, the best way (short of discovering the magic incantation to trigger the list file output for the *1* file you're interested in), is to sprinkle the code with prints.  (printfs, or printks, depending on domain), and then run the resultant .o file through a disassembler.  This is the method I've been forced to resort to, and it's not terrible. 

In my case, I sprinkled "printk()" before each line in the file, and use the resultant calls in the .o as stepping stones to guide me to the function that's being inlined, and is causing the problem. 
Reply all
Reply to author
Forward
0 new messages