0

So I am trying to follow this tutorial to debug my code. I tell gdb to run an executable, and it does, and the program crashes, giving this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00007fff907b06e5 in std::string::_Rep::_M_dispose ()

But I don't see any of the handy at main.cc:28 stuff that the tutorial talks about.

So I continue on anyways and try backtrace, which gives me this:

(gdb) backtrace
#0  0x00007fff907b06e5 in std::string::_Rep::_M_dispose ()
#1  0x00007fff907b12ba in std::string::assign ()
#2  0x00000001000029e4 in Map::insert ()
#3  0x0000000100001ac5 in main ()

Still no handy line numbers? What should I be doing?

(If it matters, I am using Mac OS 10.7 and installed the default set of C++ tools with XCode)

1
  • 1
    read Preparations for that tutorial Commented Jan 23, 2012 at 7:43

1 Answer 1

2

You need to turn on additional debug information in your build. In gcc, you want the -g compiler switch.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.