Skip to content
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

Hangs at Target folder not found. Cargo is installing necessary tools. #5

Open
Woody4618 opened this issue Jan 29, 2025 · 9 comments
Open

Comments

@Woody4618
Copy link

Woody4618 commented Jan 29, 2025

Hey, i cant get it to work.

I installed everything including

  • Extension
  • Solana CLI
  • protobuf
  • llvm

etc

But when running Run Solana LLDB it just hangs here without any error message:

Image

Can you somehow figure out what is missing and show an error message?

Im on a mac using VsCode:
solana-cli 2.0.17 (src:93e6e33e; feat:607245837, client:Agave)
libprotoc 29.3
llvm 19.1.7
agave-ledger-tool 2.0.17 (src:93e6e33e; feat:607245837, client:Agave)

@WyzaXX
Copy link
Collaborator

WyzaXX commented Feb 6, 2025

Hey Woody4618, so I troubleshooted the issue on my end, I could only reproduce it if I didn't have vscode opened in the Solana project itself.
The 2 screenshots provided show:

  1. If you have vscode opened in a project but not in the rust-solana folder
  2. if you have vscode opened inside the rust-solana folder

Image

Image

Can you provide more information as:

From where did you run the command?
Do you have rust-analyzer vscode extension installed in vscode?

@Woody4618
Copy link
Author

Woody4618 commented Feb 6, 2025

I ran the command from the repo directly:
jonasmac2@MacBook-Pro-9 solana-step-debugger % cd example-project
jonasmac2@MacBook-Pro-9 example-project % cd solana_test_extension
jonasmac2@MacBook-Pro-9 solana_test_extension %

It works when i directly open the project though. Maybe add a note for that in the readme?

Next error im getting is:

process launch -- --nocapture
zsh: command not found: process

Not sure where process is coming from.

When i try to run

validate --path /path/to/ledger

from your docs that does not work because agave-ledger-tool does not have a validate command. So not sure how to proceed:

Image

@WyzaXX
Copy link
Collaborator

WyzaXX commented Feb 6, 2025

Ill update readme for the project directory launch, also for the agave-ledger-tool command as it seems that its outdated.
as for the process launch -- --nocapture that comes from the lldb so can you check your paths in the .zshrc if everything is set correctly ?

@Woody4618
Copy link
Author

I have lldb installed via brew: lldb version 19.1.7

Looks like the path from the readme was wrong:

export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
export PATH="$PATH:$HOME/.local/share/solana/install/active_release/bin/sdk/sbf

Like that it takes the lldb installation from the solana install.

Now it runs, but setting breakpoints does not work:

solana-lldb
target create /Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/target/debug/deps/solana_test_extension-ec23fc6e8d21b5ad
process launch -- --nocapture
(lldb) command script import "/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/lldb_lookup.py"
(lldb) command script import "/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/solana_lookup.py"
(lldb) command source -s 0 '/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/lldb_commands'
Executing commands in '/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/lldb_commands'.
(lldb) type synthetic add -l lldb_lookup.synthetic_lookup -x ".*" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)String$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^&(mut )?str$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^&(mut )?\\[.+\\]$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(std::ffi::([a-z_]+::)+)OsString$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)Vec<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)VecDeque<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)BTreeSet<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)BTreeMap<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(std::collections::([a-z_]+::)+)HashMap<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(std::collections::([a-z_]+::)+)HashSet<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)Rc<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(alloc::([a-z_]+::)+)Arc<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(core::([a-z_]+::)+)Cell<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(core::([a-z_]+::)+)Ref<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(core::([a-z_]+::)+)RefMut<.+>$" --category Rust
(lldb) type summary add -F lldb_lookup.summary_lookup  -e -x -h "^(core::([a-z_]+::)+)RefCell<.+>$" --category Rust
(lldb) type category enable Rust
(lldb) command source -s 0 '/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/solana_commands'
Executing commands in '/Users/jonasmac2/.local/share/solana/install/active_release/bin/sdk/sbf/dependencies/platform-tools/llvm/bin/solana_commands'.
(lldb) type summary add -F solana_lookup.summary_lookup solana_program::account_info::AccountInfo --category Solana
(lldb) type summary add -F solana_lookup.summary_lookup solana_program::pubkey::Pubkey --category Solana
(lldb) type category enable Solana
(lldb) target create /Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/target/debug/deps/solana_test_extension-ec23fc6e8d21b5ad
Current executable set to '/Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/target/debug/deps/solana_test_extension-ec23fc6e8d21b5ad' (arm64).
(lldb) process launch -- --nocapture
Process 84299 launched: '/Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/target/debug/deps/solana_test_extension-ec23fc6e8d21b5ad' (arm64)

