Using gdb on mac os x 10.7

2,743 views
Skip to first unread message

gauravk

unread,
Oct 28, 2011, 7:38:43 PM10/28/11
to golang-nuts
Hi All,

I am trying to follow the tutorial http://golang.org/doc/debugging_with_gdb.html.
But I ran in to this error.

ggarg:regexp gaurav$ gdb 6.out -d $GOROOT
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:50:06
UTC 2011)
Copyright 2004 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 "x86_64-apple-darwin"...Reading symbols for
shared libraries . done
Dwarf Error: wrong version in compilation unit header (is 3, should be
2) [in module /Users/gaurav/apps/go/src/pkg/regexp/6.out]


I understand it is not golang issue. It is an old debugger on my
system which came with Xcode. I wanted to know can I simply install a
new version of gdb with out messing with Xcode settings?

Thank you very much.

Francisco Souza

unread,
Oct 28, 2011, 8:22:58 PM10/28/11
to gauravk, golang-nuts
On Fri, Oct 28, 2011 at 9:38 PM, gauravk <gaurav...@gmail.com> wrote:
Hi All,

[...]


 I understand it is not golang issue. It is an old debugger on my
system which came with Xcode. I wanted to know can I simply install a
new version of gdb with out messing with Xcode settings?

Did you try download and compile it? 

$ tar -xzf gdb-3.7.1.tar.gz
$ cd gdb-7.3.1
$ ./configure
$ make
$ [sudo] make install 

-- 
Francisco Souza

gauravk

unread,
Oct 28, 2011, 9:33:22 PM10/28/11
to golang-nuts
Awesome. The new gdb got installed as: /usr/local/bin/gdb. Now it
works fine.
Thanks
>
> Did you try download and compile it?
>
> $ curl -Ohttp://ftp.gnu.org/gnu/gdb/gdb-7.3.1.tar.gz

Joseph Poirier

unread,
Oct 28, 2011, 8:32:33 PM10/28/11
to gauravk, golang-nuts

I ran into this a while back http://tinyurl.com/5vxljc7 and had
similar concerns.

You don't have to install gdb to run it. Just build it, copy the
executable wherever you want it, then run it with an absolute path (I
kept the destination folder out of my search path).

- $ mkdir $HOME/gdb
- after gdb finishes building $ cp gdb/gdb $HOME/gdb/gdb
- then from the go executable's folder $ $HOME/gdb/gdb 6.out

Once I figured out the newer version wouldn't cause a problem I
installed it in /usr/bin

-joe

gauravk

unread,
Oct 29, 2011, 9:34:02 AM10/29/11
to golang-nuts


Yes I also use absolute path of gdb 7.3.1 default gdb still points to
old xcode ones.

-Thanks
>
> I ran into this a while backhttp://tinyurl.com/5vxljc7and had

Francisco Souza

unread,
Oct 29, 2011, 11:06:05 AM10/29/11
to gauravk, golang-nuts
On Sat, Oct 29, 2011 at 11:34 AM, gauravk <gaurav...@gmail.com> wrote:


Yes I also use absolute path of gdb 7.3.1 default gdb still points to
old xcode ones.

I put /usr/local/bin before /usr/bin, so I can just remove the gdb from /usr/local/bin to go back to the gdb executable provided by xcode.

--
Francisco Souza

Reply all
Reply to author
Forward
0 new messages