Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: How to debug with dbg in this case?

  1. #21
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to debug with dbg in this case?

    How about just "break QString::QString"? Or "break QString::QString(const QString&)" (without the space) ?

    You can enter "break QString::" and press the tab key to get a list of all methods defined for QString. You can then find the one you seek.
    Last edited by wysota; 8th February 2007 at 12:05.

  2. #22
    Join Date
    Jun 2006
    Location
    Vietnam
    Posts
    59
    Thanks
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to debug with dbg in this case?

    How to gdb know functions of QString because QString in Qt's library? So I think in this case, if press Tab, it can't list of all methods defined for QString.

    Why do you try to break on QString::QString(const QString&) in examples?

    Try it & help me.

  3. #23
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to debug with dbg in this case?

    Quote Originally Posted by vql View Post
    How to gdb know functions of QString because QString in Qt's library?
    GDB knows how to resolve symbols from the binary it controls and its dependencies.

    So I think in this case, if press Tab, it can't list of all methods defined for QString.
    You can list methods which are actually seen (used) by your application.

    Why do you try to break on QString::QString(const QString&) in examples?
    I think the question is why do you try to do it...

  4. #24
    Join Date
    Jun 2006
    Location
    Vietnam
    Posts
    59
    Thanks
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to debug with dbg in this case?

    You answered:
    Set a breakpoint on SbBox2f::setBounds in the debugger and check each call for negative values. When you encounter them, simply display the backtrace and you'll know where it happens.
    I tried break on SbBox2f::setBound(const SbVec2f&, const SbVec2f&) but it not effect.

    Because I think Coin or Qt, they're the same. So I tried on Qt' library with QString.
    I tried on QString::QString(QChar), it have effect.
    But I tried on QString::QString(const QString&), it don't have effect.

    Can you answer this question, wysota??? Please try on your computer before anwer. Thanks.

  5. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to debug with dbg in this case?

    Quote Originally Posted by vql View Post
    I tried break on SbBox2f::setBound(const SbVec2f&, const SbVec2f&) but it not effect.
    Do you use that method in your app? If not (which means that it is used internally), do you have a debug version of libraries you use compiled? You have to compile in debug mode and link with debug libraries to have access to all symbols from within the debugger.

    I tried on QString::QString(QChar), it have effect.
    But I tried on QString::QString(const QString&), it don't have effect.

    Can you answer this question, wysota??? Please try on your computer before anwer. Thanks.
    As I already said, you don't have access to QString::QString(const QString&) because you don't use it in your application.

    Try debugging this one:
    Qt Code:
    1. #include <QString>
    2. int main(){
    3. QString x ="xxx";
    4. QString y(x); // here the copy constructor is used
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 

    You'll notice that QString::QString(const QString &) will be among symbols available (remember to compile your app in debug mode). If you don't have a debug version of Qt compiled (and linked to the application), you'll only receive symbols defined for your executable and used by it.
    Qt Code:
    1. (gdb) break QString<tab>
    2. QString QString::QString(char const*)
    To copy to clipboard, switch view to plain text mode 

  6. #26
    Join Date
    Jun 2006
    Location
    Vietnam
    Posts
    59
    Thanks
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to debug with dbg in this case?

    Quote Originally Posted by wysota View Post
    Qt can't "throw" a segmentation fault error, because it is the system that aborts the process, so Qt could only call abort() here. Instead Qt calls its handler which outputs a warning and then aborts the process. You can easily debug such situation in gdb - simply display the backtrace and look where is the error handler called - it'll be called from within QList::index or something simmilar. Then look further in the call list, the first entry not related to QtCore will be a position in your code which triggered the warning.



    You can use gdb under Windows as well.
    I tried but not successful. I get message from gdb when type backtrace: "No stack" (not remember)

    Please explain me clearly. Thanks.

Similar Threads

  1. qmake and debug output
    By mattie in forum Qt Programming
    Replies: 7
    Last Post: 18th September 2006, 22:33
  2. Unable to execute in Debug Mode
    By Kapil in forum Installation and Deployment
    Replies: 38
    Last Post: 5th April 2006, 07:27
  3. Replies: 11
    Last Post: 22nd March 2006, 19:06
  4. QTextCursor - setTextColor()
    By Dalamar in forum Newbie
    Replies: 0
    Last Post: 20th February 2006, 18:34
  5. TIP: If Qt4.1 debug compile doesn't work...
    By pthomas in forum Newbie
    Replies: 3
    Last Post: 13th January 2006, 14:36

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.