Skip to content

Commit

Permalink
Publish to VS Code Extension Marketplace and Open VSX Registry, corre…
Browse files Browse the repository at this point in the history
…ct __metadata field, ignore docs/ folder and video in root folder when compiling
  • Loading branch information
chenzhiy2001 committed Apr 20, 2024
1 parent 42b864e commit a1aa1f7
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ out/src/test/**
test/**
src/**
**/*.map
docs/**
.gitignore
.markdownlintignore
.markdownlint.yml
Expand All @@ -22,3 +23,5 @@ cspell-dict.txt
HACKING.md
tsconfig.json
vsc-extension-quickstart.md
演示视频.mp4
最终报告.pdf
107 changes: 107 additions & 0 deletions README-ExtensionMarkets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# code-debug Operating System Debugger

This extension supports debugging across kernel and multiple user processes. For more details please visit our [Github repository](/~https://github.com/chenzhiy2001/code-debug).

Non OS-related parts are based on [WebFreak001/code-debug](/~https://github.com/WebFreak001/code-debug).

## Using the Extension
1. install the extension from an Extension Market.
2. install dependencies:
- `qemu`, `gdb`,
- optional for ebpf debugging capabilities: `nm`, `rustfilt`, `cat`, `grep`, `tail`, `xdotool`.
3. create `launch.json` in `.vscode` folder, then start debugging.

## `launch.json` example
```json
{
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "Attach to Qemu",
"autorun": ["add-symbol-file ${workspaceFolder}/os/target/riscv64gc-unknown-none-elf/release/os"],
"target": ":1234",
"remote": true,
"cwd": "/home/oslab/rCore-Tutorial-v3-eBPF/rCore-Tutorial-v3",
"valuesFormatting": "parseText",
"gdbpath": "${workspaceFolder}/riscv64-unknown-elf-gdb-rust.sh",
"showDevDebugOutput":true,
"internalConsoleOptions": "openOnSessionStart",
"printCalls": true,
"stopAtConnect": true,
"qemuPath": "${workspaceFolder}/qemu-system-riscv64-with-logs.sh",
"qemuArgs": [
"-M",
"128m",
"-machine",
"virt",
"-bios",
"${workspaceFolder}/bootloader/rustsbi-qemu.bin",
"-display",
"none",
"-device",
"loader,file=${workspaceFolder}/os/target/riscv64gc-unknown-none-elf/release/os.bin,addr=0x80200000",
"-drive",
"file=${workspaceFolder}/user/target/riscv64gc-unknown-none-elf/release/fs.img,if=none,format=raw,id=x0",
"-device",
"virtio-blk-device,drive=x0",
"-device",
"virtio-gpu-device",
"-device",
"virtio-keyboard-device",
"-device",
"virtio-mouse-device",
"-device",
"virtio-net-device,netdev=net0",
"-netdev",
"user,id=net0,hostfwd=udp::6200-:2000,hostfwd=tcp::6201-:80",
"-serial",
"stdio",
"-serial",
"pty",
"-s",
"-S"
],
"program_counter_id": 32,
"first_breakpoint_group": "kernel",
"second_breakpoint_group":"${workspaceFolder}/user/src/bin/initproc.rs",
"kernel_memory_ranges":[["0x80000000","0xffffffffffffffff"]],
"user_memory_ranges":[["0x0000000000000000","0x80000000"]],
"border_breakpoints":[
{
"filepath": "${workspaceFolder}/user/src/syscall.rs",
"line": 39
},
{
"filepath": "${workspaceFolder}/os/src/trap/mod.rs",
"line": 152
}
],
"hook_breakpoints":[
{
"breakpoint": {
"file": "${workspaceFolder}/os/src/syscall/process.rs",
"line": 49
},
"behavior": {
"isAsync": true,
"functionArguments": "",
"functionBody": "let p=await this.getStringVariable('path'); return '${workspaceFolder}/user/src/bin/'+p+'.rs'"
}
}
],
"filePathToBreakpointGroupNames":{
"isAsync": false,
"functionArguments": "filePathStr",
"functionBody": " if (filePathStr.includes('os/src')) { return ['kernel']; } else if (filePathStr.includes('user/src/bin')) { return [filePathStr]; } else if (!filePathStr.includes('user/src/bin') && filePathStr.includes('user/src')) { return ['${workspaceFolder}/user/src/bin/adder_atomic.rs', '${workspaceFolder}/user/src/bin/adder_mutex_blocking.rs', '${workspaceFolder}/user/src/bin/adder_mutex_spin.rs', '${workspaceFolder}/user/src/bin/adder_peterson_spin.rs', '${workspaceFolder}/user/src/bin/adder_peterson_yield.rs', '${workspaceFolder}/user/src/bin/adder.rs', '${workspaceFolder}/user/src/bin/adder_simple_spin.rs', '${workspaceFolder}/user/src/bin/adder_simple_yield.rs', '${workspaceFolder}/user/src/bin/barrier_condvar.rs', '${workspaceFolder}/user/src/bin/barrier_fail.rs', '${workspaceFolder}/user/src/bin/cat.rs', '${workspaceFolder}/user/src/bin/cmdline_args.rs', '${workspaceFolder}/user/src/bin/condsync_condvar.rs', '${workspaceFolder}/user/src/bin/condsync_sem.rs', '${workspaceFolder}/user/src/bin/count_lines.rs', '${workspaceFolder}/user/src/bin/eisenberg.rs', '${workspaceFolder}/user/src/bin/exit.rs', '${workspaceFolder}/user/src/bin/fantastic_text.rs', '${workspaceFolder}/user/src/bin/filetest_simple.rs', '${workspaceFolder}/user/src/bin/forktest2.rs', '${workspaceFolder}/user/src/bin/forktest.rs', '${workspaceFolder}/user/src/bin/forktest_simple.rs', '${workspaceFolder}/user/src/bin/forktree.rs', '${workspaceFolder}/user/src/bin/gui_rect.rs', '${workspaceFolder}/user/src/bin/gui_simple.rs', '${workspaceFolder}/user/src/bin/gui_snake.rs', '${workspaceFolder}/user/src/bin/gui_uart.rs', '${workspaceFolder}/user/src/bin/hello_world.rs', '${workspaceFolder}/user/src/bin/huge_write_mt.rs', '${workspaceFolder}/user/src/bin/huge_write.rs', '${workspaceFolder}/user/src/bin/infloop.rs', '${workspaceFolder}/user/src/bin/initproc.rs', '${workspaceFolder}/user/src/bin/inputdev_event.rs', '${workspaceFolder}/user/src/bin/matrix.rs', '${workspaceFolder}/user/src/bin/mpsc_sem.rs', '${workspaceFolder}/user/src/bin/peterson.rs', '${workspaceFolder}/user/src/bin/phil_din_mutex.rs', '${workspaceFolder}/user/src/bin/pipe_large_test.rs', '${workspaceFolder}/user/src/bin/pipetest.rs', '${workspaceFolder}/user/src/bin/priv_csr.rs', '${workspaceFolder}/user/src/bin/priv_inst.rs', '${workspaceFolder}/user/src/bin/race_adder_arg.rs', '${workspaceFolder}/user/src/bin/random_num.rs', '${workspaceFolder}/user/src/bin/run_pipe_test.rs', '${workspaceFolder}/user/src/bin/sleep.rs', '${workspaceFolder}/user/src/bin/sleep_simple.rs', '${workspaceFolder}/user/src/bin/stackful_coroutine.rs', '${workspaceFolder}/user/src/bin/stackless_coroutine.rs', '${workspaceFolder}/user/src/bin/stack_overflow.rs', '${workspaceFolder}/user/src/bin/store_fault.rs', '${workspaceFolder}/user/src/bin/sync_sem.rs', '${workspaceFolder}/user/src/bin/tcp_simplehttp.rs', '${workspaceFolder}/user/src/bin/threads_arg.rs', '${workspaceFolder}/user/src/bin/threads.rs', '${workspaceFolder}/user/src/bin/udp.rs', '${workspaceFolder}/user/src/bin/until_timeout.rs', '${workspaceFolder}/user/src/bin/user_shell.rs', '${workspaceFolder}/user/src/bin/usertests.rs', '${workspaceFolder}/user/src/bin/yield.rs']; } else return ['kernel'];"
},
"breakpointGroupNameToDebugFilePath":{
"isAsync": false,
"functionArguments": "groupName",
"functionBody": "if (groupName === 'kernel') { return '${workspaceFolder}/os/target/riscv64gc-unknown-none-elf/release/os'; } else { let pathSplited = groupName.split('/'); let filename = pathSplited[pathSplited.length - 1].split('.'); let filenameWithoutExtension = filename[filename.length - 2]; return '${workspaceFolder}/user/target/riscv64gc-unknown-none-elf/release/' + filenameWithoutExtension; }"
}
},
],
}
```
9 changes: 6 additions & 3 deletions docs/2024-04-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@
- 添加了 showInformationMessage 函数,代替 mibase.ts 中无法使用的 console.log
- launch.json 支持${workspacefolder}插值(之前有一些参数是不能用这个插值的),大大提升了配置文件的便
携性
- 修改插件本身的编译配置文件 tsconfig.json,使得编译本插件的时候忽略文档文件夹和根文件夹下 60m 的“演
示视频.mp4”,从而极大减小编译出的插件二进制包的大小
- 修改插件本身的编译配置文件 tsconfig.json 和 .vscodeignore,使得编译本插件的时候忽略文档文件夹和根
文件夹下 60m 的“演示视频.mp4” 以及 3m 的“最终报告.pdf”,从而极大减小编译出的插件二进制包的大小
- 修改 \_\_metadata 属性
- 通过 Github Action 自动上传到 VS Code Extension Marketplace 和 Open VSX Registry
- 编写插件商店的主页 `README-ExtensionMarkets.md`。这个主页不会直接用相对路径链接到`docs/`文件夹和根
目录下的视频、文档,所以可以放心地在编译时去掉它们。插件商店的主页会链接到 Github 仓库主页

此外我发现一些新的待解决的问题:

- 由于代码大改,仓库首页 readme.md 里面的核心代码讲解全部过时了,需要重新写。大家平时哪里看不懂的多
问我和张露元学长,然后写到文档里
- 自动安装脚本和首页 readme.md 的安装说明里面要提到这些新增的依赖:微软提供的 Hex Editor 插件,
rustfilt 和 nm(用于 ebpf panel) 还有 xdotools
- 上传到微软商店,然后修改 \_\_metadata 属性
- 目前获取下一进程名的策略是在 exec 里设置一个钩子断点,触发之后收集下一个进程的名字。这个策略应付不
了一些复杂情况。为了应对复杂情况(比如进程 A 通过 syscall 进入内核,但是内核即将返回用户态的时候因
为调度算法而切换到用户进程 B)我新增了钩子断点。我认为通过多增加一些钩子断点进行判断是可以解决这些
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "debug",
"displayName": "OS Debug",
"homepage":"/~https://github.com/chenzhiy2001/code-debug/README-ExtensionMarkets.md",
"description": "OS Debugger based on WebFreak001/Native Debug",
"keywords": [
"gdb",
Expand Down Expand Up @@ -1063,8 +1064,8 @@
"ts-node": "^10.8.0"
},
"__metadata": {
"id": "2fd22b8e-b3b8-4e7f-9a28-a5e2d1bdd0d4",
"id": "834c44ce-c4a8-4cfe-9de6-27b5a5531e6b",
"publisherDisplayName": "chenzhiy2001",
"publisherId": "e054f80a-50f9-4d80-85c8-6ff87eef6c35"
"publisherId": "chenzhiy2001"
}
}

0 comments on commit a1aa1f7

Please sign in to comment.