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

Switch to use Rizin API directly whenever appropriate #2666

Open
XVilka opened this issue Apr 15, 2021 · 6 comments
Open

Switch to use Rizin API directly whenever appropriate #2666

XVilka opened this issue Apr 15, 2021 · 6 comments
Labels
High Priority This issue should be handled as soon as possible since it describes a major problem in Cutter Refactoring This issue requires refactoring. rizin Needs changes into rizin codebase.
Projects
Milestone

Comments

@XVilka
Copy link
Member

XVilka commented Apr 15, 2021

Using API directly will improve the performance and allow to avoid situations when Rizin command has changed but it went unnoticed in Cutter. Using API will guarantee if the function has changed - it will break the compilation.

Here is the current situation (will be updated periodically):

src/core/Cutter.cpp
3948:        searchArray = cmdj(QString("%1 %2").arg(space, searchFor));

src/widgets/RizinGraphWidget.cpp
99:    CutterJson functionsDoc = Core()->cmdj(QString("%1j").arg(graphCommand));

src/widgets/HexdumpWidget.cpp
242:                selectedCommand != "" ? Core()->cmdRawAt(
@XVilka XVilka added the rizin Needs changes into rizin codebase. label Apr 15, 2021
@XVilka XVilka added this to To do in Rizin API via automation Apr 15, 2021
@XVilka XVilka added the Refactoring This issue requires refactoring. label Apr 15, 2021
@XVilka
Copy link
Member Author

XVilka commented Apr 15, 2021

First actionable items are:

  • z commands - recently were ported to the newshell and there is better API

@XVilka

This comment has been minimized.

@ret2libc
Copy link
Member

Please note that in terms of minimum required work, we only really need to convert uses of commands that were converted to rzshell and where the oldshell handler was deleted.

The others should still work. I'm working on this.

@imbillow
Copy link
Contributor

It took too much time and now we have this left

src/core/Cutter.cpp
3948:        searchArray = cmdj(QString("%1 %2").arg(space, searchFor));
3984:    for (CutterJson xrefObject : cmdjAt(findWrites ? "afvWj" : "afvRj", offset)) {

src/widgets/RizinGraphWidget.cpp
99:    CutterJson functionsDoc = Core()->cmdj(QString("%1j").arg(graphCommand));

src/plugins/sample-cpp/CutterSamplePlugin.cpp
53:        res = Core()->cmd("?E `pi 1`");
67:    QString res = Core()->cmdRaw("?E " + QString::fromUtf8(fortune));

src/widgets/CutterGraphView.cpp
376:    qWarning() << Core()->cmdRawAt(QString("%0w \"%1\"").arg(graphCommand).arg(filePath), address);
387:    fileOut << Core()->cmdRawAt(QString("%0").arg(graphCommand), address);

src/common/Decompiler.cpp
103:    task = new RizinCmdTask("pddA @ " + QString::number(addr));

@XVilka
Copy link
Member Author

XVilka commented Aug 11, 2022

Thank you, @imbillow, you did an amazing job, I never thought it's actually this big and often quite problematic.

@karliss
Copy link
Member

karliss commented Aug 12, 2022

I think you missed the stuff in HexdumpWidget.

@XVilka XVilka unpinned this issue Aug 14, 2022
@XVilka XVilka modified the milestones: 2.2, 2.3 Feb 6, 2023
@XVilka XVilka added the High Priority This issue should be handled as soon as possible since it describes a major problem in Cutter label Feb 13, 2023
@XVilka XVilka pinned this issue Feb 13, 2023
@XVilka XVilka unpinned this issue Feb 20, 2023
@XVilka XVilka modified the milestones: 2.3, 2.4 Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority This issue should be handled as soon as possible since it describes a major problem in Cutter Refactoring This issue requires refactoring. rizin Needs changes into rizin codebase.
Projects
Development

No branches or pull requests

5 participants