Search code examples
debugginggccgdb

GDB: How to print the current line or find the current line number?


The list command prints a set of lines, but I need one single line: where I currently am and where an error has probably occurred.


Solution

  • I do get the same information while debugging. Though not while I am checking the stacktrace. Most probably you would have used the optimization flag I think. Check this link - something related.

    Try compiling with -g3 remove any optimization flag. Then it might work. HTH!