Added usage message to "cvar" and "cvars" debugger commands and define

temporary variables.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23596 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-01-17 23:22:29 +00:00
parent 5aee691ed8
commit bd0689e668
2 changed files with 23 additions and 15 deletions
+2 -2
View File
@@ -73,8 +73,8 @@ class PrivateConditionVariable
: protected HashTableLink<PrivateConditionVariable> { : protected HashTableLink<PrivateConditionVariable> {
public: public:
static void ListAll(); static void ListAll();
void Dump(); void Dump() const;
const void* Object() const { return fObject; }
protected: protected:
void Publish(const void* object, void Publish(const void* object,
const char* objectType); const char* objectType);
+21 -13
View File
@@ -51,15 +51,13 @@ list_condition_variables(int argc, char** argv)
static int static int
dump_condition_variable(int argc, char** argv) dump_condition_variable(int argc, char** argv)
{ {
if (argc < 2 || strlen(argv[1]) < 2 if (argc != 2) {
|| argv[1][0] != '0' print_debugger_command_usage(argv[0]);
|| argv[1][1] != 'x') {
kprintf("%s: invalid argument, pass address\n", argv[0]);
return 0; return 0;
} }
addr_t address = strtoul(argv[1], NULL, 0); addr_t address = parse_expression(argv[1]);
if (address == NULL) if (address == 0)
return 0; return 0;
PrivateConditionVariable* variable = sConditionVariableHash.Lookup( PrivateConditionVariable* variable = sConditionVariableHash.Lookup(
@@ -77,9 +75,13 @@ dump_condition_variable(int argc, char** argv)
} }
} }
if (variable != NULL) if (variable != NULL) {
variable->Dump(); variable->Dump();
else
set_debug_variable("_cvar", (addr_t)variable);
set_debug_variable("_object", (addr_t)variable->Object());
} else
kprintf("no condition variable at or with key %p\n", (void*)address); kprintf("no condition variable at or with key %p\n", (void*)address);
return 0; return 0;
@@ -250,7 +252,7 @@ PrivateConditionVariable::ListAll()
void void
PrivateConditionVariable::Dump() PrivateConditionVariable::Dump() const
{ {
kprintf("condition variable %p\n", this); kprintf("condition variable %p\n", this);
kprintf(" object: %p (%s)\n", fObject, fObjectType); kprintf(" object: %p (%s)\n", fObject, fObjectType);
@@ -429,9 +431,15 @@ condition_variable_init()
strerror(error)); strerror(error));
} }
add_debugger_command("cvar", &dump_condition_variable, add_debugger_command_etc("cvar", &dump_condition_variable,
"Dump condition_variable"); "Dump condition variable info",
add_debugger_command("cvars", &list_condition_variables, "<address>\n"
"List condition variables"); "Prints info for the specified condition variable.\n"
" <address> - Address of the condition variable or the object it is\n"
" associated with.\n", 0);
add_debugger_command_etc("cvars", &list_condition_variables,
"List condition variables",
"\n"
"Lists all existing condition variables\n", 0);
} }