Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: hefeweizen <horacio.sanchez@kit.edu>
To: gdb@sourceware.org
Subject: gdb can not debug “hello world” in mac os x
Date: Tue, 08 Mar 2011 15:54:00 -0000	[thread overview]
Message-ID: <31098392.post@talk.nabble.com> (raw)


Hi, I have the following smal C++ program

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    puts("!!!Hello World!!!");
    return EXIT_SUCCESS;
}

I compile in Mac OS X Leopard last release using:

g++ -g hello.cpp -o hello.exe

being g++:

host:bin macbook$ g++ --ver
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking
-enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=i686-apple-darwin9 --with-arch=apple --with-tune=generic
--host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)

then I try to debug this program using fsf-gdb 7.1:

fsf-gdb hello.exe

put a breakpoint in main:

(gdb) b main
Breakpoint 1 at 0x1f8f: file hello.cpp, line 5.

run the program:

(gdb) r
Starting program:
/Users/horacio/work/software/gdb/gdb-7.2-inst/bin/hello.exe 

Breakpoint 1, main () at hello.cpp:5
5       puts("!!!Hello World!!!");

and try to step, and this happens:

(gdb) n
0x00003045 in ?? ()

This is the output if I do the same under Ubuntu Linux:

(gdb) n
!!!Hello World!!!
6       return EXIT_SUCCESS;

where gcc=7.1 and gcc 4.3.4

What is the problem ???? I honestly do not understand why this does not work
in mac os x.

Maybe the problem is the gdb version used in mac or the gcc version in mac.
Which other alternatives exist for gdb in mac?

Thanks in advance

-- 
View this message in context: http://old.nabble.com/gdb-can-not-debug-%E2%80%9Chello-world%E2%80%9D-in-mac-os-x-tp31098392p31098392.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


             reply	other threads:[~2011-03-08 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 15:54 hefeweizen [this message]
2011-03-08 16:02 ` Tristan Gingold
2011-03-08 16:12   ` hefeweizen
2011-03-08 16:23     ` André Pönitz
2011-05-08  8:52 ` Paul Pluzhnikov
     [not found] <1299599657.19674.ezmlm@sourceware.org>
2011-03-08 16:29 ` Peter Watkins
2011-03-08 16:46   ` hefeweizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31098392.post@talk.nabble.com \
    --to=horacio.sanchez@kit.edu \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox