Thread: Problem using gdb

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Angry Problem using gdb

    I am not sure if this is the correct forum the address the issue, please point me to correct place if this is not.

    But, I have been getting this error when I am trying to run my executable thru gdb.

    Code:
    GNU gdb 6.6
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i386-pc-solaris2.10"...
    DW_FORM_strp pointing outside of .debug_str section [in module ........ ]
    And When I run this program, I get a few warnings:
    Code:
    warning: Temporarily disabling breakpoints for unloaded shared library "/usr/lib/ld.so.1"
    warning: Lowest section in /lib/libthread.so.1 is .dynamic at 00000074
    warning: Lowest section in /usr/lib/libsched.so.1 is .dynamic at 00000074
    (no debugging symbols found)
    And then the debugger just stops
    Code:
    Program received signal SIGSEGV, Segmentation fault.
    0xf860a183 in ?? ()
    I am using solaris 10
    Code:
    SunOS MySolaris01 5.10 Generic_118855-14 i86pc i386 i86pc
    gdb Version 6.6
    Code:
    GNU gdb 6.6
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i386-pc-solaris2.10".
    Can anyone please suggest any solution to this or any alternate debugger?


    -- amitapm

  2. #2
    Always learning
    Join Date
    Apr 2009
    Posts
    25
    I don't know what the warnings mean, but did you compile with the -g flag?

    Code:
    gcc -g program.c
    This will put the debugging symbols and it might work for you despite the warnings (I personally get a list of errors whenever I debug on Cygwin, but it still works).

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Most likely, Mr. Pointer has the answer. I certainly do not think that another debugger will solve the problem [aside from possibly that GDB 6.6 is not as good as some other version]. The exact error message may change, but if you haven't got symbols, there is very little the debugger itself can do about the matter. The debug information comes from the compiler. So you are either not including the correct form of debug info, you are using incorrect combination of gdb and gcc, or there is a bug in either the compiler or the debugger (or both!).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    I've seen that before. It's a bug in GCC. It went away when I switched to a different version. Unfortunately, I don't remember anything more specific.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    Thank you for ur replies. Lot of googling did help me understand that this is related to some bug in gdb. I even browsed thru some mailing list I found using googling, but couldn't get a resolution for it.

    Mr Pointer, I have compiled using -g flag.

    brewbuck, Can you tell me which version of gdb solved this issue?

    One more question that I would like is ask is:
    There are a few java function calls that I am making. Will my gdb be able to pass thru those calls? Does gdb support that. Its okay if I cannot step in to those java methods, but gdb should be able to gain the control back to move on.

    Let me know.
    Last edited by amitapm; 04-14-2009 at 11:53 PM. Reason: typo

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Well he said it's a bug in GCC, so I would change GCC instead.

    What's your GCC version? (gcc -v)

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    gcc version 3.4.3.

    Is the problem with this version?

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    No idea. Try a different version?

    Do you have a different version installed?

  9. #9
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    No. Can I do it as a regular user? As I do not have root access to the machine

  10. #10
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    You probably can.

    Download the GCC source, configure it with similar options as in the output of "gcc -v", except add "--prefix=/home/xxx/gcc" or something, so it will be installed into your home directory. You may need MPFR and GMP if your system doesn't have those installed (just untar them and put them into the gcc directory and rename them to "mpfr" and "gmp" respectively)

  11. #11
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    if it is indeed a bug in GDB..

    Amitapm,

    There are a couple of other debuggers you could try. I'm pretty sure that both of the ones I'm recommending aren't based on GDB (so if there is a bug in GDB then it isn't likely that we have that same bug).

    TotalView, from my company, is available for free evaluation (or free for students) from TotalView Technologies - Evaluate Products.

    Trying it out shouldn't take a lot of time, so there is little to loose.

    You should be able to download it, untar it and type "install", take the license.dat you get in email, and drop it into place, then just type <install_path>/toolworks/totalview.8.6.2-2/bin/totalview <program_name>

    I see that you mention using java calls, we have some experience using TotalView together with the Java interpreter to debug JNI-style programs. There is a white paper Downloading JNIDebuggingWithTotalView.pdf | TotalView Technologies on the topic on our web site that you might find useful.

    For general usage I'd suggest checking out

    QuickView mini-manual
    ------
    Downloading QuickView.pdf | TotalView Technologies

    Intro video
    ------
    Video tutorials for TotalView, MemoryScape and ReplayEngine


    There is also the Sun Studio Debugger, from sun. Here is a URL Sun Studio - Program Debugging

    Best of luck with your debugging.

    Cheers,
    Chris Gottbrath
    TotalViewTech.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. Weird Problem With Pointer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 07:50 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. gdb problem in multi-threaded app
    By IfYouSaySo in forum Linux Programming
    Replies: 1
    Last Post: 10-12-2006, 08:22 PM
  5. Problem using gdb debugger.....
    By manny in forum Tech Board
    Replies: 7
    Last Post: 09-18-2006, 01:26 AM