This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

watchpoints and threads


The manual states:

     _Warning:_ In multi-thread programs, watchpoints have only limited
     usefulness.  With the current watchpoint implementation, GDB can
     only watch the value of an expression _in a single thread_.  If
     you are confident that the expression can only change due to the
     current thread's activity (and if you are also confident that no
     other thread can become current), then you can use watchpoints as
     usual.  However, GDB may not notice when a non-current thread's
     activity changes the expression.

Yet the test testsuite/gdb.threads/watchthreads.exp contains the
following:

        # Verify that we hit first watchpoint in child thread.
        set message "watchpoint on args\[0\] hit in thread"
        if { $args_1 > 1 } {
          pass $message
        } else {
          fail $message
        }
        
This seems like a conflict.

What brought this up is a user who wants this scenario to work:

        * The target program has a global variable.
        * GDB is started and a 'watch' command is give for that
        variable.
        * Some number of threads are started.
        * If _any_ thread changes the value of the global variable,
        _all_ threads stop.
        
The manual seems to say that this scenario will not work, but the
testcase seems to say that it will.

What's the story?

-=# Paul #=-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]