rizin/librz/debug
Anton Kochkov 689bafb7a4
Rewrite the RzNum parser and calculator on tree-sitter (#4326)
Replace the hand-written parser in calc.c with a tree-sitter grammar
(subprojects/rizin-math-parser) and a typed evaluator. The old parser
could only ever produce a ut64 and folded anything it failed to read to
0, which left callers unable to tell a failed expression from one that
evaluated to zero.

Expressions now evaluate to an RzNumValue, a tagged union over ut64,
double, RzBitVector, arbitrary-precision integer and arbitrary-precision
decimal, carrying an RzNumError rather than signalling failure as 0.
Literals keep the width they were written with (5u8, 0xffu128, any width
from 1 to 65536), results that outgrow 64 bits promote to a big number on
their own, and a parse error, division by zero or unresolved identifier
reaches the caller.

rz_num_math() is deprecated. rz_num_math_ut64() keeps its exact behaviour
for callers that want a ut64, and rz_num_math_value() exposes the typed
result. rz_core_math() adds the RzCore-backed form used by the % command,
with rz_core_math_ut64() deprecated alongside it. rz-ax routes through the
typed API, so it prints values at full precision, reports errors on stderr
and exits non-zero. rz_il_lift_num() converts an expression to an
RzILOpPure, so a numeric argument can be lifted instead of pre-evaluated.

Legacy input still works: trailing base suffixes (101b, 35o, 212t), the
trailing-'h' hex form and the k/m/g scale suffixes are all accepted and
warn once, pointing at the 0b/0o/0t prefixes. doc/math.md documents the
language and doc/math-il-lift.md the lift; the grammar, the evaluator,
rz-ax and the % command are covered by unit and db tests.
2026-07-24 02:57:27 +08:00
..
p Rewrite the RzNum parser and calculator on tree-sitter (#4326) 2026-07-24 02:57:27 +08:00
bp.c Rename some rz_list funcs to rz_list_XXX_val (part 1) (#5671) 2025-12-25 22:01:49 +08:00
bp_io.c Move RzBreakpoint into RzDebug (#5124) 2025-05-13 01:57:37 +08:00
bp_traptrace.c Remove rz_range (#6303) 2026-05-03 20:10:35 +08:00
bp_watch.c Move RzBreakpoint into RzDebug (#5124) 2025-05-13 01:57:37 +08:00
ddesc.c Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
debug.c Fix memory leaks across core, bin, and PDB parsing (#6579) 2026-06-30 19:04:28 +08:00
desil.c RzReg: Associate roles with RzRegItem instead of name strings (#6291) 2026-04-30 12:03:51 +02:00
dmap.c Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
dreg.c librz/bin: fix regstate load in ELF corefiles for x86_64 (#6195) 2026-05-01 12:07:59 +08:00
dsession.c RzReg: Associate roles with RzRegItem instead of name strings (#6291) 2026-04-30 12:03:51 +02:00
dsignal.c sdb: remove unused cas and expire features (#4487) 2024-05-12 18:27:54 +08:00
meson.build Add Alpha linux native debugger (#6447) 2026-06-09 12:27:19 +08:00
pid.c Remove dead code (#4705) 2024-11-08 18:46:13 +08:00
plugin.c Move RzAnalysis as private and force usage of C API (#6123) 2026-04-06 16:07:53 +00:00
README.md librz: add some initial documentation (#3782) 2023-10-13 13:46:19 +08:00
serialize_bp.c Move RzBreakpoint into RzDebug (#5124) 2025-05-13 01:57:37 +08:00
serialize_debug.c Format according to clang-format-13 2021-11-25 15:44:28 +08:00
snap.c Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
trace.c RzReg: Associate roles with RzRegItem instead of name strings (#6291) 2026-04-30 12:03:51 +02:00