Skip to content

Commit

Permalink
Fixes the missing entrypoint in the "disassemble" example. (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored Jul 15, 2022
1 parent 2e6d571 commit e8243ec
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions examples/disassemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

extern crate solana_rbpf;
use solana_rbpf::{
elf::Executable,
elf::{register_bpf_function, Executable},
static_analysis::Analysis,
user_error::UserError,
vm::{Config, SyscallRegistry, TestInstructionMeter},
Expand All @@ -31,11 +31,22 @@ fn main() {
0x00, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
];
let syscall_registry = SyscallRegistry::default();
let config = Config::default();
let mut bpf_functions = BTreeMap::new();
register_bpf_function(
&config,
&mut bpf_functions,
&syscall_registry,
0,
"entrypoint",
)
.unwrap();
let executable = Executable::<UserError, TestInstructionMeter>::from_text_bytes(
&program,
Config::default(),
SyscallRegistry::default(),
BTreeMap::default(),
config,
syscall_registry,
bpf_functions,
)
.unwrap();
let analysis = Analysis::from_executable(&executable).unwrap();
Expand Down

0 comments on commit e8243ec

Please sign in to comment.