[dbg] Add missing commands to cache/era_debug

This commit is contained in:
Ming-Hung Tsai 2021-02-21 15:49:02 +08:00
parent 29f9182078
commit e8410dec04
2 changed files with 24 additions and 0 deletions

View File

@ -23,8 +23,10 @@
#include "dbg-lib/array_block_dumper.h" #include "dbg-lib/array_block_dumper.h"
#include "dbg-lib/btree_node_dumper.h" #include "dbg-lib/btree_node_dumper.h"
#include "dbg-lib/bitset_block_dumper.h"
#include "dbg-lib/command_interpreter.h" #include "dbg-lib/command_interpreter.h"
#include "dbg-lib/commands.h" #include "dbg-lib/commands.h"
#include "dbg-lib/index_block_dumper.h"
#include "dbg-lib/output_formatter.h" #include "dbg-lib/output_formatter.h"
#include "dbg-lib/sm_show_traits.h" #include "dbg-lib/sm_show_traits.h"
#include "persistent-data/file_utils.h" #include "persistent-data/file_utils.h"
@ -46,6 +48,8 @@ namespace {
out << "Commands:" << endl out << "Commands:" << endl
<< " superblock [block#]" << endl << " superblock [block#]" << endl
<< " block_node <block# of array block-tree node>" << endl << " block_node <block# of array block-tree node>" << endl
<< " bitset_block <block# of bitset block>" << endl
<< " index_block <block# of metadata space map root>" << endl
<< " mapping_block <block# of mappings array block>" << endl << " mapping_block <block# of mappings array block>" << endl
<< " exit" << endl; << " exit" << endl;
} }
@ -141,6 +145,16 @@ namespace {
return create_block_handler(bm, create_array_block_dumper<ShowTraits>(rc)); return create_block_handler(bm, create_array_block_dumper<ShowTraits>(rc));
} }
dbg::command::ptr
create_bitset_block_handler(block_manager::ptr bm) {
return create_block_handler(bm, create_bitset_block_dumper());
}
dbg::command::ptr
create_index_block_handler(block_manager::ptr bm) {
return create_block_handler(bm, create_index_block_dumper());
}
int debug(string const &path) { int debug(string const &path) {
using dbg::command; using dbg::command;
@ -150,6 +164,8 @@ namespace {
interp->register_command("hello", create_hello_handler()); interp->register_command("hello", create_hello_handler());
interp->register_command("superblock", command::ptr(new show_superblock(bm))); interp->register_command("superblock", command::ptr(new show_superblock(bm)));
interp->register_command("block_node", create_btree_node_handler<uint64_show_traits>(bm)); interp->register_command("block_node", create_btree_node_handler<uint64_show_traits>(bm));
interp->register_command("bitset_block", create_bitset_block_handler(bm));
interp->register_command("index_block", create_index_block_handler(bm));
interp->register_command("mapping_block", create_array_block_handler<mapping_show_traits>(bm, interp->register_command("mapping_block", create_array_block_handler<mapping_show_traits>(bm,
mapping_traits::ref_counter())); mapping_traits::ref_counter()));
interp->register_command("help", command::ptr(new help)); interp->register_command("help", command::ptr(new help));

View File

@ -26,6 +26,7 @@
#include "dbg-lib/bitset_block_dumper.h" #include "dbg-lib/bitset_block_dumper.h"
#include "dbg-lib/command_interpreter.h" #include "dbg-lib/command_interpreter.h"
#include "dbg-lib/commands.h" #include "dbg-lib/commands.h"
#include "dbg-lib/index_block_dumper.h"
#include "dbg-lib/output_formatter.h" #include "dbg-lib/output_formatter.h"
#include "dbg-lib/sm_show_traits.h" #include "dbg-lib/sm_show_traits.h"
#include "persistent-data/file_utils.h" #include "persistent-data/file_utils.h"
@ -49,6 +50,7 @@ namespace {
<< " block_node <block# of array block-tree node>" << endl << " block_node <block# of array block-tree node>" << endl
<< " bitset_block <block# of bitset block>" << endl << " bitset_block <block# of bitset block>" << endl
<< " era_block <block# of era array block>" << endl << " era_block <block# of era array block>" << endl
<< " index_block <block# of metadata space map root>" << endl
<< " writeset_node <block# of writeset tree node>" << endl << " writeset_node <block# of writeset tree node>" << endl
<< " exit" << endl; << " exit" << endl;
} }
@ -143,6 +145,11 @@ namespace {
return create_block_handler(bm, create_bitset_block_dumper()); return create_block_handler(bm, create_bitset_block_dumper());
} }
dbg::command::ptr
create_index_block_handler(block_manager::ptr bm) {
return create_block_handler(bm, create_index_block_dumper());
}
int debug(string const &path) { int debug(string const &path) {
using dbg::command; using dbg::command;
@ -156,6 +163,7 @@ namespace {
interp->register_command("bitset_block", create_bitset_block_handler(bm)); interp->register_command("bitset_block", create_bitset_block_handler(bm));
interp->register_command("era_block", create_array_block_handler<uint32_show_traits>(bm, interp->register_command("era_block", create_array_block_handler<uint32_show_traits>(bm,
uint32_traits::ref_counter())); uint32_traits::ref_counter()));
interp->register_command("index_block", create_index_block_handler(bm));
interp->register_command("writeset_node", create_btree_node_handler<writeset_show_traits>(bm)); interp->register_command("writeset_node", create_btree_node_handler<writeset_show_traits>(bm));
interp->register_command("help", command::ptr(new help)); interp->register_command("help", command::ptr(new help));
interp->register_command("exit", create_exit_handler(interp)); interp->register_command("exit", create_exit_handler(interp));