aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2012-11-01 04:07:08 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2012-11-01 04:07:08 +0000
commit21d748a9573ee91dc2434ffd2688e4ea25fb5f06 (patch)
treee88b6b96e5a2b38ee55f4ff5bce4bacc8dbd543c /sys
parent72a4047ca70a8a4f9e35e7eb596dd95f6a3139fe (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/NOTES10
-rw-r--r--sys/conf/options2
-rw-r--r--sys/ddb/db_command.c5
-rw-r--r--sys/ddb/db_textdump.c29
4 files changed, 40 insertions, 6 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 19fa20bc5b51..2fba6649149f 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -389,6 +389,16 @@ options GDB
options SYSCTL_DEBUG
#
+# Enable textdump by default, this disables kernel core dumps.
+#
+options TEXTDUMP_PREFERRED
+
+#
+# Enable extra debug messages while performing textdumps.
+#
+options TEXTDUMP_VERBOSE
+
+#
# NO_SYSCTL_DESCR omits the sysctl node descriptions to save space in the
# resulting kernel.
options NO_SYSCTL_DESCR
diff --git a/sys/conf/options b/sys/conf/options
index 69a6eface5c3..574d2e2bdec1 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -61,6 +61,8 @@ KDB_TRACE opt_kdb.h
KDB_UNATTENDED opt_kdb.h
KLD_DEBUG opt_kld.h
SYSCTL_DEBUG opt_sysctl.h
+TEXTDUMP_PREFERRED opt_ddb.h
+TEXTDUMP_VERBOSE opt_ddb.h
# Miscellaneous options.
ADAPTIVE_LOCKMGRS
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index e0f14b9c1a85..cc4bde913d6a 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -535,6 +535,11 @@ db_dump(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4)
{
int error;
+ if (textdump_pending) {
+ db_printf("textdump_pending set.\n"
+ "run \"textdump unset\" first or \"textdump dump\" for a textdump.\n");
+ return;
+ }
error = doadump(FALSE);
if (error) {
db_printf("Cannot dump: ");
diff --git a/sys/ddb/db_textdump.c b/sys/ddb/db_textdump.c
index 8e78fbf2101e..e66487024040 100644
--- a/sys/ddb/db_textdump.c
+++ b/sys/ddb/db_textdump.c
@@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$");
#include "opt_config.h"
+#include "opt_ddb.h"
+
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/kernel.h>
@@ -118,7 +120,11 @@ CTASSERT(sizeof(struct ustar_header) == TEXTDUMP_BLOCKSIZE);
* Is a textdump scheduled? If so, the shutdown code will invoke our dumpsys
* routine instead of the machine-dependent kernel dump routine.
*/
-int textdump_pending;
+#ifdef TEXTDUMP_PREFERRED
+int textdump_pending = 1;
+#else
+int textdump_pending = 0;
+#endif
SYSCTL_INT(_debug_ddb_textdump, OID_AUTO, pending, CTLFLAG_RW,
&textdump_pending, 0,
"Perform textdump instead of regular kernel dump.");
@@ -201,6 +207,10 @@ textdump_mkustar(char *block_buffer, const char *filename, u_int size)
{
struct ustar_header *uhp;
+#ifdef TEXTDUMP_VERBOSE
+ if (textdump_error == 0)
+ printf("textdump: creating '%s'.\n", filename);
+#endif
uhp = (struct ustar_header *)block_buffer;
bzero(uhp, sizeof(*uhp));
strlcpy(uhp->uh_filename, filename, sizeof(uhp->uh_filename));
@@ -237,6 +247,9 @@ textdump_writeblock(struct dumperinfo *di, off_t offset, char *buffer)
return (ENOSPC);
textdump_error = dump_write(di, buffer, 0, offset + di->mediaoffset,
TEXTDUMP_BLOCKSIZE);
+ if (textdump_error)
+ printf("textdump_writeblock: offset %jd, error %d\n", (intmax_t)offset,
+ textdump_error);
return (textdump_error);
}
@@ -430,7 +443,7 @@ textdump_dumpsys(struct dumperinfo *di)
* of data.
*/
if (di->mediasize < SIZEOF_METADATA + 2 * sizeof(kdh)) {
- printf("Insufficient space on dump partition.\n");
+ printf("Insufficient space on dump partition for minimal textdump.\n");
return;
}
textdump_error = 0;
@@ -480,9 +493,9 @@ textdump_dumpsys(struct dumperinfo *di)
if (textdump_error == 0)
(void)dump_write(di, NULL, 0, 0, 0);
if (textdump_error == ENOSPC)
- printf("Insufficient space on dump partition\n");
+ printf("Textdump: Insufficient space on dump partition\n");
else if (textdump_error != 0)
- printf("Error %d writing dump\n", textdump_error);
+ printf("Textdump: Error %d writing dump\n", textdump_error);
else
printf("Textdump complete.\n");
textdump_pending = 0;
@@ -499,7 +512,7 @@ static void
db_textdump_usage(void)
{
- db_printf("textdump [unset|set|status]\n");
+ db_printf("textdump [unset|set|status|dump]\n");
}
void
@@ -528,6 +541,10 @@ db_textdump_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
} else if (strcmp(db_tok_string, "unset") == 0) {
textdump_pending = 0;
db_printf("textdump unset\n");
- } else
+ } else if (strcmp(db_tok_string, "dump") == 0) {
+ textdump_pending = 1;
+ doadump(TRUE);
+ } else {
db_textdump_usage();
+ }
}