Use hung thread stack for watchdog panics.

With this change the crash reporter tries to determine if the last stack
dump in the log file is from the hung thread watchdog, and in that case
creates a crash signature that's based on the previous stack dump.

When the previous stack is used because the watchdog function was detected,
prepend "(HANG)" to the function name or kernel message in the signature.

Also use an earlier stack signature if all functions in the last one are
uncertain.  This happens in many cases (about 1/2).  It's likely a
bug in the kernel but until we fix it this workaround will be helpful.

I tested this manually with the --generate_kernel_signature flag and
with the provided unit test.  I also added two unit tests for the two
new cases.  Finally, I tried to run the KernelCrashServer autotests,
but it doesn't run correctly in developer mode, even before my change.

BUG=chromium-os:24632
TEST=manually tested, unit tested, and autotested.  No further tests required.

Change-Id: Ib65177b06c207675cb7f6e33f1df8fa79dde6090
Reviewed-on: https://gerrit.chromium.org/gerrit/13541
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
3 files changed
tree: 0aaed12afcd9106c1ddb8a3043ce632711e1cd52
  1. crash_reporter/