Author: bonefish Date: 2010-02-20 14:19:41 +0100 (Sat, 20 Feb 2010) New Revision: 35534 Changeset: http://dev.haiku-os.org/changeset/35534/haiku Ticket: http://dev.haiku-os.org/ticket/5352 Modified: haiku/trunk/src/system/kernel/debug/debug_variables.cpp Log: * Fixed abuse of the DoublyLinkedListLink. TemporaryVariables have an explicit queued field now. Fixes #5352. * set_debug_variable(): Disallow symbol variable names. Modified: haiku/trunk/src/system/kernel/debug/debug_variables.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_variables.cpp 2010-02-20 12:37:48 UTC (rev 35533) +++ haiku/trunk/src/system/kernel/debug/debug_variables.cpp 2010-02-20 13:19:41 UTC (rev 35534) @@ -1,5 +1,5 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@xxxxxx + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@xxxxxx * Distributed under the terms of the MIT License. */ @@ -51,6 +51,7 @@ struct TemporaryVariable : Variable, DoublyLinkedListLinkImpl<TemporaryVariable> { + bool queued; }; static Variable sVariables[kVariableCount]; @@ -84,9 +85,9 @@ dequeue_temporary_variable(TemporaryVariable* variable) { // dequeue if queued - if (variable->GetDoublyLinkedListLink()->previous != NULL - || sTemporaryVariablesLRUQueue.Head() == variable) { + if (variable->queued) { sTemporaryVariablesLRUQueue.Remove(variable); + variable->queued = false; } } @@ -112,6 +113,7 @@ // move to the end of the queue dequeue_temporary_variable(variable); sTemporaryVariablesLRUQueue.Add(variable); + variable->queued = true; } @@ -119,8 +121,10 @@ free_temporary_variable_slot() { TemporaryVariable* variable = sTemporaryVariablesLRUQueue.RemoveHead(); - if (variable) + if (variable) { + variable->queued = false; variable->Uninit(); + } return variable; } @@ -260,6 +264,9 @@ bool set_debug_variable(const char* variableName, uint64 value) { + if (is_symbol_variable(variableName)) + return false; + if (is_arch_specific_variable(variableName)) return arch_set_debug_variable(variableName + 1, value) == B_OK;