edb
edb copied to clipboard
Add variable evaluation logic
A common feature is to be able to perform some basic evaluations on the current program state. This issue proposes to add a eval
/exec
/call
command to the debugger which then will evaluate an expression like local_var_a == struct a{.a=123, .b=234}
, global_var_b >= 20 && !global_var_c
, or simply local_var_d
(which will print its value if it exists).
This has the following purposes/goals:
- Together with the new command, this is an easy way to inspect the current program state.
- These same expressions can be used for conditional breakpoints and logging break points.
- Could be a stepping stone to more complex macros for more advanced automation.
The exact feature set is something to be determined and can be iterated over time, here are some initial suggestions:
- Reference local variables (see #13)
- Reference global variables (see #14)
- Reference registers, perhaps like
#R1
or some other prefix which is illegal in C identifiers to avoid conflicts - Have boolean operators
==
,!=
,>=
,<=
,<
,>
- Use BTF to match int, string, bool, struct types.
-
true
andfalse
keywords for boolean comparason - Round brackets(
(
and)
) to indicate precedence, otherwise left to right.