Debugger: Rework expression parsing API.

Operating Systems / Haiku - Rene Gollent [gollent.com] - 22 November 2014 16:06 UTC

ExpressionInfo:- No longer stores an explicit result type (this is inferred from evaluation of the expression itself now).- Introduce class ExpressionResult for returning the result of an expression computation. This can currently take the form of either a primitive value, or a value node object.- Adjust UserInterfaceListener and ExpressionInfo::Listener to take the above changes into account, and correspondingly adjust all callers/listeners.

CLanguageExpressionEvaluator:- Introduce child class Operand. This subsumes the functionality that was previously in the separate Number class, and can represent a primitive value, a value node or a type. Also has functionality to implicity handle type promotion/inferring when performing calculations between operands.- Adjust expression parser to operate in terms of Operands rather than Numbers. This allows a number of improvements, most notably that an expression can now return a value node as a result rather than only a primitive number. This capability isn't yet fully used, but paves the way for future uses such as an expression that evaluates to a data member, a global variable, or an arbitrary pointer of a particular type.- Various cleanups/simplifications that were possible as a result of the above changes.

ExpressionEvaluationWindow/ExpressionPromptWindow:
- Remove type menu field, since the expression API no longer uses it.

Adding/removing expressions in the VariablesView is temporarily disabled, pending some further rework there to properly handle the new result object.

81c848a Debugger: Rework expression parsing API.
src/apps/debugger/Jamfile | 1 -
src/apps/debugger/controllers/ThreadHandler.cpp | 54 +-
src/apps/debugger/controllers/ThreadHandler.h | 7 +-
src/apps/debugger/jobs/ExpressionEvaluationJob.cpp | 5 +-
src/apps/debugger/jobs/Jobs.h | 5 +-
src/apps/debugger/model/ExpressionInfo.cpp | 118 +-
src/apps/debugger/model/ExpressionInfo.h | 53 +-
.../debugger/source_language/CLanguageFamily.cpp | 52 +-
.../debugger/source_language/CLanguageFamily.h | 5 +-
.../debugger/source_language/SourceLanguage.cpp | 2 +-
src/apps/debugger/source_language/SourceLanguage.h | 7 +-
.../CLanguageExpressionEvaluator.cpp | 1739 +++++++++++++++++---
.../CLanguageExpressionEvaluator.h | 24 +-
src/apps/debugger/types/Number.cpp | 1008 ------------
src/apps/debugger/types/Number.h | 58 -
.../debugger/user_interface/cli/CliContext.cpp | 11 +-
src/apps/debugger/user_interface/cli/CliContext.h | 6 +-
.../cli/commands/CliDumpMemoryCommand.cpp | 38 +-
.../gui/inspector_window/InspectorWindow.cpp | 35 +-
.../gui/inspector_window/InspectorWindow.h | 2 +-
.../gui/team_window/ExpressionEvaluationWindow.cpp | 108 +-
.../gui/team_window/ExpressionEvaluationWindow.h | 9 +-
.../gui/team_window/ExpressionPromptWindow.cpp | 59 +-
.../gui/team_window/ExpressionPromptWindow.h | 6 -
.../user_interface/gui/team_window/TeamWindow.cpp | 3 -
.../gui/team_window/VariablesView.cpp | 37 +-
.../user_interface/gui/team_window/VariablesView.h | 5 +-
.../gui/team_window/WatchPromptWindow.cpp | 55 +-
.../gui/team_window/WatchPromptWindow.h | 2 +-
29 files changed, 1783 insertions(+), 1731 deletions(-)

Upstream: cgit.haiku-os.org


  • Share