Weitere ähnliche Inhalte Kürzlich hochgeladen (20) Elf文件解析10. 1. Upload Sky shell with 'exec' command and symbols (requires
several recompilations to generate correct symbols):
> make sky-shell-exec.sky 编译内核
> make sky-shell-exec.sky CORE=sky-shell-exec.sky 生成symbols
> make sky-shell-exec.upload CORE=sky-shell-exec.sky 再次编译内核
如果直接执行第二条命令,可以生成sky-shell-exec.sky ,
symbols为空,
12. 命令
• Msp430-nm - list symbols from object files
• awk [options] -f scriptfile var=value file(s)
awk是一种编程语言,用于在linux/unix下对文本和数据进
行处理。数据可以来自标准输入、一个或多个文件,或其
它命令的输出。它支持用户自定义函数和动态正则表达式
等先进功能,是linux/unix下的一个强大编程工具。它在命
令行中使用,但更多是作为脚本来使用。awk的处理文本
和数据的方式是这样的,它逐行扫描文件,从第一行到最
后一行,寻找匹配的特定模式的行,并在这些行上进行你
想要的操作。如果没有指定处理动作,则把匹配的行显示
到标准输出(屏幕),如果没有指定模式,则所有被操作所
指定的行都被处理。
13. mknmlist /^[0123456789abcdef]+ [ABCDGRSTUVW] / {
if ($3 != "symbols" && $3 != "symbols_nelts") {
name[nname] = $3;
nname++;
function sort(V, N, tmp, i, j) {
}
V[-1] = ""; # Used as a sentinel before V[0].
}
for (i = 1; i < N; i++)
for (j = i; V[j - 1] > V[j]; j--) {
END {
tmp = V[j];
sort(name, nname);
V[j] = V[j - 1];
V[j - 1] = tmp;
} print "#include "loader/symbols.h"n";
return;
} # Must deal with compiler builtins etc.
for (x = 0; x < nname; x++) {
BEGIN { if (builtin[name[x]] != "")
nname = 0; print builtin[name[x]] ";";
builtin["printf"] = "int printf(const char *, ...)"; else
builtin["sprintf"] = "int sprintf(char *, const print "extern int " name[x]"();";
char *, ...)"; }
builtin["malloc"] = "void *malloc()"; print "n";
builtin["calloc"] = "void *calloc()";
builtin["memcpy"] = "void *memcpy()"; # nname++: An { 0, 0 } entry is added at the end of the vector.
builtin["memset"] = "void *memset()"; print "const int symbols_nelts = " nname+1 ";";
builtin["memmove"] = "void *memmove()"; print "const struct symbols symbols[" nname+1 "] = {";
builtin["strcpy"] = "char *strcpy()"; for (x = 0; x < nname; x++)
builtin["strchr"] = "char *strchr()"; print "{ "" name[x] "", (void *)&"name[x]" },";
builtin[""] = ""; print "{ (const char *)0, (void *)0} };";
} }