rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.88k stars 1.15k forks source link

Provide setting to configure disassembly preview #2497

Closed Petross404 closed 3 years ago

Petross404 commented 3 years ago

Is your feature request related to a problem? Please describe. Provide the ability to configure the tooltip (ie time until it shows up, disabling it or keeping it visible for longer).

Currently previewing the code at some offsets might feel kind of intrusive for some users. The tooltip can hide some information if the mouse pointer happens to hover over an offset.

Other users might need a tooltip that doesn't show up here and there immediately as the mouse pointer moves around the assembly.

Describe the solution you'd like One should be able to able to choose whether the tooltip will be show, or after what delay it will shown. Also, the duration of the preview should be configurable too.

Devs what do you think of this? I am willing to step up and contribute this with your help and guidance.

karliss commented 3 years ago

Was it not done in #2459 already? I agree that it that preview on hover might somewhat excessive and it should be possible to disable it. Just don't overdo it configuring delays seems too much.

Petross404 commented 3 years ago

Sure.

ITAYC0HEN commented 3 years ago

I don't think it was implemented by @Petross404 as part of #2459. I agree with Karliss, adding an option to disable the tooltip can be a good idea, but controlling the delay is too much.

And sure! Petross, you can go on and implement this part :)

Petross404 commented 3 years ago

May I ask where am I supposed to start? I mean where is the widget (or window) for the settings?

ITAYC0HEN commented 3 years ago

It is called the Preferences widget, or dialog. It is split to different views and tabs (Disassembly, Settings, ...). You can access it from Edit -> Preferences. And the relevant source code will contain the words Preferences and Options.

PreferencesDialog.cpp AppearanceOptionsWidget.cpp [Appearence, A]sm, Graph, ...]OptionsWidget.cpp

Petross404 commented 3 years ago

I am getting the following error:

ninja
[1/4] Building CXX object src/CMakeFiles/Cutter.dir/dialogs/AboutDialog.cpp.o
FAILED: src/CMakeFiles/Cutter.dir/dialogs/AboutDialog.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DCUTTER_ENABLE_GRAPHVIZ -DCUTTER_ENABLE_KSYNTAXHIGHLIGHTING -DCUTTER_SOURCE_BUILD -DCutter_EXPORTS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -Isrc -I../src -Isrc/Cutter_autogen/include -I../src/core -I../src/widgets -I../src/common -I../src/plugins -I../src/menus -I../src/. -isystem /usr/local/Cellar/graphviz/2.46.0/include/graphviz -iframework /usr/local/opt/qt/lib -isystem /usr/local/opt/qt/lib/QtCore.framework/Headers -isystem /usr/local/opt/qt/./mkspecs/macx-clang -isystem /usr/local/opt/qt/lib/QtWidgets.framework/Headers -isystem /usr/local/opt/qt/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers -isystem /usr/local/opt/qt/lib/QtSvg.framework/Headers -isystem /usr/local/opt/qt/lib/QtNetwork.framework/Headers -isystem /usr/local/include/librz -isystem /usr/local/Cellar/libuv/HEAD-dde9815/include -isystem /usr/local/include/librz/sdb -isystem /usr/local/include/KF5/KSyntaxHighlighting -isystem /usr/local/include/KF5 -isystem /usr/local/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fvisibility=hidden -fPIC -std=gnu++11 -MD -MT src/CMakeFiles/Cutter.dir/dialogs/AboutDialog.cpp.o -MF src/CMakeFiles/Cutter.dir/dialogs/AboutDialog.cpp.o.d -o src/CMakeFiles/Cutter.dir/dialogs/AboutDialog.cpp.o -c ../src/dialogs/AboutDialog.cpp
../src/dialogs/AboutDialog.cpp:28:84: error: use of undeclared identifier 'RZ_GITTAP'
            tr("Version") + " " CUTTER_VERSION_FULL "<br/>" + tr("Using rizin-") + RZ_GITTAP
                                                                                   ^
1 error generated.
[2/4] Building CXX object src/CMakeFiles/Cutter.dir/CutterApplication.cpp.o
FAILED: src/CMakeFiles/Cutter.dir/CutterApplication.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DCUTTER_ENABLE_GRAPHVIZ -DCUTTER_ENABLE_KSYNTAXHIGHLIGHTING -DCUTTER_SOURCE_BUILD -DCutter_EXPORTS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -Isrc -I../src -Isrc/Cutter_autogen/include -I../src/core -I../src/widgets -I../src/common -I../src/plugins -I../src/menus -I../src/. -isystem /usr/local/Cellar/graphviz/2.46.0/include/graphviz -iframework /usr/local/opt/qt/lib -isystem /usr/local/opt/qt/lib/QtCore.framework/Headers -isystem /usr/local/opt/qt/./mkspecs/macx-clang -isystem /usr/local/opt/qt/lib/QtWidgets.framework/Headers -isystem /usr/local/opt/qt/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers -isystem /usr/local/opt/qt/lib/QtSvg.framework/Headers -isystem /usr/local/opt/qt/lib/QtNetwork.framework/Headers -isystem /usr/local/include/librz -isystem /usr/local/Cellar/libuv/HEAD-dde9815/include -isystem /usr/local/include/librz/sdb -isystem /usr/local/include/KF5/KSyntaxHighlighting -isystem /usr/local/include/KF5 -isystem /usr/local/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fvisibility=hidden -fPIC -std=gnu++11 -MD -MT src/CMakeFiles/Cutter.dir/CutterApplication.cpp.o -MF src/CMakeFiles/Cutter.dir/CutterApplication.cpp.o.d -o src/CMakeFiles/Cutter.dir/CutterApplication.cpp.o -c ../src/CutterApplication.cpp
../src/CutterApplication.cpp:79:30: error: expected ';' at end of declaration
    QString localVersion = "" RZ_GITTAP;
                             ^
                             ;
1 error generated.
[3/4] Building CXX object src/CMakeFiles/Cutter.dir/core/Cutter.cpp.o
FAILED: src/CMakeFiles/Cutter.dir/core/Cutter.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DCUTTER_ENABLE_GRAPHVIZ -DCUTTER_ENABLE_KSYNTAXHIGHLIGHTING -DCUTTER_SOURCE_BUILD -DCutter_EXPORTS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -Isrc -I../src -Isrc/Cutter_autogen/include -I../src/core -I../src/widgets -I../src/common -I../src/plugins -I../src/menus -I../src/. -isystem /usr/local/Cellar/graphviz/2.46.0/include/graphviz -iframework /usr/local/opt/qt/lib -isystem /usr/local/opt/qt/lib/QtCore.framework/Headers -isystem /usr/local/opt/qt/./mkspecs/macx-clang -isystem /usr/local/opt/qt/lib/QtWidgets.framework/Headers -isystem /usr/local/opt/qt/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers -isystem /usr/local/opt/qt/lib/QtSvg.framework/Headers -isystem /usr/local/opt/qt/lib/QtNetwork.framework/Headers -isystem /usr/local/include/librz -isystem /usr/local/Cellar/libuv/HEAD-dde9815/include -isystem /usr/local/include/librz/sdb -isystem /usr/local/include/KF5/KSyntaxHighlighting -isystem /usr/local/include/KF5 -isystem /usr/local/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fvisibility=hidden -fPIC -std=gnu++11 -MD -MT src/CMakeFiles/Cutter.dir/core/Cutter.cpp.o -MF src/CMakeFiles/Cutter.dir/core/Cutter.cpp.o.d -o src/CMakeFiles/Cutter.dir/core/Cutter.cpp.o -c ../src/core/Cutter.cpp
../src/core/Cutter.cpp:3797:47: error: use of undeclared identifier 'RZ_GITTAP'
    versionInfo.append(QString("%1 rz\n").arg(RZ_GITTAP));
                                              ^
1 error generated.
ninja: build stopped: subcommand failed.

CMake configuration:

cmake -DCUTTER_USE_BUNDLED_RIZIN=OFF CUTTER_USE_ADDITIONAL_RIZIN_PATHS=OFF ..
-- 
-- Building Cutter version 1.12.0
-- Options:
-- - Bundled rizin: OFF
-- - Python: OFF
-- - Python Bindings: OFF
-- - Crash Handling: OFF
-- - KSyntaxHighlighting: ON
-- - Graphviz: TRUE
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/petros/projects/cutter.git/build

Using the bundled rizin doesn't help either. Any ideas on why this is happening?

Surendrajat commented 3 years ago

It is related to https://github.com/rizinorg/rizin/pull/480 and shouldn't have happened as Cutter's Rizin submodule is not updated to that commit yet. Try running this to sync your submodules: git submodule sync --recursive && git submodule update

BTW, I'm curious what CUTTER_USE_ADDITIONAL_RIZIN_PATHS is.

Petross404 commented 3 years ago

I am sorry, using bundled rizin doesn't help due to other errors. My mistake.

I used rizin's git master to compile and install on macOS Catalina and using this version gives me the error I described in my previous post.

Surendrajat commented 3 years ago

@Petross404 yeah. Rizin master won't work with Cutter so try to use bundled and paste your errors here.

Petross404 commented 3 years ago

No it's fine. git submodule update --init --recursive solved it for me.

Petross404 commented 3 years ago

I compiled Cutter with my changes and I can't access any menu. I click on the Mac toolbar that the menus exist and they don't respond. The official Cutter.app that I downloaded from GH works normal.

I recall that the last time I edited cutter and created a PR I had the same issue. How can I debug this?

karliss commented 3 years ago

Does it also happen with Cutter you compile yourself without your changes? If yes maybe it's something to do with Qt you are using. How did you install it? Does the rest of Cutter can be interacted with?

Petross404 commented 3 years ago

Does it also happen with Cutter you compile yourself without your changes? If yes maybe it's something to do with Qt you are using. How did you install it? Does the rest of Cutter can be interacted with?

The rest of Cutter is fine. Also if I give it a minute or two the menus are working again, I don't know why this is happening.

I haven't installed (custom) Cutter, I am running it from inside the build folder and yes, this is happening even without my changes.