Search code examples
cdebugginggdb

layout next shows [ No Source Available ]


I can't understand why 'layout next' has stopped showing code. It worked for some time and i was happy with 'layout next' option but now i constantly see the error. Awkwardly enough i could find only one question relating that topic which doesn't seem to solve the problem. Any ideas how to bring this function back?

Maybe i should find some compilation flag to enable this?

EDIT:

Make sure you add -g flag on compilation and type run after 'layout next' window have appeared.


Solution

  • No Source Available

    The error means literally that: GDB doesn't know where the source for the current program location is.

    There are several possible reasons:

    • you have not started the program yet
    • you built your program without debugging info (without -g flag)
    • you are stopped inside a system library
    • you moved the source to a different location after the program was built