summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-09-14 09:42:06 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-09-14 09:42:06 -0400
commitab934a4f4244b011d3266cd1c9d0d19978c31443 (patch)
tree06ed5833c98af1cfec245c80cd26c521f3df5470
parentf85108d092ff7e12f30a8fd8153642977a878774 (diff)
downloadmongo-ab934a4f4244b011d3266cd1c9d0d19978c31443.tar.gz
Add a debug routine to print out an address, it helps with salvage
debugging.
-rw-r--r--dist/s_funcs.list1
-rw-r--r--src/btree/bt_debug.c18
-rw-r--r--src/include/extern.h3
3 files changed, 22 insertions, 0 deletions
diff --git a/dist/s_funcs.list b/dist/s_funcs.list
index bf1d5156820..2bc87233084 100644
--- a/dist/s_funcs.list
+++ b/dist/s_funcs.list
@@ -14,6 +14,7 @@ __wt_cache_dump
__wt_config_getone
__wt_cursor_get_raw_value
__wt_debug_addr
+__wt_debug_addr_print
__wt_debug_offset
__wt_debug_set_verbose
__wt_debug_tree
diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c
index 84c4565eafe..5412286621e 100644
--- a/src/btree/bt_debug.c
+++ b/src/btree/bt_debug.c
@@ -195,6 +195,24 @@ __dmsg(WT_DBG *ds, const char *fmt, ...)
}
/*
+ * __wt_debug_addr_print --
+ * Print out an address.
+ */
+int
+__wt_debug_addr_print(
+ WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size)
+{
+ WT_DECL_ITEM(buf);
+
+ WT_RET(__wt_scr_alloc(session, 128, &buf));
+ fprintf(stderr, "%s\n",
+ __wt_addr_string(session, addr, addr_size, buf));
+ __wt_scr_free(&buf);
+
+ return (0);
+}
+
+/*
* __wt_debug_addr --
* Read and dump a disk page in debugging mode, using an addr/size pair.
*/
diff --git a/src/include/extern.h b/src/include/extern.h
index 9783de0a7a6..26321bcc909 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -277,6 +277,9 @@ extern int __wt_btcur_range_truncate(WT_CURSOR_BTREE *start,
WT_CURSOR_BTREE *stop);
extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt);
extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v);
+extern int __wt_debug_addr_print( WT_SESSION_IMPL *session,
+ const uint8_t *addr,
+ size_t addr_size);
extern int __wt_debug_addr(WT_SESSION_IMPL *session,
const uint8_t *addr,
size_t addr_size,