显示更新内容


小trick 1: makefile编译的时候LDFLAG最好放在-o之后。比如要写成
g++ -I/usr/local/include $^ -o $@ -L/usr/local/lib -lunwind

而不要写成:

g++ -I/usr/local/include -L/usr/local/lib -lunwind $^ -o $@

小trick 2: LD_PRELOAD={full_path of the target shared object file}

在说一个大家都知道但我还不知道的事情,在x86架构里,e开头的寄存器(例如$eip)是intel 32位处理器的寄存器,r开头的寄存器(例如$rip)是intel 64位处理器的寄存器。

linux 有一个command叫watch,watch -b ./executable的话,该程序以非exit(0)的状态退出,你的terminal就会发出beep的声音。适合我这种一边码字一边跑实验的人orz

继续 , patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 <binary> ,可以用来修复一个程序的interpreter。

the interpreter is the program that “launches” the executable file. For a regular binary it’s the loader, i.e., /lib64/ld-linux-x86-64.so.2. For a script it would be the script interpreter (bash, python, etc).

雾海

雾海是一个开放且不限制讨论主题的非营利性中文社区,名字来源于德国浪漫主义画家 Friedrich 的画作《雾海上的旅人》。生活总是在雾海中吞吐不定,不管怎么艰辛,他还是站在了这里!希望大家在这里玩的开心~