Opened 10 years ago

Closed 10 years ago

#45833 closed defect (worksforme)

gdb @7.7.1 completely useless

Reported by: trac-1948@… Owned by: stuartwesterman (Stuart Westerman)
Priority: Normal Milestone:
Component: ports Version: 2.3.2
Keywords: Cc:
Port: gdb

Description (last modified by larryv (Lawrence Velázquez))

Hi, running MacPorts 2.3.2 (clean install) on Yosemite (clean install) with current Xcode (6.1).

I just compiled something with MacPorts' GCC 4.8 that worked fine on Mavericks, but now produces a segfault.

In order to debug the issue with MacPorts' gdb I did another build of the application in question with -O0 -g.

Then I tried to use gdb to obtain a stack backtrace of the crash in the application, however there is no usable output:

Program received signal SIGSEGV, Segmentation fault.
0x00007fff8fc64432 in ?? ()
(gdb) bt
#0  0x00007fff8fc64432 in ?? ()
#1  0x0000000100204bd9 in ?? ()
#2  0x00000001000a2690 in ?? ()
#3  0x00000000000060f1 in ?? ()
#4  0x000000010004cf78 in ?? ()
#5  0x00007fff5fbff328 in ?? ()
#6  0x0000000000000070 in ?? ()
#7  0x000000010004d15d in ?? ()
#8  0x00000001000a69c0 in ?? ()
#9  0x00000001000c9088 in ?? ()
#10 0x0000000000000000 in ?? ()

On Linux, this works, i.e. it gives me a backtrace, on Mac OS X with MacPorts' gdb this has never worked, I can't remember when I had a decent backtrace on OS X when developing with gcc and gdb on the command line. I'm not doing anything strange, so I can't quite understand what's going on...

Change History (9)

comment:1 Changed 10 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to stuartwesterman@…

comment:2 Changed 10 years ago by stuartwesterman (Stuart Westerman)

I'm testing this now. Did you make sure to make the the -p change to the following plist:

/System/Library/LaunchDaemons/com.apple.taskgated.plist

            <key>ProgramArguments</key>
            <array>
                    <string>/usr/libexec/taskgated</string>
                    <string>-sp</string>
            </array>
Last edited 10 years ago by stuartwesterman (Stuart Westerman) (previous) (diff)

comment:3 Changed 10 years ago by stuartwesterman (Stuart Westerman)

This works fine for me.

wei ~/Dropbox/CSCI531 Applied Cryptography/hw2 $ ggdb hw2
GNU gdb (GDB) 7.7.1
Copyright (C) 2014 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-darwin14.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hw2...done.
(gdb) run
Starting program: /Users/wei/Dropbox/CSCI531 Applied Cryptography/hw2/hw2

Program received signal SIGSEGV, Segmentation fault.
0x0000000100001411 in print_usage () at hw2.c:231
231	    *(woot + 10) = 100;
(gdb) bt
#0  0x0000000100001411 in print_usage () at hw2.c:231
#1  0x0000000100000920 in main (argc=1, argv=0x7fff5fbffa80) at hw2.c:23
(gdb)

I'm requesting that the ticket author give me more information about their setup, and failing that I'm requesting that this ticket be closed (worksforme).

Please ensure that you've made the taskgated plist change above (and reboot). Also please make sure that you are in fact using MacPorts' gcc. You can try things like sudo port select gcc, or invoking /opt/local/bin/gcc directly.

Here is my setup:

wei ~/Dropbox/CSCI531 Applied Cryptography/hw2 $ which ggdb
/opt/local/bin/ggdb
wei ~/Dropbox/CSCI531 Applied Cryptography/hw2 $ which gcc
/opt/local/bin/gcc
wei ~/Dropbox/CSCI531 Applied Cryptography/hw2 $ gcc --version
gcc (MacPorts gcc49 4.9.1_1) 4.9.1
Copyright (C) 2014 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.

wei ~/Dropbox/CSCI531 Applied Cryptography/hw2 $ uname -a
Darwin qi.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

Also, I compiled with -g -Wall, and I got the same exact results with mp-gcc48.

Last edited 10 years ago by stuartwesterman (Stuart Westerman) (previous) (diff)

comment:4 in reply to:  2 Changed 10 years ago by trac-1948@…

Replying to stuartwesterman@…:

I'm testing this now. Did you make sure to make the the -p change to the following plist:

/System/Library/LaunchDaemons/com.apple.taskgated.plist

Yes, just checked again. IIRC it wouldn't even attach to the process without the p.

comment:5 Changed 10 years ago by stuartwesterman (Stuart Westerman)

So what are you doing differently than me? Backtrace has worked fine in my simple testing. I need to understand more about your setup.

You're running code that you compiled in Mavericks with gcc48, which then ran fine on Mavericks, but now when you run the same code on Yosemite it segfaults? You then recompiled the code on Yosemite with debugging enabled? You then tried to bt the segfault in gdb?

Show me your source code. Show me your versions of gcc and gdb. Prove to me that you're using gcc48 and gdb 7.7.1.

Last edited 10 years ago by stuartwesterman (Stuart Westerman) (previous) (diff)

comment:6 Changed 10 years ago by trac-1948@…

It's fixed now, it seems that gdb not working was a side-effect of the compiler being broken, which was fixed independently (and also fixed the segfault that I was hunting down in the first place).

comment:7 Changed 10 years ago by stuartwesterman (Stuart Westerman)

Excellent! Please mark this ticket as closed.

comment:8 Changed 10 years ago by trac-1948@…

How? Under "Modify Ticket" and "Action" there's "leave as new" and I can't seem to be able to change it.

comment:9 Changed 10 years ago by neverpanic (Clemens Lang)

Resolution: worksforme
Status: newclosed

You cannot, but MacPorts developers can. I closed the ticket for you.

Note: See TracTickets for help on using tickets.