diff --git a/help.c b/help.c index 5061c48..d0da9f8 100644 --- a/help.c +++ b/help.c @@ -5658,7 +5658,7 @@ NULL char *help_tree[] = { "tree", "display radix tree or red-black tree", -"-t [radix|rbtree] [-r offset] [-[s|S] struct[.member[,member]] -[x|d]]\n [-o offset] [-p] [-l] [-N] start", +"[-t [radix|rbtree]] [-r offset] [-[s|S] struct[.member[,member]]] -[x|d]\n [-o offset] [-l] [-p] [-N] start", " This command dumps the contents of a radix tree or a red-black tree.", " The arguments are as follows:\n", " -t type The type of tree to dump; the type string can be either ", @@ -5691,15 +5691,16 @@ char *help_tree[] = { " -S struct Similar to -s, but instead of parsing gdb output, member values", " are read directly from memory, so the command works much faster", " for 1-, 2-, 4-, and 8-byte members.", -" -x Override default output format with hexadecimal format.", -" -d Override default output format with decimal format.", +" -l For red-black trees, dump the tree sorted in linear order starting", +" with the leftmost node and progressing to the right. This option", +" does not apply to radix trees.", " -p Display the node's position information, showing the relationship", " between it and the root. For red-black trees, a position that", " indicates \"root/l/r\" means that the node is the right child", " of the left child of the root node. For radix trees, the height", " and slot index values are shown with respect to the root.", -" -l Dump the tree sorted in linear order starting with the leftmost", -" node and progressing to the right.", +" -x Override default output format with hexadecimal format.", +" -d Override default output format with decimal format.", " ", " The meaning of the \"start\" argument, which can be expressed either in", " hexadecimal format or symbolically, depends upon whether the -N option", diff --git a/tools.c b/tools.c index cd89471..1a83643 100644 --- a/tools.c +++ b/tools.c @@ -3946,6 +3946,10 @@ cmd_tree() break; + case 'l': + td->flags |= TREE_LINEAR_ORDER; + break; + case 'r': if (td->flags & TREE_ROOT_OFFSET_ENTERED) error(FATAL, @@ -3993,10 +3997,6 @@ cmd_tree() td->flags |= TREE_POSITION_DISPLAY; break; - case 'l': - td->flags |= TREE_LINEAR_ORDER; - break; - case 'N': td->flags |= TREE_NODE_POINTER; break; @@ -4023,12 +4023,15 @@ cmd_tree() if (argerrs) cmd_usage(pc->curcmd, SYNOPSIS); + if ((type_flag & RADIXTREE_REQUEST) && (td->flags & TREE_LINEAR_ORDER)) + error(FATAL, "-l option is not applicable to radix trees\n"); + if ((type_flag & RADIXTREE_REQUEST) && (td->flags & TREE_NODE_OFFSET_ENTERED)) error(FATAL, "-o option is not applicable to radix trees\n"); if ((td->flags & TREE_ROOT_OFFSET_ENTERED) && (td->flags & TREE_NODE_POINTER)) - error(INFO, "-r and -N options are mutually exclusive\n"); + error(FATAL, "-r and -N options are mutually exclusive\n"); if (!args[optind]) { error(INFO, "a starting address is required\n");