From cd694fdbfab5b5b0fe200a1370d6756119ab0dd0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 20 Feb 2010 13:19:41 +0000 Subject: [PATCH] * Fixed abuse of the DoublyLinkedListLink. TemporaryVariables have an explicit queued field now. Fixes #5352. * set_debug_variable(): Disallow symbol variable names. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35534 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/debug_variables.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/debug/debug_variables.cpp b/src/system/kernel/debug/debug_variables.cpp index b774f41623..fe8c0dbc84 100644 --- a/src/system/kernel/debug/debug_variables.cpp +++ b/src/system/kernel/debug/debug_variables.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de * Distributed under the terms of the MIT License. */ @@ -51,6 +51,7 @@ struct Variable { struct TemporaryVariable : Variable, DoublyLinkedListLinkImpl { + bool queued; }; static Variable sVariables[kVariableCount]; @@ -84,9 +85,9 @@ static void 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 @@ touch_variable(Variable* _variable) // move to the end of the queue dequeue_temporary_variable(variable); sTemporaryVariablesLRUQueue.Add(variable); + variable->queued = true; } @@ -119,8 +121,10 @@ static Variable* free_temporary_variable_slot() { TemporaryVariable* variable = sTemporaryVariablesLRUQueue.RemoveHead(); - if (variable) + if (variable) { + variable->queued = false; variable->Uninit(); + } return variable; } @@ -260,6 +264,9 @@ is_debug_variable_defined(const char* variableName) 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;