diff options
author | emaste <emaste@FreeBSD.org> | 2010-09-22 19:41:01 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2010-09-22 19:41:01 +0000 |
commit | 1efa60231a30195287137b26cd7f9fb666f48677 (patch) | |
tree | 7b7577b3e25398fc70c8d20432adfc1cf6b7c9d5 | |
parent | 0a89cbc56c79b1d283917729ebf9e3e62af7d620 (diff) | |
download | FreeBSD-src-1efa60231a30195287137b26cd7f9fb666f48677.zip FreeBSD-src-1efa60231a30195287137b26cd7f9fb666f48677.tar.gz |
Move test for zero bufp or size before rseq and wseq calculation. This
avoids spinning in an infinite loop for some (possibly corrupt?) core
files at work.
-rw-r--r-- | gnu/usr.bin/gdb/kgdb/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/main.c b/gnu/usr.bin/gdb/kgdb/main.c index 3d94406..3110efa 100644 --- a/gnu/usr.bin/gdb/kgdb/main.c +++ b/gnu/usr.bin/gdb/kgdb/main.c @@ -222,11 +222,13 @@ kgdb_dmesg(void) return; bufp = kgdb_parse("msgbufp->msg_ptr"); size = (int)kgdb_parse("msgbufp->msg_size"); + if (bufp == 0 || size == 0) + return; rseq = (int)kgdb_parse("msgbufp->msg_rseq"); wseq = (int)kgdb_parse("msgbufp->msg_wseq"); rseq = MSGBUF_SEQ_TO_POS(size, rseq); wseq = MSGBUF_SEQ_TO_POS(size, wseq); - if (bufp == 0 || size == 0 || rseq == wseq) + if (rseq == wseq) return; printf("\nUnread portion of the kernel message buffer:\n"); |