c****d 发帖数: 116 | 1 I know the printk supports ``%pS'' would output
function_name+0ffset if given current pc.
Something I know is that compiler would generate
unwind tables, with unwind index. But I don't know
exactly what are those entries in tables, and how
kernel would use these entries to unwind the stack,
particularly the function name.
unwind.c in kernel source code helps, but I still
need someone explain this a little bit.
thanks |
m**k 发帖数: 290 | 2 跟unwind.c没关系。
编译内核最后面几步会运行
KSYM .tmp_kallsyms1.o
KSYM .tmp_kallsyms2.o
LD vmlinux
KSYM 运行 nm | scripts/kallsyms | cc
把所有的symbol编译到 vmlinux 里面。具体数据保存在 kallsyms_addresses 等一些
表里面。printk会在这些表里查询。实现在 kenrel/kallsyms.c:sprint_symbol() |
c****d 发帖数: 116 | 3 thank you so much.
Let me dig dig.. ;) unwind.c is used to unwind the whole stack.
【在 m**k 的大作中提到】 : 跟unwind.c没关系。 : 编译内核最后面几步会运行 : KSYM .tmp_kallsyms1.o : KSYM .tmp_kallsyms2.o : LD vmlinux : KSYM 运行 nm | scripts/kallsyms | cc : 把所有的symbol编译到 vmlinux 里面。具体数据保存在 kallsyms_addresses 等一些 : 表里面。printk会在这些表里查询。实现在 kenrel/kallsyms.c:sprint_symbol()
|