Thread: gdb debug issues

  1. #1
    Registered User
    Join Date
    Jul 2005

    gdb debug issues

    Hi Guys

    I am trying to print out the value of a variable after a segmentation fault. However no matter what i try cannot get the values printed out. I have tried print XX, to no avail. The variables should all be in scope. I have also tried the print ZZ:XX where ZZ is the function name. I switched off all compiler optimisation trying absence of any command and also -O0. I cannot print anything out!

    Here is the gdb output from running the program

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000411167 in R2MinImageCo ()
    (gdb) bt
    #0  0x0000000000411167 in R2MinImageCo ()
    #1  0x0000000000411bc5 in CalculatePairwiseEnergyNonBondedEnergyCell ()
    #2  0x000000000040b30f in MonteCarloRunComb ()
    #3  0x0000000000418892 in main ()
    (gdb) info registers
    rax            0x65f1   26097
    rbx            0x7      7
    rcx            0x40366a161e4f7660       4627002310400112224
    rdx            0x13a9b80        20618112
    rsi            0x3      3
    rdi            0x7fff297afd50   140733889314128
    rbp            0x7fff29789220   0x7fff29789220
    rsp            0x7fff297891d0   0x7fff297891d0
    r8             0x7fff297afd50   140733889314128
    r9             0xd13940 13711680
    r10            0x192    402
    r11            0x7      7
    r12            0x8      8
    r13            0x7fff297892b0   140733889155760
    r14            0x40366a161e4f7660       4627002310400112224
    r15            0xd0f930 13695280
    rip            0x411167 0x411167 <R2MinImageCo(double***, int, int, double, double, double)+83>
    eflags         0x10283  [ CF SF IF RF ]
    cs             0x33     51
    ss             0x2b     43
    ds             0x0      0
    es             0x0      0
    fs             0x0      0
    gs             0x0      0
    fctrl          0x37f    895
    fstat          0x0      0
    ftag           0xffff   65535
    fiseg          0x0      0
    fioff          0x4137be 4274110
    foseg          0x7fff   32767
    fooff          0x297952b8       695816888
    fop            0x1c9    457
    mxcsr          0x1fa2   [ DE PE IM DM ZM OM UM PM ]

    Now I wish to obtain a variable that is passed into R2MinImageCo() function. However I cannot seem to find any of these variables. I include the function prototype here:

    double R2MinImageCo(double ***ptrBeadArray, int FinalBeadIndex, int InitialBeadIndex, double Xbox, double Ybox, double Zbox)

    so I am trying

    (gdb) print FinalBeadIndex
    No symbol "FinalBeadIndex" in current context.
    (gdb) print R2MinImageCo
    $1 = {<text variable, no debug info>} 0x411114 <R2MinImageCo(double***, int, int, double, double, double)>
    (gdb) print R2MinImageCo::FinalBeadIndex
    A syntax error in expression, near `::FinalBeadIndex'.
    (gdb) print 'R2MinImageCo::FinalBeadIndex'
    No symbol "R2MinImageCo::FinalBeadIndex" in current context.
    (gdb) print `R2MinImageCo::FinalBeadIndex`
    Invalid character '`' in expression.
    (gdb) print R2MinImageCo::xdiff
    A syntax error in expression, near `::xdiff'.
    Any ideas how I can achieve these values to be outputted? Thanks!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Did you use -g? (I'm guessing since it says "no debug info" the answer is "no". You should.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. buffered vs unbuffered question
    By Overworked_PhD in forum Linux Programming
    Replies: 6
    Last Post: 07-04-2008, 04:57 PM
  2. Contiguous Array version of Linked List
    By ampersand11 in forum C Programming
    Replies: 19
    Last Post: 10-07-2007, 03:05 AM
  3. Too much output in GDB
    By MacNilly in forum Tech Board
    Replies: 0
    Last Post: 09-13-2006, 12:45 PM
  4. debug threads in gdb
    By sudu in forum C Programming
    Replies: 4
    Last Post: 09-09-2006, 02:58 PM
  5. does gdb lie?
    By dinjas in forum C Programming
    Replies: 8
    Last Post: 03-10-2005, 05:17 PM