Skip to content

Commit

Permalink
Mavericks gdb fix (picks lldb)
Browse files Browse the repository at this point in the history
Mavericks no longer includes gdb with the Xcode tools. Running “nuke
gdb” will now choose the correct debugger, either gdb or lldb.
  • Loading branch information
tjklemz committed Feb 15, 2014
1 parent 2b72b1b commit 030c15d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/nuke
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
(exit result))
result)

(function command-exists (cmd)
(not (system "command -v #{cmd} >/dev/null 2>&1")))

(macro ifDarwin (*body) `(if (eq (uname) "Darwin") ,@*body))
(macro ifLinux (*body) `(if (eq (uname) "Linux") ,@*body))
(macro ifFreeBSD (*body) `(if (eq (uname) "FreeBSD") ,@*body))
Expand Down Expand Up @@ -283,6 +286,9 @@
;; default to gcc
(if clang clang (else "gcc")))

(function select-debugger ()
(if (command-exists "lldb") "lldb" (else "gdb")))

;; use this to create all the compilation tasks for the files in the @c_files and @m_files collections
(macro compilation-tasks ()
`(progn
Expand Down Expand Up @@ -493,7 +499,7 @@
(SH "'#{@application_dir}/Contents/MacOS/#{@application}'"))

(task "gdb" => "application" is
(SH "gdb '#{@application_dir}/Contents/MacOS/#{@application}'"))
(SH "#{(select-debugger)} '#{@application_dir}/Contents/MacOS/#{@application}'"))

(task "clobber" => "clean" is
(system "rm -rf '#{@application_dir}'"))
Expand Down Expand Up @@ -539,7 +545,7 @@
(SH @tool))

(task "gdb" => "tool" is
(SH "gdb '#{@tool}'"))
(SH "#{(select-debugger)} '#{@tool}'"))

(task "clobber" => "clean" is
(system "rm -rf '#{@tool}'"))))
Expand Down

0 comments on commit 030c15d

Please sign in to comment.