Skip to content

Commit

Permalink
Merge pull request #841 from tonlabs/disasm-cpp
Browse files Browse the repository at this point in the history
disasm: add cpp selector
  • Loading branch information
mskvortsov authored Jan 24, 2023
2 parents 6e67a90 + 3315bef commit 14e0ba7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license-file = 'LICENSE.md'
name = 'tvm_linker'
readme = 'README.md'
repository = 'https://github.com/tonlabs/TVM-linker'
version = '0.19.1'
version = '0.19.2'

[[bin]]
name = 'tvm_linker'
Expand Down
11 changes: 11 additions & 0 deletions src/disasm/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ fn disasm_text_command(m: &ArgMatches) -> Status {
.branch(Shape::var("dict-c3")
.branch(Shape::any())); // just to mark any() as used, can be omitted

let shape_cpp = Shape::literal("ff0020c101f4a4205892f4a0e05f028a20ed53d9")
.branch(Shape::var("dict-public"))
.branch(Shape::literal("f4a420f4a1")
.branch(Shape::var("code-c3")));

let code = roots.remove(0).reference(0).unwrap();
if let Ok(assigned) = shape_deprecated1.captures(&code) {
println!(";; solidity deprecated selector detected");
Expand Down Expand Up @@ -287,6 +292,12 @@ fn disasm_text_command(m: &ArgMatches) -> Status {
println!(";; fun-c selector detected");
println!(";; internal functions dictionary");
print_code_dict(&assigned["dict-c3"], 19);
} else if let Ok(assigned) = shape_cpp.captures(&code) {
println!(";; cpp selector detected");
println!(";; public methods dictionary");
print_code_dict(&assigned["dict-public"], 32);
println!(";; internal functions dictionary");
print_code_dict(&assigned["code-c3"], 32);
} else {
bail!("failed to recognize selector")
}
Expand Down
1 change: 1 addition & 0 deletions src/disasm/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ impl Handlers {
.set(0x27, Loader::balance)
.set(0x28, Loader::my_addr)
.set(0x29, Loader::config_root)
.set(0x2a, Loader::my_code)
.set(0x30, Loader::config_dict)
.set(0x32, Loader::config_ref_param)
.set(0x33, Loader::config_opt_param)
Expand Down
1 change: 1 addition & 0 deletions src/disasm/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,7 @@ impl Loader {
create_handler_2!(balance, 0xf827, "BALANCE");
create_handler_2!(my_addr, 0xf828, "MYADDR");
create_handler_2!(config_root, 0xf829, "CONFIGROOT");
create_handler_2!(my_code, 0xf82a, "MYCODE");
create_handler_2!(config_dict, 0xf830, "CONFIGDICT");
create_handler_2!(config_ref_param, 0xf832, "CONFIGPARAM");
create_handler_2!(config_opt_param, 0xf833, "CONFIGOPTPARAM");
Expand Down

0 comments on commit 14e0ba7

Please sign in to comment.