Add Export disassembly of current function action - #3642
Conversation
Adds a new UI action to both the main File menu and the Disassembly context menu to allow users to export the disassembly of the currently selected function directly to a .txt file. It temporarily sets the `scr.color` to `0` to prevent ANSI color codes from being written into the output file.
|
Hi @PremadeS pls let me know if this pr needs any changes or if it is good to merge |
|
Hi @wargio I have done the requested changes pls let me know of there any more changes needed or if it is good to merge |
PremadeS
left a comment
There was a problem hiding this comment.
Doesn't seem to be exporting disassembly of a function correctly. It exports way more lines than a function contains
| if (!buf) { | ||
| return false; | ||
| } | ||
| rz_io_read_at_mapped(core->io, core->offset, buf, size); |
There was a problem hiding this comment.
shouldn't this be funcStart or actually the low address of the function?
| rz_io_read_at_mapped(core->io, core->offset, buf, size); | ||
| RzCoreDisasmOptions options = {}; | ||
| options.cbytes = 1; | ||
| rz_core_print_disasm(core, core->offset, buf, size, 0, nullptr, &options); |
efd9ce6 to
86ce61b
Compare
| qWarning() << "No function at current offset."; | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
the start address should not actually be the address at funcStart as the function start may be lower than the actual lowest address of the function.
I would say to maybe use rz_analysis_function_min_addr as start address since you use rz_analysis_function_linear_size for the size.
35cd900 to
22b6cdf
Compare
|
Hi @wargio I have done the changes pls let me know if there any other changes needed |
|
Hi @wargio this pr is good to merge ? |
Your checklist for this pull request
Detailed description
Adds a new UI action to both the main File menu and the Disassembly context menu to allow users to export the disassembly of the currently selected function directly to a .txt file. It temporarily sets the
scr.colorto0to prevent ANSI color codes from being written into the output file.Test plan (required)
Open a binary in Cutter.
Navigate to the Disassembly view and ensure you are inside a recognized function.
Test Context Menu Export:
export_context.txt(or any preferred name).\x1b[31m).Test Main Menu Export:
export_main.txt.Test Invalid Offset/No Function:
Closing issues
Closes:#3631