OpenBSD CVS

CVS log for src/usr.sbin/btrace/bt_parser.h


[BACK] Up to [local] / src / usr.sbin / btrace

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.26 / (download) - annotate - [select for diffs], Sat Mar 30 07:41:45 2024 UTC (2 months, 1 week ago) by mpi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.25: +9 -1 lines
Diff to previous 1.25 (colored)

Implement else branching logic including 'else if'.

Statement lists for if & else conditions are now wrapped in a new
'struct bt_cond'.  Handling B_AC_TEST statements moved to stmt_eval()
to handle nested conditional statements.

From Christian Ludwig christian_ludwig at genua.de

Revision 1.25 / (download) - annotate - [select for diffs], Thu Oct 12 15:16:44 2023 UTC (7 months, 4 weeks ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

bt(5), btrace(8): add support for binary modulo operator ('%')

Link: https://marc.info/?l=openbsd-tech&m=169695435209410&w=2

ok mpi@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Sep 11 19:01:26 2023 UTC (8 months, 4 weeks ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.23: +5 -2 lines
Diff to previous 1.23 (colored)

Implement tuples, needed to export per-CPU scheduling data.

It is now possible to save and print immutable arrays as below:

..$t = (1, 42, "something");
..printf("%d %s\n", $t.1, $t.2);

Also add support for evaluating builtin in order to save them in variables
(required by tuples)

Revision 1.23 / (download) - annotate - [select for diffs], Wed Dec 28 21:30:16 2022 UTC (17 months, 1 week ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

spelling fixes; from paul tagliamonte
any parts of his diff not taken are noted on tech

Revision 1.22 / (download) - annotate - [select for diffs], Fri Nov 12 16:57:24 2021 UTC (2 years, 6 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored)

Implement the probe variable. Can be used for example with
	@map[probe] = count();
OK mpi@

Revision 1.21 / (download) - annotate - [select for diffs], Sun Oct 3 22:01:48 2021 UTC (2 years, 8 months ago) by dv
Branch: MAIN
Changes since 1.20: +3 -1 lines
Diff to previous 1.20 (colored)

bt(5)/btrace(8): add support for str()

Implement initial support for the str() function, which is used
primarily to truncate or NUL-terminate strings from either cli args
or args to tracepoints and syscalls.

Current implementation only supports cli args and is primarily for
compatability with bpftrace. Future work is needed once dt(4)
supports builtin args other than long values.

Adds a regress test and wires in argument-based tests again.

ok mpi@

Revision 1.20 / (download) - annotate - [select for diffs], Thu Sep 9 09:53:11 2021 UTC (2 years, 9 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.19: +12 -11 lines
Diff to previous 1.19 (colored)

Make it possible to associate multiple probes to a single rule.

The following syntax, reducing duplication, is now allowed:

END,
interval:hz:2
{
...
}

Rule descriptors are now linked to a list of probe descriptors instead of
a single one.  Enabled kernel probes are now linked to btrace(8) probe
descriptors.

While here stop parsing filter and probe if debug is not enabled.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Sep 8 13:29:51 2021 UTC (2 years, 9 months ago) by dv
Branch: MAIN
Changes since 1.18: +2 -1 lines
Diff to previous 1.18 (colored)

btrace(8): add initial support for cli arguments

This adds initial support for passing cli args to btrace(8) for use
in bt(5) scripts. Similar to bpftrace, they are referenced via $1,
$2, etc. with $# being the number of command line arguments provided.

Adds an initial regress test and a Makefile change to allow providing
arguments to regress tests in a .args file.

Currently no limit is imposed on the number of arguments, keeping
a similar approach as observed in bpftrace. References to undefined
arguments result in a new "nil" type that contextually acts as a
zero or empty string. More work can be done here to improve bpftrace
compatibility.

ok mpi@, jasper@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Aug 31 08:39:26 2021 UTC (2 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.17: +4 -1 lines
Diff to previous 1.17 (colored)

Rewrite grammar to implement operator precedence without using %right or %prec.

Arithmetic operator should now behave as expeted and tests can now be written
without superfluous parenthesis, for example:

syscall:select:entry
/($1 == 0) || (pid == $1)/
{
}

Can now be written:

syscall:select:entry
/$1 == 0 || pid == $1/
{
}

While here improve filter debugging support.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Aug 30 11:57:45 2021 UTC (2 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)

Implement '<' and '>' operators in filters.

Based on a diff from and ok dv@

Revision 1.16 / (download) - annotate - [select for diffs], Thu Apr 22 09:36:39 2021 UTC (3 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.15: +3 -5 lines
Diff to previous 1.15 (colored)

Remove support for in-kernel filters.

This might be added back in a future if copying events to userland becomes
a performance issue.  However note that it is not always possible to filter
in-kernel if, for example. a variable has to be evaluated when a rule fires.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Apr 21 10:28:54 2021 UTC (3 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.14: +3 -5 lines
Diff to previous 1.14 (colored)

Support for local (scratch) variables: "$var_name".

Every rule gets its own list of (local) variables.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 21 10:26:18 2021 UTC (3 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.13: +8 -2 lines
Diff to previous 1.13 (colored)

Extend print() to support any kind of variable.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Feb 8 09:46:45 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.12: +11 -9 lines
Diff to previous 1.12 (colored)

Extend binary operators support, required for more filter features.

Improve debugging of filters and print operator names in debug output.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Feb 1 11:26:29 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.11: +21 -9 lines
Diff to previous 1.11 (colored)

Start implementing conditionals for filters.

Allows to check the existence of a variable in predicates, making it
possible to trace syscall latency, as follow:

syscall:select:entry
{
  @start[pid] = nsecs;
}

syscall:select:return
/@start[pid]/
{
  @usecs = hist((nsecs - @start[pid]) / 1000);
  delete(@start[pid]);
}

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jan 27 07:19:54 2021 UTC (3 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

commons used rather than externs, fix for -fno-common

Revision 1.10 / (download) - annotate - [select for diffs], Mon Sep 14 18:45:19 2020 UTC (3 years, 8 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

add support for '&' and '|' operators in btrace scripts

feedback from otto@
ok mpi@ kn@ semarie@

Revision 1.9 / (download) - annotate - [select for diffs], Thu Aug 13 11:29:39 2020 UTC (3 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.8: +12 -4 lines
Diff to previous 1.8 (colored)

Improve documentation.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jul 11 14:52:14 2020 UTC (3 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.7: +8 -4 lines
Diff to previous 1.7 (colored)

Implement linear and power-of-two histograms: hist() and lhist() keywords.

This is built on top of maps which are currently built on top of RB-trees.
Improvements are welcome!  For example the use of a hashing table as pointed
by espie@.

The following one-liner produce an histogram of power-of-two values returned
by the read(2) syscall:

btrace 'syscall:read:return { @bytes = hist(retval); }'
^C
@bytes:
[0]               19 |@@@@@@@@@@@@@@@@@@@@@@@@@@                          |
[1]               26 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                |
[1, 2)             1 |@                                                   |
[2, 4)            13 |@@@@@@@@@@@@@@@@@@                                  |
[4, 8)             4 |@@@@@                                               |
[8, 16)            3 |@@@@                                                |
[16, 32)           1 |@                                                   |
[32, 64)           8 |@@@@@@@@@@@                                         |
[64, 128)         14 |@@@@@@@@@@@@@@@@@@@                                 |
[128, 256)         7 |@@@@@@@@@                                           |
[256, 512)        37 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[512, 1K)          1 |@                                                   |
[1K, 2K)          10 |@@@@@@@@@@@@@@                                      |
[2K, 4K)          11 |@@@@@@@@@@@@@@@                                     |
[8K, 16K)          1 |@                                                   |

Revision 1.7 / (download) - annotate - [select for diffs], Thu Apr 23 18:36:51 2020 UTC (4 years, 1 month ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.6: +2 -1 lines
Diff to previous 1.6 (colored)

Implement builtin 'cpu' keyword.

This is useful to know which CPU recorded a given event.

While here document 'retval' and comment out 'ustack' until we have a
way to capture userland stacks.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Apr 15 15:00:04 2020 UTC (4 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.5: +6 -3 lines
Diff to previous 1.5 (colored)

Document filters: one type of predicates checked in kernel.

By default a PID filter is set by dt(4) to not record events for the tracing
program.

The other type of predicates, which are checked in userland, is coming soon!

Revision 1.5 / (download) - annotate - [select for diffs], Thu Mar 19 15:52:30 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored)

Add support for unnamed map.

The following is now possible but won't print anything by default:

# btrace -e 'profile:hz:99 { @[kstack] = count() }'

ok patrick@, tobhe@

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jan 28 16:39:51 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.3: +5 -2 lines
Diff to previous 1.3 (colored)

Implement map functions min(), max() and sum().

For the moment map values are currently limited to integers.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jan 28 12:13:49 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

Implement delete() and @map[key] access.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jan 27 14:15:25 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

Implement builtin time() function.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jan 21 16:24:55 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN

Import a bug tracer, companion of dt(4), that speaks the bt(5) language.

ok kettenis@, visa@, jasper@, deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.