running 1 test
stop: 1
lorem ipsum
Hello, Solana!
test tests::test_process_instruction ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Process 84299 exited with status = 0 (0x00000000) 
(lldb) breakpoint set --file /Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/src/lib.rs --line 15
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x0000000100002d44 back to a compile unit, please file a bug and attach the address and file.
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x0000000100003188 back to a compile unit, please file a bug and attach the address and file.
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x000000010000319c back to a compile unit, please file a bug and attach the address and file.
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x00000001000031a4 back to a compile unit, please file a bug and attach the address and file.
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x00000001000031c4 back to a compile unit, please file a bug and attach the address and file.
error: solana_test_extension-ec23fc6e8d21b5ad unable to resolve a line table file address 0x0000000100003274 back to a compile unit, please file a bug and attach the address and file.
Breakpoint 1: where = solana_test_extension-ec23fc6e8d21b5ad`solana_test_extension::process_instruction::hfbffa84d1f43d3a2 + 272, address = 0x0000000100002d44
(lldb) 

@WyzaXX
Copy link
Collaborator

WyzaXX commented Feb 7, 2025

So I've checked the paths and there are 2 ways that it could be accessed depending on lldb installation so I'll add those to the readme as well.

For the breakpoints. In the readme, it says that after you've launched the file and run it then you can add breakpoints and rerun the file with the command "Re-run process launch" As I see from the log provided you've added the breakpoint but didn't rerun the file. Try that and let me know if anything else pops up.

@Woody4618
Copy link
Author

When add a breakpoint without running LLDB before i get

jonasmac2@MacBook-Pro-32 solana_test_extension % breakpoint delete 1
zsh: command not found: breakpoint

Where does that command come from?
Can you add more debug infos to the error messages?

@WyzaXX
Copy link
Collaborator

WyzaXX commented Feb 7, 2025

zsh doesn't recognize that command because it's an lldb command and it's executed when you've opened the "Solana Debugger" terminal from the command Run Solana LLDB, the lldb is launched and you set a breakpoint in vs code when you delete a breakpoint you get the command "breakpoint delete {the breakpoint in order that was deleted}" if you close that terminal those commands won't run. And you need to run the program again and do the flow.

You won't get those commands in another terminal. only in the Newly opened one by the extension.
You also shouldn't close the lldb in that terminal

I cannot add more debug info to those kind of error messages.

@Woody4618
Copy link
Author

Woody4618 commented Feb 7, 2025

Ah i see i missed the Rerun part. It wasnt obvious to me. Thank you for explaining. Now if i run it, set a breakpoint and rerun it stops at the breakpoint and i see the assembly code:

Process 38983 launched: '/Users/jonasmac2/Documents/GitHub/solana-step-debugger/example-project/solana_test_extension/target/debug/deps/solana_test_extension-ec23fc6e8d21b5ad' (arm64)

running 1 test
stop: 1
Process 38983 stopped

  • thread ci: publisher, update version #2, name = 'tests::test_process_instruction', stop reason = breakpoint 1.1
    frame #0: 0x0000000100002d30 solana_test_extension-ec23fc6e8d21b5adsolana_test_extension::process_instruction::hfbffa84d1f43d3a2 + 252 solana_test_extension-ec23fc6e8d21b5adsolana_test_extension::process_instruction::hfbffa84d1f43d3a2:
    -> 0x100002d30 <+252>: adrp x0, 138
    0x100002d34 <+256>: add x0, x0, #0x976
    0x100002d38 <+260>: mov w8, #0xb ; =11
    0x100002d3c <+264>: mov x1, x8
    (lldb)

Cool stuff.

I can step through different breakpoints using c. Is there a way to inspect variables? Can you add a section on how to use the debugger?

@WyzaXX
Copy link
Collaborator

WyzaXX commented Feb 10, 2025

I'll add a link to more lldb commands LLDB Commands in the readme, for the inspect variables I'm not 100% sure, but probably no, for that !msg() should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants