-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add options to copy pointer addresses (or base address) of a watch entry #167
Conversation
…widget Added a right click menu to m_pointerWidget which activates only if an address label is right clicked. It provides a single option (Copy address) which copies the address from that pointer level to clipboard. ref: aldelaro5#160
…ntry Added an option (copy address) to the right click menu of a MemWatchWidget. Selecting Copy address on a pointer watch can copy the address at any pointer level to the clipboard. Selecting Copy address on a non-pointer watch will copy the base address of the watch to the clipboard. ref: aldelaro5#160
for making on linux and macOS
Instead of finding the QLabel for the address when the pointer widget is clicked, the context menu is now registered to each pointer address label in the pointer widget. A property is also set (addr) which contains the numeric address at that pointer level. If addr is zero, the Copy Address is not enabled. Otherwise it is converted to a hex string which is copied to the clipboard if Copy Address is selected.
Since it already checks whether the index is a valid QModelIndex, this means that there will always be atleast one target that addresses can be copied from.
I'll be doing real-world use / tests of this feature branch later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as @cristian64 signs off on this, I'm good with merging as is.
Since we are not super strict about squash/merge rules, I'll leave it up to you if you want to squash @cristian64
Not tested, but looks good to me. |
We should definitely squash this into a single commit. |
…group node is right-clicked. This was a regression in aldelaro5#167. Group nodes do not have a watch entry associated with them. When a group node was right-clicked, a null pointer would be fatally dereferenced: ``` #0 MemWatchEntry::isBoundToPointer() const (this=this@entry=0x0) at /w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.cpp:77 aldelaro5#1 0x0000561a4ab96c94 in MemWatchWidget::onMemWatchContextMenuRequested(QPoint const&) (this=0x561a4c28c580, pos=...) at /w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:280 aldelaro5#2 0x00007f56ac7be023 in () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#3 0x00007f56ad489889 in QWidget::customContextMenuRequested(QPoint const&) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#4 0x00007f56ad4a6020 in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#5 0x00007f56ad541406 in QFrame::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#6 0x00007f56ac765818 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#7 0x00007f56ad44bd25 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#8 0x00007f56ad454c5e in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#9 0x00007f56ac765a58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#10 0x00007f56ad4b796c in () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#11 0x00007f56ad4ba635 in () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#12 0x00007f56ad44bd36 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 aldelaro5#13 0x00007f56ac765a58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#14 0x00007f56acd0a6bf in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib/x86_64-linux-gnu/libQt6Gui.so.6 aldelaro5#15 0x00007f56acd52c8c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Gui.so.6 aldelaro5#16 0x00007f56a8c7686e in () at /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/../../../libQt6XcbQpa.so.6 aldelaro5#17 0x00007f56abe32d3b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 aldelaro5#18 0x00007f56abe882b8 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 aldelaro5#19 0x00007f56abe303e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 aldelaro5#20 0x00007f56ac98deae in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#21 0x00007f56ac772adb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#22 0x00007f56ac76e0f3 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt6Core.so.6 aldelaro5#23 0x0000561a4ab66e8c in main(int, char**) (argc=<optimised out>, argv=<optimised out>) at /w/dolphin-memory-engine/Source/main.cpp:54 ``` Fixes aldelaro5#170.
…group node is right-clicked. This was a regression in #167. Group nodes do not have a watch entry associated with them. When a group node was right-clicked, a null pointer would be fatally dereferenced: ``` #0 MemWatchEntry::isBoundToPointer() const (this=this@entry=0x0) at /w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.cpp:77 #1 0x0000561a4ab96c94 in MemWatchWidget::onMemWatchContextMenuRequested(QPoint const&) (this=0x561a4c28c580, pos=...) at /w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:280 #2 0x00007f56ac7be023 in () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #3 0x00007f56ad489889 in QWidget::customContextMenuRequested(QPoint const&) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #4 0x00007f56ad4a6020 in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #5 0x00007f56ad541406 in QFrame::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #6 0x00007f56ac765818 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #7 0x00007f56ad44bd25 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #8 0x00007f56ad454c5e in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #9 0x00007f56ac765a58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #10 0x00007f56ad4b796c in () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #11 0x00007f56ad4ba635 in () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #12 0x00007f56ad44bd36 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6 #13 0x00007f56ac765a58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #14 0x00007f56acd0a6bf in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib/x86_64-linux-gnu/libQt6Gui.so.6 #15 0x00007f56acd52c8c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Gui.so.6 #16 0x00007f56a8c7686e in () at /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/../../../libQt6XcbQpa.so.6 #17 0x00007f56abe32d3b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #18 0x00007f56abe882b8 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #19 0x00007f56abe303e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007f56ac98deae in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #21 0x00007f56ac772adb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #22 0x00007f56ac76e0f3 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt6Core.so.6 #23 0x0000561a4ab66e8c in main(int, char**) (argc=<optimised out>, argv=<optimised out>) at /w/dolphin-memory-engine/Source/main.cpp:54 ``` Fixes #170.
Added two methods for copying a pointer address to the clipboard
Added a context menu to the Edit Address widget for the pointer widget to copy an address from the address label
Added an option ("Copy address") to the context menu of a Memory Watch widget to copy either the base address of the memory watch, or a selected pointer level if the watch is a pointer.
The second item is currently located after the "Copy" entry of the context menu, though it might fit better after the "Browse memory at" entry.
reference: #160