Giter Club home page Giter Club logo

Comments (8)

Waqar144 avatar Waqar144 commented on July 28, 2024 1

@brycegbrazen

You can add something like the following at the start of main() https://github.com/KDAB/GammaRay/blob/master/launcher/app/main.cpp and then launch the app from the Terminal ./bin/gammaray.exe:

#include <windows.h>

// Enable on windows to see output in console
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
    if (fileno(stdout) < 0)
        freopen("CON", "w", stdout);
    if (fileno(stderr) < 0)
        freopen("CON", "w", stderr);
}

You can also try to use a debugger instead.


This is the function that is used to check if the running process uses QtCore

QString ProbeABIDetector::qtCoreForProcess(quint64 pid) const

and then this

QVector<ProbeABI> ProbeABIDetector::detectAbiForQtCore(const QString &path)
function is used to check the abi.

If anything is going wrong in these two, it won't attach to pyside apps.

For linux the issue was that it was finding QtCore.abi3.so and thinking that this was the QtCore library, which it isn't and hence failed to attach. I am assuming that on windows there is a similar issue.

Perhaps you can create a patch that fixes this :)

from gammaray.

Waqar144 avatar Waqar144 commented on July 28, 2024

Please try with latest master

from gammaray.

brycegbrazen avatar brycegbrazen commented on July 28, 2024

@Waqar144 I rebuilt Gamma Ray with latest master commit and the application still does not appear in the list of processes that Gamma Ray can attach to after adding the from PySide2 import QtCore line.

from gammaray.

Waqar144 avatar Waqar144 commented on July 28, 2024

@brycegbrazen Can you share what are the contents of your PySide2 package. For e.g., on linux on my pc /usr/lib/python3.11/site-packages/PySide6/ has

/usr/lib/python3.11/site-packages/PySide6/QtConcurrent.abi3.so
/usr/lib/python3.11/site-packages/PySide6/QtCore.abi3.so
... more .so files

Also, if possible put a std::cout in ProbeABIDetector::containsQtCore(const QByteArray &line) and print out the line when trying to attach to a pyside app. It will make it easier to figure out what's going wrong.

from gammaray.

brycegbrazen avatar brycegbrazen commented on July 28, 2024

@Waqar144 Inside of the PySide2 package I've got some similar files to the ones you mentioned above but with the .dll and .lib extensions:

pyside2.abi3.dll
pyside2.abi3.lib
... more .dll files

I do also see a .dll file specifically for Qt5Core: Qt5Core.dll

I am on Windows 10 so I know the file extensions will be different than what you're seeing.

from gammaray.

brycegbrazen avatar brycegbrazen commented on July 28, 2024

Unfortunately I'm not sure how to build and launch Gamma Ray in order to see any std::cout print statements I add, so I cannot do that part without some guidance.

from gammaray.

brycegbrazen avatar brycegbrazen commented on July 28, 2024

@Waqar144 Alright I've figured out the issue! For Python Qt apps on Windows, it seems that the Qt application uses the standard QtCore5.dll if QtCore is NOT imported in Python, and then switches over to a different file if it IS imported QtCore.pyd.

The problem lies in the fact that the code relies on the found file including the Qt major version as shown here. I'm not really sure what to do about this, but this is definitely the issue.

Any ideas on a solve?

from gammaray.

Waqar144 avatar Waqar144 commented on July 28, 2024

Trying to understand... Can you tell me what is the path when

    Version version = fileVersion(path);
    if (version.major == -1)

this check faills? Is it the QtCore.pyd file? If yes, then the solution would be to make sure QtCore5.dll is the file instead of QtCore.pyd.

See this commit abd80cc which does the same for linux.

perhaps add a check and test

    // ignore QtCore.pyd
    if (line.lastIndexOf(".pyd", index) == index) {
        return false;
    }

from gammaray.

Related Issues (20)

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.