简体   繁体   English

树莓派3上的ftrace + addr2line

[英]ftrace + addr2line on raspberry pi 3

I want to get kernel source code file name and line number of a kernel function from the function address that ftrace outputed on rapberry pi 3. 我想从ftrace在rapberry pi 3上输出的函数地址中获取内核函数的内核源代码文件名和行号。

I tried addr2line -e /boot/kernel8.img [function address] on raspberry pi 3. But it returned addr2line: /boot/kernel8.img: File format not recognized . 我在树莓派3上尝试了addr2line -e /boot/kernel8.img [function address] 。但是它返回了addr2line: /boot/kernel8.img: File format not recognized

note: 注意:

kernel8.img is customed kernel that i compiled. kernel8.img是我编译的自定义内核。 I cloned kernel source from https://github.com/raspberrypi/linux.git , checkouted to rpi-4.18.y , turned on CONFIG_DEBUG_INFO , and run make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 . 我从https://github.com/raspberrypi/linux.git克隆了内核源代码,检出到rpi-4.18.y ,打开了CONFIG_DEBUG_INFO ,然后运行make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 This compile work performed on ubuntu x86_64 linux kernel 4.15.0-23-generic. 此编译工作是在ubuntu x86_64 linux内核4.15.0-23-generic上执行的。 The type of kernel8.img is as follows. kernel8.img的类型如下。

$ file kernel8.img
kernel8.img: MS-DOS executable

thanks 谢谢

You need to run addr2line against the vmlinux file (ie uncompressed/raw kernel binary). 您需要针对vmlinux文件(即未压缩/原始内核二进制文件)运行addr2line /boot/kernel8.img is, most probably, a zImage (ie compressed kernel). /boot/kernel8.img很可能是zImage (即压缩内核)。 You can find the vmlinux file in the root of your kernel sources after compilation. 编译后,您可以在内核源代码的根目录中找到vmlinux文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM