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

Example panicking due to UnexpectedEof error #9

Closed
dmell opened this issue Jul 12, 2022 · 5 comments
Closed

Example panicking due to UnexpectedEof error #9

dmell opened this issue Jul 12, 2022 · 5 comments

Comments

@dmell
Copy link

dmell commented Jul 12, 2022

Hello,

Thank you very much for open sourcing this project, which I believe has the potential to radically improve the emulation experience with Unicorn. I followed all the provided steps to compile it (with the exception of removing "use_system_unicorn" from Cargo.toml, because I wanted a fresh installation). Unfortunately, when trying to connect to the example, it crashes as you can see below.

Steps to reproduce:

  • install udbserver without using the local installation of Unicorn
  • RUST_BACKTRACE=1 cargo run --example server
  • on another terminal, run gdb and then target remote :1234

On the first terminal, I see the following:

$ RUST_BACKTRACE=1 cargo run --example server
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/examples/server`
Waiting for a GDB connection on "127.0.0.1:1234"...
Debugger connected from 127.0.0.1:37154
thread 'main' panicked at 'Failed to start udbserver: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }', src/lib.rs:46:60
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::expect
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/result.rs:1035:23
   4: udbserver::udbserver::{{closure}}
             at ./src/lib.rs:46:13
   5: unicorn_engine::ffi::code_hook_proxy
             at /home/damiano/.cargo/registry/src/github.com-1ecc6299db9ec823/unicorn-engine-2.0.0-rc7/bindings/rust/src/ffi.rs:137:5
   6: helper_uc_tracecode
             at /home/damiano/.cargo/registry/src/github.com-1ecc6299db9ec823/unicorn-engine-2.0.0-rc7/uc.c:1718:14
   7: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
[1]    929611 abort (core dumped)  RUST_BACKTRACE=1 cargo run --example server

In gdb instead I get this:

$ target remote :1234
Remote debugging using :1234
warning: while parsing target description (at line 3): Target description specified unknown architecture "arm"
warning: Could not load XML target description; ignoring
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
Truncated register 16 in remote 'g' packet

Am I doing anything wrong? I successfully reproduced the same issue following these steps in a VM with a fresh Linux installation, but let me know if I can provide anything further to help you debug this.

Thanks!

@bet4it
Copy link
Owner

bet4it commented Jul 13, 2022

You need to use gdb-multiarch rather than gdb.

@dmell
Copy link
Author

dmell commented Jul 13, 2022

Thank you! Perhaps this is worth mentioning in the README, so that folks avoid stumbling upon the same issue?

@bet4it
Copy link
Owner

bet4it commented Jul 13, 2022

You are right! I will add it later.

@dmell dmell closed this as completed Jul 15, 2022
@gwiede
Copy link

gwiede commented Oct 12, 2022

PLEASE update the README about this, as I just spent a couple hours trying to track down what was wrong until I saw this.

Really appreciate all the hard work, thanks, this hugely improves Unicorn's usability! I might even be in a position to help contribute at some point.

@bet4it
Copy link
Owner

bet4it commented Oct 14, 2022

@gwiede Sorry for the delay!

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

3 participants