1

This is most likely an issue with g++/gdb/other, but an indirect issue within Emacs nonetheless.

Whilst debugging, I would like for Emacs to step into the standard library implementation of the overloaded << operator function called from object std::cout.
As is shown in the series of screenshots when the current source file (in the source file window) switches from main.cpp to funct.cpp when function funct() is called:

Screenshot 1
Just starting the debugging session. enter image description here

Screenshot 2
One step taken; thus changing the source file I'm looking at. enter image description here

Screenshot 3
One step taken; std::cout << "ok\n"; is completely stepped over; when I would like to be directed to another source file. enter image description here

The command I used to compile the files:
g++ -g -std=c++11 main.cpp funct.cpp

If someone could guide me through step-by-step of how they got this to work, that would be a great example to learn from; or if any more information is needed (whether it be the system I'm using, file-paths, etc.), please ask away.

2
  • There's nothing you can do with Emacs that will change how this works, since you're just asking Emacs to ask gdb to step. Try compiling your program with -Og -ggdb, to ensure that you have the maximum amount of debugging information available.
    – db48x
    Commented Sep 30, 2018 at 1:58
  • Yep! You're the man db48x! Feel free to post this as an answer to the question, so that I can accept it as the answer. Commented Sep 30, 2018 at 8:05

1 Answer 1

1

There's nothing you can do with Emacs that will change how this works, since you're just asking Emacs to ask gdb to step. Try compiling your program with -Og -ggdb, to ensure that you have the maximum amount of debugging information available.

And of course there are about a billion related options that you can use to control the amount of optimization the compiler does and the amount of debug information it includes. You should set aside a week to read through the gcc man page from top to bottom, so that you know them all. Have fun :)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.