Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I am running Qt 3.3.2.1 on Fedora core 1. I have added "CONFIG += qt warn_on debug" to my foo.pro file. I have re-compiled the several ".cpp" files in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2004
    Location
    Rhode Island, USA
    Posts
    7

    gdb problem


    Hi, I am running Qt 3.3.2.1 on Fedora core 1. I have added "CONFIG += qt warn_on debug" to my foo.pro file. I have re-compiled the several ".cpp" files in the program after adding this line.

    I can't make heads or tails out of the GDB manual ( I'm old ) so I come here looking for help on how to set "break" points in the various .cpp files.

    I am ok in "main.cpp" so I am getting some debug info in the program. Occasionally, by screwing around, I have been able to set them in other cpp files, but I don't know what I did and can't repeat it.

    I have downloaded "ddd" and installed it (I think), but have been unable to get it up. I did the "configure" and the "make" as instructed with out any errors or wornings.

    I would appreciate any help very much.

    pete

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    pete,

    if i am correct, you need to ensure firstly that your programs are compiled with the "-g" flag to ensure debugging information is built into the resulting binary, i would guess you've already done this part.

    when tracing flow of execution using gdb, if you want to set a breakpoint for a function, even if technically it is in another source file, simply use the "br" (breakpoint) command like so:

    Code:
    br my_function
    This would create a breakpoint at "my_function", even if "my_function" was in file2.cpp, and not main.cpp for example.

    Jason

  3. #3
    Just Joined!
    Join Date
    Apr 2004
    Location
    Rhode Island, USA
    Posts
    7
    Thanks Jasos, but I am using Qt's "qmake" as the combiler, not "gcc". Qt's documentation has the follawing

    CONFIG += qt debug
    HEADERS += hello.h
    SOURCES += hello.cpp
    SOURCES += main.cpp
    Use qmake as before to generate a makefile and you will be able to debug your application.

    Below is my .pro file:

    ################################################## ####################
    # Automatically generated by qmake (1.06c) Sun May 16 21:05:51 2004
    ################################################## ####################

    TEMPLATE = app
    INCLUDEPATH += .

    # Input

    CONFIG = qt warn_on debug
    HEADERS += mainsetup.h
    SOURCES += errorfunctions.cpp \
    helpfunction.cpp \
    main.cpp \
    mainsetup.cpp \
    namebuttons.cpp \
    programfunctions.cpp \
    userinput.cpp

    TARGET = promaster

    As I said, no problems with break points in "main.cpp" module, but I still can't get a break point set in any of the other modules. (I have done it in the past, but can't remember what I did.

    If I enter as you suggest:
    (gdb) br programfunctions
    I get
    Function "programFunctions" net defined.
    If I enter
    (gdb) br programfunctions.cpp
    I get
    (gdb) br programFunctions.cpp
    Can't find member of namespace, class, struct, or union named "programFunctions.cpp"
    Hint: try 'programFunctions.cpp 43<TAB> or 'programFunctions.cpp 43<ESC-?>
    (Note leading single quote.)

    The above is all gibberish to me.

    Have you tried "ddd"?

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •