-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to debug #47
Comments
So the problem is your logger drops at the end of If you don't care about clean console and want to use the Alternatively don't use a logger and use |
I found links that showed how to step-through wasm-bindgen Rust code in Chrome Canary or Chrome Dev and it seems to work. I just can't seem to step into where i want it to. For example I can get it to step through inside view functions like It also steps through kobold files so you can get some information about the state variables This is how I did it (note that most of what i've written is a mixed summary
|
Note: I was getting the following error in the browser To fix that I had to remove the That's probably what @71 meant here rustwasm/walrus#231 (comment) when they said So now the index.html has the following and it works:
Also note: If you get errors in the browser like |
So the reason why i was only able to debug in So I debugging worked when i did stuff like
I pushed the changes i made to get it to work here https://github.com/ltfschoen/kobold in branch 'luke/invoice-debug' |
But I still don't know how to:
Which is caused because as shown here For some reason it's not able to find these folders in Chrome DevTools > Sources
I don't know what it's trying to use But meanwhile it can successfully find
And it has access to the project folders itself
So i tried running it on Ubuntu with
I also did a search but couldn't find any rustc folders with a subdirectory called library when i did a search
|
Thanks for doing all this, and documenting it! There is still a ton of stuff that I want to tackle and this isn't necessarily top of my list right now, but it will be good to have all this researched when it is. |
So i resolved 2. although, i think these errors may be as a result of from @71 trying to use source maps, but maybe the source maps aren't setup correctly yet. but i just decided to manually copy the files it wants to the relevant folders as follows:
sudo touch /etc/synthetic.conf
sudo chmod 0666 /etc/synthetic.conf
sudo echo -e "rustc Users/luke/code/temp/rustc" >> /etc/synthetic.conf
sudo echo -e "cargo Users/luke/code/temp/cargo" >> /etc/synthetic.conf
cat /etc/synthetic.conf
sudo chmod 0644 /etc/synthetic.conf
sudo chown root:wheel /etc/synthetic.conf
mkdir -p /Users/luke/code/temp/rustc
mkdir -p /Users/luke/code/temp/cargo
cargo install --version 0.2.3 dlmalloc
cargo install --version 0.1.21 rustc-demangle
cargo install --version 0.1.85 compiler-builtins
mkdir -p /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/dlmalloc-0.2.3
mkdir -p /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.21
mkdir -p /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.85
cp -r /Users/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/dlmalloc-0.2.3/ /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/dlmalloc-0.2.3
cp -r /Users/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.21/ /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.21
cp -r /Users/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.85/ /Users/luke/code/temp/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.85
mkdir -p ~/code/github/rust-lang
cd ~/code/github/rust-lang
git clone https://github.com/rust-lang/rust
git fetch origin 1.68.2:1.68.2
git checkout 1.68.2
cd rust
mkdir -p /Users/luke/code/temp/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library
cp -r /Users/luke/code/github/rust-lang/rust/library/ /Users/luke/temp/code/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library
cd ~/code/github/rust-lang
git clone https://github.com/rust-lang/backtrace-rs
git fetch origin 07872f28cd8a65c3c7428811548dc85f1f2fb05b:07872f28cd8a65c3c7428811548dc85f1f2fb05b
git checkout 07872f28cd8a65c3c7428811548dc85f1f2fb05b
mkdir -p /Users/luke/code/temp/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/backtrace
cp -r /Users/luke/code/github/rust-lang/backtrace-rs/ /Users/luke/code/temp/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/backtrace
cd ~/code/github/rust-lang
git clone https://github.com/rust-lang/stdarch
git fetch origin b655243782c18d3419439daa523782e0818ecf26:b655243782c18d3419439daa523782e0818ecf26
git checkout b655243782c18d3419439daa523782e0818ecf26
mkdir -p /Users/luke/code/temp/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/stdarch
cp -r /Users/luke/code/github/rust-lang/stdarch/ /Users/luke/code/temp/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/stdarch
|
Note: For some reason after i restarted the computer when i went to debug again using Google Chrome Canary, even though I had breakpoints setup it wouldn't stop at them, and it would only debug the JS code instead of Rust code. I resolved that by:
|
i just set this up so i could debug this PR where i am using CSS https://github.com/maciejhirsz/kobold/pull/57/files#diff-6f961f3fdf36b8574e58351c93169e1f148663d2d0b0aa58f7e839af517e8a12R16. it was necessary to update the index.html to be the following (note: the first has <link
data-trunk rel="css"
data-keep-debug={true}
data-type="main"
data-typescript={false}
data-wasm-opt="0"
data-no-demangle={false}
data-weak-refs={true}
href="styles.css"
/>
<link
data-trunk rel="rust"
data-keep-debug={true}
data-type="main"
data-typescript={false}
data-wasm-opt="0"
data-no-demangle={false}
data-weak-refs={true}
/> also i used Incognito mode. if it crashed and it wouldn't show the files in "Source", i just disabled and re-enabled the "DWARF support feature" mentioned here #47 (comment) |
I'm been trying to figure out how to setup debugging for introspection using breakpoints. I'm using VSCode.
I pushed my attempts so far in this commit d6b170d.
I want to debug
struct Table
.If I run the code with
RUST_LOG=debug
(i.e.RUST_LOG=debug trunk serve --address=127.0.0.1
) then it outputs more debugging logs in the terminal, but not the ones that i introduce in the code usinggloo_console::debug
orlog::debug
.I'm aware that i can use the following to use console.log in the browser https://rustwasm.github.io/wasm-bindgen/examples/console-log.html, but i want to debug the non-private parts of kobold.
I managed to get it to log to console in the browser by following this https://blog.urth.org/2022/02/14/frontend-rust-without-node/#just-use-trunkhttpstrunkrsdev where they suggested using
wasm-logger
, so it worked in this commit dfc527f, but it only outputmain()
andEditor()
, but not themove
and## table
logsI found the info about how to try and debug from these sources.
The text was updated successfully, but these errors were encountered: