Watchpoint segfaults

Daniel Jacobowitz drow@false.org
Fri Dec 9 19:58:00 GMT 2005


This is just a brain dump; I was going to fix this today, but it was only
tangential to the patch I was working on, and it turned out to be a real
rathole.

There are lots of ways to make gdb segfault with watchpoints.  Here's one of
the easiest to reproduce:

  file ./gdb
  watch object_files
  file
  info break

b->exp will be NULL because re-parsing the expression failed in
breakpoint_re_set_one.  When we go to print the expression we crash.
I think we want to temporarily disable breakpoints whose expression can't be
parsed, and print it as a string rather than using the expression printer.

A frequent cause of this in my debugging sessions is "watch *$33" followed
by something that rereads the symbol table; as Andrew S. noticed, that
clears the history.  Alternative to his patch coming right up which prevents
that particular case, by not clearing the history.

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Gdb mailing list