08 2022 档案

摘要:两个方法: 1. 使用 make -d 去追 'Updating goal targets', 2. 看 .DEFAULT_GOAL, .DEFAULT, 以及 default: all 等等 答案来源:https://stackoverflow.com/questions/50136547/how 阅读全文
posted @ 2022-08-31 14:08 yinhuachen 阅读(146) 评论(0) 推荐(0) 编辑
摘要:话说,不得不感叹锐佬的信息搜索能力。 答案来源:https://clang.llvm.org/compatibility.html#inline 阅读全文
posted @ 2022-08-31 11:37 yinhuachen 阅读(27) 评论(0) 推荐(0) 编辑
摘要:答案来源:https://stackoverflow.com/questions/17388431/declaring-two-global-variables-of-same-name-in-c 阅读全文
posted @ 2022-08-31 10:51 yinhuachen 阅读(31) 评论(0) 推荐(0) 编辑
摘要:当 printf() 后面紧跟 while(1) 时,printf的内容有时候能打印出来,有时候打印不出来 原因是,printf() 中的内容在缓冲区里,你得加上 ‘\n’ 或者使用 fflush(stdout) 才能让它打印出来。 答案来源:https://stackoverflow.com/qu 阅读全文
posted @ 2022-08-29 22:51 yinhuachen 阅读(55) 评论(0) 推荐(0) 编辑
摘要:Simple DirectMedia Layer (SDL) is a cross-platform development library designed to provide low level access to audio(声音), keyboard(键盘), mouse(鼠标), joy 阅读全文
posted @ 2022-08-28 14:19 yinhuachen 阅读(99) 评论(0) 推荐(0) 编辑
摘要:来源:https://stackoverflow.com/questions/39036774/advanced-variable-inheritance-in-gnu-make 阅读全文
posted @ 2022-08-25 03:43 yinhuachen 阅读(94) 评论(0) 推荐(0) 编辑
摘要:答案来源:https://blog.csdn.net/pengpengzhou/article/details/109333931 阅读全文
posted @ 2022-08-24 15:19 yinhuachen 阅读(380) 评论(0) 推荐(0) 编辑
摘要:提问:当我们编写了和库函数同名的函数,比如 strcmp,什么情况下会使用库函数版本的strcmp?什么情况下会使用我们自己编写的strcmp? 详细描述:我正在做 PA2.2 的蓝框题:为什么定义宏__NATIVE_USE_KLIB__之后就可以把native上的这些库函数链接到klib? 在 N 阅读全文
posted @ 2022-08-23 21:56 yinhuachen 阅读(586) 评论(0) 推荐(0) 编辑
摘要:来源:https://www.jianshu.com/p/dd425b9dc9db 阅读全文
posted @ 2022-08-22 23:07 yinhuachen 阅读(17) 评论(0) 推荐(0) 编辑
摘要:在 gdb8.1 后,启动gdb后,使用 start 或者 starti 命令会在将要执行的第一个机器指令上打上暂时的断点 其中,start 会停在 main 函数入口 starti 则会停留在第一个要执行的机器指令上,一般是_start的入口 来源: https://stackoverflow.c 阅读全文
posted @ 2022-08-22 22:58 yinhuachen 阅读(172) 评论(0) 推荐(0) 编辑
摘要:参考这里:https://sourceware.org/legacy-ml/binutils/2007-09/msg00016.html 阅读全文
posted @ 2022-08-22 17:23 yinhuachen 阅读(113) 评论(0) 推荐(0) 编辑
摘要:参考这里:https://lynxbee.com/meaning-of-contents-alloc-load-readonly-code-in-elf-sections/#.YwNJmepByUk 阅读全文
posted @ 2022-08-22 17:19 yinhuachen 阅读(36) 评论(0) 推荐(0) 编辑
摘要:网页:https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html#SEC6 阅读全文
posted @ 2022-08-22 00:21 yinhuachen 阅读(14) 评论(0) 推荐(0) 编辑
摘要:答案来源: https://softwareengineering.stackexchange.com/questions/373269/what-does-the-emulation-do-in-the-linker 阅读全文
posted @ 2022-08-22 00:05 yinhuachen 阅读(10) 评论(0) 推荐(0) 编辑
摘要:参考来源:https://stackoverflow.com/questions/34859338/why-does-makefile-automatically-generate-object-file-o-without-any-specific-r 阅读全文
posted @ 2022-08-21 16:42 yinhuachen 阅读(17) 评论(0) 推荐(0) 编辑
摘要:ar,Linux系统的一个备份压缩命令,用于创建、修改备存文件(archive),或从备存文件中提取成员文件。ar命令最常见的用法是将目标文件打包为静态链接库。 两个作用: 1. 创建修改 档案(archive) 2. 从档案中提取成员文件 阅读全文
posted @ 2022-08-21 16:30 yinhuachen 阅读(193) 评论(0) 推荐(0) 编辑
摘要:提问:为什么我的Makefile中存在同名目标,却没有报错?(一个目标下有命令,另一个目标下没有命令) 详细描述:我正在做PA2.2中的蓝框任务:阅读相关Makefile, 尝试理解abstract-machine是如何生成native的可执行文件的。 使用 native 作为运行时环境并运行 re 阅读全文
posted @ 2022-08-21 14:30 yinhuachen 阅读(122) 评论(0) 推荐(0) 编辑
摘要:安装vim插件的各种方式:https://www.makeuseof.com/install-vim-plugins/ 1. CtrlP 直接使用文件名定位项目中的文件 2. NERDTree 项目文件浏览器 3. snazzy 美化 4. airline 搞个状态栏 5. coc 用于代码补全 6 阅读全文
posted @ 2022-08-14 21:57 yinhuachen 阅读(38) 评论(0) 推荐(0) 编辑
摘要:1.实时演示Markdown编译后效果 补充点Markdown: 表格中可以用<++>占位 2. q宏自动化 3. :r !ls 可以把ls命令的结果复制到vim里 : vsplit 左右分屏 : split 上下分屏 :source $MYVIMRC 重新加载我的vim配置文件 : e <文件名> 阅读全文
posted @ 2022-08-14 15:33 yinhuachen 阅读(118) 评论(0) 推荐(0) 编辑
摘要:volatile 关键字一般用于 MMIO寄存器、通信、中断服务中。 来源:https://stackoverflow.com/questions/246127/why-is-volatile-needed-in-c 阅读全文
posted @ 2022-08-08 15:32 yinhuachen 阅读(109) 评论(0) 推荐(0) 编辑
摘要:gdb默认无法调试宏函数,需要做以下特殊处理 1. 把项目中的宏函数展开 修改Makefile,产生所有中间文件: gcc -E -P *.c -o *.i 使用 -P 的原因是去掉 linemarkers,因为linemarker会给gdb提供调试信息,linemarker存在的话,gdb在调试可 阅读全文
posted @ 2022-08-07 23:24 yinhuachen 阅读(758) 评论(0) 推荐(1) 编辑
摘要:1. hexdump 一个例子:hexdump -e '2/4 "%08x " "\n"' build/dummy-riscv64-nemu.bin 2. xxd https://unix.stackexchange.com/questions/282215/how-to-view-a-binary 阅读全文
posted @ 2022-08-07 21:42 yinhuachen 阅读(38) 评论(0) 推荐(0) 编辑
摘要:看这里:https://en.wikichip.org/wiki/risc-v/registers 阅读全文
posted @ 2022-08-07 18:42 yinhuachen 阅读(187) 评论(0) 推荐(0) 编辑
摘要:#: ##:粘连两个符号 答案来源:https://blog.csdn.net/qq_37858386/article/details/78919163 阅读全文
posted @ 2022-08-07 18:13 yinhuachen 阅读(215) 评论(0) 推荐(0) 编辑
摘要:使用好 gcc 和 objdump 的组合 来源:https://stackoverflow.com/questions/70154049/how-can-i-resolve-risc-v-assembly-pseudo-instructions-to-true-risc-v-instruction 阅读全文
posted @ 2022-08-07 14:15 yinhuachen 阅读(63) 评论(0) 推荐(0) 编辑
摘要:参开这里: https://www.gnu.org/software/binutils/ 阅读全文
posted @ 2022-08-06 15:34 yinhuachen 阅读(57) 评论(0) 推荐(0) 编辑
摘要:答案1:关掉最大打印限制 https://blog.csdn.net/qq_34347375/article/details/123216780 答案2:打印数组中任意连续值 https://wizardforcel.gitbooks.io/100-gdb-tips/content/print-co 阅读全文
posted @ 2022-08-05 10:37 yinhuachen 阅读(216) 评论(0) 推荐(0) 编辑
摘要:问题:使用 make run 可以成功编译并运行,使用 bear make run 就会报错 1. 尝试 使用 bear make clean,再用 bear make run --不可行2. 尝试谷歌搜索报错信息: ==20704==ASan runtime does not come first 阅读全文
posted @ 2022-08-04 10:24 yinhuachen 阅读(358) 评论(0) 推荐(0) 编辑
摘要:struct { uint32_t opcode1_0 : 2; uint32_t opcode6_2 : 5; uint32_t rd : 5; uint32_t funct3 : 3; uint32_t rs1 : 5; int32_t simm11_0 :12; } i; 以上是PA中暂时不明 阅读全文
posted @ 2022-08-04 09:30 yinhuachen 阅读(101) 评论(0) 推荐(0) 编辑
摘要:在Linux中,调试器实现的主要构建块是 ptrace 系统调用 虽然现代调试器非常复杂,但是基础的调试器其实很简单,它们仅仅使用了OS和编译器、链接器提供的很少的服务。 Stepping through the code of a process (感觉这些内容跟完成PA暂时没有关系,以后在说) 阅读全文
posted @ 2022-08-03 13:38 yinhuachen 阅读(26) 评论(0) 推荐(0) 编辑
摘要:调试器有两个基石:1. 断点 2. 访问被调试程序的内存 Software interrupts 中断:为了处理异步事件(比如 IO 和 时钟) 硬件中断:包含1. 一个专用的电子信号 2. 一个特别的“反应电路”会回应这个电子信号。当电路检测到这个电子信号,就会停下CPU,保存它的状态,接着跳入一 阅读全文
posted @ 2022-08-03 13:21 yinhuachen 阅读(67) 评论(0) 推荐(0) 编辑
摘要:https://eli.thegreenplace.net/2011/01/27/how-debuggers-work-part-2-breakpoints 阅读全文
posted @ 2022-08-03 10:18 yinhuachen 阅读(11) 评论(0) 推荐(0) 编辑
摘要:调试其实就是从观测到的failure一步一步回溯寻找fault的过程, 找到了fault之后, 我们就很快知道应该如何修改错误的代码了. 但从上面的例子也可以看出, 调试之所以不容易, 恰恰是因为: fault不一定马上触发error 触发了error也不一定马上转变成可观测的failure err 阅读全文
posted @ 2022-08-03 09:32 yinhuachen 阅读(164) 评论(0) 推荐(0) 编辑
摘要:Fault: 实现错误的代码, 例如if (p = NULL) Error: 程序执行时不符合预期的状态, 例如p被错误地赋值成NULL Failure: 能直接观测到的错误, 例如程序触发了段错误 来源:https://nju-projectn.github.io/ics-pa-gitbook/i 阅读全文
posted @ 2022-08-03 09:26 yinhuachen 阅读(149) 评论(0) 推荐(0) 编辑
摘要:watch: 借助观察断点可以监控程序中某个变量或者表达式的值,只要发生改变,程序就会停止执行。 rwatch 命令:只要程序中出现读取目标变量(表达式)的值的操作,程序就会停止运行; awatch 命令:只要程序中出现读取目标变量(表达式)的值或者改变值的操作,程序就会停止运行。 来源:http: 阅读全文
posted @ 2022-08-02 18:55 yinhuachen 阅读(523) 评论(0) 推荐(0) 编辑
摘要:来源:https://www.bilibili.com/read/cv16318897 阅读全文
posted @ 2022-08-01 19:16 yinhuachen 阅读(39) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示