summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-06-22 10:02:25 -0400
committerFlorin Coras <florin.coras@gmail.com>2020-06-23 15:35:14 +0000
commitb30b9549acaa0ffd4c94c2c50d0756416f9b58ee (patch)
tree6aa6a41861d1a8383002da298235a992064fd85d /docs
parentcc7209469601a29d0284c50716d876f685868c4b (diff)
vlib: debug CLI macro expander, part deux
Deal with circular macro definitions instead of crashing due to stack overflow. Separate macro tables, per CLI session Add documentation to the Sphinx docs Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I55fc9152bd37ad0c15fa3959f38b07b63100e634
Diffstat (limited to 'docs')
-rw-r--r--docs/gettingstarted/developers/vlib.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/docs/gettingstarted/developers/vlib.md b/docs/gettingstarted/developers/vlib.md
index 13844ab455a..59206e5ed4b 100644
--- a/docs/gettingstarted/developers/vlib.md
+++ b/docs/gettingstarted/developers/vlib.md
@@ -540,6 +540,54 @@ certain cli command has the potential to hurt packet processing
performance by running for too long, do the work incrementally in a
process node. The client can wait.
+### Macro expansion
+
+The vpp debug CLI engine includes a recursive macro expander. This
+is quite useful for factoring out address and/or interface name
+specifics:
+
+```
+ define ip1 192.168.1.1/24
+ define ip2 192.168.2.1/24
+ define iface1 GigabitEthernet3/0/0
+ define iface2 loop1
+
+ set int ip address $iface1 $ip1
+ set int ip address $iface2 $(ip2)
+
+ undefine ip1
+ undefine ip2
+ undefine iface1
+ undefine iface2
+```
+
+Each socket (or telnet) debug CLI session has its own macro
+tables. All debug CLI sessions which use CLI_INBAND binary API
+messages share a single table.
+
+The macro expander recognizes circular defintions:
+
+```
+ define foo \$(bar)
+ define bar \$(mumble)
+ define mumble \$(foo)
+```
+
+At 8 levels of recursion, the macro expander throws up its hands and
+replies "CIRCULAR."
+
+### Macro-related debug CLI commands
+
+In addition to the "define" and "undefine" debug CLI commands, use
+"show macro [noevaluate]" to dump the macro table. The "echo" debug
+CLI command will evaluate and print its argument:
+
+```
+ vpp# define foo This\ Is\ Foo
+ vpp# echo $foo
+ This Is Foo
+```
+
Handing off buffers between threads
-----------------------------------