You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
工作内容
任务梳理
工作记录
1. osgdb 功能修复
2. 适配 uCore
首先clone uCore:https://github.com/oscourse-tsinghua/ucore_os_lab;
接下来就是配置文件的核心内容确定:
qemuPath / 运行架构:uCore支持两种架构:X86_32、Risc-V,我这里是X86_32。
确定方式:查看uCore 的Makefile文件,看Qemu的变量用的是什么值。
内核、用户地址范围:找 KERNBASE 和 USERBASE 的定义:
Border 断点位置(内核↔用户切换点):查看 kern/trap/trapentry.S:
内核→用户(border):找 iret 指令所在行
Hook 断点位置(获取下一个进程名):查看 kern/process/proc.c,找进程切换函数(通常是 proc_run 或 schedule)。Hook 应该打在即将切换到新进程、能拿到新进程 proc->name 的那一行。
用户程序 ELF 路径:查看 Makefile,找编译产物的路径格式。Hook 返回的进程名要和这个路径对应。
相关问题:
3. 配置Starry OS
QEMU 路径与固件修复:由于我使用的是自定义路径编译的 QEMU,导致其无法自动识别系统固件。
解决方案:通过修改
make/qemu.mk,在qemu_args中添加-L /usr/share/qemu参数,显式指定 OpenSBI** 和 网卡 ROM(efi-virtio.rom)的搜索路径。根据StarryOs的信息写调试配置文件。以下是适配 StarryOS 到 osgdb 调试遇到的核心问题:
4. 新功能实现方案:注释标记断点
目标:在 launch.json 里,border/hook 断点支持用 marker 字段替代 filepath+line,osgdb 在
attach 阶段自动扫描源文件找到标记行。
launch.json 配置格式变更
Border 断点(现在):
{ "filepath": "/path/to/trap/mod.rs", "line": 42 }
Border 断点(新增支持):
{ "marker": "@osgdb:border" }
Hook 断点(现在):
{
"breakpoint": { "file": "/path/to/task/mod.rs", "line": 100 },
"behavior": { ... }
}
Hook 断点(新增支持):
{
"marker": "@osgdb:hook",
"behavior": { ... }
}
uCore 源码里对应加注释:
// @osgdb:border
trap_return();
// @osgdb:hook
next_proc = schedule();
职责:给定 cwd 和 marker 字符串,递归扫描源文件,返回 { filepath, line }[]。
scanMarker(cwd: string, marker: string): { filepath: string; line: number }[]
在 attachRequest 处理 border_breakpoints / hook_breakpoints 时,检测是否有 marker
字段:
两种格式可以混用。
All reactions