Opened 8 years ago

Closed 8 years ago

#17176 closed defect (fixed)

Gdb on Yosemite

Reported by: vbraun Owned by:
Priority: major Milestone: sage-6.4
Component: packages: optional Keywords: yosemite
Cc: ohanar Merged in:
Authors: Volker Braun Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: c2ff01b (Commits, GitHub, GitLab) Commit: c2ff01b24aa9bc150498acbb370af5fdcae347d0
Dependencies: Stopgaps:

Status badges

Change History (14)

comment:1 Changed 8 years ago by vbraun

Authors: Volker Braun
Component: PLEASE CHANGEpackages: optional
Description: modified (diff)
Keywords: yosemite added
Type: PLEASE CHANGEdefect

comment:2 Changed 8 years ago by vbraun

Description: modified (diff)

comment:3 Changed 8 years ago by vbraun

Branch: u/vbraun/gdb_on_yosemite

comment:4 Changed 8 years ago by vbraun

Commit: c2ff01b24aa9bc150498acbb370af5fdcae347d0

Aaand codesign doesn't work, can only run gdb as root.


New commits:

c2ff01bAdjust header location for setjmp

comment:5 Changed 8 years ago by vbraun

Description: modified (diff)
Status: newneeds_review

comment:6 Changed 8 years ago by vbraun

Tried the following to be able to use gdb:

  • Made a gdbc certificate (can only be done in the GUI, wtf): http://blog.panks.me/posts/2013/11/install-gdb-on-os-x-mavericks-from-source/
  • Sign: codesign -fs gdbc ./gdb/gdb
  • Put the gdb binary in the procmod group and make it chgrp
    $ ls -al gdb
    -rwxrwsr-x  1 vbraun  procmod  6717344 Oct 19 12:31 gdb
    
  • Add myself to the groups admin, _developer, procmod, procview:
    dscl . append /Groups/procmod GroupMembership vbraun
    
  • Rebooted

Still can't run without root:

$ ./gdb ~/Sage/local/bin/patch 
....
Starting program: /Users/vbraun/Sage/local/bin/patch 
Unable to find Mach task port for process-id 476: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

More info:

$ codesign -d --verbose gdb
Executable=/Users/vbraun/Code/gdb-7.8/gdb/gdb
Identifier=org.gnu.gdb
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=32700 flags=0x0(none) hashes=1630+2 location=embedded
Signature size=1237
Signed Time=Oct 19, 2014, 12:31:26 PM
Info.plist entries=4
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=2 size=448

comment:7 Changed 8 years ago by vbraun

Cc: ohanar added

Of course if you run gdb as root (e.g. suid rood) then it will erase DYLD_LIBRARY_PATH from the environment. This is generally good idea for a suid binary, but really crappy if you want to debug Sage.

comment:8 Changed 8 years ago by jhpalmieri

This seems to work on an OSX 10.9 machine. I actually see both files /usr/include/setjmp.h and /usr/include/machine/setjmp.h, and they differ: the second one basically just contains these lines:

#ifndef	_MACHINE_SETJMP_H_
#define	_MACHINE_SETJMP_H_

#include <setjmp.h>

#endif	/* _MACHINE_SETJMP_H_ */

Is it an issue to not use that one? I also don't have access to earlier versions of OS X to test there.

comment:9 Changed 8 years ago by vbraun

Interesting, but the latter is probably left-over from an earlier SDK. I removed all files and reinstalled the CLT and got:

$ ls /usr/include/machine/setjmp.h 
ls: /usr/include/machine/setjmp.h: No such file or directory

comment:10 Changed 8 years ago by vbraun

Oh you said 10.9. Thats probably what it was, then.

In any case /usr/include/setjmp.h is the standard location (or anything directly in the system include path). There was probably some old Apple SDK that didn't do that right, which prompted gdb to include setjmp.h it from a somewhat weird place.

comment:11 Changed 8 years ago by vbraun

Anybody care to review this? Without gdb its hard to debug stuff on OSX

comment:12 Changed 8 years ago by jhpalmieri

It worked for me before on OS X 10.9, and it works for me now on OS X 10.10. I have no way of testing earlier versions of OS X.

Is this good enough for a positive review, given that it's an optional package?

comment:13 Changed 8 years ago by vbraun

Reviewers: John Palmieri
Status: needs_reviewpositive_review

IMHO thats enough

comment:14 Changed 8 years ago by vbraun

Branch: u/vbraun/gdb_on_yosemitec2ff01b24aa9bc150498acbb370af5fdcae347d0
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.