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

[move] Fix and add interactive disassembler #17986

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/sui-move/src/disassemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub struct Disassemble {
/// Whether to display the disassembly in raw Debug format
#[clap(long = "Xdebug")]
debug: bool,

#[clap(short = 'i', long = "interactive")]
interactive: bool,
}

impl Disassemble {
Expand All @@ -40,7 +43,7 @@ impl Disassemble {
.expect("Cannot convert module name to string")
.to_owned();
move_cli::base::disassemble::Disassemble {
interactive: false,
interactive: self.interactive,
package_name: None,
module_or_script_name: module_name,
debug: self.debug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ impl<'a> BytecodeViewer<'a> {

fn build_mapping(&mut self) {
let regex = Regex::new(r"^(\d+):.*").unwrap();
let fun_regex = Regex::new(r"^public\s+([a-zA-Z_]+)\(").unwrap();
let fun_regex =
Regex::new(r"^(?:public(?:\(\w+\))?|native|entry)?\s*(\w+)\s*(?:<.*>)?\s*\(.*\).*\{")
.unwrap();

let mut current_fun = None;
let mut current_fdef_idx = None;
let mut line_map = HashMap::new();
Expand Down
Loading