Skip to content

Commit e8ac1fc

Browse files
SersemPecaalehander92
authored andcommitted
fix: Address PR comments
1 parent 9a7cd5e commit e8ac1fc

File tree

9 files changed

+25
-46
lines changed

9 files changed

+25
-46
lines changed

nix/shells/main.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ mkShell {
2929
# general dependencies
3030
git
3131

32-
rustup
3332
binaryen
3433
llvmPackages_21.clang-unwrapped
3534
# clang
@@ -181,6 +180,7 @@ mkShell {
181180
rustup override set 1.89
182181
rustup target add wasm32-unknown-unknown
183182
rustup target add wasm32-unknown-emscripten
183+
rustup target add x86_64-unknown-linux-gnu
184184
185185
186186
export CPPFLAGS_wasm32_unknown_unknown="--target=wasm32 --sysroot=$(pwd)/src/db-backend/wasm-sysroot -isystem $(pwd)/src/db-backend/wasm-sysroot/include"

src/db-backend/build.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/db-backend/build_wasm.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# your sysroot layout: wasm-sysroot/{include,lib,...}
4+
SYSROOT="$(pwd)/wasm-sysroot"
5+
6+
echo "SYSROOT: ${SYSROOT}"
7+
8+
# make sure we use LLVM tools for wasm C/AR
9+
export CC_wasm32_unknown_unknown=clang
10+
export AR_wasm32_unknown_unknown=llvm-ar
11+
12+
cargo clean
13+
14+
# build (just your crate, or the specific package)
15+
cargo build --target wasm32-unknown-unknown --release --no-default-features --features browser-transport
16+
17+
wasm-pack build --target web --release -- --no-default-features --features browser-transport

src/db-backend/src/core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::error::Error;
22
use std::fs::create_dir_all;
33
use std::io::Write;
44

5+
#[cfg(feature = "io-transport")]
56
use std::os::unix::net::UnixStream;
67

78
use std::path::PathBuf;

src/db-backend/src/dap_server.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn make_io_transport() -> Result<(BufReader<std::io::StdinLock<'static>>, st
6161

6262
let stdin = std::io::stdin();
6363
let stdout = std::io::stdout();
64-
let mut reader = BufReader::new(stdin.lock());
64+
let reader = BufReader::new(stdin.lock());
6565
Ok((reader, stdout))
6666
}
6767

@@ -128,22 +128,16 @@ fn launch(trace_folder: &Path, trace_file: &Path, seq: i64) -> Result<Handler, B
128128
let trace_path = trace_folder.join(trace_file);
129129
// duration code copied from
130130
// https://rust-lang-nursery.github.io/rust-cookbook/datetime/duration.html
131-
let start = Instant::now();
131+
let _start = Instant::now();
132132
if let (Ok(meta), Ok(trace)) = (
133133
load_trace_metadata(&metadata_path),
134134
load_trace_data(&trace_path, trace_file_format),
135135
) {
136-
let duration = start.elapsed();
137-
// info!("loading trace: duration: {:?}", duration);
138-
139-
let start2 = Instant::now();
136+
let _start2 = Instant::now();
140137
let mut db = Db::new(&meta.workdir);
141138
let mut proc = TraceProcessor::new(&mut db);
142139
proc.postprocess(&trace)?;
143140

144-
let duration2 = start2.elapsed();
145-
// info!("postprocessing trace: duration: {:?}", duration2);
146-
147141
let mut handler = Handler::new(Box::new(db));
148142
handler.dap_client.seq = seq;
149143
handler.run_to_entry(dap::Request::default())?;
@@ -501,7 +495,7 @@ pub fn handle_message<T: DapTransport>(
501495
DapMessage::Request(req) => {
502496
if let Some(h) = ctx.handler.as_mut() {
503497
let res = handle_request(h, req.clone(), &mut ctx.seq, transport);
504-
if let Err(e) = res {
498+
if let Err(_e) = res {
505499
// warn!("handle_request error: {e:?}");
506500
}
507501
}

src/db-backend/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl Db {
7676
}
7777
}
7878

79-
pub fn step_from(&self, step_id: StepId, forward: bool) -> StepIterator {
79+
pub fn step_from(&'_ self, step_id: StepId, forward: bool) -> StepIterator<'_> {
8080
StepIterator {
8181
db: self,
8282
step_id,

src/db-backend/src/main.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,8 @@ fn main() -> Result<(), Box<dyn Error>> {
121121

122122
info!("pid {:?}", std::process::id());
123123
if cli.stdio {
124-
use std::io::BufReader;
125-
126-
let stdin = std::io::stdin();
127-
let stdout = std::io::stdout();
128-
let mut reader = BufReader::new(stdin.lock());
129-
130124
let _ = db_backend::dap_server::run_stdio();
131125
} else {
132-
use std::os::unix::net::UnixListener;
133-
134-
use std::io::BufReader;
135-
136126
let socket_path = if let Some(p) = cli.socket_path {
137127
p
138128
} else {

src/db-backend/src/trace_processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(target_arch = "x86_64")]
1+
#[cfg(feature = "io-transport")]
22
use expanduser::expanduser;
33

44
use std::collections::HashMap;

src/db-backend/tests/dap_backend_server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use db_backend::transport::DapTransport;
55
use serde_json::{from_reader, json};
66
use std::io::BufReader;
77

8-
#[cfg(target_arch = "x86_64")]
98
use std::os::unix::net::UnixStream;
109

1110
use std::path::{Path, PathBuf};

0 commit comments

Comments
 (0)