From 1b629877b1ee4c31f8d4eaed00d253abccd087f5 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 27 Oct 2014 11:51:00 -0400 Subject: [PATCH] Debugger: Cleanups. - Remove dependency on MAPM/ExpressionParser. Consequently also adjust CliDumpMemoryCommand, InspectorWindow and WatchPromptWindow to use CLanguageExpressionEvaluator for address input evaluation. --- src/apps/debugger/Jamfile | 3 --- .../cli/commands/CliDumpMemoryCommand.cpp | 12 ++++++------ .../gui/inspector_window/InspectorWindow.cpp | 12 +++++++----- .../gui/team_window/WatchPromptWindow.cpp | 17 ++++++++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 3c730066d9..9b3c91a56b 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -6,7 +6,6 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; UseHeaders [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) system kernel ] ; -UseLibraryHeaders mapm ; UsePrivateHeaders app debug interface kernel package shared libroot ; UsePrivateSystemHeaders ; @@ -358,8 +357,6 @@ Application Debugger : debug_utils.a libcolumnlistview.a libshared.a - libexpression_parser.a - libmapm.a libedit.a libncurses.a diff --git a/src/apps/debugger/user_interface/cli/commands/CliDumpMemoryCommand.cpp b/src/apps/debugger/user_interface/cli/commands/CliDumpMemoryCommand.cpp index 50899f1f16..e18fcf2fc5 100644 --- a/src/apps/debugger/user_interface/cli/commands/CliDumpMemoryCommand.cpp +++ b/src/apps/debugger/user_interface/cli/commands/CliDumpMemoryCommand.cpp @@ -1,7 +1,7 @@ /* * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -15,9 +15,10 @@ #include #include -#include +#include "CLanguageExpressionEvaluator.h" #include "CliContext.h" +#include "Number.h" #include "Team.h" #include "TeamMemoryBlock.h" #include "UiUtils.h" @@ -42,12 +43,11 @@ CliDumpMemoryCommand::Execute(int argc, const char* const* argv, return; } + CLanguageExpressionEvaluator evaluator; target_addr_t address; - ExpressionParser parser; - parser.SetSupportHexInput(true); - try { - address = parser.EvaluateToInt64(argv[1]); + Number value = evaluator.Evaluate(argv[1], B_UINT64_TYPE); + address = value.GetValue().ToUInt64(); } catch(...) { printf("Error parsing address/expression.\n"); return; diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp index b64e804fb0..3c29e44720 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp @@ -16,12 +16,12 @@ #include #include -#include - #include "Architecture.h" +#include "CLanguageExpressionEvaluator.h" #include "GuiTeamUiSettings.h" #include "MemoryView.h" #include "MessageCodes.h" +#include "Number.h" #include "Team.h" #include "UserInterface.h" @@ -199,12 +199,14 @@ InspectorWindow::MessageReceived(BMessage* message) target_addr_t address = 0; bool addressValid = false; if (message->FindUInt64("address", &address) != B_OK) { - ExpressionParser parser; - parser.SetSupportHexInput(true); + CLanguageExpressionEvaluator evaluator; const char* addressExpression = fAddressInput->Text(); BString errorMessage; try { - address = parser.EvaluateToInt64(addressExpression); + Number value; + value = evaluator.Evaluate(addressExpression, + B_INT64_TYPE); + address = value.GetValue().ToUInt64(); } catch(ParseException parseError) { errorMessage.SetToFormat("Failed to parse address: %s", parseError.message.String()); diff --git a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp index 4bef8b2258..bdeffcfd25 100644 --- a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #include "WatchPromptWindow.h" @@ -13,10 +13,10 @@ #include #include -#include - #include "Architecture.h" +#include "CLanguageExpressionEvaluator.h" #include "MessageCodes.h" +#include "Number.h" #include "UserInterface.h" #include "Watchpoint.h" @@ -143,12 +143,15 @@ WatchPromptWindow::MessageReceived(BMessage* message) { target_addr_t address = 0; int32 length = 0; - ExpressionParser parser; - parser.SetSupportHexInput(true); + CLanguageExpressionEvaluator evaluator; BString errorMessage; try { - address = parser.EvaluateToInt64(fAddressInput->Text()); - length = (int32)parser.EvaluateToInt64(fLengthInput->Text()); + Number value = evaluator.Evaluate(fAddressInput->Text(), + B_UINT64_TYPE); + address = value.GetValue().ToUInt64(); + value = evaluator.Evaluate(fLengthInput->Text(), + B_INT32_TYPE); + length = value.GetValue().ToInt32(); } catch(ParseException parseError) { errorMessage.SetToFormat("Failed to parse data: %s", parseError.message.String());