tree: 5f3ff081dc6fd946a7d9977b72cd9abba843473e [path history] [tgz]
  1. async_dwarf_expr_eval.cc
  2. async_dwarf_expr_eval.h
  3. async_dwarf_expr_eval_unittest.cc
  4. bitfield.cc
  5. bitfield.h
  6. bitfield_unittest.cc
  7. BUILD.gn
  8. builtin_types.cc
  9. builtin_types.h
  10. builtin_types_unittest.cc
  11. cast.cc
  12. cast.h
  13. cast_unittest.cc
  14. eval_callback.h
  15. eval_context.h
  16. eval_context_impl.cc
  17. eval_context_impl.h
  18. eval_context_impl_unittest.cc
  19. eval_operators.cc
  20. eval_operators.h
  21. eval_operators_unittest.cc
  22. eval_test_support.cc
  23. eval_test_support.h
  24. expr.cc
  25. expr.h
  26. expr_language.h
  27. expr_node.cc
  28. expr_node.h
  29. expr_node_unittest.cc
  30. expr_parser.cc
  31. expr_parser.h
  32. expr_parser_fuzzer.cc
  33. expr_parser_unittest.cc
  34. expr_token.h
  35. expr_token_type.cc
  36. expr_token_type.h
  37. expr_tokenizer.cc
  38. expr_tokenizer.h
  39. expr_tokenizer_unittest.cc
  40. expr_unittest.cc
  41. expr_value.cc
  42. expr_value.h
  43. expr_value_source.cc
  44. expr_value_source.h
  45. expr_value_source_unittest.cc
  46. find_name.cc
  47. find_name.h
  48. find_name_unittest.cc
  49. format.cc
  50. format.h
  51. format_node.cc
  52. format_node.h
  53. format_options.h
  54. format_test_support.cc
  55. format_test_support.h
  56. format_unittest.cc
  57. found_member.cc
  58. found_member.h
  59. found_name.cc
  60. found_name.h
  61. identifier_glob.cc
  62. identifier_glob.h
  63. identifier_glob_unittest.cc
  64. index_walker.cc
  65. index_walker.h
  66. index_walker_unittest.cc
  67. keywords.cc
  68. keywords.h
  69. mock_eval_context.cc
  70. mock_eval_context.h
  71. mock_expr_node.cc
  72. mock_expr_node.h
  73. name_lookup.h
  74. number_parser.cc
  75. number_parser.h
  76. number_parser_unittest.cc
  77. operator_keyword.cc
  78. operator_keyword.h
  79. operator_keyword_unittest.cc
  80. parse_special_identifier.cc
  81. parse_special_identifier.h
  82. parse_special_identifier_unittest.cc
  83. parse_string.cc
  84. parse_string.h
  85. parse_string_unittest.cc
  86. parsed_identifier.cc
  87. parsed_identifier.h
  88. parsed_identifier_unittest.cc
  89. permissive_input_location.cc
  90. permissive_input_location.h
  91. permissive_input_location_unittest.cc
  92. pretty_rust_tuple.cc
  93. pretty_rust_tuple.h
  94. pretty_rust_tuple_unittest.cc
  95. pretty_std_string.cc
  96. pretty_std_string.h
  97. pretty_std_string_unittest.cc
  98. pretty_tree.cc
  99. pretty_tree.h
  100. pretty_type.cc
  101. pretty_type.h
  102. pretty_type_manager.cc
  103. pretty_type_manager.h
  104. pretty_type_manager_unittest.cc
  105. pretty_type_unittest.cc
  106. README.md
  107. resolve_array.cc
  108. resolve_array.h
  109. resolve_array_unittest.cc
  110. resolve_base.cc
  111. resolve_base.h
  112. resolve_base_unittest.cc
  113. resolve_collection.cc
  114. resolve_collection.h
  115. resolve_collection_unittest.cc
  116. resolve_const_value.cc
  117. resolve_const_value.h
  118. resolve_ptr_ref.cc
  119. resolve_ptr_ref.h
  120. resolve_ptr_ref_unittest.cc
  121. resolve_type.cc
  122. resolve_type.h
  123. resolve_type_unittest.cc
  124. resolve_variant.cc
  125. resolve_variant.h
  126. resolve_variant_unittest.cc
  127. template_type_extractor.cc
  128. template_type_extractor.h
  129. template_type_extractor_unittest.cc
  130. test_eval_context_impl.h
  131. vector_register_format.cc
  132. vector_register_format.h
  133. vector_register_format_unittest.cc
  134. virtual_base_test_setup.cc
  135. virtual_base_test_setup.h
  136. virtual_inheritance_test_setup.cc
  137. virtual_inheritance_test_setup.h
src/developer/debug/zxdb/expr/README.md

zxdb/expr

This directory handles parsing and evaluating console expressions. These are what appear in the “print” command, for example.

They are not to be confused with “DWARF expressions” which are small programs used to evaluate the location of variables.

Main Components

Tokenizer: The tokenizer is in expr_tokenizer.cc and converts input into a stream of tokens that can be used by the parser.

Parser: The parser is in expr_parser.cc and converts tokens into the Abstract Syntax Tree.

Abstract Syntax Tree: This tree is in expr_node.cc where each ExprNode subclass is a node in the tree. These nodes know how to recursively execute themselves to produce a result.

Expression Value: The ExprValue is in expr_value.cc and represents a value when executing the Abstract Syntax Tree. Each value has a type that describes it (a reference to the DWARF symbol data) and the binary data associated with the value.

Integration with the outside world

The abstract syntax tree code that executes doesn't actually refer directly to the symbol data or the running process. Mostly this is to allow better unit testing.

Looking up symbols: The abstract syntax tree nodes look up variables using the abstract EvalContext. The EvalContextImpl is the normal concrete implementation of this class that references the symbols associated with a process (ProcessSymbols) and provides access to the SymbolDataProvider implementation that reads data from the running process.

Helper components

The rest of the code in this directory are helper classes for executing the syntax tree, in particular for converting names to variable declarations (find_variable.* and found_*) and converting various types of variable accesses to data (resolve_*).

An Identifier is a parsing of a variable name (or potentially other things that look like names) and is generated by the parser. The TemplateTypeExtractor helps finding the template parameters in an Identifier.