[Bug translator/23407] New: bpf: backend should support strings as first class values
me at serhei dot io
sourceware-bugzilla@sourceware.org
Thu Jul 12 20:01:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23407
Bug ID: 23407
Summary: bpf: backend should support strings as first class
values
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: me at serhei dot io
Target Milestone: ---
PR created based on https://sourceware.org/ml/systemtap/2018-q3/msg00016.html
It should be possible to store string literals of reasonable size
(BPF_MAXSTRINGLEN=64, matching the 'best practice' of other eBPF tracing tools)
within local variables, associative array elements, and associative array keys,
and to pass them as function arguments.
The tentative plan is to add a new value type STR to struct value in
bpf-internal.h. In addition to doing register allocation, bpf-opt.cxx will also
lower any STR value into a set of instructions that loads the string onto the
eBPF stack (based on existing printf() code) or into memory (if writing to a
global data structure), then returns the string address. Because more than one
string can be written to the stack at once, strings may need to be written
somewhere besides the start of the stack.
Suggested testcase:
global var
global tab1
global tab2
probe begin {
printf("BEGIN\n")
var = "str1"
tab1[0] = "str2"
tab2["key"] = "str3"
}
probe end {
printf("%s\n", "str0")
printf("%s\n", var)
printf("%s\n", tab1[0])
printf("%s\n", tab2["key"])
printf("END\n")
}
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Systemtap
mailing list