1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
|
= `barectf` CLI tool usage
barectf ships with the `barectf` command-line interface (CLI) tool.
== General synopses
Run a `barectf` command:
[.cl]
[verse]
*barectf* _COMMAND_ _COMMAND-ARGUMENTS_
Print the version of `barectf`:
[.cl]
[verse]
*barectf* pass:[[]xref:#version-option[--version]pass:[\]]
Print brief general help:
[.cl]
[verse]
*barectf* pass:[[]xref:#help-option[--help]pass:[\]]
== General description
The `barectf` tool offers a https://git-scm.com/[Git]-like
user interface with the following available commands:
<<generate-command,`generate`>>::
Generates the C{nbsp}source and CTF metadata stream files of a
tracer from a xref:yaml:index.adoc[YAML configuration file].
<<show-effective-configuration-command,`show-effective-configuration`>>::
Prints the xref:yaml:index.adoc#stages[_effective_] version of
a YAML configuration file.
<<show-configuration-version-command,`show-configuration-version`>>::
Prints the major version (2 or 3) of a YAML configuration file.
== General options
[[help-option]]`-h`::
`--help`::
Print brief general help and exit.
[[version-option]]`-V`::
`--version`::
Print the version of `barectf` and exit.
[[generate-command]]
== `generate` command
=== Synopses
Generate files from a xref:yaml:index.adoc[YAML configuration file]:
[.cl]
[verse]
*barectf generate* pass:[[]xref:#generate-prefix-option[--prefix]=__PREFIX__] pass:[[]xref:#generate-metadata-dir-option[--metadata-dir]=__MDIR__]
pass:[[]xref:#generate-headers-dir-option[--headers-dir]=__HDIR__] pass:[[]xref:#generate-code-dir-option[--code-dir]=__CDIR__]
pass:[[]xref:#generate-include-dir-option[--include-dir]=__IDIR__]...
pass:[[]xref:#generate-ignore-include-not-found-option[--ignore-include-not-found]pass:[\]] _CONFIG-PATH_
Print command's brief help:
[.cl]
[verse]
*barectf generate* xref:#generate-help-option[--help]
=== Command name aliases
* `gen`
=== Description
The `barectf generate` command reads the xref:yaml:index.adoc[YAML
configuration file] `__CONFIG-PATH__` to produce:
[%autowidth.stretch, cols="d,a"]
|===
|File name |Description
|`__MDIR__/metadata`
|The CTF metadata stream file.
|`__HDIR__/__FPREFIX__.h`
|The generated tracer's public C{nbsp}header file.
|`__HDIR__/__FPREFIX__-bitfield.h`
|Internal macros for the generated tracer (included by `__FPREFIX__.c`).
|`__CDIR__/__FPREFIX__.c`
|The generated tracer's C{nbsp}source code.
|===
See xref:lel[Build the generated C{nbsp}source code] to learn how to
build the C{nbsp}source which the `generate` command produces.
In the list above, `__FPREFIX__` is:
Without the <<generate-prefix-option,`--prefix`>> option::
If the `__CONFIG-PATH__` file has a file name xref:yaml:cfg-obj.adoc#prefix-prop[prefix option]:::
The `__CONFIG-PATH__` file's file name prefix option.
Otherwise:::
`barectf`
With the <<generate-prefix-option,`--prefix`>> option::
`__PREFIX__`, without trailing underscores.
+
For example, if `__PREFIX__` is `my_tracer_`, then `__FPREFIX__` is
`my_tracer`.
By default, `__MDIR__`, `__HDIR__`, and `__CDIR__` are the current
working directory. Use the
<<generate-metadata-dir-option,`--metadata-dir`>>,
<<generate-headers-dir-option,`--headers-dir`>>, and
<<generate-code-dir-option,`--code-dir`>> to specify other output
directories.
Therefore, by default, the `generate` command writes the `metadata`,
`barectf.h`, `barectf-bitfield.h`, and `barectf.c` files to the current
working directory.
If you use the <<prefix-option,`--prefix`>> option, then all the
public C{nbsp}identifiers in `__FPREFIX__.h` and `__FPREFIX__.c` begin
with `__PREFIX__`. Otherwise, they begin with:
If the `__CONFIG-PATH__` file has an identifier xref:yaml:cfg-obj.adoc#prefix-prop[prefix option]::
The `__CONFIG-PATH__` file's identifier prefix option.
Otherwise::
`barectf_`
Add directories to be searched into for xref:yaml:include.adoc[inclusion
files] before the default inclusion directories with the repeatable
<<generate-include-dir-option,`--include-dir`>> option.
By default, if `barectf` can't find an inclusion file while processing
the `__CONFIG-PATH__` file, the command prints an error and
<<exit-status,exits>> with a non-zero status. Force
`barectf generate` to continue silently instead with its
<<generate-ignore-include-not-found-option,`--ignore-include-not-found`>>
option.
=== Options
[[generate-code-dir-option]]`-c __CDIR__`::
`--code-dir=__CDIR__`::
Write the C{nbsp}source file to the directory `__CDIR__` instead of
the current working directory.
[[generate-headers-dir-option]]`-H __HDIR__`::
`--headers-dir=__HDIR__`::
Write C{nbsp}header files to the directory `__HDIR__` instead of
the current working directory.
[[generate-help-option]]`-h`::
`--help`::
Print the `generate` command's brief help and exit.
[[generate-ignore-include-not-found-option]]`--ignore-include-not-found`::
Continue to process the `__CONFIG-PATH__` file when inclusion
files are not found.
[[generate-include-dir-option]]`-I __IDIR__`::
`--include-dir=__IDIR__`::
Add `__IDIR__` to the list of directories to be searched into for
inclusion files before the default inclusion directories.
+
The default inclusion directories are:
+
. The current working directory.
. The directory containing the
xref:yaml:include.adoc#std[standard partial YAML files]
(like `stdint.yaml`).
[[generate-metadata-dir-option]]`-m __MDIR__`::
`--metadata-dir=__MDIR__`::
Write the CTF metadata stream file to the directory `__MDIR__`
instead of the current working directory.
[[generate-prefix-option]]`-p __PREFIX__`::
`--prefix=__PREFIX__`::
Override the default or `__CONFIG-PATH__` file's file and
identifier prefixes with:
+
File name prefix:::
`__PREFIX__`, without trailing underscores.
Identifier prefix:::
`__PREFIX__`
+
--
`__PREFIX__` must be a valid C{nbsp}identifier.
The default file name prefix is `barectf`.
The default identifier prefix is `barectf_`.
--
[[show-effective-configuration-command]]
== `show-effective-configuration` command
=== Synopses
Show the xref:yaml:index.adoc#stages[effective] version of a
xref:yaml:index.adoc[YAML configuration file]:
[.cl]
[verse]
*barectf show-effective-configuration* pass:[[]xref:#show-effective-configuration-include-dir-option[--include-dir]=__IDIR__]...
pass:[[]xref:#show-effective-configuration-ignore-include-not-found-option[--ignore-include-not-found]pass:[\]] _CONFIG-PATH_
Print command's brief help:
[.cl]
[verse]
*barectf show-effective-configuration* xref:#show-effective-configuration-help-option[`--help`]
=== Command name aliases
* `show-effective-config`
* `show-effective-cfg`
=== Description
The `barectf show-effective-configuration` command reads the
xref:yaml:index.adoc[YAML configuration file] `__CONFIG-PATH__` and
prints an equivalent, _effective_ YAML configuration.
See the xref:yaml:index.adoc#stages[processing stages] of a YAML
configuration file to learn what an effective configuration is.
Moreover, the `show-effective-configuration` command validates the
`__CONFIG-PATH__` file. In other words, if the command
<<exit-status,exits>> with status{nbsp}0, the
<<generate-command,`generate` command>> using the same options and
`__CONFIG-PATH__` file would also succeed.
Add directories to be searched into for inclusion files before the
default inclusion directories with the repeatable
<<show-effective-configuration-include-dir-option,`--include-dir`>> option.
By default, if `barectf` can't find an inclusion file while processing
the `__CONFIG-PATH__` file, the command prints an error and
<<exit-status,exits>> with a non-zero status. Force
`barectf show-effective-configuration` to continue silently instead
with its
<<show-effective-configuration-ignore-include-not-found-option,`--ignore-include-not-found`>>
option.
=== Options
[[show-effective-configuration-help-option]]`-h`::
`--help`::
Print the `show-effective-configuration` command's
brief help and exit.
[[show-effective-configuration-ignore-include-not-found-option]]`--ignore-include-not-found`::
Continue to process the `__CONFIG-PATH__` file when inclusion
files are not found.
[[show-effective-configuration-include-dir-option]]`-I __IDIR__`::
`--include-dir=__IDIR__`::
Add `__IDIR__` to the list of directories to be searched into for
inclusion files before the default inclusion directories.
+
The default inclusion directories are:
+
. The current working directory.
. The directory containing the
xref:yaml:include.adoc#std[standard partial YAML files]
(like `stdint.yaml`).
[[show-configuration-version-command]]
== `show-configuration-version` command
=== Synopses
Show a xref:yaml:index.adoc[YAML configuration file]'s version:
[.cl]
[verse]
*barectf show-configuration-version* _CONFIG-PATH_
Print command's brief help:
[.cl]
[verse]
*barectf show-configuration-version* xref:#show-configuration-version-help-option[`--help`]
=== Command name aliases
* `show-config-version`
* `show-cfg-version`
=== Description
The `barectf show-configuration-version` command reads the
xref:yaml:index.adoc[YAML configuration file] `__CONFIG-PATH__` and
prints its version, which is either 2 or 3.
The `show-configuration-version` does _not_ validate the
`__CONFIG-PATH__` file like the
<<show-effective-configuration-command,`show-effective-configuration`
command>> does.
=== Options
[[show-configuration-version-help-option]]`-h`::
`--help`::
Print the `show-configuration-version` command's brief help
and exit.
[[exit-status]]
== Exit status
0::
Success
Not 0::
Error
|