Coder Social home page Coder Social logo

robertknight / qt-inspector Goto Github PK

View Code? Open in Web Editor NEW
398.0 35.0 69.0 112 KB

Utility to browse the Qt object tree of a running Qt application and edit object properties on the fly.

License: GNU Lesser General Public License v3.0

C++ 95.34% CMake 4.45% C 0.22%
qt

qt-inspector's Introduction

Qt Inspector

Qt Inspector is a tool to browse the object/widget tree of Qt applications.

Screenshot

Qt Inspector starts a specified application or connects to a specified process and once connected it can:

  • Browse the object tree of Qt applications.
  • View properties of objects
  • Edit properties of objects
  • Locate a widget in the object tree by clicking on it in the application

Building Qt inspector

Qt Inspector currently runs on Linux and Mac.

You will need protoc in your PATH. On Debian/Ubuntu, install protobuf-compiler and libprotobuf-dev.

	cmake <path to Qt inspector src>
	make -j2

Usage

Qt Inspector can either attach to an existing application or launch a specified application and then attach to it.

Recommended usage is to specify the program name and arguments.

	./qtinspector <program name> <args>
	./qtinspector <process ID of running Qt app>

Design

Qt Inspector operates by injecting a helper library into the target process when starting it using LD_PRELOAD / DYLD_INSERT_LIBRARIES or via gdb (if attaching to an existing process).

This helper library sets up a local socket and listens for requests from the inspector process. The inspector and target process communicate via protocol buffer messages over this socket.

qt-inspector's People

Contributors

danvratil avatar horrendus avatar knjmooney avatar robertknight avatar stachujemiola avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qt-inspector's Issues

QT 5.X Support

Is support for future versions of Qt (beyond 4.X) a possibility?

Windows support?

As in the title. I have a Windows-only application I would like to use this tool on. Any chances of adding support for it?

Widget picking does not seems to work (Ubuntu 20.04)

I compiled this great tool on Ubuntu 20.04. Tried both with and without -DUSE_QT5=True.
I launch it as root as otherwise I got errors that it could not connect the process to inspect.

When I click the Pick Widget button:

  • The inspector GUI becomes unresponsive (as expected)
  • Click somewhere in the target app
  • ... nothing happens

I expected the inspector finding the clicked widget in its tree and selecting it.

qtinspector failed to start because it could not load the Qt platform plugin 'cocoa'

I'm trying to run Qt-Inspector on OS X 10.11 El Capitan. I have Qt 5.5.1, which cmake (which I think I installed via homebrew a while ago) seems able to find OK. I have installed Google Protocol Buffers by way of brew install protobuf, after cmake first complained it couldn't find it.

After cmake -DUSE_QT5=on seemed to get me a properly configured build, I did make -j2 as recommended in the readme, and the build completed successfully.

However, when I try to run Qt-Inspector and attach it to a running process, I get the output:

This application failed to start because it could not find or load the Qt platform plugin "cocoa".

Reinstalling the application may fix this problem.
Abort trap: 6

I have ~/qt5/plugins/platforms/libqcocoa.dylib and have tried copying libqcocoa.dylib alongside the qtinspector executable, but that doesn't work.

Can you give me any hints as to how to get up and running?

Thanks!

Revisit choice of protocol buffers for IPC

Protocol buffers is easy to use on Linux and Mac but more work to download, build and configure for use with Qt Inspector on Windows.

Consider revisiting this. Some options:

  • Avoid IPC entirely and run the UI entirely in-process
  • Replace protocol buffers with something else
  • Implement a CMake build system for protocol buffers and import as a git submodule
  • Use a different (smaller) protocol buffers implementation

Additionally protocol buffers provides a framework for RPC implementations which we could consider using.

cmake src

Hello,

I'm getting the following error:

MacBook-Pro:projects user$ cmake Qt-Inspector/
Building with Qt 4. Enable the USE_QT5 option to build with Qt 5
-- Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PROTOBUF_INCLUDE_DIR (ADVANCED)
used as include directory in directory /Users/user/develop/projects/Qt-Inspector/lib
PROTOBUF_LIBRARY (ADVANCED)
linked by target "QtInspector" in directory /Users/user/develop/projects/Qt-Inspector/lib

-- Configuring incomplete, errors occurred!
See also "/Users/user/develop/projects/Qt-Inspector/CMakeFiles/CMakeOutput.log".
See also "/Users/user/develop/projects/Qt-Inspector/CMakeFiles/CMakeError.log".

What can I do to resolve this issue ?

Thanks,
Roy de Kleijn

Inspect signal/slot connection graph

I would like to be able to inspect the connection graph of Qt signal connections. Is this already possible ? If not, what would it take to add support for that ?

set unwindonsignal on/off both fail

After setting kernel.yama.ptrace_scope = 0 in /etc/sysctl.d/10-ptrace.conf on Ubuntu 16.04 running in Virtualbox.
And adding "sharedlibrary libdl" to the gdbStream.

With set unwindonsignal on

&"call qtInspectorInit()\n"
~"\nThread "
~"1 \"XXXXX\" received signal SIGSEGV, Segmentation fault.\n"
~"0x00007f02f194be06 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4\n"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x00007f02f194be06",func="??",args=[],from="/usr/lib/x86_64-linux-gnu/libQtCore.so.4"},thread-id="1",stopped-threads="all",core="1"
&"The program being debugged was signaled while in a function called from GDB.\n"
&"GDB has restored the context to what it was before the call.\n"
&"To change this behavior use \"set unwindonsignal off\".\n"
&"Evaluation of the expression containing the function\n"
&"(qtInspectorInit()) will be abandoned.\n"
^error,msg="The program being debugged was signaled while in a function called from GDB.\nGDB has restored the context to what it was before the call.\nTo change this behavior use \"set unwindonsignal off\".\nEvaluation of the expression containing the function\n(qtInspectorInit()) will be abandoned."
(gdb)
&"detach\n"
~"Detaching from program: /home/xxxx/Desktop/workspace/build-XXXX-Qt_5_5_1_in_PATH_qt5-Debug/XXXX, process 2774\n"

