Skip to content

Commit

Permalink
MVP TIME 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Hatch-Martinez committed Jun 18, 2022
1 parent bd87779 commit 27697f0
Show file tree
Hide file tree
Showing 84 changed files with 545 additions and 44 deletions.
45 changes: 45 additions & 0 deletions example_projects/rust/for_loop/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'for_loop'",
"cargo": {
"args": [
"build",
"--bin=for_loop",
"--package=for_loop"
],
"filter": {
"name": "for_loop",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'for_loop'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=for_loop",
"--package=for_loop"
],
"filter": {
"name": "for_loop",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
7 changes: 7 additions & 0 deletions example_projects/rust/for_loop/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions example_projects/rust/for_loop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "for_loop"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
8 changes: 8 additions & 0 deletions example_projects/rust/for_loop/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
println!("Hello, world!");
let mut index = 0;
while index < 100 {
println!("Index value is: {}", index);
index += 1;
}
}
1 change: 1 addition & 0 deletions example_projects/rust/for_loop/target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc_fingerprint":14170316736625081058,"outputs":{"5912810005807744388":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.61.0 (fe5b13d68 2022-05-18)\nbinary: rustc\ncommit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e\ncommit-date: 2022-05-18\nhost: aarch64-apple-darwin\nrelease: 1.61.0\nLLVM version: 14.0.0\n","stderr":""},"3376809586958156926":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/nateageek/.rustup/toolchains/stable-aarch64-apple-darwin\ndebug_assertions\nfeature=\"cargo-clippy\"\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
3 changes: 3 additions & 0 deletions example_projects/rust/for_loop/target/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f99de0a9feed7d66
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":5055087155190864114,"features":"[]","target":2507382578171158105,"profile":17483045194147818835,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/for_loop-11a3ecf36a88020d/dep-bin-for_loop"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
819db4b8e5c18929
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":5055087155190864114,"features":"[]","target":2507382578171158105,"profile":11736316127369858332,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/for_loop-72ba072149cce268/dep-bin-for_loop"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14a382e683122091
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":5055087155190864114,"features":"[]","target":2507382578171158105,"profile":11506243869495082934,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/for_loop-8d53f5be9f54c502/dep-test-bin-for_loop"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7b2cb354e804e363
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":5055087155190864114,"features":"[]","target":2507382578171158105,"profile":17483045194147818835,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/for_loop-91b509657542b0b5/dep-bin-for_loop"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2a45c5345d9c692
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":5055087155190864114,"features":"[]","target":2507382578171158105,"profile":11506243869495082934,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/for_loop-f52072bd5f2c1681/dep-test-bin-for_loop"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-72ba072149cce268: src/main.rs

/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-72ba072149cce268.d: src/main.rs

src/main.rs:
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-91b509657542b0b5.rmeta: src/main.rs

/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-91b509657542b0b5.d: src/main.rs

src/main.rs:

# env-dep:CLIPPY_ARGS=
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-f52072bd5f2c1681.rmeta: src/main.rs

/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/deps/for_loop-f52072bd5f2c1681.d: src/main.rs

src/main.rs:

# env-dep:CLIPPY_ARGS=
Empty file.
Empty file.
Binary file not shown.
1 change: 1 addition & 0 deletions example_projects/rust/for_loop/target/debug/for_loop.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/target/debug/for_loop: /Users/nateageek/Development/VSCodeExtentions/VSCode-Better-Memory-Viewer/example_projects/rust/for_loop/src/main.rs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 27 additions & 4 deletions src/MemoryViewerViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export class MemoryViewerViewProvider implements WebviewViewProvider {

// Set the HTML content that will fill the webview view
webviewView.webview.html = this._getWebviewContent(webviewView.webview, this._extensionUri);
vscode.debug.onDidChangeActiveDebugSession((event) => {
console.log("DEBUGGER CHANGED", event);
});

// Sets up an event listener to listen for messages passed from the webview view context
// and executes code based on the message that is recieved
Expand Down Expand Up @@ -60,24 +63,44 @@ export class MemoryViewerViewProvider implements WebviewViewProvider {
}

private _setWebviewMessageListener(webviewView: WebviewView) {
webviewView.webview.onDidReceiveMessage((message) => {
webviewView.webview.onDidReceiveMessage((message: MemoryViewerReadMemoryRequest) => {
console.log("Received message from webview: ", message);
switch (message.command) {
case "readMemory":
const activeDebugSession = vscode.debug.activeDebugSession;
if (activeDebugSession !== undefined) {
try {
activeDebugSession.customRequest("readMemory", {
memoryReference: message.address,
count: 100,
}).then((response) => {
// offset: message.offset,
count: message.bufferSize,
}).then((response: MemoryViewerReadMemoryResponse) => {
console.log("Got response", response);
response.direction = message.offset >= 0 ? "POSITIVE" : "NEGATIVE";
webviewView.webview.postMessage(response);
});
} catch (e) {
console.log("THERE WAS AN ERROR",e);
}
} else {
console.log("Not is a valid session...");
console.log("Not is a valid debug session is running...");
}
break;
}
});
}
}

interface MemoryViewerReadMemoryRequest {
command: "readMemory",
address: string,
offset: number,
bufferSize: number
}

interface MemoryViewerReadMemoryResponse {
address: string;
unreadableBytes?: number;
data?: string;
direction: "POSITIVE" | "NEGATIVE"
}
Loading

0 comments on commit 27697f0

Please sign in to comment.