Tag Info

New answers tagged


The GCC documentation explains this: GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values ...


You don't need to use stop to make the program stop when the variable changes. Just watch test_v is enough. stop command is not for stopping the program, but only meant to be hooked so you can execute some commands automatically when the program stops. Example usage from the gdb manual: define hook-stop handle SIGALRM nopass end define hook-run handle ...

Top 50 recent answers are included