Why can't I enter a function in gdb?

I wrote a simple test.ccas follows:

#include <iostream>
using namespace std;

int main()
{
  cout << "Hello world" << endl;
  return 0;
}

And I compiled with:

g++ -g test.cc -o test.o

I started gdband set a breakpoint on the line "Hello world":

$ gdb test.o
(gdb) b 7
(gdb) c

Then it gdbstops at the line "Hello world", but when I run

(gdb) s

He cannot enter the function cout. So my question is: how can I get into a function cout?

+3
source share
2 answers

If it was not associated with a version of the standard library with debugging information, it does not know how to enter the library; it can only step over it (i.e., run until control returns to the code with debugging information).

, , C ++.

+6

, . . .

, , , disas.

+1

All Articles