When setting ``set unwindonsignal off`

When setting set unwindonsignal on, the application crashes.

&"call qtInspectorInit()\n"
~"\nThread "
~"1 \"Habitat\" received signal SIGSEGV, Segmentation fault.\n"
~"0x00007fa080413e06 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4\n"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x00007fa080413e06",func="??",args=[],from="/usr/lib/x86_64-linux-gnu/libQtCore.so.4"},thread-id="1",stopped-threads="all",core="1"
&"The program being debugged was signaled while in a function called from GDB.\n"
&"GDB remains in the frame where the signal was received.\n"
&"To change this behavior use \"set unwindonsignal on\".\n"
&"Evaluation of the expression containing the function\n"
&"(qtInspectorInit()) will be abandoned.\n"
&"When the function is done executing, GDB will silently stop.\n"
^error,msg="The program being debugged was signaled while in a function called from GDB.\nGDB remains in the frame where the signal was received.\nTo change this behavior use \"set unwindonsignal on\".\nEvaluation of the expression containing the function\n(qtInspectorInit()) will be abandoned.\nWhen the function is done executing, GDB will silently stop."
(gdb)
&"detach\n"
~"Detaching from program: /home/xxxx/Desktop/workspace/build-xxx-Qt_5_5_1_in_PATH_qt5-Debug/xxxx process 2652\n"

Bring this project back!

I need this in my life.

If I didn't have a ton of other projects I was already working on, I'd fork this and try to bring it back myself.

Please!

./qtinspector pid can not work

gdb.log info:
&"call dlopen("/home/kkk/fk/Qt-Inspector-master/lib/libQtInspector.so",2)\n"
~"\nProgram received signal "
~"SIGSEGV, Segmentation fault.\n"
~"0x00000002 in ?? ()\n"

shell output:
Local socket state changed QLocalSocket::ConnectingState
Local socket reported error QLocalSocket::ServerNotFoundError
Local socket state changed QLocalSocket::UnconnectedState
Failed to connect to local socket server in target process 6656
Failed to inject helper library into process
Failed to send top-level widget request fetch to child process

How to fix it?

How to use

I tried run:

qtinspector okular
qtinspector dolphin

But nothing happens, maybe it is not compatible with QT5 ?

Anyway ...
My aim is to change the background/font color of a close source QT4 app (TimeDoctor) because It is not usable with Breeze Dark.
if I try run:
qtinspector timedoctorpro
The Timedoctor is executed but nothing else happens, I expect the Widget Inspector to start as well ... at least this is what I understood but maybe I am wrong ...

Missing symbol for QFutureInterface

Hi,

I built Qt-Inspector, as well as a Qt application, on CentOS 7, w/ Qt 5.

However attaching fails with a "Symbol not found" error and a mangled C++ symbol name.
When unmangling, it appears to be refering to QFutureInterface.

Is that an issue in Qt-Inspetor?
What kind of information could I collect that would help debugging.?

Thanks,

Guillaume

No symbol "dlopen" in current context

From gdb.log:

call dlopen(\"/home/terry.westley/usr/Qt-Inspector-master/build/lib/libQtInspector.so\",2)\n" &"No symbol \"dlopen\" in current context.\n"

Is this something wrong with the way I'm building my application under test?

CMakeLists.txt

I think there should be "option(USE_QT5 "QT5" OFF)" instead of "option(USE_QT5 OFF)" in CMakeLists.txt.

Hangs or crashes on Kubuntu 18.04, system Qt and PyQt

realloc(): invalid pointer
hangs
qtinspector konsole
realloc(): invalid pointer
hangs
qtinspector 14998 # PID of Konsole
Local socket state changed QLocalSocket::ConnectingState 
Local socket reported error QLocalSocket::ServerNotFoundError 
Local socket state changed QLocalSocket::UnconnectedState 
Failed to connect to local socket server in target process 14998 
Failed to inject helper library into process <pid> 
Failed to send top-level widget request fetch to child process
qtinspector okular
hangs

I get the same issue with system or pip pyqt. If I press Ctrl+C, the application exits. If I import platform.machine() and press ctrl+c, the application shows a stack trace where it's waiting for uname to exit.

qtinspector python3 app.py
hangs

Debugging Konsole crash

gdb -args qtinspector konsole
set follow-fork-mode child
run

Logs at https://gist.github.com/nyanpasu64/a222389b67f7e3f7139d2a099a66a092

System Details

Kubuntu 18.04, Qt-Inspector master 0e538d3 .
Qt 5.9.5

I ran make -j4, is that an issue?

Does not work on ubuntu

Another user reported their similar issue, except I have much less idea of what is going on. I made sure to find the process id and run it with that. I am attempting to run a forked bitcoin qt version 4.8 I probably have version 5 but Im not smart enough to figure out how all this works.

image

I would love to get this product working, it would become a must have for me. I use ubuntu sometimes and debian 12 most. Thanks for your time and consideration to help get this resolved.

undefined reference to protobuf libs

Hello,
I'm getting these undefined references:

[ 96%] Building CXX object CMakeFiles/qtinspector.dir/qtinspector_automoc.cpp.o
[100%] Linking CXX executable qtinspector
CMakeFiles/qtinspector.dir/TargetApplicationProxy.cpp.o: In function `google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]()':
TargetApplicationProxy.cpp:(.text._ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev[_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev]+0x7): undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit(int)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint64Fallback()'
lib/libQtInspector.so: undefined reference to `google::protobuf::UnknownFieldSet::default_instance()'
lib/libQtInspector.so: undefined reference to `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit(int)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::WireFormatLite::Int32Size(google::protobuf::RepeatedField<int> const&)'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::InitProtobufDefaults()'
lib/libQtInspector.so: undefined reference to `google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned long)'
lib/libQtInspector.so: undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback()'
lib/libQtInspector.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
lib/libQtInspector.so: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)'
collect2: error: ld returned 1 exit status
CMakeFiles/qtinspector.dir/build.make:413: recipe for target 'qtinspector' failed
make[2]: *** [qtinspector] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/qtinspector.dir/all' failed
make[1]: *** [CMakeFiles/qtinspector.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

buiding with protobuf 3.3.0, Ubuntu 16.04
did i miss something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.