Results 1 to 5 of 5

Thread: [DEBUG] Debug or reverse engineering a QListView or QListBox

  1. #1
    Join Date
    Sep 2010
    Posts
    4
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Lightbulb [DEBUG] Debug or reverse engineering a QListView or QListBox

    Hello :-)

    I'll be straighforward: A third party application for Mac OS X is programmed with carbon + qt3, and it uses a QListBox -maybe a QListView I don't know for sure, "nm" shows both of them- to display text information in rows.

    PROBLEM
    ---------
    I want to log every row added to the QListView or QListBox in a file. For that, I have three options:


    OPTIONS
    -----------
    1) Use any QT debug tool that might help me to do achieve this. Is there any?

    2) Inject C++ code into te application, using class interposing or method swizzling with DYLD dynamic linking.

    I have already achieve this, being able to intercept standard C++ functions that helped me to get a clear picture of the workarounds of the application, like open(), close(), malloc() and string related functions.

    My question is, what should I interpose?

    - Is there any simple C++ function QString uses to build itself? This would be the best solution because it's low level and no class-interposing is needed. Maybe concatenation functions would be effective as well: the messages I want to intercept are built with concatenation for sure because all of them have the same structure: "Dealer: <message>"

    Regarding QString, I am ready to incercept any function that does not belong to any class. I am browsing QString.h and it uses many functions that are declared outside of the class, like real_detach() and operatorPlusEqHelper(), inserhelper(), etc. Any ideas on this path oriented towards seeing all processed strings would be welcomed. The base for QString is http://doc.qt.nokia.com/qtopia1.6/html/qcstring-h.html and standard C++ string.h functions are used. That seems a good place to start.

    - I am browsing QListView documentation and can't find any addRow or insertRow methods. I do find it in QListBox: if this were the case, I should override QListBox::inserItem(). If not, QListViewItem would be the center of my attention. Which one do you think is it?

    3) Another option would be to recompile completely the QT bundle the application uses from source code, adding my own changes. This is huge and effective but if they added their own touch, it won't work.


    REASONS
    ---------
    I have built a Poker Engine and I want it to retrieve information from the board to guide my playing: the future of it would be creating a bot. The application I want to debug is the following:

    full_tilt_poker_1.jpg

    The chat window in the lower-left displays ALL the information my poker bot needs to work. And it's a QListview or QListBox. The players and actions, folds, bets, my cards, the flop, everything I need is displayed there. I want to log all that activity to a file and make my application parse it to get a clear picture of the game.

    Would you think it is a QListBox or QListView?

    Thanks in advace for your answers!
    Last edited by flaab; 29th September 2010 at 18:04.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: [DEBUG] Debug or reverse engineering a QListView or QListBox

    You naughty boy!
    You want to cheat in poker rooms :-)
    And get some quick cash :-)

    Learn about application hooks. You'll have to do some disassembly to get the correct address of a statement or function, but once you get that, you can just hook into it. A lot of debuggers use a similar technique.

    Or... on MacOs you have this wonderfull toy called DTrace. Learn about it. It can do magic beyond your wildest dreams.

    Now, on to reporting you to FTP.

  3. The following user says thank you to tbscope for this useful post:

    flaab (30th September 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    4
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default Re: [DEBUG] Debug or reverse engineering a QListView or QListBox

    Thank you for answering. I am more from linux and use strace. Dtrace would do. Any nice man to point me to? I am exploring QString inheritance and that seems extremely doable :P

  5. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: [DEBUG] Debug or reverse engineering a QListView or QListBox

    Well, on linux use Systemtap.
    It has a very high learning curve but it can do magic at almost no speed loss. Just run your program and in the background trace it though systemtap. Write a little script to send new list items, via a local tcp socket to your own program. You still need a hook into the event queue to actual control the program.

    Edit: I think these are enough tips.

  6. The following user says thank you to tbscope for this useful post:

    flaab (30th September 2010)

  7. #5
    Join Date
    Sep 2010
    Posts
    4
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default Re: [DEBUG] Debug or reverse engineering a QListView or QListBox

    It's going to be easier than I thought. QString uses memcpy for almost all concatenation processes, insert and append. I have averriden memcpy with my patch and applying a suitable regex to find out only the strings I want I have it solved :P

Similar Threads

  1. Qt + Linux + Eclipse - debug using debug build?
    By will49 in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2012, 06:27
  2. Reverse engineering tools
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 29th September 2010, 17:48
  3. DEBUG macro not defined in debug build using vc++
    By piotr.dobrogost in forum Qt Programming
    Replies: 0
    Last Post: 21st July 2009, 13:07
  4. Reverse engineering of ui-file
    By wallyqt in forum Qt Tools
    Replies: 5
    Last Post: 18th November 2007, 22:11
  5. Replies: 11
    Last Post: 22nd March 2006, 19:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.