Currently when an event probe (eprobe) hooks to a string field, it does not display it as a string, but instead as a number. This makes the field rather useless. Handle the different kinds of strings, dynamic, static, relational/dynamic etc. Now when a string field is used, the ":string" type can be used to display it: echo "e:sw sched/sched_switch comm=$next_comm:string" > dynamic_events Link: https://lkml.kernel.org/r/20220820134400.959640191@goodmis.org
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -311,6 +311,27 @@ static unsigned long get_event_field(struct fetch_insn *code, void *rec) · 310 unmodified lines | |||
| 311 | 311 | ||
| 312 | addr = rec + field->offset; | 312 | addr = rec + field->offset; |
| 313 | 313 | ||
| 314 | if (is_string_field(field)) { | ||
| 315 | switch (field->filter_type) { | ||
| 316 | case FILTER_DYN_STRING: | ||
| 317 | val = (unsigned long)(rec + (*(unsigned int *)addr & 0xffff)); | ||
| 318 | break; | ||
| 319 | case FILTER_RDYN_STRING: | ||
| 320 | val = (unsigned long)(addr + (*(unsigned int *)addr & 0xffff)); | ||
| 321 | break; | ||
| 322 | case FILTER_STATIC_STRING: | ||
| 323 | val = (unsigned long)addr; | ||
| 324 | break; | ||
| 325 | case FILTER_PTR_STRING: | ||
| 326 | val = (unsigned long)(*(char *)addr); | ||
| 327 | break; | ||
| 328 | default: | ||
| 329 | WARN_ON_ONCE(1); | ||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | return val; | ||
| 333 | } | ||
| 334 | |||
| 314 | switch (field->size) { | 335 | switch (field->size) { |
| 315 | case 1: | 336 | case 1: |
| 316 | if (field->is_signed) | 337 | if (field->is_signed) |