Opened 11 years ago

Last modified 7 years ago

#43001 new defect

can not debug (gdb 7.7) programs compiled with gcc 4.7.3 on OSX 10.9.2 XCode 5.1 64bit

Reported by: davydden@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: mww@…, stuartwesterman (Stuart Westerman)
Port: gdb gcc47

Description

Compile a simple program

#include <iostream>
#include <vector>

namespace Example
{

  template <int dim>
  class Problem
  {
  public:

    void run() {
        std::cout<<"here.."<<std::endl;
    }   
  };
}

int main(int argc, char *argv[])
{
  Example::Problem<2> problem;
  problem.run();
  return 0;
}

with macport's gcc 4.7.3:

g++-mp-4.7 -g -gdwarf-2 -gstrict-dwarf -O0 prog.cc -o prog

Now if I try to debug it:

$ ggdb ./prog
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin13.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/gdb/prog...Reading symbols from /Users/gdb/prog.dSYM/Contents/Resources/DWARF/prog...done.
done.
(gdb) b main
Breakpoint 1 at 0x100000dbf: file prog.cc, line 36.
(gdb) r
Starting program: /Users/gdb/prog

Breakpoint 1, main (argc=1, argv=0x7fff5fbff620) at prog.cc:36
36	  problem.run();
(gdb) s
here..
38	  return 0;
(gdb)

you see that gdb was not able to step-in the run() function.

I saw a lot of similar problems on StackOverflow with slightly different results depending on 64/32 bit, imposing C11, etc. Here are few: http://stackoverflow.com/questions/20909547/missing-call-stack-frame-with-assert-for-gdb-7-6-on-mac, https://www.sourceware.org/ml/gdb/2014-02/msg00023.html, http://stackoverflow.com/questions/10592521/gdb-error-message-gcc-4-7-from-macports/11705195#11705195

I don't know if the problem is related to GCC or GDB, but i hope there is a solution, since many people experience it and so far I have not seen any way to overcome it...

p.s. I have Xcode 5.1

$ g++-mp-4.7 --version
g++-mp-4.7 (MacPorts gcc47 4.7.3_3) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Change History (3)

comment:1 Changed 11 years ago by mf2k (Frank Schima)

Cc: openmaintainer@… removed
Port: gdb, gcc47gdb gcc47

In the future, please do not Cc openmaintainer@…, because it is not a valid email address.

comment:2 Changed 10 years ago by mf2k (Frank Schima)

Cc: stuartwesterman@… added; dweber@… removed

comment:3 Changed 7 years ago by raimue (Rainer Müller)

Can this still be reproduced?

Note: See TracTickets for help on using tickets.